blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
616
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
69
| license_type
stringclasses 2
values | repo_name
stringlengths 5
118
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
63
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 2.91k
686M
โ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 23
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 213
values | src_encoding
stringclasses 30
values | language
stringclasses 1
value | is_vendor
bool 2
classes | is_generated
bool 2
classes | length_bytes
int64 2
10.3M
| extension
stringclasses 246
values | content
stringlengths 2
10.3M
| authors
listlengths 1
1
| author_id
stringlengths 0
212
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
33ed1f7601c1aa5900918a48c228342e9d2c0d7e
|
3cd1246ff58f26329021f2d13caa62221c91d5a4
|
/testdata/python/stmt/continue_.py
|
cdf9bbbb4948d1484d532ed6b131ada0ab7bab62
|
[] |
no_license
|
mwkmwkmwk/unpyc
|
0929e15fb37599496930299d7ced0bf1bedd7e99
|
000fdaec159050c94b7ecf6ab57be3950676f778
|
refs/heads/master
| 2020-12-01T14:01:57.592806
| 2016-03-21T14:11:43
| 2016-03-21T14:12:01
| 230,650,936
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 562
|
py
|
while a:
b
continue
c
while a:
if x:
b
continue
c
while a:
continue
while a:
if x:
continue
else:
c
while a:
if x:
a
else:
continue
while a:
if x:
continue
while a:
if x:
continue
continue
while a:
if x:
continue
z
while a:
try:
x
except y, z:
continue
except:
w
continue
c
for a in b:
continue
while a:
x
while b:
x
else:
continue
|
[
"koriakin@0x04.net"
] |
koriakin@0x04.net
|
d517cab3ae830007c9876c00721fdfda4722ddf0
|
48e124e97cc776feb0ad6d17b9ef1dfa24e2e474
|
/sdk/python/pulumi_azure_native/devices/v20200301/iot_dps_resource.py
|
d8921105104141cf445932bfeb4f21aa81f62ac5
|
[
"BSD-3-Clause",
"Apache-2.0"
] |
permissive
|
bpkgoud/pulumi-azure-native
|
0817502630062efbc35134410c4a784b61a4736d
|
a3215fe1b87fba69294f248017b1591767c2b96c
|
refs/heads/master
| 2023-08-29T22:39:49.984212
| 2021-11-15T12:43:41
| 2021-11-15T12:43:41
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 13,255
|
py
|
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . import outputs
from ._enums import *
from ._inputs import *
__all__ = ['IotDpsResourceArgs', 'IotDpsResource']
@pulumi.input_type
class IotDpsResourceArgs:
def __init__(__self__, *,
properties: pulumi.Input['IotDpsPropertiesDescriptionArgs'],
resource_group_name: pulumi.Input[str],
sku: pulumi.Input['IotDpsSkuInfoArgs'],
etag: Optional[pulumi.Input[str]] = None,
location: Optional[pulumi.Input[str]] = None,
provisioning_service_name: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None):
"""
The set of arguments for constructing a IotDpsResource resource.
:param pulumi.Input['IotDpsPropertiesDescriptionArgs'] properties: Service specific properties for a provisioning service
:param pulumi.Input[str] resource_group_name: Resource group identifier.
:param pulumi.Input['IotDpsSkuInfoArgs'] sku: Sku info for a provisioning Service.
:param pulumi.Input[str] etag: The Etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention.
:param pulumi.Input[str] location: The resource location.
:param pulumi.Input[str] provisioning_service_name: Name of provisioning service to create or update.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: The resource tags.
"""
pulumi.set(__self__, "properties", properties)
pulumi.set(__self__, "resource_group_name", resource_group_name)
pulumi.set(__self__, "sku", sku)
if etag is not None:
pulumi.set(__self__, "etag", etag)
if location is not None:
pulumi.set(__self__, "location", location)
if provisioning_service_name is not None:
pulumi.set(__self__, "provisioning_service_name", provisioning_service_name)
if tags is not None:
pulumi.set(__self__, "tags", tags)
@property
@pulumi.getter
def properties(self) -> pulumi.Input['IotDpsPropertiesDescriptionArgs']:
"""
Service specific properties for a provisioning service
"""
return pulumi.get(self, "properties")
@properties.setter
def properties(self, value: pulumi.Input['IotDpsPropertiesDescriptionArgs']):
pulumi.set(self, "properties", value)
@property
@pulumi.getter(name="resourceGroupName")
def resource_group_name(self) -> pulumi.Input[str]:
"""
Resource group identifier.
"""
return pulumi.get(self, "resource_group_name")
@resource_group_name.setter
def resource_group_name(self, value: pulumi.Input[str]):
pulumi.set(self, "resource_group_name", value)
@property
@pulumi.getter
def sku(self) -> pulumi.Input['IotDpsSkuInfoArgs']:
"""
Sku info for a provisioning Service.
"""
return pulumi.get(self, "sku")
@sku.setter
def sku(self, value: pulumi.Input['IotDpsSkuInfoArgs']):
pulumi.set(self, "sku", value)
@property
@pulumi.getter
def etag(self) -> Optional[pulumi.Input[str]]:
"""
The Etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention.
"""
return pulumi.get(self, "etag")
@etag.setter
def etag(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "etag", value)
@property
@pulumi.getter
def location(self) -> Optional[pulumi.Input[str]]:
"""
The resource location.
"""
return pulumi.get(self, "location")
@location.setter
def location(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "location", value)
@property
@pulumi.getter(name="provisioningServiceName")
def provisioning_service_name(self) -> Optional[pulumi.Input[str]]:
"""
Name of provisioning service to create or update.
"""
return pulumi.get(self, "provisioning_service_name")
@provisioning_service_name.setter
def provisioning_service_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "provisioning_service_name", value)
@property
@pulumi.getter
def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
"""
The resource tags.
"""
return pulumi.get(self, "tags")
@tags.setter
def tags(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):
pulumi.set(self, "tags", value)
class IotDpsResource(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
etag: Optional[pulumi.Input[str]] = None,
location: Optional[pulumi.Input[str]] = None,
properties: Optional[pulumi.Input[pulumi.InputType['IotDpsPropertiesDescriptionArgs']]] = None,
provisioning_service_name: Optional[pulumi.Input[str]] = None,
resource_group_name: Optional[pulumi.Input[str]] = None,
sku: Optional[pulumi.Input[pulumi.InputType['IotDpsSkuInfoArgs']]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
__props__=None):
"""
The description of the provisioning service.
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] etag: The Etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention.
:param pulumi.Input[str] location: The resource location.
:param pulumi.Input[pulumi.InputType['IotDpsPropertiesDescriptionArgs']] properties: Service specific properties for a provisioning service
:param pulumi.Input[str] provisioning_service_name: Name of provisioning service to create or update.
:param pulumi.Input[str] resource_group_name: Resource group identifier.
:param pulumi.Input[pulumi.InputType['IotDpsSkuInfoArgs']] sku: Sku info for a provisioning Service.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: The resource tags.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: IotDpsResourceArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
The description of the provisioning service.
:param str resource_name: The name of the resource.
:param IotDpsResourceArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(IotDpsResourceArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
etag: Optional[pulumi.Input[str]] = None,
location: Optional[pulumi.Input[str]] = None,
properties: Optional[pulumi.Input[pulumi.InputType['IotDpsPropertiesDescriptionArgs']]] = None,
provisioning_service_name: Optional[pulumi.Input[str]] = None,
resource_group_name: Optional[pulumi.Input[str]] = None,
sku: Optional[pulumi.Input[pulumi.InputType['IotDpsSkuInfoArgs']]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
__props__=None):
if opts is None:
opts = pulumi.ResourceOptions()
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = _utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = IotDpsResourceArgs.__new__(IotDpsResourceArgs)
__props__.__dict__["etag"] = etag
__props__.__dict__["location"] = location
if properties is None and not opts.urn:
raise TypeError("Missing required property 'properties'")
__props__.__dict__["properties"] = properties
__props__.__dict__["provisioning_service_name"] = provisioning_service_name
if resource_group_name is None and not opts.urn:
raise TypeError("Missing required property 'resource_group_name'")
__props__.__dict__["resource_group_name"] = resource_group_name
if sku is None and not opts.urn:
raise TypeError("Missing required property 'sku'")
__props__.__dict__["sku"] = sku
__props__.__dict__["tags"] = tags
__props__.__dict__["name"] = None
__props__.__dict__["type"] = None
alias_opts = pulumi.ResourceOptions(aliases=[pulumi.Alias(type_="azure-native:devices:IotDpsResource"), pulumi.Alias(type_="azure-native:devices/v20170821preview:IotDpsResource"), pulumi.Alias(type_="azure-native:devices/v20171115:IotDpsResource"), pulumi.Alias(type_="azure-native:devices/v20180122:IotDpsResource"), pulumi.Alias(type_="azure-native:devices/v20200101:IotDpsResource"), pulumi.Alias(type_="azure-native:devices/v20200901preview:IotDpsResource"), pulumi.Alias(type_="azure-native:devices/v20211015:IotDpsResource")])
opts = pulumi.ResourceOptions.merge(opts, alias_opts)
super(IotDpsResource, __self__).__init__(
'azure-native:devices/v20200301:IotDpsResource',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'IotDpsResource':
"""
Get an existing IotDpsResource resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = IotDpsResourceArgs.__new__(IotDpsResourceArgs)
__props__.__dict__["etag"] = None
__props__.__dict__["location"] = None
__props__.__dict__["name"] = None
__props__.__dict__["properties"] = None
__props__.__dict__["sku"] = None
__props__.__dict__["tags"] = None
__props__.__dict__["type"] = None
return IotDpsResource(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter
def etag(self) -> pulumi.Output[Optional[str]]:
"""
The Etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal ETag convention.
"""
return pulumi.get(self, "etag")
@property
@pulumi.getter
def location(self) -> pulumi.Output[str]:
"""
The resource location.
"""
return pulumi.get(self, "location")
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
"""
The resource name.
"""
return pulumi.get(self, "name")
@property
@pulumi.getter
def properties(self) -> pulumi.Output['outputs.IotDpsPropertiesDescriptionResponse']:
"""
Service specific properties for a provisioning service
"""
return pulumi.get(self, "properties")
@property
@pulumi.getter
def sku(self) -> pulumi.Output['outputs.IotDpsSkuInfoResponse']:
"""
Sku info for a provisioning Service.
"""
return pulumi.get(self, "sku")
@property
@pulumi.getter
def tags(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
"""
The resource tags.
"""
return pulumi.get(self, "tags")
@property
@pulumi.getter
def type(self) -> pulumi.Output[str]:
"""
The resource type.
"""
return pulumi.get(self, "type")
|
[
"noreply@github.com"
] |
bpkgoud.noreply@github.com
|
5a03fd10d84e198f822cbb2eae8035d8074aeb92
|
7bb37821b54c2ffe0dc8cbf2a70bd20c932fb515
|
/contacts/admin.py
|
0bffb6763736d19871fddc9084bbe9e23c230bd4
|
[] |
no_license
|
andrewhstead/dating-site
|
6dfed04404fa1ea03594ff08a1d3aa31fe07b47c
|
bc81ade529ab916093ba80ab009d03a00e1dfab0
|
refs/heads/master
| 2020-07-02T13:04:02.878187
| 2020-05-07T22:23:09
| 2020-05-07T22:23:09
| 176,342,530
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 181
|
py
|
from django.contrib import admin
from .models import MessageThread, Message, Interaction
# Register your models here.
admin.site.register(Message)
admin.site.register(Interaction)
|
[
"andrew@andrewstead.co.uk"
] |
andrew@andrewstead.co.uk
|
1b71421015ed4331d6c8c40463ac73e2aee21ded
|
d658641f19ee2ce32144449876c63f73bdb4f961
|
/clientTrackExpenses/clientApp/views.py
|
9bea8af8f0e7d5fe94ef535e9f132a8581cfc79e
|
[] |
no_license
|
om2001chaudhary/trackingExpenses
|
b0ccf5f5c75249e41c979496ec40dcd20cee5d49
|
0149c7e43f4581847a583ed81258656f1bccdc03
|
refs/heads/master
| 2020-04-16T19:33:57.475150
| 2019-01-16T05:19:25
| 2019-01-16T05:19:25
| 165,864,945
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,456
|
py
|
from django.shortcuts import render
from clientApp.forms import ClientExpenseForm
from clientApp.models import ClientExpense
from django.contrib.auth.decorators import login_required
@login_required(login_url='signin')
def dashBoard(request):
message = ''
form = ClientExpenseForm()
if request.method == 'POST':
form = ClientExpenseForm(request.POST)
if form.is_valid():
clientExpense = ClientExpense()
clientExpense.client = request.user
clientExpense.title = form.cleaned_data['title']
clientExpense.amount = form.cleaned_data['amount']
clientExpense.currency = form.cleaned_data['currency']
clientExpense.description = form.cleaned_data['description']
clientExpense.save()
form = ClientExpenseForm()
message = "created successfully.."
return render(request, 'dashBoard.html', {'form':form , 'msg':message})
@login_required(login_url='signin')
def read(request):
data = ClientExpense.objects.filter(client_id=request.user.id)
return render(request, 'expenseList.html', {'data':data})
@login_required(login_url='signin')
def viewAll(request):
data = ClientExpense.objects.all()
return render(request , 'viewAll.html' , {'data':data})
def viewRow(request):
resultSet = ClientExpense.objects.get(id=request.GET['id'])
return render(request, 'viewRow.html' , {'data':resultSet})
|
[
"noreply@github.com"
] |
om2001chaudhary.noreply@github.com
|
e6622494ca17ed86672e14c718f1c123e0135d7d
|
0211b241d2523ebc6d6703f2a7d5080ad1a66b6e
|
/scipy/interpolate/tests/test_rbfinterp.py
|
e168a403a306619dc14db1646e7c3871d34a0ef7
|
[
"BSD-2-Clause",
"Python-2.0",
"Qhull",
"BSL-1.0",
"Apache-2.0",
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
ArnaudPannatier/scipy
|
b0edfb53c7fb150603463628e95c53e72fb74ec9
|
a0e875ac3441a33ee90606143636d497802c5e36
|
refs/heads/master
| 2023-05-06T18:59:03.560543
| 2021-05-31T23:22:55
| 2021-05-31T23:22:55
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 16,995
|
py
|
import pickle
import pytest
import numpy as np
from numpy.linalg import LinAlgError
from numpy.testing import assert_allclose, assert_array_equal
from scipy.stats.qmc import Halton
from scipy.spatial import cKDTree
from scipy.interpolate._rbfinterp import (
_AVAILABLE, _SCALE_INVARIANT, _NAME_TO_MIN_DEGREE, _monomial_powers,
RBFInterpolator
)
from scipy.interpolate import _rbfinterp_pythran
def _vandermonde(x, degree):
# Returns a matrix of monomials that span polynomials with the specified
# degree evaluated at x.
powers = _monomial_powers(x.shape[1], degree)
return _rbfinterp_pythran._polynomial_matrix(x, powers)
def _1d_test_function(x):
# Test function used in Wahba's "Spline Models for Observational Data".
# domain ~= (0, 3), range ~= (-1.0, 0.2)
x = x[:, 0]
y = 4.26*(np.exp(-x) - 4*np.exp(-2*x) + 3*np.exp(-3*x))
return y
def _2d_test_function(x):
# Franke's test function.
# domain ~= (0, 1) X (0, 1), range ~= (0.0, 1.2)
x1, x2 = x[:, 0], x[:, 1]
term1 = 0.75 * np.exp(-(9*x1-2)**2/4 - (9*x2-2)**2/4)
term2 = 0.75 * np.exp(-(9*x1+1)**2/49 - (9*x2+1)/10)
term3 = 0.5 * np.exp(-(9*x1-7)**2/4 - (9*x2-3)**2/4)
term4 = -0.2 * np.exp(-(9*x1-4)**2 - (9*x2-7)**2)
y = term1 + term2 + term3 + term4
return y
def _is_conditionally_positive_definite(kernel, m):
# Tests whether the kernel is conditionally positive definite of order m.
# See chapter 7 of Fasshauer's "Meshfree Approximation Methods with
# MATLAB".
nx = 10
ntests = 100
for ndim in [1, 2, 3, 4, 5]:
# Generate sample points with a Halton sequence to avoid samples that
# are too close to eachother, which can make the matrix singular.
seq = Halton(ndim, scramble=False, seed=np.random.RandomState())
for _ in range(ntests):
x = 2*seq.random(nx) - 1
A = _rbfinterp_pythran._kernel_matrix(x, kernel)
P = _vandermonde(x, m - 1)
Q, R = np.linalg.qr(P, mode='complete')
# Q2 forms a basis spanning the space where P.T.dot(x) = 0. Project
# A onto this space, and then see if it is positive definite using
# the Cholesky decomposition. If not, then the kernel is not c.p.d.
# of order m.
Q2 = Q[:, P.shape[1]:]
B = Q2.T.dot(A).dot(Q2)
try:
np.linalg.cholesky(B)
except np.linalg.LinAlgError:
return False
return True
# Sorting the parametrize arguments is necessary to avoid a parallelization
# issue described here: https://github.com/pytest-dev/pytest-xdist/issues/432.
@pytest.mark.parametrize('kernel', sorted(_AVAILABLE))
def test_conditionally_positive_definite(kernel):
# Test if each kernel in _AVAILABLE is conditionally positive definite of
# order m, where m comes from _NAME_TO_MIN_DEGREE. This is a necessary
# condition for the smoothed RBF interpolant to be well-posed in general.
m = _NAME_TO_MIN_DEGREE.get(kernel, -1) + 1
assert _is_conditionally_positive_definite(kernel, m)
class _TestRBFInterpolator:
@pytest.mark.parametrize('kernel', sorted(_SCALE_INVARIANT))
def test_scale_invariance_1d(self, kernel):
# Verify that the functions in _SCALE_INVARIANT are insensitive to the
# shape parameter (when smoothing == 0) in 1d.
seq = Halton(1, scramble=False, seed=np.random.RandomState())
x = 3*seq.random(50)
y = _1d_test_function(x)
xitp = 3*seq.random(50)
yitp1 = self.build(x, y, epsilon=1.0, kernel=kernel)(xitp)
yitp2 = self.build(x, y, epsilon=2.0, kernel=kernel)(xitp)
assert_allclose(yitp1, yitp2, atol=1e-8)
@pytest.mark.parametrize('kernel', sorted(_SCALE_INVARIANT))
def test_scale_invariance_2d(self, kernel):
# Verify that the functions in _SCALE_INVARIANT are insensitive to the
# shape parameter (when smoothing == 0) in 2d.
seq = Halton(2, scramble=False, seed=np.random.RandomState())
x = seq.random(100)
y = _2d_test_function(x)
xitp = seq.random(100)
yitp1 = self.build(x, y, epsilon=1.0, kernel=kernel)(xitp)
yitp2 = self.build(x, y, epsilon=2.0, kernel=kernel)(xitp)
assert_allclose(yitp1, yitp2, atol=1e-8)
@pytest.mark.parametrize('kernel', sorted(_AVAILABLE))
def test_extreme_domains(self, kernel):
# Make sure the interpolant remains numerically stable for very
# large/small domains.
seq = Halton(2, scramble=False, seed=np.random.RandomState())
scale = 1e50
shift = 1e55
x = seq.random(100)
y = _2d_test_function(x)
xitp = seq.random(100)
if kernel in _SCALE_INVARIANT:
yitp1 = self.build(x, y, kernel=kernel)(xitp)
yitp2 = self.build(
x*scale + shift, y,
kernel=kernel
)(xitp*scale + shift)
else:
yitp1 = self.build(x, y, epsilon=5.0, kernel=kernel)(xitp)
yitp2 = self.build(
x*scale + shift, y,
epsilon=5.0/scale,
kernel=kernel
)(xitp*scale + shift)
assert_allclose(yitp1, yitp2, atol=1e-8)
def test_polynomial_reproduction(self):
# If the observed data comes from a polynomial, then the interpolant
# should be able to reproduce the polynomial exactly, provided that
# `degree` is sufficiently high.
rng = np.random.RandomState(0)
seq = Halton(2, scramble=False, seed=rng)
degree = 3
x = seq.random(50)
xitp = seq.random(50)
P = _vandermonde(x, degree)
Pitp = _vandermonde(xitp, degree)
poly_coeffs = rng.normal(0.0, 1.0, P.shape[1])
y = P.dot(poly_coeffs)
yitp1 = Pitp.dot(poly_coeffs)
yitp2 = self.build(x, y, degree=degree)(xitp)
assert_allclose(yitp1, yitp2, atol=1e-8)
def test_vector_data(self):
# Make sure interpolating a vector field is the same as interpolating
# each component separately.
seq = Halton(2, scramble=False, seed=np.random.RandomState())
x = seq.random(100)
xitp = seq.random(100)
y = np.array([_2d_test_function(x),
_2d_test_function(x[:, ::-1])]).T
yitp1 = self.build(x, y)(xitp)
yitp2 = self.build(x, y[:, 0])(xitp)
yitp3 = self.build(x, y[:, 1])(xitp)
assert_allclose(yitp1[:, 0], yitp2)
assert_allclose(yitp1[:, 1], yitp3)
def test_complex_data(self):
# Interpolating complex input should be the same as interpolating the
# real and complex components.
seq = Halton(2, scramble=False, seed=np.random.RandomState())
x = seq.random(100)
xitp = seq.random(100)
y = _2d_test_function(x) + 1j*_2d_test_function(x[:, ::-1])
yitp1 = self.build(x, y)(xitp)
yitp2 = self.build(x, y.real)(xitp)
yitp3 = self.build(x, y.imag)(xitp)
assert_allclose(yitp1.real, yitp2)
assert_allclose(yitp1.imag, yitp3)
@pytest.mark.parametrize('kernel', sorted(_AVAILABLE))
def test_interpolation_misfit_1d(self, kernel):
# Make sure that each kernel, with its default `degree` and an
# appropriate `epsilon`, does a good job at interpolation in 1d.
seq = Halton(1, scramble=False, seed=np.random.RandomState())
x = 3*seq.random(50)
xitp = 3*seq.random(50)
y = _1d_test_function(x)
ytrue = _1d_test_function(xitp)
yitp = self.build(x, y, epsilon=0.6, kernel=kernel)(xitp)
mse = np.mean((yitp - ytrue)**2)
assert mse < 1.0e-4
@pytest.mark.parametrize('kernel', sorted(_AVAILABLE))
def test_interpolation_misfit_2d(self, kernel):
# Make sure that each kernel, with its default `degree` and an
# appropriate `epsilon`, does a good job at interpolation in 2d.
seq = Halton(2, scramble=False, seed=np.random.RandomState())
x = seq.random(100)
xitp = seq.random(100)
y = _2d_test_function(x)
ytrue = _2d_test_function(xitp)
yitp = self.build(x, y, epsilon=5.0, kernel=kernel)(xitp)
mse = np.mean((yitp - ytrue)**2)
assert mse < 2.0e-4
@pytest.mark.parametrize('kernel', sorted(_AVAILABLE))
def test_smoothing_misfit(self, kernel):
# Make sure we can find a smoothing parameter for each kernel that
# removes a sufficient amount of noise.
rng = np.random.RandomState(0)
seq = Halton(1, scramble=False, seed=rng)
noise = 0.2
rmse_tol = 0.1
smoothing_range = 10**np.linspace(-4, 1, 20)
x = 3*seq.random(100)
y = _1d_test_function(x) + rng.normal(0.0, noise, (100,))
ytrue = _1d_test_function(x)
rmse_within_tol = False
for smoothing in smoothing_range:
ysmooth = self.build(
x, y,
epsilon=1.0,
smoothing=smoothing,
kernel=kernel)(x)
rmse = np.sqrt(np.mean((ysmooth - ytrue)**2))
if rmse < rmse_tol:
rmse_within_tol = True
break
assert rmse_within_tol
def test_array_smoothing(self):
# Test using an array for `smoothing` to give less weight to a known
# outlier.
rng = np.random.RandomState(0)
seq = Halton(1, scramble=False, seed=rng)
degree = 2
x = seq.random(50)
P = _vandermonde(x, degree)
poly_coeffs = rng.normal(0.0, 1.0, P.shape[1])
y = P.dot(poly_coeffs)
y_with_outlier = np.copy(y)
y_with_outlier[10] += 1.0
smoothing = np.zeros((50,))
smoothing[10] = 1000.0
yitp = self.build(x, y_with_outlier, smoothing=smoothing)(x)
# Should be able to reproduce the uncorrupted data almost exactly.
assert_allclose(yitp, y, atol=1e-4)
def test_inconsistent_x_dimensions_error(self):
# ValueError should be raised if the observation points and evaluation
# points have a different number of dimensions.
y = Halton(2, scramble=False, seed=np.random.RandomState()).random(10)
d = _2d_test_function(y)
x = Halton(1, scramble=False, seed=np.random.RandomState()).random(10)
match = 'Expected the second axis of `x`'
with pytest.raises(ValueError, match=match):
self.build(y, d)(x)
def test_inconsistent_d_length_error(self):
y = np.linspace(0, 1, 5)[:, None]
d = np.zeros(1)
match = 'Expected the first axis of `d`'
with pytest.raises(ValueError, match=match):
self.build(y, d)
def test_y_not_2d_error(self):
y = np.linspace(0, 1, 5)
d = np.zeros(5)
match = '`y` must be a 2-dimensional array.'
with pytest.raises(ValueError, match=match):
self.build(y, d)
def test_inconsistent_smoothing_length_error(self):
y = np.linspace(0, 1, 5)[:, None]
d = np.zeros(5)
smoothing = np.ones(1)
match = 'Expected `smoothing` to be'
with pytest.raises(ValueError, match=match):
self.build(y, d, smoothing=smoothing)
def test_invalid_kernel_name_error(self):
y = np.linspace(0, 1, 5)[:, None]
d = np.zeros(5)
match = '`kernel` must be one of'
with pytest.raises(ValueError, match=match):
self.build(y, d, kernel='test')
def test_epsilon_not_specified_error(self):
y = np.linspace(0, 1, 5)[:, None]
d = np.zeros(5)
for kernel in _AVAILABLE:
if kernel in _SCALE_INVARIANT:
continue
match = '`epsilon` must be specified'
with pytest.raises(ValueError, match=match):
self.build(y, d, kernel=kernel)
def test_x_not_2d_error(self):
y = np.linspace(0, 1, 5)[:, None]
x = np.linspace(0, 1, 5)
d = np.zeros(5)
match = '`x` must be a 2-dimensional array.'
with pytest.raises(ValueError, match=match):
self.build(y, d)(x)
def test_not_enough_observations_error(self):
y = np.linspace(0, 1, 1)[:, None]
d = np.zeros(1)
match = 'At least 2 data points are required'
with pytest.raises(ValueError, match=match):
self.build(y, d, kernel='thin_plate_spline')
def test_degree_warning(self):
y = np.linspace(0, 1, 5)[:, None]
d = np.zeros(5)
for kernel, deg in _NAME_TO_MIN_DEGREE.items():
match = f'`degree` should not be below {deg}'
with pytest.warns(Warning, match=match):
self.build(y, d, epsilon=1.0, kernel=kernel, degree=deg-1)
def test_rank_error(self):
# An error should be raised when `kernel` is "thin_plate_spline" and
# observations are 2-D and collinear.
y = np.array([[2.0, 0.0], [1.0, 0.0], [0.0, 0.0]])
d = np.array([0.0, 0.0, 0.0])
match = 'does not have full column rank'
with pytest.raises(LinAlgError, match=match):
self.build(y, d, kernel='thin_plate_spline')(y)
def test_single_point(self):
# Make sure interpolation still works with only one point (in 1, 2, and
# 3 dimensions).
for dim in [1, 2, 3]:
y = np.zeros((1, dim))
d = np.ones((1,))
f = self.build(y, d, kernel='linear')(y)
assert_allclose(d, f)
def test_pickleable(self):
# Make sure we can pickle and unpickle the interpolant without any
# changes in the behavior.
seq = Halton(1, scramble=False, seed=np.random.RandomState())
x = 3*seq.random(50)
xitp = 3*seq.random(50)
y = _1d_test_function(x)
interp = self.build(x, y)
yitp1 = interp(xitp)
yitp2 = pickle.loads(pickle.dumps(interp))(xitp)
assert_array_equal(yitp1, yitp2)
class TestRBFInterpolatorNeighborsNone(_TestRBFInterpolator):
def build(self, *args, **kwargs):
return RBFInterpolator(*args, **kwargs)
def test_smoothing_limit_1d(self):
# For large smoothing parameters, the interpolant should approach a
# least squares fit of a polynomial with the specified degree.
seq = Halton(1, scramble=False, seed=np.random.RandomState())
degree = 3
smoothing = 1e8
x = 3*seq.random(50)
xitp = 3*seq.random(50)
y = _1d_test_function(x)
yitp1 = self.build(
x, y,
degree=degree,
smoothing=smoothing
)(xitp)
P = _vandermonde(x, degree)
Pitp = _vandermonde(xitp, degree)
yitp2 = Pitp.dot(np.linalg.lstsq(P, y, rcond=None)[0])
assert_allclose(yitp1, yitp2, atol=1e-8)
def test_smoothing_limit_2d(self):
# For large smoothing parameters, the interpolant should approach a
# least squares fit of a polynomial with the specified degree.
seq = Halton(2, scramble=False, seed=np.random.RandomState())
degree = 3
smoothing = 1e8
x = seq.random(100)
xitp = seq.random(100)
y = _2d_test_function(x)
yitp1 = self.build(
x, y,
degree=degree,
smoothing=smoothing
)(xitp)
P = _vandermonde(x, degree)
Pitp = _vandermonde(xitp, degree)
yitp2 = Pitp.dot(np.linalg.lstsq(P, y, rcond=None)[0])
assert_allclose(yitp1, yitp2, atol=1e-8)
class TestRBFInterpolatorNeighbors20(_TestRBFInterpolator):
# RBFInterpolator using 20 nearest neighbors.
def build(self, *args, **kwargs):
return RBFInterpolator(*args, **kwargs, neighbors=20)
def test_equivalent_to_rbf_interpolator(self):
seq = Halton(2, scramble=False, seed=np.random.RandomState())
x = seq.random(100)
xitp = seq.random(100)
y = _2d_test_function(x)
yitp1 = self.build(x, y)(xitp)
yitp2 = []
tree = cKDTree(x)
for xi in xitp:
_, nbr = tree.query(xi, 20)
yitp2.append(RBFInterpolator(x[nbr], y[nbr])(xi[None])[0])
assert_allclose(yitp1, yitp2, atol=1e-8)
class TestRBFInterpolatorNeighborsInf(TestRBFInterpolatorNeighborsNone):
# RBFInterpolator using neighbors=np.inf. This should give exactly the same
# results as neighbors=None, but it will be slower.
def build(self, *args, **kwargs):
return RBFInterpolator(*args, **kwargs, neighbors=np.inf)
def test_equivalent_to_rbf_interpolator(self):
seq = Halton(1, scramble=False, seed=np.random.RandomState())
x = 3*seq.random(50)
xitp = 3*seq.random(50)
y = _1d_test_function(x)
yitp1 = self.build(x, y)(xitp)
yitp2 = RBFInterpolator(x, y)(xitp)
assert_allclose(yitp1, yitp2, atol=1e-8)
|
[
"noreply@github.com"
] |
ArnaudPannatier.noreply@github.com
|
7466dcc58252fb7dd5cb5a5bc16b9cda2ab70723
|
03529c0ad99a1cbae581b33e4ee47bb870ec9934
|
/doubanMovie/spiders/DoubanMovieActor.py
|
584a41aa42a1b1daed2435b1a926d01da3a48416
|
[] |
no_license
|
LanceGG/doubanMovie
|
a3d805889be0579c7f8ce5275182d082744ede7e
|
ae82f0c6e6092958d8f11c8f1baf9bfffd1e5d34
|
refs/heads/master
| 2020-03-23T19:43:00.104751
| 2018-08-14T10:11:30
| 2018-08-14T10:11:30
| 141,998,125
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,733
|
py
|
# -*- coding: utf-8 -*-
from scrapy.spiders import Spider
from scrapy import Request
import urllib.parse
from doubanMovie.spiders.SaveData import SaveData
class DoubanMovieAward(Spider):
name = 'doubanMovieActor'
type = 'ACTOR'
def start_requests(self):
history = SaveData().query_media_history(self.type)[0][1]
mediaAwardList = SaveData().query_media_data(history, 1)[0]
if len(mediaAwardList) > 0:
dataItem = mediaAwardList
acturl = 'https://movie.douban.com/celebrity/' + str(dataItem[1]) + '/'
yield Request(acturl,
callback=self.parse_actor_detail)
def parse_actor_detail(self, response):
if response.status == 200:
actor = {}
# ๅid
actor['id'] = response.url.replace('https://movie.douban.com/celebrity/', '').replace('/', '')
actorDetailTags = response.selector.xpath("//div[@class='info']/ul/li")
for actorDetailTag in actorDetailTags:
actorTag = ''.join(actorDetailTag.xpath("./span/text()").extract())
if actorTag == 'imdb็ผๅท':
actorVal = ''.join(actorDetailTag.xpath("./a/text()").extract())
else:
actorVal = actorDetailTag.xpath("./span/following::text()")[0].extract().replace(' ', '').replace(
'\n', '')
actor[actorTag] = actorVal
print ("ๆผๅDetail")
print (actor)
else:
url = response.url
print ("ๆผๅDetail" + response.status + ": ่ฎฟ้ฎๅคฑ่ดฅ, ้ๆฐ่ฎฟ้ฎ")
yield Request(url, headers=self.headers, callback=self.parse_actor_detail)
|
[
"12nifeng456@163.com"
] |
12nifeng456@163.com
|
dc914aec88b2ca71895d30b99f73971c941e2e5d
|
d94b6845aeeb412aac6850b70e22628bc84d1d6d
|
/fisher_brc/evaluation.py
|
5d740203edf3f5efbaca7b8307c8c4f3951cd95b
|
[
"CC-BY-4.0",
"Apache-2.0"
] |
permissive
|
ishine/google-research
|
541aea114a68ced68736340e037fc0f8257d1ea2
|
c1ae273841592fce4c993bf35cdd0a6424e73da4
|
refs/heads/master
| 2023-06-08T23:02:25.502203
| 2023-05-31T01:00:56
| 2023-05-31T01:06:45
| 242,478,569
| 0
| 0
|
Apache-2.0
| 2020-06-23T01:55:11
| 2020-02-23T07:59:42
|
Jupyter Notebook
|
UTF-8
|
Python
| false
| false
| 1,382
|
py
|
# coding=utf-8
# Copyright 2023 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Policy evaluation."""
from typing import Tuple
def evaluate(env, policy, num_episodes = 10):
"""Evaluates the policy.
Args:
env: Environment to evaluate the policy on.
policy: Policy to evaluate.
num_episodes: A number of episodes to average the policy on.
Returns:
Averaged reward and a total number of steps.
"""
total_timesteps = 0
total_returns = 0.0
for _ in range(num_episodes):
episode_return = 0
timestep = env.reset()
while not timestep.is_last():
action = policy.act(timestep.observation)
timestep = env.step(action)
total_returns += timestep.reward[0]
episode_return += timestep.reward[0]
total_timesteps += 1
return total_returns / num_episodes, total_timesteps / num_episodes
|
[
"copybara-worker@google.com"
] |
copybara-worker@google.com
|
43aff9cff56508f37e65c33c916f231adb1384d7
|
10c689b8fc5ff99ea69197553a14124437288343
|
/napixd/utils/undo.py
|
e96a39dfaec6de59aafc0a74e72c1f7a8136ea51
|
[] |
no_license
|
napix/NapixServer
|
4e4ec3dbdbc7b1fc885c55b2fd3f093cecc3da1a
|
e08b09594091e1d86d4de0dacd1c5801f5255253
|
refs/heads/master
| 2021-05-28T14:29:31.952649
| 2015-04-01T16:02:06
| 2015-04-01T16:02:06
| 15,139,808
| 0
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,107
|
py
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger('Napix.undo')
class UndoManager(object):
"""
A class to watch a piece of code and register
callbacks in case of an exception.
If an exception is thrown during the execution of the context manager or
by manually calling :meth:`undo`, all the callbacks are called in the
reverse order in which they have been :meth:`registered<register>`.
"""
def __init__(self):
self._stack = []
def undo(self):
"""
Runs the error callbacks.
If the callback raises an exception, it is ignored.
"""
for callback in reversed(self._stack):
try:
callback()
except Exception as e:
logger.exception(e)
def register(self, callback):
"""
Registers a *callback*
"""
self._stack.append(callback)
return callback
def __enter__(self):
return self
def __exit__(self, exc_value, exc_type, tb):
if exc_value:
self.undo()
|
[
"gr@enix.org"
] |
gr@enix.org
|
390a9f2cee851dcf50b72c4cdc8a2b03b68a51d5
|
7823412c320a326772415c4566e88b5a182dbba4
|
/mklds.py
|
2986c5413802da942fec3acafc7a24985cf900ac
|
[] |
no_license
|
archibate/PyAsm
|
099cf8031a49aa3cd239e4d9f6e4bacc6510cdfb
|
6fd09e3e639c7190c832d874a824cd50d53e6130
|
refs/heads/master
| 2020-04-02T03:49:54.529572
| 2018-10-27T09:29:25
| 2018-10-27T09:29:25
| 153,986,838
| 0
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 120
|
py
|
import sys
from wrinfo import print_
names = sys.argv[1:]
for name in names:
print_(name + '.bin', name + '.inf')
|
[
"17721388340@163.com"
] |
17721388340@163.com
|
1136444f75dc2b50e7286ad4f03a986d7bf03717
|
82b7d1c5aa34968936c427c93cdec686112a96a3
|
/landslag/src/alaska/teikningar/admin.py
|
95fd751a84c2d44ec40defce7dc870b2c3dfa6df
|
[] |
no_license
|
bthj/landslag
|
22e7ee14d58c906320b598e97fc57b578c064340
|
78d360c68bb367aa686b852ef93cba68821a759d
|
refs/heads/master
| 2021-01-21T13:11:11.933324
| 2015-03-22T20:42:07
| 2015-03-22T20:42:07
| 32,688,564
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,337
|
py
|
#!python
#coding=utf-8
from alaska.teikningar.models import Teikning, Umfjollun, Frasogn, Ljosmynd, Scan, Myndband
from django.contrib import admin
from django import forms
from custom_widgets import SelectScansWidget, SelectFrasognWidget, SelectLjosmyndWidget, SelectMyndbandWidget
class UmfjollunInline(admin.StackedInline):
model = Umfjollun
extra = 1
class FrasognAdminForm(forms.ModelForm):
class Meta:
model = Frasogn
frasogn = forms.CharField(label="Frรกsรถgn", widget=SelectFrasognWidget())
class FrasognInline(admin.TabularInline):
model = Frasogn
form = FrasognAdminForm
extra = 1
class LjosmyndAdminForm(forms.ModelForm):
class Meta:
model = Ljosmynd
ljosmynd = forms.CharField(label="Ljรณsmynd", widget=SelectLjosmyndWidget())
class LjosmyndInline(admin.TabularInline):
model = Ljosmynd
form = LjosmyndAdminForm
extra = 1
class ScanAdminForm(forms.ModelForm):
class Meta:
model = Scan
scan = forms.CharField(label="Skann", widget=SelectScansWidget())
class ScanInine(admin.TabularInline):
model = Scan
form = ScanAdminForm
extra = 1
class MyndbandAdminForm(forms.ModelForm):
class Meta:
model = Myndband
myndband = forms.CharField(label="Myndband", widget=SelectMyndbandWidget())
class MyndbandInline(admin.TabularInline):
model = Myndband
form = MyndbandAdminForm
extra = 1
class TeikningAdmin(admin.ModelAdmin):
inlines = [ScanInine, UmfjollunInline, FrasognInline, LjosmyndInline, MyndbandInline]
list_display = ('hasTeikningar', 'dags_formatted', 'stadur', 'eigandi')
list_filter = ['flokkur', 'sveitarfelag', 'skipulag', 'teikning']
search_fields = ['eigandi','stadur','sveitarfelag','flokkur','flokkur_nanar','skipulag','teikning']
date_hierarchy = 'dags'
list_display_links = ['dags_formatted']
ordering = ['dags']
def hasTeikningar(self, obj):
return len(Scan.objects.filter(teikning=obj)) > 0
hasTeikningar.boolean = True
hasTeikningar.short_description = 'Skannaรฐ'
class ScanAdmin(admin.ModelAdmin):
list_display = ['scan']
search_fields = ['scan']
admin.site.register(Teikning, TeikningAdmin)
admin.site.register(Scan, ScanAdmin)
|
[
"bangsi@bthj.is@af246f38-f70d-11dd-a320-db7d8e7a638f"
] |
bangsi@bthj.is@af246f38-f70d-11dd-a320-db7d8e7a638f
|
adda342794118afcb252622027f56edfc3bbf45b
|
0c4bd1b977cc714a8a6b2839f51c4247ecfd32b1
|
/C++/lbann/bamboo/unit_tests/test_unit_layer_softsign.py
|
878e4e4474b2cc3f591491861cbdcdb803a9fe68
|
[
"Apache-2.0"
] |
permissive
|
ishine/neuralLOGIC
|
281d498b40159308815cee6327e6cf79c9426b16
|
3eb3b9980e7f7a7d87a77ef40b1794fb5137c459
|
refs/heads/master
| 2020-08-14T14:11:54.487922
| 2019-10-14T05:32:53
| 2019-10-14T05:32:53
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,924
|
py
|
import sys
sys.path.insert(0, '../common_python')
import tools
import pytest
import os
def skeleton_layer_softsign(cluster, executables, dir_name, compiler_name):
if compiler_name not in executables:
e = 'skeleton_layer_softsign: default_exes[%s] does not exist' % compiler_name
print('Skip - ' + e)
pytest.skip(e)
output_file_name = '%s/bamboo/unit_tests/output/layer_softsign_%s_output.txt' % (dir_name, compiler_name)
error_file_name = '%s/bamboo/unit_tests/error/layer_softsign_%s_error.txt' % (dir_name, compiler_name)
command = tools.get_command(
cluster=cluster, executable=executables[compiler_name], num_nodes=1,
time_limit=10,
num_processes=2, dir_name=dir_name,
data_reader_name='synthetic',
model_folder='tests/layer_tests', model_name='softsign',
optimizer_name='sgd',
output_file_name=output_file_name, error_file_name=error_file_name)
return_code = os.system(command)
tools.assert_success(return_code, error_file_name)
def test_unit_layer_softsign_clang6(cluster, exes, dirname):
skeleton_layer_softsign(cluster, exes, dirname, 'clang6')
def test_unit_layer_softsign_gcc7(cluster, exes, dirname):
skeleton_layer_softsign(cluster, exes, dirname, 'gcc7')
def test_unit_layer_softsign_intel19(cluster, exes, dirname):
skeleton_layer_softsign(cluster, exes, dirname, 'intel19')
def test_unit_layer_softsign_intel19(cluster, exes, dirname):
skeleton_layer_softsign(cluster, exes, dirname, 'intel19')
# Run with python3 -m pytest -s test_unit_layer_softsign.py -k 'test_unit_layer_softsign_exe' --exe=<executable>
def test_unit_layer_softsign_exe(cluster, dirname, exe):
if exe is None:
e = 'test_unit_layer_softsign_exe: Non-local testing'
print('Skip - ' + e)
pytest.skip(e)
exes = {'exe': exe}
skeleton_layer_softsign(cluster, exes, dirname, 'exe')
|
[
"the.new.horizon@outlook.com"
] |
the.new.horizon@outlook.com
|
2173612aaec62012504d001a03f7322176e0be3a
|
62f8862454b3cbedd21e62524f964a2780c6bb77
|
/170/170b.py
|
863ead179755855992d46b80ac9f5f3420c91a8b
|
[] |
no_license
|
31159piko-suke/Atcoder
|
3cdb630415e46e717261c5aad1e3dd44cf2ef449
|
a23a0b8551d83ca83bc657ccbfb1667e26b6d8da
|
refs/heads/main
| 2023-05-14T14:04:16.898948
| 2021-06-08T06:46:08
| 2021-06-08T06:46:08
| 323,053,093
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 177
|
py
|
X,Y = map(int,input().split())
#๏ฝ้ถดใฎๆฐใmใซใกใฎๆฐ
m = (Y-2*X)/2
n = X-m
if m%1==0 and n%1==0 and m*n>=0:
print("Yes")
else:
print("No")
|
[
"k426.31159@gmail.com"
] |
k426.31159@gmail.com
|
08e6893f70072344f14bd59b0532d709636e2a6f
|
bbd0eccf61c56f94f06b8d2981be4ec5ab93c2d3
|
/exercises/1901090055/1001S02E04_control_flow.py
|
65d0d5648bf66bb9cead7261e90fffe731e3629c
|
[] |
no_license
|
nancy3457/selfteaching-python-camp
|
110641a9ac480e8783f33acfeaef3d455cd90336
|
ab3d987492768befe2af93e54f6e662e87aea58a
|
refs/heads/master
| 2020-06-20T15:05:09.088660
| 2019-07-18T10:48:56
| 2019-07-18T10:48:56
| 197,159,258
| 1
| 0
| null | 2019-07-16T09:05:20
| 2019-07-16T09:05:19
| null |
UTF-8
|
Python
| false
| false
| 342
|
py
|
print('ไนไนไนๆณ่กจ')
for i in range(1, 10):
for j in range(1, i+1):
print('{}x{}={}\t'.format(j, i, i*j), end='')
print()
print('ไธๅซๅถๆฐ่ก็ไนไนไนๆณ่กจ')
i = 1
while i <= 9:
j = 1
while j <= i and i % 2!=0:
print('{}ร{}={}'.format(i,j,i*j),end = " ")
j += 1
print()
i += 1
|
[
"6396023+realcaiying@users.noreply.github.com"
] |
6396023+realcaiying@users.noreply.github.com
|
93441f22af428d4b2c065014f15b7e02a0890813
|
68de77662b7cb5d2559cce327c86dfe48435ce4b
|
/static/pix2pixHD/data/custom_dataset_data_loader.py
|
676a7bd8abde556527b8dc187e1dde6bcc8c1502
|
[
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"BSD-2-Clause"
] |
permissive
|
gamble27/flask-gender-swap
|
301fca59cd71c08a705efd9cc4a919a6594ea081
|
0d3c1bacb929d05b23b03ce790dc6d996359095e
|
refs/heads/master
| 2023-04-05T23:24:06.810000
| 2021-04-20T18:36:43
| 2021-04-20T18:36:43
| 359,903,063
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 920
|
py
|
import torch.utils.data
from static.pix2pixHD.data.base_data_loader import BaseDataLoader
def CreateDataset(opt):
dataset = None
from static.pix2pixHD.data.aligned_dataset import AlignedDataset
dataset = AlignedDataset()
print("dataset [%s] was created" % (dataset.name()))
dataset.initialize(opt)
return dataset
class CustomDatasetDataLoader(BaseDataLoader):
def name(self):
return 'CustomDatasetDataLoader'
def initialize(self, opt):
BaseDataLoader.initialize(self, opt)
self.dataset = CreateDataset(opt)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batchSize,
shuffle=not opt.serial_batches,
num_workers=int(opt.nThreads))
def load_data(self):
return self.dataloader
def __len__(self):
return min(len(self.dataset), self.opt.max_dataset_size)
|
[
"olyushkam@gmail.com"
] |
olyushkam@gmail.com
|
7beb5eb0cab77fef619d016771da62177832b65c
|
aca8a9e2cb69e88d9b1b4902582eed1eb00ffaec
|
/autofoucus/Autofocus3D/Model.py
|
f4f9f103245d7ecec1bbb485d05b30e591dbc927
|
[] |
no_license
|
luvgold/auotofoucus3D-Brats
|
b60cecb2936ad40a7cfbb2710947852184682d99
|
20eca40fc939f1e60f4b3cf7fed67d91b1bdb3bc
|
refs/heads/main
| 2023-03-14T17:19:56.436705
| 2021-03-02T11:20:56
| 2021-03-02T11:20:56
| 343,621,339
| 2
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,046
|
py
|
from Autofocus3D.autofocus3D import Autofocus3D
from Autofocus3D.ResBlock import BasicBlock
from Autofocus3D.autofocus_single import Autofocus_single
import tensorflow as tf
import numpy as np
import tensorflow.keras.backend as K
def build_model():
# Dilation rates, here 4 parallel conv applications
dilations = [2, 6, 10, 14]
# channels = [num_input - 1, 30, 30, 40, 40, 40, 40, 50, 50, num_classes]
# Define model
model = tf.keras.Sequential([
tf.keras.layers.Conv3D(30, kernel_size=3, dilation_rate=[1, 1, 1], padding='SAME'),
tf.keras.layers.BatchNormalization(1),
tf.keras.layers.Activation("relu"),
tf.keras.layers.Conv3D(30, kernel_size=3, dilation_rate=[1, 1, 1], padding='SAME'),
tf.keras.layers.BatchNormalization(1),
tf.keras.layers.Activation("relu"),
tf.keras.layers.Conv3D(40, kernel_size=3, dilation_rate=[1, 1, 1], padding='SAME'),
tf.keras.layers.BatchNormalization(1),
tf.keras.layers.Activation("relu"),
tf.keras.layers.Conv3D(40, kernel_size=3, dilation_rate=[1, 1, 1], padding='SAME'),
tf.keras.layers.BatchNormalization(1),
tf.keras.layers.Activation("relu"),
BasicBlock(40,40,40),
# BasicBlock(40,40, 40),
# BasicBlock(40,40, 40),
# BasicBlock(40,40, 40),
# Autofocus_single(40, 50, 50, dilations, 4),
Autofocus3D(dilations,
filters=50,
kernel_size=(3, 3, 3),
activation='relu',
attention_activation=tf.nn.relu,
attention_filters=25,
attention_kernel_size=3,
use_bn=True,
use_bias=True),
tf.keras.layers.Conv3D(3, 1, activation="relu")
# etc....
])
return model
def build_graph(model):
# Build model by passing random data...
writer = tf.summary.FileWriter(logdir="./")
with tf.Session() as s:
writer.add_graph(s.graph)
writer.flush()
|
[
"564478192@qq.com"
] |
564478192@qq.com
|
a6a8899205d9ec3169216af64a35cac23dbcafd7
|
4cd135c66207762fee500e336264224c5537718b
|
/examples/references/segmentation/pascal_voc2012/code/dataflow/datasets.py
|
2d8045343e89521038c2d1719afbc2d39a1b2b7d
|
[
"BSD-3-Clause"
] |
permissive
|
Sharad24/ignite
|
2c8e962ad7675ed7cd19cb6f47c3abb91f388137
|
0de7156bb284bd01d788252469a3b386f10abbd7
|
refs/heads/master
| 2022-06-03T16:52:54.484461
| 2020-05-01T21:43:41
| 2020-05-01T21:43:41
| 260,777,961
| 1
| 1
|
BSD-3-Clause
| 2020-05-02T21:26:58
| 2020-05-02T21:26:57
| null |
UTF-8
|
Python
| false
| false
| 2,966
|
py
|
from typing import Type, Callable
import numpy as np
import cv2
from PIL import Image
from torch.utils.data import Dataset
from torchvision.datasets.voc import VOCSegmentation
from torchvision.datasets.sbd import SBDataset
class TransformedDataset(Dataset):
def __init__(self, ds: Dataset, transform_fn: Callable):
assert isinstance(ds, Dataset)
assert callable(transform_fn)
self.ds = ds
self.transform_fn = transform_fn
def __len__(self):
return len(self.ds)
def __getitem__(self, index):
dp = self.ds[index]
return self.transform_fn(**dp)
class VOCSegmentationOpencv(VOCSegmentation):
def __init__(self, *args, return_meta: bool = False, **kwargs):
super(VOCSegmentationOpencv, self).__init__(*args, **kwargs)
self.return_meta = return_meta
def __getitem__(self, index):
img = cv2.imread(self.images[index])
assert img is not None, "Image at '{}' has a problem".format(self.images[index])
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
mask = np.asarray(Image.open(self.masks[index]))
if self.return_meta:
return {
"image": img,
"mask": mask,
"meta": {"index": index, "image_path": self.images[index], "mask_path": self.masks[index]},
}
return {"image": img, "mask": mask}
class SBDatasetOpencv(SBDataset):
def __init__(self, *args, return_meta: bool = False, **kwargs):
super(SBDatasetOpencv, self).__init__(*args, **kwargs)
assert self.mode == "segmentation", "SBDatasetOpencv should be in segmentation mode only"
self.return_meta = return_meta
def _get_segmentation_target(self, filepath):
mat = self._loadmat(filepath)
return mat["GTcls"][0]["Segmentation"][0]
def __getitem__(self, index):
img = cv2.imread(self.images[index])
assert img is not None, "Image at '{}' has a problem".format(self.images[index])
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
mask = self._get_target(self.masks[index])
if self.return_meta:
return {
"image": img,
"mask": mask,
"meta": {"index": index, "image_path": self.images[index], "mask_path": self.masks[index]},
}
return {"image": img, "mask": mask}
def get_train_dataset(root_path: str, return_meta: bool = False):
return VOCSegmentationOpencv(
root=root_path, year="2012", image_set="train", download=False, return_meta=return_meta
)
def get_val_dataset(root_path: str, return_meta: bool = False):
return VOCSegmentationOpencv(root=root_path, year="2012", image_set="val", download=False, return_meta=return_meta)
def get_train_noval_sbdataset(root_path: str, return_meta: bool = False):
return SBDatasetOpencv(root_path, image_set="train_noval", mode="segmentation", return_meta=return_meta)
|
[
"noreply@github.com"
] |
Sharad24.noreply@github.com
|
e5204ad4bb99064e3df1a1bcf77c4743510a3ca1
|
6f79722871e2650ef0ceb490ab3f2a720c8d29b2
|
/Plot/3dplot.py
|
391b93e88ecf7a45b2c6f409137ef265eac1f066
|
[] |
no_license
|
carollaurini/Bayesian-Network
|
b0d598b44ee6fdfd4539887e7f3e0c46c2c733ff
|
b3b7bd08d13249d5e7be92a77ef3e23536298b76
|
refs/heads/master
| 2021-01-22T04:33:45.964310
| 2015-07-20T13:34:07
| 2015-07-20T13:34:07
| 26,274,230
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 387
|
py
|
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pylab import *
from mpl_toolkits.mplot3d import axes3d
df=pd.read_csv('Out.txt',sep=' ')
#print df
fig= plt.figure().gca(projection='3d')
fig.scatter(df.Twet,df.Load,df.Tset)
fig.set_xlabel('Twet ($^\circ$C)',size=30)
fig.set_ylabel('Load (Ton)',size=30)
fig.set_zlabel('Tset ($^\circ$C)',size=30)
plt.show()
|
[
"carol.laurini@gmail.com"
] |
carol.laurini@gmail.com
|
942b9e91c3d31c25afd9b27774a0224a6b8da96d
|
22ff39e9bf8e04fd3384fa626fb9d9424c87c65f
|
/week_1/equation.py
|
f510fd75207d8e54611e545d5543377364f041cb
|
[] |
no_license
|
panzercheg/learning
|
3c454dd41cf7652defdd584fe64ca32815ba169a
|
5e0c84b5b22b5cf4254f6d502089749e6df6e855
|
refs/heads/master
| 2022-02-17T02:34:23.789227
| 2019-07-25T07:34:34
| 2019-07-25T07:34:34
| 109,257,578
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 427
|
py
|
import sys
a = int(sys.argv[1])
b = int(sys.argv[2])
c = int(sys.argv[3])
disc = ( b * b ) - 4 * a * c
if disc > 0:
root_1 = (-b + disc ** 0.5) / 2 * a
root_2 = (-b - disc ** 0.5) / 2 * a
print(int(root_1))
print(int(root_2))
elif disc == 0:
root_1 = (-b + disc ** 0.5) / 2 * a
print(int(root_1))
elif disc < 0:
print("ะฃัะฐะฒะฝะตะฝะธะต ะฝะต ะธะผะตะตั ะดะตะนััะฒะธัะตะปัะฝัั
ะบะพัะฝะตะน")
|
[
"r.burenkov@corp.mail.ru"
] |
r.burenkov@corp.mail.ru
|
314f3ad930976961c6bfd660b4bb68aeb19e12f4
|
8568982a76c16e244ab1fd9e59b333d29844d5f7
|
/7. Ubbi Dubbi.py
|
84b0763606776404db0f6ad5e2ad143afc5235fd
|
[] |
no_license
|
harrisonzhou/python-workout-test
|
0adcf8f40922271870e429fd6f53a979ed61b003
|
9cb13925c24d7ae88bca8d9c8dfbc0cadc82bab2
|
refs/heads/master
| 2023-03-30T01:05:59.014196
| 2021-04-11T13:11:56
| 2021-04-11T13:11:56
| 345,278,193
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 243
|
py
|
def ubbi_dubbi(word):
output=[]
for letter in word :
if letter in 'aioue':
output.append(f'ub{letter}')
else:
output.append(letter)
return ' '.join(output)
print(ubbi_dubbi('python'))
|
[
"menghui1126@gmail.com"
] |
menghui1126@gmail.com
|
8454776653f4153231379ad5d9ec12c6745463f9
|
510eccf2912e1acfc41a1e5a7c5190d6ff5e24c7
|
/14.py
|
c8fb885f5ec88ffb7ee57bf2d6fee6592190b3a1
|
[] |
no_license
|
alex75311/acmp.ru-solution
|
16acb34265f46d2e9a46efcf8d5d9ff6e5d6c257
|
c73c1d4a1ec39e16d17c66dde9ceb031f2d5a1a0
|
refs/heads/master
| 2020-09-23T04:51:11.549043
| 2019-12-16T21:50:24
| 2019-12-16T21:50:24
| 225,408,126
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 133
|
py
|
a, b = map(int, input().split())
if a < 0: a *= -1
if b < 0: b *= -1
res = a
while res % a or res % b != 0:
res += a
print(res)
|
[
"isaev.alex75311@gmail.com"
] |
isaev.alex75311@gmail.com
|
4cc2dbc1986fe00579fa3df68910f079b362f95f
|
713012e43109abacfc212d5243de7282dc0a19a6
|
/goodreads_dwh/apps/dashboard/models.py
|
c81a864c3ddc53ff5c5eed4c5cf563bf98b4e3ab
|
[] |
no_license
|
nhlinh99/Practice_Project_DE
|
fbdf235e9f92d4ab00d30900f10c5df0488d1846
|
7440bb5386ee46bfefc69544a48bad352a7d5097
|
refs/heads/master
| 2023-09-03T16:03:18.592844
| 2021-10-18T08:04:18
| 2021-10-18T08:04:18
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,191
|
py
|
from django.db import models
from django.db.models.fields.related import ForeignKey
# Create your models here.
class Information_Book_Detail(models.Model):
Book_Id = models.IntegerField(primary_key=True, null=False)
Book_Title = models.CharField(max_length=50)
Author_Name = models.CharField(max_length=50)
Author_Url = models.CharField(max_length=50, null=True)
Description = models.CharField(max_length=1000, null=True)
Rating_Avg = models.FloatField(null=True)
Rating_Count = models.IntegerField(null=True)
Reviews_Count = models.IntegerField(null=True)
Num_Pages = models.IntegerField(null=True)
Book_Format = models.CharField(max_length=50, null=True)
Time_publish = models.CharField(max_length=50, null=True)
Publisher = models.CharField(max_length=50, null=True)
ISBN = models.CharField(max_length=50, null=True)
Language = models.CharField(max_length=50, null=True)
Genres = models.JSONField(null=True)
Book_Url = models.CharField(max_length=100)
class Meta:
db_table = "Book_Details"
verbose_name = 'Book Detail'
verbose_name_plural = 'Book Details'
ordering = ['Author_Name', 'Book_Title']
def __str__(self):
return self.Book_Title
class Information_User_Detail(models.Model):
User_Id = models.IntegerField(primary_key=True, null=False)
Username = models.CharField(max_length=50)
User_Url = models.CharField(max_length=100)
class Meta:
db_table = "User_Info"
verbose_name = 'User Information'
verbose_name_plural = 'User Information'
def __str__(self):
return self.Username
class User_Rating_Information(models.Model):
Book = models.ForeignKey(Information_Book_Detail, on_delete=models.PROTECT, related_name='User_to_Book')
User = models.ForeignKey(Information_User_Detail, on_delete=models.PROTECT, related_name="User_to_User")
User_Rating = models.FloatField()
class Meta:
db_table = "User_Rating"
verbose_name = 'User Rating'
verbose_name_plural = 'User Ratings'
def __str__(self):
return "{} - {}".format(self.User_Info, self.Book_Info)
|
[
"hlinh81999@gmail.com"
] |
hlinh81999@gmail.com
|
53c7ef3180c7ad71463d6495787212597622c32b
|
09e57dd1374713f06b70d7b37a580130d9bbab0d
|
/data/p2DJ/New/program/qiskit/class/startQiskit_Class11.py
|
b1355830151716b9c55c93278385b7e4750ca945
|
[
"BSD-3-Clause"
] |
permissive
|
UCLA-SEAL/QDiff
|
ad53650034897abb5941e74539e3aee8edb600ab
|
d968cbc47fe926b7f88b4adf10490f1edd6f8819
|
refs/heads/main
| 2023-08-05T04:52:24.961998
| 2021-09-19T02:56:16
| 2021-09-19T02:56:16
| 405,159,939
| 2
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,891
|
py
|
# qubit number=2
# total number=4
import cirq
import qiskit
from qiskit import IBMQ
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as nx
def build_oracle(n: int, f) -> QuantumCircuit:
# implement the oracle O_f^\pm
# NOTE: use U1 gate (P gate) with \lambda = 180 ==> CZ gate
# or multi_control_Z_gate (issue #127)
controls = QuantumRegister(n, "ofc")
target = QuantumRegister(1, "oft")
oracle = QuantumCircuit(controls, target, name="Of")
for i in range(2 ** n):
rep = np.binary_repr(i, n)
if f(rep) == "1":
for j in range(n):
if rep[j] == "0":
oracle.x(controls[j])
oracle.mct(controls, target[0], None, mode='noancilla')
for j in range(n):
if rep[j] == "0":
oracle.x(controls[j])
# oracle.barrier()
# oracle.draw('mpl', filename='circuit/deutsch-oracle.png')
return oracle
def make_circuit(n:int,f) -> QuantumCircuit:
# circuit begin
input_qubit = QuantumRegister(n, "qc")
target = QuantumRegister(1, "qt")
prog = QuantumCircuit(input_qubit, target)
# inverse last one (can be omitted if using O_f^\pm)
prog.x(target)
# apply H to get superposition
for i in range(n):
prog.h(input_qubit[i])
prog.h(input_qubit[1]) # number=1
prog.h(target)
prog.barrier()
# apply oracle O_f
oracle = build_oracle(n, f)
prog.append(
oracle.to_gate(),
[input_qubit[i] for i in range(n)] + [target])
# apply H back (QFT on Z_2^n)
for i in range(n):
prog.h(input_qubit[i])
prog.barrier()
# measure
prog.swap(input_qubit[1],input_qubit[0]) # number=2
prog.swap(input_qubit[1],input_qubit[0]) # number=3
# circuit end
return prog
if __name__ == '__main__':
n = 2
f = lambda rep: rep[-1]
# f = lambda rep: "1" if rep[0:2] == "01" or rep[0:2] == "10" else "0"
# f = lambda rep: "0"
prog = make_circuit(n, f)
sample_shot =2800
backend = BasicAer.get_backend('statevector_simulator')
circuit1 = transpile(prog,FakeVigo())
circuit1.x(qubit=3)
circuit1.x(qubit=3)
prog = circuit1
info = execute(prog, backend=backend).result().get_statevector()
qubits = round(log2(len(info)))
info = {
np.binary_repr(i, qubits): round((info[i]*(info[i].conjugate())).real,3)
for i in range(2 ** qubits)
}
writefile = open("../data/startQiskit_Class11.csv","w")
print(info,file=writefile)
print("results end", file=writefile)
print(circuit1.depth(),file=writefile)
print(circuit1,file=writefile)
writefile.close()
|
[
"wangjiyuan123@yeah.net"
] |
wangjiyuan123@yeah.net
|
b5ae73eca2c21bbcccd7042001d79c2f58a45cf5
|
d1d9f6fae8e7210e5f6303ba01d9e4b4691ddb5c
|
/brief_projet/la_roue_des_emotions/app/callbacks.py
|
757520263460f0cd99fab49038733dcd4c955321
|
[] |
no_license
|
hachemmosbah/artificial_inteligence
|
2d7ab141fdeb0c8729116f7b5bc026474fc092db
|
87bdf55068a11881a7d4afb1f11725ba8e28e8bd
|
refs/heads/main
| 2023-04-03T03:27:09.037300
| 2021-04-13T08:42:45
| 2021-04-13T08:42:45
| 307,414,816
| 0
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 923
|
py
|
from dash.dependencies import Input, Output
import plotly.express as px
from app import app
import dash
from layouts import layout1, layout2, layout3, layout4, pipe
import pandas as pd
@app.callback(
Output('id1', 'children'),
Input('Home page', 'value'))
def display_value(value):
return 'You have selected "{}"'.format(value)
@app.callback(
Output('id2', 'children'),
Input('kaggle', 'value'))
def display_value1(value):
return 'You have selected "{}"'.format(value)
@app.callback(
Output('id3', 'children'),
Input('Kaggle1', 'value'))
def display_value2(value):
return 'You have selected "{}"'.format(value)
@app.callback(
Output("output", "children"),
Input("input1", "value"),)
def update_output(input1):
text = [input1]
if input1 is None:
return ""
else:
y_pred = pipe.predict(text)
return u'Emotion : {}'.format(y_pred)
|
[
"ยซhachem.mosbah.data@gmail.comยป"
] |
ยซhachem.mosbah.data@gmail.comยป
|
63cb696e842f5ef6a69bba18a478b746b6f811a6
|
3e1427ee83be041f98b4f7a209200bcb7a0ea48a
|
/cdptools/tests/pipelines/test_event_gather_pipeline.py
|
cb5d992a73fb30847459980b966f1d2e8b3f10bf
|
[
"BSD-3-Clause"
] |
permissive
|
textioHQ/cdptools
|
f0e8c98f1e5843adb9996aa2815cb746fe350439
|
6fcf97838aaa5e0faaa2d3e33d1473823bd8fa3d
|
refs/heads/master
| 2020-07-05T07:47:44.066245
| 2019-08-07T23:39:23
| 2019-08-07T23:45:27
| 202,576,259
| 0
| 0
|
BSD-3-Clause
| 2019-08-16T16:05:55
| 2019-08-15T16:32:51
|
Python
|
UTF-8
|
Python
| false
| false
| 6,581
|
py
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from pathlib import Path
from typing import List, Union
from unittest import mock
import pytest
from firebase_admin import firestore
from google.cloud import storage
from cdptools.audio_splitters.ffmpeg_audio_splitter import FFmpegAudioSplitter
from cdptools.databases.cloud_firestore_database import CloudFirestoreDatabase
from cdptools.event_scrapers.seattle_event_scraper import SeattleEventScraper
from cdptools.file_stores.gcs_file_store import GCSFileStore
from cdptools.pipelines import EventGatherPipeline
from cdptools.sr_models.google_cloud_sr_model import (GoogleCloudSRModel,
SRModelOutputs)
from ..databases.test_cloud_firestore_database import MockedCollection
from ..file_stores.test_gcs_file_store import MockedBlob, MockedBucket
@pytest.fixture
def legistar_data_dir(data_dir) -> Path:
return data_dir / "legistar"
@pytest.fixture
def example_video(data_dir) -> Path:
return data_dir / "example_video.mp4"
@pytest.fixture
def example_audio(data_dir) -> Path:
return data_dir / "example_audio.wav"
@pytest.fixture
def example_config(data_dir) -> Path:
return data_dir / "example_event_pipeline_config.json"
@pytest.fixture
def example_transcript_raw(data_dir) -> Path:
return data_dir / "example_transcript_raw.json"
@pytest.fixture
def example_transcript_words(data_dir) -> Path:
return data_dir / "example_transcript_words.json"
@pytest.fixture
def example_transcript_sentences(data_dir) -> Path:
return data_dir / "example_transcript_sentences.json"
@pytest.fixture
def empty_creds_db() -> CloudFirestoreDatabase:
with mock.patch("cdptools.databases.cloud_firestore_database.CloudFirestoreDatabase._initialize_creds_db"):
db = CloudFirestoreDatabase("/fake/path/to/creds.json")
db._credentials_path = "/fake/path/to/creds.json"
db._root = mock.Mock(firestore.Client)
db._root.collection.return_value = MockedCollection([])
return db
@pytest.fixture
def empty_creds_fs() -> GCSFileStore:
with mock.patch("cdptools.file_stores.gcs_file_store.GCSFileStore._initialize_creds_fs"):
fs = GCSFileStore("/fake/path/to/creds.json")
fs._credentials_path = "/fake/path/to/creds.json"
fs._client = mock.Mock(storage.Client)
fs._bucket = MockedBucket("fake_bucket", [MockedBlob("example.mp4", exists=False)])
return fs
@pytest.fixture
def mocked_splitter(example_audio) -> FFmpegAudioSplitter:
mocked_splitter = mock.Mock(FFmpegAudioSplitter())
mocked_splitter.split.return_value = example_audio
return mocked_splitter
@pytest.fixture
def mocked_sr_model(
example_transcript_raw,
example_transcript_words,
example_transcript_sentences
) -> GoogleCloudSRModel:
# Create basic sr model
# It doesn't matter what file is put in the init as long as it's a file
# The speech client is configured during the transcribe function
mocked_model = mock.Mock(GoogleCloudSRModel(example_transcript_raw))
mocked_model.transcribe.return_value = SRModelOutputs(
example_transcript_raw,
99.0,
example_transcript_words,
example_transcript_sentences
)
return mocked_model
@pytest.fixture
def example_seattle_routes(data_dir):
return data_dir / "example_seattle_routes.html"
@pytest.fixture
def example_seattle_route(data_dir):
return data_dir / "example_seattle_route.html"
class RequestReturn:
def __init__(self, content: Union[str, Path]):
if isinstance(content, Path):
with open(content, "r") as read_in:
if content.suffix == ".json":
content = json.load(read_in)
else:
content = read_in.read()
self.content = content
def raise_for_status(self):
pass
def json(self):
return self.content
@pytest.fixture
def loaded_legistar_requests(legistar_data_dir) -> List[RequestReturn]:
mocked_responses = []
for i in range(len(list(legistar_data_dir.glob("request_*")))):
mocked_responses.append(RequestReturn(list(legistar_data_dir.glob(f"request_{i}_*"))[0]))
return mocked_responses
def test_event_pipeline_no_backfill(
empty_creds_db,
empty_creds_fs,
mocked_sr_model,
example_config,
example_seattle_routes
):
# Configure all mocks
with mock.patch("cdptools.dev_utils.load_custom_object.load_custom_object") as mock_loader:
mock_loader.side_effect = [
SeattleEventScraper(), empty_creds_db, empty_creds_fs, FFmpegAudioSplitter(), mocked_sr_model
]
# Initialize pipeline
pipeline = mock.Mock(EventGatherPipeline(example_config))
with mock.patch("requests.get") as mock_requests:
# No backfill means only routes will be gathered because example html file only includes past events.
mock_requests.side_effect = [RequestReturn(example_seattle_routes)]
pipeline.run()
# This should never be ran because example html files only include past events.
pipeline.process_event.assert_not_called()
def test_event_pipeline_with_backfill(
empty_creds_db,
empty_creds_fs,
mocked_splitter,
mocked_sr_model,
example_config,
example_seattle_routes,
example_seattle_route,
example_video,
loaded_legistar_requests
):
# Configure all mocks
with mock.patch("cdptools.dev_utils.load_custom_object.load_custom_object") as mock_loader:
mock_loader.side_effect = [
SeattleEventScraper(backfill=True), empty_creds_db, empty_creds_fs, mocked_splitter, mocked_sr_model
]
# Initialize pipeline
pipeline = EventGatherPipeline(example_config)
with mock.patch("requests.get") as mock_requests:
# Backfill means we need to mock every request call including all the legistar calls
mock_requests.side_effect = [
RequestReturn(example_seattle_routes),
RequestReturn(example_seattle_route),
*loaded_legistar_requests
]
# Mock the video copy
with mock.patch("cdptools.file_stores.FileStore._external_resource_copy") as mocked_resource_copy:
mocked_resource_copy.return_value = example_video
# Interupt calls to os.remove because it deletes test data otherwise
with mock.patch("os.remove"):
pipeline.run()
|
[
"jmaxfieldbrown@gmail.com"
] |
jmaxfieldbrown@gmail.com
|
6ee648af98c71fb32b59ad3e3865013031e6de15
|
72e27c99fb55cbcd5ffd460d3c98a78d54467ead
|
/tests/pbbs/maximalMatching/run_ser.py
|
e2094ae0400d06aa3d82777a8fc245fd5a1c45d5
|
[
"BSD-2-Clause"
] |
permissive
|
rutgers-apl/omp-racer
|
a492ebf5826efc6638206d50c38e816b8325f90e
|
a8a32e186950997b8eee7864f766819129a5ee06
|
refs/heads/master
| 2022-12-09T19:14:47.454842
| 2020-09-09T19:49:47
| 2020-09-09T19:49:47
| 266,447,520
| 3
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 4,402
|
py
|
#!/usr/bin/python
import sys, string, os, popen2, shutil, platform, subprocess, pprint, time
import util, commands, csv
from math import sqrt
#clean up the src
do_clean = True
#build the src
do_build = True
#clean, build, and run the benchmarks
do_run = True
#collect data to plot
#do_collect_data = True
if do_clean and not do_build:
print "Clean - true and build - false not allowed"
exit(0)
configs = []
entry = { "NAME" : "RUN_ALL_BENCHMARKS",
"NUM_RUNS" : 3,
"CLEAN_LINE" : " make clean ",
"BUILD_LINE" : " make ",
"BUILD_ARCH" : "x86_64",
"RUN_ARCH" : "x86_64",
"RUN_LINE" : '/usr/bin/time -f "%E" ./',
"ARGS" : "",
}
configs.append(entry)
ref_cwd = os.getcwd()
arch = platform.machine()
full_hostname = platform.node()
hostname=full_hostname
bench_name = "mMatch"
benchmarks=[
"ndMatching"
]
inner_data_folder=[
"graphData/data"
]
input_file=[
"randLocalGraph_E_5_10000000"
]
executable=[
"matching.ser",
]
inputs=[
"-r 1 -o /tmp/ofile685095_551810 ../graphData/data/randLocalGraph_E_5_10000000"
]
if __name__ == "__main__":
with open('ser.csv', 'wb') as csvfile:
res_writer = csv.writer(csvfile, delimiter=',')
res_writer.writerow(['test name', 'time (s)'])
for config in configs:
util.log_heading(config["NAME"], character="-")
print('input file folder: ' + inner_data_folder[0])
data_input = inner_data_folder[0]+'/'+input_file[0]
print('checking if input data exists at:' + data_input)
if not os.path.exists(data_input):
print("input data doesn't exist. building input data")
util.chdir(ref_cwd + "/" + inner_data_folder[0])
build_data = config["BUILD_LINE"] + " " + input_file[0]
util.run_command(build_data, verbose=True)
util.chdir(ref_cwd)
else:
print("input data exists")
total_sum = 0.0
for b_index in range(len(executable)):
util.chdir(ref_cwd)
for i in range(0, config["NUM_RUNS"]):
row = []
row.append(bench_name)
try:
util.chdir(ref_cwd + "/" + benchmarks[0] )
util.log_heading(benchmarks[0], character="=")
if i==0:
try:
clean_string = config["CLEAN_LINE"]
util.run_command(clean_string, verbose=True)
except:
print "Clean failed"
build_bench_string = config["BUILD_LINE"]
util.run_command(build_bench_string, verbose=True)
util.log_heading("running: " + benchmarks[0], character="=")
run_string = config["RUN_LINE"] + executable[b_index] + " " + inputs[0]
#running applications
if i == 0:#warm up serial run
util.run_command(run_string, verbose=True)
output_string = util.run_command(run_string, verbose=True)
output_lines = output_string.split('\n')
time_line = output_lines[-2] #format is hh:mm:sec
time_line = time_line.split(':')
tot_secs = 0.0
for t in time_line:
tot_secs = (tot_secs*60) + float(t)
row.append(tot_secs)
total_sum+=tot_secs
print ('total secs= ' + str(tot_secs))
res_writer.writerow(row)
except util.ExperimentError, e:
print "Error: %s" % e
print "-----------"
print "%s" % e.output
continue
row = ['mean', "{0:.2f}".format(total_sum/config["NUM_RUNS"])]
res_writer.writerow(row)
util.chdir(ref_cwd)
print("done")
|
[
"naderb@rutgers.edu"
] |
naderb@rutgers.edu
|
a564d42fe82a1997f3e1da572a56222581d3031d
|
5543825a8dc09cbf519959d5cc58b32685ffe123
|
/napari_pyclesperanto_assistant/_scriptgenerators/_PythonJupyterNotebookGenerator.py
|
17501a639739f4978a841134e31420fa76e71151
|
[
"BSD-3-Clause"
] |
permissive
|
haesleinhuepf/napari_pyclesperanto_assistant
|
cfb79029eeb4119eab37501a112e7e9ba22a0285
|
659b5ae8e5626771afdd5d0e6d1ba8112e48ff97
|
refs/heads/master
| 2023-04-03T01:20:25.933417
| 2021-04-11T23:31:18
| 2021-04-11T23:31:18
| 357,648,202
| 0
| 0
|
NOASSERTION
| 2021-04-13T18:13:22
| 2021-04-13T18:13:21
| null |
UTF-8
|
Python
| false
| false
| 2,513
|
py
|
from ._JythonGenerator import JythonGenerator
class PythonJupyterNotebookGenerator(JythonGenerator):
def _header(self):
return "{\n" + \
" \"cells\": [\n" + \
self._code_cell(super()._header())
def _push(self, layer, layer_number):
return self._code_cell(super()._push(layer, layer_number))
def _execute(self, layer, layer_number):
return self._markdown_cell("## " + layer.name.replace("Result of ", "")) + \
self._code_cell(super()._execute(layer, layer_number))
def _pull(self, layer, layer_number):
return self._code_cell(super()._pull(layer, layer_number))
def _code_cell(self, content):
return " {\n" + \
" \"cell_type\": \"code\",\n" + \
" \"execution_count\": 1,\n" + \
" \"metadata\": {},\n" + \
" \"outputs\": [],\n" + \
" \"source\": [\n" + \
" \"" + content.replace("\"", "'").replace("\n", "\\n\",\n\"") + "\"\n" + \
" ]\n" + \
" },"
def _markdown_cell(self, content):
return " {\n" + \
" \"cell_type\": \"markdown\",\n" + \
" \"metadata\": {},\n" + \
" \"source\": [\n" + \
" \"" + content.replace("\n", "\\n\",\n\"") + "\"\n" + \
" ]\n" + \
" },"
def _finish(self, code : str):
return super()._finish(code[0:-1]) + "" + \
"],\n" + \
" \"metadata\": {\n" + \
" \"kernelspec\": {\n" + \
" \"display_name\": \"Python 3\",\n" + \
" \"language\": \"python\",\n" + \
" \"name\": \"python3\"\n" + \
" },\n" + \
" \"language_info\": {\n" + \
" \"codemirror_mode\": {\n" + \
" \"name\": \"ipython\",\n" + \
" \"version\": 3\n" + \
" },\n" + \
" \"file_extension\": \".py\",\n" + \
" \"mimetype\": \"text/x-python\",\n" + \
" \"name\": \"python\",\n" + \
" \"nbconvert_exporter\": \"python\",\n" + \
" \"pygments_lexer\": \"ipython3\",\n" + \
" \"version\": \"3.7.6\"\n" + \
" }\n" + \
" },\n" + \
" \"nbformat\": 4,\n" + \
" \"nbformat_minor\": 4\n" + \
"}\n"
def file_ending(self):
return ".ipynb"
|
[
"robert_haase@gmx.de"
] |
robert_haase@gmx.de
|
e79f22b2b38a48af544d684184ab39a418c25599
|
d32614b108411b07dbd1080bcddb856b4bc0aec5
|
/train.py
|
6aeaf1ab436dbe5c882bb5bbaed36de8333fa30c
|
[
"MIT"
] |
permissive
|
ayadav8/Image_Classifier
|
22c245ab8d6512d5b0f202cf98c99f3b12a0cc8d
|
8bd10193bd95c3387144926f08f088100aadb1a9
|
refs/heads/master
| 2022-10-22T02:36:06.655017
| 2020-06-15T22:24:46
| 2020-06-15T22:24:46
| 272,532,813
| 0
| 0
|
MIT
| 2020-06-15T20:48:10
| 2020-06-15T20:04:05
|
Jupyter Notebook
|
UTF-8
|
Python
| false
| false
| 4,878
|
py
|
# PROGRAMMER: Amit Yadav
# DATE CREATED: 06/06/2020
# Imports python modules
from get_input_args import get_input_args
from functions import train_transforms,valid_transforms,test_transforms
from torchvision import datasets, transforms, models
import torch
from collections import OrderedDict
from torch import nn
from torch import optim
from workspace_utils import keep_awake
def main():
###Get input from user
in_arg = get_input_args()
print(in_arg)
train_dir = in_arg.dir + '/train'
valid_dir = in_arg.dir + '/valid'
test_dir = in_arg.dir + '/test'
# Pass transforms in here, then run the next cell to see how the transforms look
train_data = datasets.ImageFolder( train_dir, transform=train_transforms)
valid_data = datasets.ImageFolder( valid_dir, transform=valid_transforms)
test_data = datasets.ImageFolder( test_dir, transform=test_transforms)
# TODO: Using the image datasets and the trainforms, define the dataloaders
trainloader = torch.utils.data.DataLoader(train_data, batch_size=64, shuffle=True)
validloader = torch.utils.data.DataLoader(valid_data, batch_size=64, shuffle=True)
testloader = torch.utils.data.DataLoader(test_data, batch_size=64)
####Define the model
resnet18 = models.resnet18(pretrained=True)
alexnet = models.alexnet(pretrained=True)
vgg16 = models.vgg16(pretrained=True)
densenet121 = models.densenet121(pretrained=True)
models_dic = {'resnet': resnet18, 'alexnet': alexnet, 'vgg': vgg16, 'densenet':densenet121}
model_name = in_arg.arch
###Load the userdefined model
model = models_dic[model_name]
# Freeze parameters so we don't backprop through them
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
for param in model.parameters():
param.requires_grad = False
classifier = nn.Sequential(OrderedDict([
('fc1', nn.Linear(1024, in_arg.hidden_nodes)),
('relu', nn.ReLU()),
('fc2', nn.Linear(in_arg.hidden_nodes, in_arg.output_nodes)),
('output', nn.LogSoftmax(dim=1))
]))
model.classifier = classifier
criterion = nn.NLLLoss()
# Only train the classifier parameters, feature parameters are frozen
optimizer = optim.Adam(model.classifier.parameters(), lr=in_arg.learning_rate)
model.to(device);
epochs = in_arg.epocs
steps = 0
running_loss = 0
print_every = 5
for i in keep_awake(range(5)):
for epoch in range(epochs):
for inputs, labels in trainloader:
steps += 1
# Move input and label tensors to the default device
inputs, labels = inputs.to(device), labels.to(device)
optimizer.zero_grad()
logps = model.forward(inputs)
loss = criterion(logps, labels)
loss.backward()
optimizer.step()
running_loss += loss.item()
if steps % print_every == 0:
valid_loss = 0
accuracy = 0
model.eval()
with torch.no_grad():
for inputs, labels in validloader:
inputs, labels = inputs.to(device), labels.to(device)
logps = model.forward(inputs)
batch_loss = criterion(logps, labels)
valid_loss += batch_loss.item()
# Calculate accuracy
ps = torch.exp(logps)
top_p, top_class = ps.topk(1, dim=1)
equals = top_class == labels.view(*top_class.shape)
accuracy += torch.mean(equals.type(torch.FloatTensor)).item()
print(f"Epoch {epoch+1}/{epochs}.. "
f"Train loss: {running_loss/print_every:.3f}.. "
f"Validation loss: {valid_loss/len(testloader):.3f}.. "
f"Validation accuracy: {accuracy/len(testloader):.3f}")
running_loss = 0
model.train()
########Save the model
model.class_to_idx = train_data.class_to_idx
checkpoint = {'input_size': 1024,
'output_size': in_arg.output_nodes,
'hidden_layers': [each for each in model.classifier],
'state_dict': model.state_dict(),
'optimizer': optimizer.state_dict(),
'class_to_idx': model.class_to_idx}
torch.save(checkpoint, in_arg.save_dir)
# Call to main function to run the program
if __name__ == "__main__":
main()
|
[
"noreply@github.com"
] |
ayadav8.noreply@github.com
|
7d572989803473b050505a4b87aa16dbad98da0b
|
0812da6b59eee36861c97cb4d9c1c9520cb2ca9c
|
/.venv/lib/python3.6/site-packages/aws_cdk/aws_ec2/__init__.py
|
206bf82dd2034b3cd17ebf7b56f72a292d77f6a1
|
[] |
no_license
|
zachelliottwx/cdk-demo
|
fe6d4ee19945e2cd5007c5fdfe6617627c923509
|
e1dffc5d262cd1bb7d3335c5f1f79a52296a8edc
|
refs/heads/master
| 2023-03-06T20:40:27.862628
| 2021-02-18T17:00:10
| 2021-02-18T17:00:10
| 339,174,696
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,967,934
|
py
|
"""
# Amazon EC2 Construct Library
<!--BEGIN STABILITY BANNER-->---


---
<!--END STABILITY BANNER-->
The `@aws-cdk/aws-ec2` package contains primitives for setting up networking and
instances.
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
import aws_cdk.aws_ec2 as ec2
```
## VPC
Most projects need a Virtual Private Cloud to provide security by means of
network partitioning. This is achieved by creating an instance of
`Vpc`:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
vpc = ec2.Vpc(self, "VPC")
```
All default constructs require EC2 instances to be launched inside a VPC, so
you should generally start by defining a VPC whenever you need to launch
instances for your project.
### Subnet Types
A VPC consists of one or more subnets that instances can be placed into. CDK
distinguishes three different subnet types:
* **Public** - public subnets connect directly to the Internet using an
Internet Gateway. If you want your instances to have a public IP address
and be directly reachable from the Internet, you must place them in a
public subnet.
* **Private** - instances in private subnets are not directly routable from the
Internet, and connect out to the Internet via a NAT gateway. By default, a
NAT gateway is created in every public subnet for maximum availability. Be
aware that you will be charged for NAT gateways.
* **Isolated** - isolated subnets do not route from or to the Internet, and
as such do not require NAT gateways. They can only connect to or be
connected to from other instances in the same VPC. A default VPC configuration
will not include isolated subnets,
A default VPC configuration will create public and **private** subnets. However, if
`natGateways:0` **and** `subnetConfiguration` is undefined, default VPC configuration
will create public and **isolated** subnets. See [*Advanced Subnet Configuration*](#advanced-subnet-configuration)
below for information on how to change the default subnet configuration.
Constructs using the VPC will "launch instances" (or more accurately, create
Elastic Network Interfaces) into one or more of the subnets. They all accept
a property called `subnetSelection` (sometimes called `vpcSubnets`) to allow
you to select in what subnet to place the ENIs, usually defaulting to
*private* subnets if the property is omitted.
If you would like to save on the cost of NAT gateways, you can use
*isolated* subnets instead of *private* subnets (as described in Advanced
*Subnet Configuration*). If you need private instances to have
internet connectivity, another option is to reduce the number of NAT gateways
created by setting the `natGateways` property to a lower value (the default
is one NAT gateway per availability zone). Be aware that this may have
availability implications for your application.
[Read more about
subnets](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html).
### Control over availability zones
By default, a VPC will spread over at most 3 Availability Zones available to
it. To change the number of Availability Zones that the VPC will spread over,
specify the `maxAzs` property when defining it.
The number of Availability Zones that are available depends on the *region*
and *account* of the Stack containing the VPC. If the [region and account are
specified](https://docs.aws.amazon.com/cdk/latest/guide/environments.html) on
the Stack, the CLI will [look up the existing Availability
Zones](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html#using-regions-availability-zones-describe)
and get an accurate count. If region and account are not specified, the stack
could be deployed anywhere and it will have to make a safe choice, limiting
itself to 2 Availability Zones.
Therefore, to get the VPC to spread over 3 or more availability zones, you
must specify the environment where the stack will be deployed.
You can gain full control over the availability zones selection strategy by overriding the Stack's [`get availabilityZones()`](https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/core/lib/stack.ts) method:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
class MyStack(Stack): get availabilityZones(): string[] {
return ['us-west-2a', 'us-west-2b'];
}
def __init__(self, scope, id, props=None):
super().__init__(scope, id, props)
```
Note that overriding the `get availabilityZones()` method will override the default behavior for all constructs defined within the Stack.
### Choosing subnets for resources
When creating resources that create Elastic Network Interfaces (such as
databases or instances), there is an option to choose which subnets to place
them in. For example, a VPC endpoint by default is placed into a subnet in
every availability zone, but you can override which subnets to use. The property
is typically called one of `subnets`, `vpcSubnets` or `subnetSelection`.
The example below will place the endpoint into two AZs (`us-east-1a` and `us-east-1c`),
in Isolated subnets:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
InterfaceVpcEndpoint(stack, "VPC Endpoint",
vpc=vpc,
service=InterfaceVpcEndpointService("com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc", 443),
subnets={
"subnet_type": SubnetType.ISOLATED,
"availability_zones": ["us-east-1a", "us-east-1c"]
}
)
```
You can also specify specific subnet objects for granular control:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
InterfaceVpcEndpoint(stack, "VPC Endpoint",
vpc=vpc,
service=InterfaceVpcEndpointService("com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc", 443),
subnets={
"subnets": [subnet1, subnet2]
}
)
```
Which subnets are selected is evaluated as follows:
* `subnets`: if specific subnet objects are supplied, these are selected, and no other
logic is used.
* `subnetType`/`subnetGroupName`: otherwise, a set of subnets is selected by
supplying either type or name:
* `subnetType` will select all subnets of the given type.
* `subnetGroupName` should be used to distinguish between multiple groups of subnets of
the same type (for example, you may want to separate your application instances and your
RDS instances into two distinct groups of Isolated subnets).
* If neither are given, the first available subnet group of a given type that
exists in the VPC will be used, in this order: Private, then Isolated, then Public.
In short: by default ENIs will preferentially be placed in subnets not connected to
the Internet.
* `availabilityZones`/`onePerAz`: finally, some availability-zone based filtering may be done.
This filtering by availability zones will only be possible if the VPC has been created or
looked up in a non-environment agnostic stack (so account and region have been set and
availability zones have been looked up).
* `availabilityZones`: only the specific subnets from the selected subnet groups that are
in the given availability zones will be returned.
* `onePerAz`: per availability zone, a maximum of one subnet will be returned (Useful for resource
types that do not allow creating two ENIs in the same availability zone).
* `subnetFilters`: additional filtering on subnets using any number of user-provided filters which
extend the SubnetFilter class.
### Using NAT instances
By default, the `Vpc` construct will create NAT *gateways* for you, which
are managed by AWS. If you would prefer to use your own managed NAT
*instances* instead, specify a different value for the `natGatewayProvider`
property, as follows:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
# Configure the `natGatewayProvider` when defining a Vpc
nat_gateway_provider = ec2.NatProvider.instance(
instance_type=ec2.InstanceType("t3.small")
)
vpc = ec2.Vpc(self, "MyVpc",
nat_gateway_provider=nat_gateway_provider,
# The 'natGateways' parameter now controls the number of NAT instances
nat_gateways=2
)
```
The construct will automatically search for the most recent NAT gateway AMI.
If you prefer to use a custom AMI, use `machineImage: MachineImage.genericLinux({ ... })` and configure the right AMI ID for the
regions you want to deploy to.
By default, the NAT instances will route all traffic. To control what traffic
gets routed, pass `allowAllTraffic: false` and access the
`NatInstanceProvider.connections` member after having passed it to the VPC:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
provider = NatProvider.instance(
instance_type=,
allow_all_traffic=False
)
Vpc(stack, "TheVPC",
nat_gateway_provider=provider
)
provider.connections.allow_from(Peer.ipv4("1.2.3.4/8"), Port.tcp(80))
```
### Advanced Subnet Configuration
If the default VPC configuration (public and private subnets spanning the
size of the VPC) don't suffice for you, you can configure what subnets to
create by specifying the `subnetConfiguration` property. It allows you
to configure the number and size of all subnets. Specifying an advanced
subnet configuration could look like this:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
vpc = ec2.Vpc(self, "TheVPC",
# 'cidr' configures the IP range and size of the entire VPC.
# The IP space will be divided over the configured subnets.
cidr="10.0.0.0/21",
# 'maxAzs' configures the maximum number of availability zones to use
max_azs=3,
# 'subnetConfiguration' specifies the "subnet groups" to create.
# Every subnet group will have a subnet for each AZ, so this
# configuration will create `3 groups ร 3 AZs = 9` subnets.
subnet_configuration=[SubnetConfiguration(
# 'subnetType' controls Internet access, as described above.
subnet_type=ec2.SubnetType.PUBLIC,
# 'name' is used to name this particular subnet group. You will have to
# use the name for subnet selection if you have more than one subnet
# group of the same type.
name="Ingress",
# 'cidrMask' specifies the IP addresses in the range of of individual
# subnets in the group. Each of the subnets in this group will contain
# `2^(32 address bits - 24 subnet bits) - 2 reserved addresses = 254`
# usable IP addresses.
#
# If 'cidrMask' is left out the available address space is evenly
# divided across the remaining subnet groups.
cidr_mask=24
), SubnetConfiguration(
cidr_mask=24,
name="Application",
subnet_type=ec2.SubnetType.PRIVATE
), SubnetConfiguration(
cidr_mask=28,
name="Database",
subnet_type=ec2.SubnetType.ISOLATED,
# 'reserved' can be used to reserve IP address space. No resources will
# be created for this subnet, but the IP range will be kept available for
# future creation of this subnet, or even for future subdivision.
reserved=True
)
]
)
```
The example above is one possible configuration, but the user can use the
constructs above to implement many other network configurations.
The `Vpc` from the above configuration in a Region with three
availability zones will be the following:
Subnet Name |Type |IP Block |AZ|Features
------------------|----------|--------------|--|--------
IngressSubnet1 |`PUBLIC` |`10.0.0.0/24` |#1|NAT Gateway
IngressSubnet2 |`PUBLIC` |`10.0.1.0/24` |#2|NAT Gateway
IngressSubnet3 |`PUBLIC` |`10.0.2.0/24` |#3|NAT Gateway
ApplicationSubnet1|`PRIVATE` |`10.0.3.0/24` |#1|Route to NAT in IngressSubnet1
ApplicationSubnet2|`PRIVATE` |`10.0.4.0/24` |#2|Route to NAT in IngressSubnet2
ApplicationSubnet3|`PRIVATE` |`10.0.5.0/24` |#3|Route to NAT in IngressSubnet3
DatabaseSubnet1 |`ISOLATED`|`10.0.6.0/28` |#1|Only routes within the VPC
DatabaseSubnet2 |`ISOLATED`|`10.0.6.16/28`|#2|Only routes within the VPC
DatabaseSubnet3 |`ISOLATED`|`10.0.6.32/28`|#3|Only routes within the VPC
### Accessing the Internet Gateway
If you need access to the internet gateway, you can get it's ID like so:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
igw_id = vpc.internet_gateway_id
```
For a VPC with only `ISOLATED` subnets, this value will be undefined.
This is only supported for VPCs created in the stack - currently you're
unable to get the ID for imported VPCs. To do that you'd have to specifically
look up the Internet Gateway by name, which would require knowing the name
beforehand.
This can be useful for configuring routing using a combination of gateways:
for more information see [Routing](#routing) below.
#### Routing
It's possible to add routes to any subnets using the `addRoute()` method. If for
example you want an isolated subnet to have a static route via the default
Internet Gateway created for the public subnet - perhaps for routing a VPN
connection - you can do so like this:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
vpc = ec2.Vpc(self, "VPC",
subnet_configuration=[{
"subnet_type": SubnetType.PUBLIC,
"name": "Public"
}, {
"subnet_type": SubnetType.ISOLATED,
"name": "Isolated"
}]
)(vpc.isolatedSubnets[0]).add_route("StaticRoute",
router_id=vpc.internet_gateway_id,
router_type=RouterType.GATEWAY,
destination_cidr_block="8.8.8.8/32"
)
```
*Note that we cast to `Subnet` here because the list of subnets only returns an
`ISubnet`.*
### Reserving subnet IP space
There are situations where the IP space for a subnet or number of subnets
will need to be reserved. This is useful in situations where subnets would
need to be added after the vpc is originally deployed, without causing IP
renumbering for existing subnets. The IP space for a subnet may be reserved
by setting the `reserved` subnetConfiguration property to true, as shown
below:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
vpc = ec2.Vpc(self, "TheVPC",
nat_gateways=1,
subnet_configuration=[SubnetConfiguration(
cidr_mask=26,
name="Public",
subnet_type=ec2.SubnetType.PUBLIC
), SubnetConfiguration(
cidr_mask=26,
name="Application1",
subnet_type=ec2.SubnetType.PRIVATE
), SubnetConfiguration(
cidr_mask=26,
name="Application2",
subnet_type=ec2.SubnetType.PRIVATE,
reserved=True
), SubnetConfiguration(
cidr_mask=27,
name="Database",
subnet_type=ec2.SubnetType.ISOLATED
)
]
)
```
In the example above, the subnet for Application2 is not actually provisioned
but its IP space is still reserved. If in the future this subnet needs to be
provisioned, then the `reserved: true` property should be removed. Reserving
parts of the IP space prevents the other subnets from getting renumbered.
### Sharing VPCs between stacks
If you are creating multiple `Stack`s inside the same CDK application, you
can reuse a VPC defined in one Stack in another by simply passing the VPC
instance around:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
#
# Stack1 creates the VPC
#
class Stack1(cdk.Stack):
def __init__(self, scope, id, *, description=None, env=None, stackName=None, tags=None, synthesizer=None, terminationProtection=None, analyticsReporting=None):
super().__init__(scope, id, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting)
self.vpc = ec2.Vpc(self, "VPC")
#
# Stack2 consumes the VPC
#
class Stack2(cdk.Stack):
def __init__(self, scope, id, *, vpc, description=None, env=None, stackName=None, tags=None, synthesizer=None, terminationProtection=None, analyticsReporting=None):
super().__init__(scope, id, vpc=vpc, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting)
# Pass the VPC to a construct that needs it
ConstructThatTakesAVpc(self, "Construct",
vpc=vpc
)
stack1 = Stack1(app, "Stack1")
stack2 = Stack2(app, "Stack2",
vpc=stack1.vpc
)
```
### Importing an existing VPC
If your VPC is created outside your CDK app, you can use `Vpc.fromLookup()`.
The CDK CLI will search for the specified VPC in the the stack's region and
account, and import the subnet configuration. Looking up can be done by VPC
ID, but more flexibly by searching for a specific tag on the VPC.
Subnet types will be determined from the `aws-cdk:subnet-type` tag on the
subnet if it exists, or the presence of a route to an Internet Gateway
otherwise. Subnet names will be determined from the `aws-cdk:subnet-name` tag
on the subnet if it exists, or will mirror the subnet type otherwise (i.e.
a public subnet will have the name `"Public"`).
The result of the `Vpc.fromLookup()` operation will be written to a file
called `cdk.context.json`. You must commit this file to source control so
that the lookup values are available in non-privileged environments such
as CI build steps, and to ensure your template builds are repeatable.
Here's how `Vpc.fromLookup()` can be used:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
vpc = ec2.Vpc.from_lookup(stack, "VPC",
# This imports the default VPC but you can also
# specify a 'vpcName' or 'tags'.
is_default=True
)
```
`Vpc.fromLookup` is the recommended way to import VPCs. If for whatever
reason you do not want to use the context mechanism to look up a VPC at
synthesis time, you can also use `Vpc.fromVpcAttributes`. This has the
following limitations:
* Every subnet group in the VPC must have a subnet in each availability zone
(for example, each AZ must have both a public and private subnet). Asymmetric
VPCs are not supported.
* All VpcId, SubnetId, RouteTableId, ... parameters must either be known at
synthesis time, or they must come from deploy-time list parameters whose
deploy-time lengths are known at synthesis time.
Using `Vpc.fromVpcAttributes()` looks like this:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
vpc = ec2.Vpc.from_vpc_attributes(stack, "VPC",
vpc_id="vpc-1234",
availability_zones=["us-east-1a", "us-east-1b"],
# Either pass literals for all IDs
public_subnet_ids=["s-12345", "s-67890"],
# OR: import a list of known length
private_subnet_ids=Fn.import_list_value("PrivateSubnetIds", 2),
# OR: split an imported string to a list of known length
isolated_subnet_ids=Fn.split(",", ssm.StringParameter.value_for_string_parameter(stack, "MyParameter"), 2)
)
```
## Allowing Connections
In AWS, all network traffic in and out of **Elastic Network Interfaces** (ENIs)
is controlled by **Security Groups**. You can think of Security Groups as a
firewall with a set of rules. By default, Security Groups allow no incoming
(ingress) traffic and all outgoing (egress) traffic. You can add ingress rules
to them to allow incoming traffic streams. To exert fine-grained control over
egress traffic, set `allowAllOutbound: false` on the `SecurityGroup`, after
which you can add egress traffic rules.
You can manipulate Security Groups directly:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
my_security_group = ec2.SecurityGroup(self, "SecurityGroup",
vpc=vpc,
description="Allow ssh access to ec2 instances",
allow_all_outbound=True
)
my_security_group.add_ingress_rule(ec2.Peer.any_ipv4(), ec2.Port.tcp(22), "allow ssh access from the world")
```
All constructs that create ENIs on your behalf (typically constructs that create
EC2 instances or other VPC-connected resources) will all have security groups
automatically assigned. Those constructs have an attribute called
**connections**, which is an object that makes it convenient to update the
security groups. If you want to allow connections between two constructs that
have security groups, you have to add an **Egress** rule to one Security Group,
and an **Ingress** rule to the other. The connections object will automatically
take care of this for you:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
# Allow connections from anywhere
load_balancer.connections.allow_from_any_ipv4(ec2.Port.tcp(443), "Allow inbound HTTPS")
# The same, but an explicit IP address
load_balancer.connections.allow_from(ec2.Peer.ipv4("1.2.3.4/32"), ec2.Port.tcp(443), "Allow inbound HTTPS")
# Allow connection between AutoScalingGroups
app_fleet.connections.allow_to(db_fleet, ec2.Port.tcp(443), "App can call database")
```
### Connection Peers
There are various classes that implement the connection peer part:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
# Simple connection peers
peer = ec2.Peer.ipv4("10.0.0.0/16")
peer = ec2.Peer.any_ipv4()
peer = ec2.Peer.ipv6("::0/0")
peer = ec2.Peer.any_ipv6()
peer = ec2.Peer.prefix_list("pl-12345")
app_fleet.connections.allow_to(peer, ec2.Port.tcp(443), "Allow outbound HTTPS")
```
Any object that has a security group can itself be used as a connection peer:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
# These automatically create appropriate ingress and egress rules in both security groups
fleet1.connections.allow_to(fleet2, ec2.Port.tcp(80), "Allow between fleets")
app_fleet.connections.allow_from_any_ipv4(ec2.Port.tcp(80), "Allow from load balancer")
```
### Port Ranges
The connections that are allowed are specified by port ranges. A number of classes provide
the connection specifier:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
ec2.Port.tcp(80)
ec2.Port.tcp_range(60000, 65535)
ec2.Port.all_tcp()
ec2.Port.all_traffic()
```
> NOTE: This set is not complete yet; for example, there is no library support for ICMP at the moment.
> However, you can write your own classes to implement those.
### Default Ports
Some Constructs have default ports associated with them. For example, the
listener of a load balancer does (it's the public port), or instances of an
RDS database (it's the port the database is accepting connections on).
If the object you're calling the peering method on has a default port associated with it, you can call
`allowDefaultPortFrom()` and omit the port specifier. If the argument has an associated default port, call
`allowDefaultPortTo()`.
For example:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
# Port implicit in listener
listener.connections.allow_default_port_from_any_ipv4("Allow public")
# Port implicit in peer
app_fleet.connections.allow_default_port_to(rds_database, "Fleet can access database")
```
## Machine Images (AMIs)
AMIs control the OS that gets launched when you start your EC2 instance. The EC2
library contains constructs to select the AMI you want to use.
Depending on the type of AMI, you select it a different way. Here are some
examples of things you might want to use:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
# Pick the right Amazon Linux edition. All arguments shown are optional
# and will default to these values when omitted.
amzn_linux = ec2.MachineImage.latest_amazon_linux(
generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX,
edition=ec2.AmazonLinuxEdition.STANDARD,
virtualization=ec2.AmazonLinuxVirt.HVM,
storage=ec2.AmazonLinuxStorage.GENERAL_PURPOSE,
cpu_type=ec2.AmazonLinuxCpuType.X86_64
)
# Pick a Windows edition to use
windows = ec2.MachineImage.latest_windows(ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE)
# Read AMI id from SSM parameter store
ssm = ec2.MachineImage.from_sSMParameter("/my/ami", ec2.OperatingSystemType.LINUX)
# Look up the most recent image matching a set of AMI filters.
# In this case, look up the NAT instance AMI, by using a wildcard
# in the 'name' field:
nat_ami = ec2.MachineImage.lookup(
name="amzn-ami-vpc-nat-*",
owners=["amazon"]
)
# For other custom (Linux) images, instantiate a `GenericLinuxImage` with
# a map giving the AMI to in for each region:
linux = ec2.MachineImage.generic_linux({
"us-east-1": "ami-97785bed",
"eu-west-1": "ami-12345678"
})
# For other custom (Windows) images, instantiate a `GenericWindowsImage` with
# a map giving the AMI to in for each region:
generic_windows = ec2.MachineImage.generic_windows({
"us-east-1": "ami-97785bed",
"eu-west-1": "ami-12345678"
})
```
> NOTE: The AMIs selected by `MachineImage.lookup()` will be cached in
> `cdk.context.json`, so that your AutoScalingGroup instances aren't replaced while
> you are making unrelated changes to your CDK app.
>
> To query for the latest AMI again, remove the relevant cache entry from
> `cdk.context.json`, or use the `cdk context` command. For more information, see
> [Runtime Context](https://docs.aws.amazon.com/cdk/latest/guide/context.html) in the CDK
> developer guide.
>
> `MachineImage.genericLinux()`, `MachineImage.genericWindows()` will use `CfnMapping` in
> an agnostic stack.
## Special VPC configurations
### VPN connections to a VPC
Create your VPC with VPN connections by specifying the `vpnConnections` props (keys are construct `id`s):
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
vpc = ec2.Vpc(self, "MyVpc",
vpn_connections={
"dynamic": VpnConnectionOptions(# Dynamic routing (BGP)
ip="1.2.3.4"),
"static": VpnConnectionOptions(# Static routing
ip="4.5.6.7",
static_routes=["192.168.10.0/24", "192.168.20.0/24"
])
}
)
```
To create a VPC that can accept VPN connections, set `vpnGateway` to `true`:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
vpc = ec2.Vpc(self, "MyVpc",
vpn_gateway=True
)
```
VPN connections can then be added:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
vpc.add_vpn_connection("Dynamic",
ip="1.2.3.4"
)
```
By default, routes will be propagated on the route tables associated with the private subnets. If no
private subnets exists, isolated subnets are used. If no isolated subnets exists, public subnets are
used. Use the `Vpc` property `vpnRoutePropagation` to customize this behavior.
VPN connections expose [metrics (cloudwatch.Metric)](https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-cloudwatch/README.md) across all tunnels in the account/region and per connection:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
# Across all tunnels in the account/region
all_data_out = ec2.VpnConnection.metric_all_tunnel_data_out()
# For a specific vpn connection
vpn_connection = vpc.add_vpn_connection("Dynamic",
ip="1.2.3.4"
)
state = vpn_connection.metric_tunnel_state()
```
### VPC endpoints
A VPC endpoint enables you to privately connect your VPC to supported AWS services and VPC endpoint services powered by PrivateLink without requiring an internet gateway, NAT device, VPN connection, or AWS Direct Connect connection. Instances in your VPC do not require public IP addresses to communicate with resources in the service. Traffic between your VPC and the other service does not leave the Amazon network.
Endpoints are virtual devices. They are horizontally scaled, redundant, and highly available VPC components that allow communication between instances in your VPC and services without imposing availability risks or bandwidth constraints on your network traffic.
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
# Add gateway endpoints when creating the VPC
vpc = ec2.Vpc(self, "MyVpc",
gateway_endpoints={
"S3": GatewayVpcEndpointOptions(
service=ec2.GatewayVpcEndpointAwsService.S3
)
}
)
# Alternatively gateway endpoints can be added on the VPC
dynamo_db_endpoint = vpc.add_gateway_endpoint("DynamoDbEndpoint",
service=ec2.GatewayVpcEndpointAwsService.DYNAMODB
)
# This allows to customize the endpoint policy
dynamo_db_endpoint.add_to_policy(
iam.PolicyStatement(# Restrict to listing and describing tables
principals=[iam.AnyPrincipal()],
actions=["dynamodb:DescribeTable", "dynamodb:ListTables"],
resources=["*"]))
# Add an interface endpoint
vpc.add_interface_endpoint("EcrDockerEndpoint", {
"service": ec2.InterfaceVpcEndpointAwsService.ECR_DOCKER
})
```
By default, CDK will place a VPC endpoint in one subnet per AZ. If you wish to override the AZs CDK places the VPC endpoint in,
use the `subnets` parameter as follows:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
InterfaceVpcEndpoint(stack, "VPC Endpoint",
vpc=vpc,
service=InterfaceVpcEndpointService("com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc", 443),
# Choose which availability zones to place the VPC endpoint in, based on
# available AZs
subnets={
"availability_zones": ["us-east-1a", "us-east-1c"]
}
)
```
Per the [AWS documentation](https://aws.amazon.com/premiumsupport/knowledge-center/interface-endpoint-availability-zone/), not all
VPC endpoint services are available in all AZs. If you specify the parameter `lookupSupportedAzs`, CDK attempts to discover which
AZs an endpoint service is available in, and will ensure the VPC endpoint is not placed in a subnet that doesn't match those AZs.
These AZs will be stored in cdk.context.json.
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
InterfaceVpcEndpoint(stack, "VPC Endpoint",
vpc=vpc,
service=InterfaceVpcEndpointService("com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc", 443),
# Choose which availability zones to place the VPC endpoint in, based on
# available AZs
lookup_supported_azs=True
)
```
#### Security groups for interface VPC endpoints
By default, interface VPC endpoints create a new security group and traffic is **not**
automatically allowed from the VPC CIDR.
Use the `connections` object to allow traffic to flow to the endpoint:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
my_endpoint.connections.allow_default_port_from_any_ipv4()
```
Alternatively, existing security groups can be used by specifying the `securityGroups` prop.
### VPC endpoint services
A VPC endpoint service enables you to expose a Network Load Balancer(s) as a provider service to consumers, who connect to your service over a VPC endpoint. You can restrict access to your service via whitelisted principals (anything that extends ArnPrincipal), and require that new connections be manually accepted.
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
VpcEndpointService(self, "EndpointService",
vpc_endpoint_service_load_balancers=[network_load_balancer1, network_load_balancer2],
acceptance_required=True,
whitelisted_principals=[ArnPrincipal("arn:aws:iam::123456789012:root")]
)
```
Endpoint services support private DNS, which makes it easier for clients to connect to your service by automatically setting up DNS in their VPC.
You can enable private DNS on an endpoint service like so:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from aws_cdk.aws_route53 import VpcEndpointServiceDomainName
VpcEndpointServiceDomainName(stack, "EndpointDomain",
endpoint_service=vpces,
domain_name="my-stuff.aws-cdk.dev",
public_hosted_zone=zone
)
```
Note: The domain name must be owned (registered through Route53) by the account the endpoint service is in, or delegated to the account.
The VpcEndpointServiceDomainName will handle the AWS side of domain verification, the process for which can be found
[here](https://docs.aws.amazon.com/vpc/latest/userguide/endpoint-services-dns-validation.html)
## Instances
You can use the `Instance` class to start up a single EC2 instance. For production setups, we recommend
you use an `AutoScalingGroup` from the `aws-autoscaling` module instead, as AutoScalingGroups will take
care of restarting your instance if it ever fails.
### Configuring Instances using CloudFormation Init (cfn-init)
CloudFormation Init allows you to configure your instances by writing files to them, installing software
packages, starting services and running arbitrary commands. By default, if any of the instance setup
commands throw an error, the deployment will fail and roll back to the previously known good state.
The following documentation also applies to `AutoScalingGroup`s.
For the full set of capabilities of this system, see the documentation for
[`AWS::CloudFormation::Init`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-init.html).
Here is an example of applying some configuration to an instance:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
ec2.Instance(self, "Instance", {
# Showing the most complex setup, if you have simpler requirements
# you can use `CloudFormationInit.fromElements()`.
"init": ec2.CloudFormationInit.from_config_sets(
config_sets={
# Applies the configs below in this order
"default": ["yumPreinstall", "config"]
},
configs={
"yum_preinstall": ec2.InitConfig([
# Install an Amazon Linux package using yum
ec2.InitPackage.yum("git")
]),
"config": ec2.InitConfig([
# Create a JSON file from tokens (can also create other files)
ec2.InitFile.from_object("/etc/stack.json", {
"stack_id": stack.stack_id,
"stack_name": stack.stack_name,
"region": stack.region
}),
# Create a group and user
ec2.InitGroup.from_name("my-group"),
ec2.InitUser.from_name("my-user"),
# Install an RPM from the internet
ec2.InitPackage.rpm("http://mirrors.ukfast.co.uk/sites/dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/r/rubygem-git-1.5.0-2.el8.noarch.rpm")
])
}
),
"init_options": ApplyCloudFormationInitOptions(
# Optional, which configsets to activate (['default'] by default)
config_sets=["default"],
# Optional, how long the installation is expected to take (5 minutes by default)
timeout=Duration.minutes(30)
)
})
```
You can have services restarted after the init process has made changes to the system.
To do that, instantiate an `InitServiceRestartHandle` and pass it to the config elements
that need to trigger the restart and the service itself. For example, the following
config writes a config file for nginx, extracts an archive to the root directory, and then
restarts nginx so that it picks up the new config and files:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
handle = ec2.InitServiceRestartHandle()
ec2.CloudFormationInit.from_elements(
ec2.InitFile.from_string("/etc/nginx/nginx.conf", "...", {"service_restart_handles": [handle]}),
ec2.InitSource.from_bucket("/var/www/html", my_bucket, "html.zip", service_restart_handles=[handle]),
ec2.InitService.enable("nginx", {
"service_restart_handle": handle
}))
```
### Bastion Hosts
A bastion host functions as an instance used to access servers and resources in a VPC without open up the complete VPC on a network level.
You can use bastion hosts using a standard SSH connection targeting port 22 on the host. As an alternative, you can connect the SSH connection
feature of AWS Systems Manager Session Manager, which does not need an opened security group. (https://aws.amazon.com/about-aws/whats-new/2019/07/session-manager-launches-tunneling-support-for-ssh-and-scp/)
A default bastion host for use via SSM can be configured like:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
host = ec2.BastionHostLinux(self, "BastionHost", vpc=vpc)
```
If you want to connect from the internet using SSH, you need to place the host into a public subnet. You can then configure allowed source hosts.
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
host = ec2.BastionHostLinux(self, "BastionHost",
vpc=vpc,
subnet_selection=SubnetSelection(subnet_type=ec2.SubnetType.PUBLIC)
)
host.allow_ssh_access_from(ec2.Peer.ipv4("1.2.3.4/32"))
```
As there are no SSH public keys deployed on this machine, you need to use [EC2 Instance Connect](https://aws.amazon.com/de/blogs/compute/new-using-amazon-ec2-instance-connect-for-ssh-access-to-your-ec2-instances/)
with the command `aws ec2-instance-connect send-ssh-public-key` to provide your SSH public key.
EBS volume for the bastion host can be encrypted like:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
host = ec2.BastionHostLinux(stack, "BastionHost",
vpc=vpc,
block_devices=[BlockDevice(
device_name="EBSBastionHost",
volume=BlockDeviceVolume.ebs(10,
encrypted=True
)
)]
)
```
### Block Devices
To add EBS block device mappings, specify the `blockDevices` property. The following example sets the EBS-backed
root device (`/dev/sda1`) size to 50 GiB, and adds another EBS-backed device mapped to `/dev/sdm` that is 100 GiB in
size:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
ec2.Instance(self, "Instance", {
# ...
"block_devices": [BlockDevice(
device_name="/dev/sda1",
volume=ec2.BlockDeviceVolume.ebs(50)
), BlockDevice(
device_name="/dev/sdm",
volume=ec2.BlockDeviceVolume.ebs(100)
)
]
})
```
### Volumes
Whereas a `BlockDeviceVolume` is an EBS volume that is created and destroyed as part of the creation and destruction of a specific instance. A `Volume` is for when you want an EBS volume separate from any particular instance. A `Volume` is an EBS block device that can be attached to, or detached from, any instance at any time. Some types of `Volume`s can also be attached to multiple instances at the same time to allow you to have shared storage between those instances.
A notable restriction is that a Volume can only be attached to instances in the same availability zone as the Volume itself.
The following demonstrates how to create a 500 GiB encrypted Volume in the `us-west-2a` availability zone, and give a role the ability to attach that Volume to a specific instance:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
instance = ec2.Instance(self, "Instance", {})
role = iam.Role(stack, "SomeRole",
assumed_by=iam.AccountRootPrincipal()
)
volume = ec2.Volume(self, "Volume",
availability_zone="us-west-2a",
size=cdk.Size.gibibytes(500),
encrypted=True
)
volume.grant_attach_volume(role, [instance])
```
#### Instances Attaching Volumes to Themselves
If you need to grant an instance the ability to attach/detach an EBS volume to/from itself, then using `grantAttachVolume` and `grantDetachVolume` as outlined above
will lead to an unresolvable circular reference between the instance role and the instance. In this case, use `grantAttachVolumeByResourceTag` and `grantDetachVolumeByResourceTag` as follows:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
instance = ec2.Instance(self, "Instance", {})
volume = ec2.Volume(self, "Volume")
attach_grant = volume.grant_attach_volume_by_resource_tag(instance.grant_principal, [instance])
detach_grant = volume.grant_detach_volume_by_resource_tag(instance.grant_principal, [instance])
```
#### Attaching Volumes
The Amazon EC2 documentation for
[Linux Instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html) and
[Windows Instances](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ebs-volumes.html) contains information on how
to attach and detach your Volumes to/from instances, and how to format them for use.
The following is a sample skeleton of EC2 UserData that can be used to attach a Volume to the Linux instance that it is running on:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
volume = ec2.Volume(self, "Volume")
instance = ec2.Instance(self, "Instance", {})
volume.grant_attach_volume_by_resource_tag(instance.grant_principal, [instance])
target_device = "/dev/xvdz"
instance.user_data.add_commands(f"aws --region {Stack.of(this).region} ec2 attach-volume --volume-id {volume.volumeId} --instance-id {instance.instanceId} --device {targetDevice}", f"while ! test -e {targetDevice}; do sleep 1; done")
```
## VPC Flow Logs
VPC Flow Logs is a feature that enables you to capture information about the IP traffic going to and from network interfaces in your VPC. Flow log data can be published to Amazon CloudWatch Logs and Amazon S3. After you've created a flow log, you can retrieve and view its data in the chosen destination. ([https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html](https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html)).
By default a flow log will be created with CloudWatch Logs as the destination.
You can create a flow log like this:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
ec2.FlowLog(self, "FlowLog",
resource_type=ec2.FlowLogResourceType.from_vpc(vpc)
)
```
Or you can add a Flow Log to a VPC by using the addFlowLog method like this:
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
vpc = ec2.Vpc(self, "Vpc")
vpc.add_flow_log("FlowLog")
```
You can also add multiple flow logs with different destinations.
```python
# Example automatically generated. See https://github.com/aws/jsii/issues/826
vpc = ec2.Vpc(self, "Vpc")
vpc.add_flow_log("FlowLogS3",
destination=ec2.FlowLogDestination.to_s3()
)
vpc.add_flow_log("FlowLogCloudWatch",
traffic_type=ec2.FlowLogTrafficType.REJECT
)
```
By default the CDK will create the necessary resources for the destination. For the CloudWatch Logs destination
it will create a CloudWatch Logs Log Group as well as the IAM role with the necessary permissions to publish to
the log group. In the case of an S3 destination, it will create the S3 bucket.
If you want to customize any of the destination resources you can provide your own as part of the `destination`.
*CloudWatch Logs*
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
log_group = logs.LogGroup(self, "MyCustomLogGroup")
role = iam.Role(self, "MyCustomRole",
assumed_by=iam.ServicePrincipal("vpc-flow-logs.amazonaws.com")
)
ec2.FlowLog(self, "FlowLog",
resource_type=ec2.FlowLogResourceType.from_vpc(vpc),
destination=ec2.FlowLogDestination.to_cloud_watch_logs(log_group, role)
)
```
*S3*
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
bucket = s3.Bucket(self, "MyCustomBucket")
ec2.FlowLog(self, "FlowLog",
resource_type=ec2.FlowLogResourceType.from_vpc(vpc),
destination=ec2.FlowLogDestination.to_s3(bucket)
)
ec2.FlowLog(self, "FlowLogWithKeyPrefix",
resource_type=ec2.FlowLogResourceType.from_vpc(vpc),
destination=ec2.FlowLogDestination.to_s3(bucket, "prefix/")
)
```
## User Data
User data enables you to run a script when your instances start up. In order to configure these scripts you can add commands directly to the script
or you can use the UserData's convenience functions to aid in the creation of your script.
A user data could be configured to run a script found in an asset through the following:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
asset = Asset(self, "Asset", path=path.join(__dirname, "configure.sh"))
instance = ec2.Instance(self, "Instance", {})
local_path = instance.user_data.add_s3_download_command(
bucket=asset.bucket,
bucket_key=asset.s3_object_key
)
instance.user_data.add_execute_file_command(
file_path=local_path,
arguments="--verbose -y"
)
asset.grant_read(instance.role)
```
## Importing existing subnet
To import an existing Subnet, call `Subnet.fromSubnetAttributes()` or
`Subnet.fromSubnetId()`. Only if you supply the subnet's Availability Zone
and Route Table Ids when calling `Subnet.fromSubnetAttributes()` will you be
able to use the CDK features that use these values (such as selecting one
subnet per AZ).
Importing an existing subnet looks like this:
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
# Supply all properties
subnet = Subnet.from_subnet_attributes(self, "SubnetFromAttributes",
subnet_id="s-1234",
availability_zone="pub-az-4465",
route_table_id="rt-145"
)
# Supply only subnet id
subnet = Subnet.from_subnet_id(self, "SubnetFromId", "s-1234")
```
## Launch Templates
A Launch Template is a standardized template that contains the configuration information to launch an instance.
They can be used when launching instances on their own, through Amazon EC2 Auto Scaling, EC2 Fleet, and Spot Fleet.
Launch templates enable you to store launch parameters so that you do not have to specify them every time you launch
an instance. For information on Launch Templates please see the
[official documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html).
The following demonstrates how to create a launch template with an Amazon Machine Image, and security group.
```python
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
vpc = ec2.Vpc(...)
# ...
template = ec2.LaunchTemplate(self, "LaunchTemplate",
machine_image=ec2.AmazonMachineImage(),
security_group=ec2.SecurityGroup(self, "LaunchTemplateSG",
vpc=vpc
)
)
```
"""
import abc
import builtins
import datetime
import enum
import typing
import jsii
import publication
import typing_extensions
from ._jsii import *
import aws_cdk.assets
import aws_cdk.aws_cloudwatch
import aws_cdk.aws_iam
import aws_cdk.aws_kms
import aws_cdk.aws_logs
import aws_cdk.aws_s3
import aws_cdk.aws_s3_assets
import aws_cdk.core
import constructs
class AclCidr(metaclass=jsii.JSIIAbstractClass, jsii_type="@aws-cdk/aws-ec2.AclCidr"):
"""(experimental) Either an IPv4 or an IPv6 CIDR.
:stability: experimental
"""
@builtins.staticmethod
def __jsii_proxy_class__():
return _AclCidrProxy
def __init__(self) -> None:
jsii.create(AclCidr, self, [])
@jsii.member(jsii_name="anyIpv4")
@builtins.classmethod
def any_ipv4(cls) -> "AclCidr":
"""(experimental) The CIDR containing all IPv4 addresses (i.e., 0.0.0.0/0).
:stability: experimental
"""
return jsii.sinvoke(cls, "anyIpv4", [])
@jsii.member(jsii_name="anyIpv6")
@builtins.classmethod
def any_ipv6(cls) -> "AclCidr":
"""(experimental) The CIDR containing all IPv6 addresses (i.e., ::/0).
:stability: experimental
"""
return jsii.sinvoke(cls, "anyIpv6", [])
@jsii.member(jsii_name="ipv4")
@builtins.classmethod
def ipv4(cls, ipv4_cidr: builtins.str) -> "AclCidr":
"""(experimental) An IP network range in CIDR notation (for example, 172.16.0.0/24).
:param ipv4_cidr: -
:stability: experimental
"""
return jsii.sinvoke(cls, "ipv4", [ipv4_cidr])
@jsii.member(jsii_name="ipv6")
@builtins.classmethod
def ipv6(cls, ipv6_cidr: builtins.str) -> "AclCidr":
"""(experimental) An IPv6 network range in CIDR notation (for example, 2001:db8::/48).
:param ipv6_cidr: -
:stability: experimental
"""
return jsii.sinvoke(cls, "ipv6", [ipv6_cidr])
@jsii.member(jsii_name="toCidrConfig")
@abc.abstractmethod
def to_cidr_config(self) -> "AclCidrConfig":
"""
:stability: experimental
"""
...
class _AclCidrProxy(AclCidr):
@jsii.member(jsii_name="toCidrConfig")
def to_cidr_config(self) -> "AclCidrConfig":
"""
:stability: experimental
"""
return jsii.invoke(self, "toCidrConfig", [])
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.AclCidrConfig",
jsii_struct_bases=[],
name_mapping={"cidr_block": "cidrBlock", "ipv6_cidr_block": "ipv6CidrBlock"},
)
class AclCidrConfig:
def __init__(
self,
*,
cidr_block: typing.Optional[builtins.str] = None,
ipv6_cidr_block: typing.Optional[builtins.str] = None,
) -> None:
"""(experimental) Acl Configuration for CIDR.
:param cidr_block: (experimental) Ipv4 CIDR.
:param ipv6_cidr_block: (experimental) Ipv6 CIDR.
:stability: experimental
"""
self._values: typing.Dict[str, typing.Any] = {}
if cidr_block is not None:
self._values["cidr_block"] = cidr_block
if ipv6_cidr_block is not None:
self._values["ipv6_cidr_block"] = ipv6_cidr_block
@builtins.property
def cidr_block(self) -> typing.Optional[builtins.str]:
"""(experimental) Ipv4 CIDR.
:stability: experimental
"""
result = self._values.get("cidr_block")
return result
@builtins.property
def ipv6_cidr_block(self) -> typing.Optional[builtins.str]:
"""(experimental) Ipv6 CIDR.
:stability: experimental
"""
result = self._values.get("ipv6_cidr_block")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AclCidrConfig(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.AclIcmp",
jsii_struct_bases=[],
name_mapping={"code": "code", "type": "type"},
)
class AclIcmp:
def __init__(
self,
*,
code: typing.Optional[jsii.Number] = None,
type: typing.Optional[jsii.Number] = None,
) -> None:
"""(experimental) Properties to create Icmp.
:param code: (experimental) The Internet Control Message Protocol (ICMP) code. You can use -1 to specify all ICMP codes for the given ICMP type. Requirement is conditional: Required if you specify 1 (ICMP) for the protocol parameter.
:param type: (experimental) The Internet Control Message Protocol (ICMP) type. You can use -1 to specify all ICMP types. Conditional requirement: Required if you specify 1 (ICMP) for the CreateNetworkAclEntry protocol parameter.
:stability: experimental
"""
self._values: typing.Dict[str, typing.Any] = {}
if code is not None:
self._values["code"] = code
if type is not None:
self._values["type"] = type
@builtins.property
def code(self) -> typing.Optional[jsii.Number]:
"""(experimental) The Internet Control Message Protocol (ICMP) code.
You can use -1 to specify all ICMP
codes for the given ICMP type. Requirement is conditional: Required if you
specify 1 (ICMP) for the protocol parameter.
:stability: experimental
"""
result = self._values.get("code")
return result
@builtins.property
def type(self) -> typing.Optional[jsii.Number]:
"""(experimental) The Internet Control Message Protocol (ICMP) type.
You can use -1 to specify all ICMP types.
Conditional requirement: Required if you specify 1 (ICMP) for the CreateNetworkAclEntry protocol parameter.
:stability: experimental
"""
result = self._values.get("type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AclIcmp(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.AclPortRange",
jsii_struct_bases=[],
name_mapping={"from_": "from", "to": "to"},
)
class AclPortRange:
def __init__(
self,
*,
from_: typing.Optional[jsii.Number] = None,
to: typing.Optional[jsii.Number] = None,
) -> None:
"""(experimental) Properties to create PortRange.
:param from_: (experimental) The first port in the range. Required if you specify 6 (TCP) or 17 (UDP) for the protocol parameter.
:param to: (experimental) The last port in the range. Required if you specify 6 (TCP) or 17 (UDP) for the protocol parameter.
:stability: experimental
"""
self._values: typing.Dict[str, typing.Any] = {}
if from_ is not None:
self._values["from_"] = from_
if to is not None:
self._values["to"] = to
@builtins.property
def from_(self) -> typing.Optional[jsii.Number]:
"""(experimental) The first port in the range.
Required if you specify 6 (TCP) or 17 (UDP) for the protocol parameter.
:stability: experimental
"""
result = self._values.get("from_")
return result
@builtins.property
def to(self) -> typing.Optional[jsii.Number]:
"""(experimental) The last port in the range.
Required if you specify 6 (TCP) or 17 (UDP) for the protocol parameter.
:stability: experimental
"""
result = self._values.get("to")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AclPortRange(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class AclTraffic(
metaclass=jsii.JSIIAbstractClass,
jsii_type="@aws-cdk/aws-ec2.AclTraffic",
):
"""(experimental) The traffic that is configured using a Network ACL entry.
:stability: experimental
"""
@builtins.staticmethod
def __jsii_proxy_class__():
return _AclTrafficProxy
def __init__(self) -> None:
jsii.create(AclTraffic, self, [])
@jsii.member(jsii_name="allTraffic")
@builtins.classmethod
def all_traffic(cls) -> "AclTraffic":
"""(experimental) Apply the ACL entry to all traffic.
:stability: experimental
"""
return jsii.sinvoke(cls, "allTraffic", [])
@jsii.member(jsii_name="icmp")
@builtins.classmethod
def icmp(
cls,
*,
code: typing.Optional[jsii.Number] = None,
type: typing.Optional[jsii.Number] = None,
) -> "AclTraffic":
"""(experimental) Apply the ACL entry to ICMP traffic of given type and code.
:param code: (experimental) The Internet Control Message Protocol (ICMP) code. You can use -1 to specify all ICMP codes for the given ICMP type. Requirement is conditional: Required if you specify 1 (ICMP) for the protocol parameter.
:param type: (experimental) The Internet Control Message Protocol (ICMP) type. You can use -1 to specify all ICMP types. Conditional requirement: Required if you specify 1 (ICMP) for the CreateNetworkAclEntry protocol parameter.
:stability: experimental
"""
props = AclIcmp(code=code, type=type)
return jsii.sinvoke(cls, "icmp", [props])
@jsii.member(jsii_name="icmpv6")
@builtins.classmethod
def icmpv6(
cls,
*,
code: typing.Optional[jsii.Number] = None,
type: typing.Optional[jsii.Number] = None,
) -> "AclTraffic":
"""(experimental) Apply the ACL entry to ICMPv6 traffic of given type and code.
Requires an IPv6 CIDR block.
:param code: (experimental) The Internet Control Message Protocol (ICMP) code. You can use -1 to specify all ICMP codes for the given ICMP type. Requirement is conditional: Required if you specify 1 (ICMP) for the protocol parameter.
:param type: (experimental) The Internet Control Message Protocol (ICMP) type. You can use -1 to specify all ICMP types. Conditional requirement: Required if you specify 1 (ICMP) for the CreateNetworkAclEntry protocol parameter.
:stability: experimental
"""
props = AclIcmp(code=code, type=type)
return jsii.sinvoke(cls, "icmpv6", [props])
@jsii.member(jsii_name="tcpPort")
@builtins.classmethod
def tcp_port(cls, port: jsii.Number) -> "AclTraffic":
"""(experimental) Apply the ACL entry to TCP traffic on a given port.
:param port: -
:stability: experimental
"""
return jsii.sinvoke(cls, "tcpPort", [port])
@jsii.member(jsii_name="tcpPortRange")
@builtins.classmethod
def tcp_port_range(
cls,
start_port: jsii.Number,
end_port: jsii.Number,
) -> "AclTraffic":
"""(experimental) Apply the ACL entry to TCP traffic on a given port range.
:param start_port: -
:param end_port: -
:stability: experimental
"""
return jsii.sinvoke(cls, "tcpPortRange", [start_port, end_port])
@jsii.member(jsii_name="udpPort")
@builtins.classmethod
def udp_port(cls, port: jsii.Number) -> "AclTraffic":
"""(experimental) Apply the ACL entry to UDP traffic on a given port.
:param port: -
:stability: experimental
"""
return jsii.sinvoke(cls, "udpPort", [port])
@jsii.member(jsii_name="udpPortRange")
@builtins.classmethod
def udp_port_range(
cls,
start_port: jsii.Number,
end_port: jsii.Number,
) -> "AclTraffic":
"""(experimental) Apply the ACL entry to UDP traffic on a given port range.
:param start_port: -
:param end_port: -
:stability: experimental
"""
return jsii.sinvoke(cls, "udpPortRange", [start_port, end_port])
@jsii.member(jsii_name="toTrafficConfig")
@abc.abstractmethod
def to_traffic_config(self) -> "AclTrafficConfig":
"""
:stability: experimental
"""
...
class _AclTrafficProxy(AclTraffic):
@jsii.member(jsii_name="toTrafficConfig")
def to_traffic_config(self) -> "AclTrafficConfig":
"""
:stability: experimental
"""
return jsii.invoke(self, "toTrafficConfig", [])
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.AclTrafficConfig",
jsii_struct_bases=[],
name_mapping={"protocol": "protocol", "icmp": "icmp", "port_range": "portRange"},
)
class AclTrafficConfig:
def __init__(
self,
*,
protocol: jsii.Number,
icmp: typing.Optional[AclIcmp] = None,
port_range: typing.Optional[AclPortRange] = None,
) -> None:
"""(experimental) Acl Configuration for traffic.
:param protocol: (experimental) The protocol number. A value of "-1" means all protocols. If you specify "-1" or a protocol number other than "6" (TCP), "17" (UDP), or "1" (ICMP), traffic on all ports is allowed, regardless of any ports or ICMP types or codes that you specify. If you specify protocol "58" (ICMPv6) and specify an IPv4 CIDR block, traffic for all ICMP types and codes allowed, regardless of any that you specify. If you specify protocol "58" (ICMPv6) and specify an IPv6 CIDR block, you must specify an ICMP type and code. Default: 17
:param icmp: (experimental) The Internet Control Message Protocol (ICMP) code and type. Default: - Required if specifying 1 (ICMP) for the protocol parameter.
:param port_range: (experimental) The range of port numbers for the UDP/TCP protocol. Default: - Required if specifying 6 (TCP) or 17 (UDP) for the protocol parameter
:stability: experimental
"""
if isinstance(icmp, dict):
icmp = AclIcmp(**icmp)
if isinstance(port_range, dict):
port_range = AclPortRange(**port_range)
self._values: typing.Dict[str, typing.Any] = {
"protocol": protocol,
}
if icmp is not None:
self._values["icmp"] = icmp
if port_range is not None:
self._values["port_range"] = port_range
@builtins.property
def protocol(self) -> jsii.Number:
"""(experimental) The protocol number.
A value of "-1" means all protocols.
If you specify "-1" or a protocol number other than "6" (TCP), "17" (UDP),
or "1" (ICMP), traffic on all ports is allowed, regardless of any ports or
ICMP types or codes that you specify.
If you specify protocol "58" (ICMPv6) and specify an IPv4 CIDR
block, traffic for all ICMP types and codes allowed, regardless of any that
you specify. If you specify protocol "58" (ICMPv6) and specify an IPv6 CIDR
block, you must specify an ICMP type and code.
:default: 17
:stability: experimental
"""
result = self._values.get("protocol")
assert result is not None, "Required property 'protocol' is missing"
return result
@builtins.property
def icmp(self) -> typing.Optional[AclIcmp]:
"""(experimental) The Internet Control Message Protocol (ICMP) code and type.
:default: - Required if specifying 1 (ICMP) for the protocol parameter.
:stability: experimental
"""
result = self._values.get("icmp")
return result
@builtins.property
def port_range(self) -> typing.Optional[AclPortRange]:
"""(experimental) The range of port numbers for the UDP/TCP protocol.
:default: - Required if specifying 6 (TCP) or 17 (UDP) for the protocol parameter
:stability: experimental
"""
result = self._values.get("port_range")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AclTrafficConfig(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.Action")
class Action(enum.Enum):
"""(experimental) What action to apply to traffic matching the ACL.
:stability: experimental
"""
ALLOW = "ALLOW"
"""(experimental) Allow the traffic.
:stability: experimental
"""
DENY = "DENY"
"""(experimental) Deny the traffic.
:stability: experimental
"""
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.AddRouteOptions",
jsii_struct_bases=[],
name_mapping={
"router_id": "routerId",
"router_type": "routerType",
"destination_cidr_block": "destinationCidrBlock",
"destination_ipv6_cidr_block": "destinationIpv6CidrBlock",
"enables_internet_connectivity": "enablesInternetConnectivity",
},
)
class AddRouteOptions:
def __init__(
self,
*,
router_id: builtins.str,
router_type: "RouterType",
destination_cidr_block: typing.Optional[builtins.str] = None,
destination_ipv6_cidr_block: typing.Optional[builtins.str] = None,
enables_internet_connectivity: typing.Optional[builtins.bool] = None,
) -> None:
"""Options for adding a new route to a subnet.
:param router_id: The ID of the router. Can be an instance ID, gateway ID, etc, depending on the router type.
:param router_type: What type of router to route this traffic to.
:param destination_cidr_block: IPv4 range this route applies to. Default: '0.0.0.0/0'
:param destination_ipv6_cidr_block: IPv6 range this route applies to. Default: - Uses IPv6
:param enables_internet_connectivity: Whether this route will enable internet connectivity. If true, this route will be added before any AWS resources that depend on internet connectivity in the VPC will be created. Default: false
"""
self._values: typing.Dict[str, typing.Any] = {
"router_id": router_id,
"router_type": router_type,
}
if destination_cidr_block is not None:
self._values["destination_cidr_block"] = destination_cidr_block
if destination_ipv6_cidr_block is not None:
self._values["destination_ipv6_cidr_block"] = destination_ipv6_cidr_block
if enables_internet_connectivity is not None:
self._values["enables_internet_connectivity"] = enables_internet_connectivity
@builtins.property
def router_id(self) -> builtins.str:
"""The ID of the router.
Can be an instance ID, gateway ID, etc, depending on the router type.
"""
result = self._values.get("router_id")
assert result is not None, "Required property 'router_id' is missing"
return result
@builtins.property
def router_type(self) -> "RouterType":
"""What type of router to route this traffic to."""
result = self._values.get("router_type")
assert result is not None, "Required property 'router_type' is missing"
return result
@builtins.property
def destination_cidr_block(self) -> typing.Optional[builtins.str]:
"""IPv4 range this route applies to.
:default: '0.0.0.0/0'
"""
result = self._values.get("destination_cidr_block")
return result
@builtins.property
def destination_ipv6_cidr_block(self) -> typing.Optional[builtins.str]:
"""IPv6 range this route applies to.
:default: - Uses IPv6
"""
result = self._values.get("destination_ipv6_cidr_block")
return result
@builtins.property
def enables_internet_connectivity(self) -> typing.Optional[builtins.bool]:
"""Whether this route will enable internet connectivity.
If true, this route will be added before any AWS resources that depend
on internet connectivity in the VPC will be created.
:default: false
"""
result = self._values.get("enables_internet_connectivity")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AddRouteOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.AmazonLinuxCpuType")
class AmazonLinuxCpuType(enum.Enum):
"""CPU type."""
ARM_64 = "ARM_64"
"""arm64 CPU type."""
X86_64 = "X86_64"
"""x86_64 CPU type."""
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.AmazonLinuxEdition")
class AmazonLinuxEdition(enum.Enum):
"""Amazon Linux edition."""
STANDARD = "STANDARD"
"""Standard edition."""
MINIMAL = "MINIMAL"
"""Minimal edition."""
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.AmazonLinuxGeneration")
class AmazonLinuxGeneration(enum.Enum):
"""What generation of Amazon Linux to use."""
AMAZON_LINUX = "AMAZON_LINUX"
"""Amazon Linux."""
AMAZON_LINUX_2 = "AMAZON_LINUX_2"
"""Amazon Linux 2."""
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.AmazonLinuxImageProps",
jsii_struct_bases=[],
name_mapping={
"cpu_type": "cpuType",
"edition": "edition",
"generation": "generation",
"storage": "storage",
"user_data": "userData",
"virtualization": "virtualization",
},
)
class AmazonLinuxImageProps:
def __init__(
self,
*,
cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
edition: typing.Optional[AmazonLinuxEdition] = None,
generation: typing.Optional[AmazonLinuxGeneration] = None,
storage: typing.Optional["AmazonLinuxStorage"] = None,
user_data: typing.Optional["UserData"] = None,
virtualization: typing.Optional["AmazonLinuxVirt"] = None,
) -> None:
"""Amazon Linux image properties.
:param cpu_type: CPU Type. Default: X86_64
:param edition: What edition of Amazon Linux to use. Default: Standard
:param generation: What generation of Amazon Linux to use. Default: AmazonLinux
:param storage: What storage backed image to use. Default: GeneralPurpose
:param user_data: Initial user data. Default: - Empty UserData for Linux machines
:param virtualization: Virtualization type. Default: HVM
"""
self._values: typing.Dict[str, typing.Any] = {}
if cpu_type is not None:
self._values["cpu_type"] = cpu_type
if edition is not None:
self._values["edition"] = edition
if generation is not None:
self._values["generation"] = generation
if storage is not None:
self._values["storage"] = storage
if user_data is not None:
self._values["user_data"] = user_data
if virtualization is not None:
self._values["virtualization"] = virtualization
@builtins.property
def cpu_type(self) -> typing.Optional[AmazonLinuxCpuType]:
"""CPU Type.
:default: X86_64
"""
result = self._values.get("cpu_type")
return result
@builtins.property
def edition(self) -> typing.Optional[AmazonLinuxEdition]:
"""What edition of Amazon Linux to use.
:default: Standard
"""
result = self._values.get("edition")
return result
@builtins.property
def generation(self) -> typing.Optional[AmazonLinuxGeneration]:
"""What generation of Amazon Linux to use.
:default: AmazonLinux
"""
result = self._values.get("generation")
return result
@builtins.property
def storage(self) -> typing.Optional["AmazonLinuxStorage"]:
"""What storage backed image to use.
:default: GeneralPurpose
"""
result = self._values.get("storage")
return result
@builtins.property
def user_data(self) -> typing.Optional["UserData"]:
"""Initial user data.
:default: - Empty UserData for Linux machines
"""
result = self._values.get("user_data")
return result
@builtins.property
def virtualization(self) -> typing.Optional["AmazonLinuxVirt"]:
"""Virtualization type.
:default: HVM
"""
result = self._values.get("virtualization")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AmazonLinuxImageProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.AmazonLinuxStorage")
class AmazonLinuxStorage(enum.Enum):
EBS = "EBS"
"""EBS-backed storage."""
GENERAL_PURPOSE = "GENERAL_PURPOSE"
"""General Purpose-based storage (recommended)."""
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.AmazonLinuxVirt")
class AmazonLinuxVirt(enum.Enum):
"""Virtualization type for Amazon Linux."""
HVM = "HVM"
"""HVM virtualization (recommended)."""
PV = "PV"
"""PV virtualization."""
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.ApplyCloudFormationInitOptions",
jsii_struct_bases=[],
name_mapping={
"config_sets": "configSets",
"embed_fingerprint": "embedFingerprint",
"ignore_failures": "ignoreFailures",
"print_log": "printLog",
"timeout": "timeout",
},
)
class ApplyCloudFormationInitOptions:
def __init__(
self,
*,
config_sets: typing.Optional[typing.List[builtins.str]] = None,
embed_fingerprint: typing.Optional[builtins.bool] = None,
ignore_failures: typing.Optional[builtins.bool] = None,
print_log: typing.Optional[builtins.bool] = None,
timeout: typing.Optional[aws_cdk.core.Duration] = None,
) -> None:
"""Options for applying CloudFormation init to an instance or instance group.
:param config_sets: ConfigSet to activate. Default: ['default']
:param embed_fingerprint: Force instance replacement by embedding a config fingerprint. If ``true`` (the default), a hash of the config will be embedded into the UserData, so that if the config changes, the UserData changes. - If the EC2 instance is instance-store backed or ``userDataCausesReplacement`` is set, this will cause the instance to be replaced and the new configuration to be applied. - If the instance is EBS-backed and ``userDataCausesReplacement`` is not set, the change of UserData will make the instance restart but not be replaced, and the configuration will not be applied automatically. If ``false``, no hash will be embedded, and if the CloudFormation Init config changes nothing will happen to the running instance. If a config update introduces errors, you will not notice until after the CloudFormation deployment successfully finishes and the next instance fails to launch. Default: true
:param ignore_failures: Don't fail the instance creation when cfn-init fails. You can use this to prevent CloudFormation from rolling back when instances fail to start up, to help in debugging. Default: false
:param print_log: Print the results of running cfn-init to the Instance System Log. By default, the output of running cfn-init is written to a log file on the instance. Set this to ``true`` to print it to the System Log (visible from the EC2 Console), ``false`` to not print it. (Be aware that the system log is refreshed at certain points in time of the instance life cycle, and successful execution may not always show up). Default: true
:param timeout: Timeout waiting for the configuration to be applied. Default: Duration.minutes(5)
"""
self._values: typing.Dict[str, typing.Any] = {}
if config_sets is not None:
self._values["config_sets"] = config_sets
if embed_fingerprint is not None:
self._values["embed_fingerprint"] = embed_fingerprint
if ignore_failures is not None:
self._values["ignore_failures"] = ignore_failures
if print_log is not None:
self._values["print_log"] = print_log
if timeout is not None:
self._values["timeout"] = timeout
@builtins.property
def config_sets(self) -> typing.Optional[typing.List[builtins.str]]:
"""ConfigSet to activate.
:default: ['default']
"""
result = self._values.get("config_sets")
return result
@builtins.property
def embed_fingerprint(self) -> typing.Optional[builtins.bool]:
"""Force instance replacement by embedding a config fingerprint.
If ``true`` (the default), a hash of the config will be embedded into the
UserData, so that if the config changes, the UserData changes.
- If the EC2 instance is instance-store backed or
``userDataCausesReplacement`` is set, this will cause the instance to be
replaced and the new configuration to be applied.
- If the instance is EBS-backed and ``userDataCausesReplacement`` is not
set, the change of UserData will make the instance restart but not be
replaced, and the configuration will not be applied automatically.
If ``false``, no hash will be embedded, and if the CloudFormation Init
config changes nothing will happen to the running instance. If a
config update introduces errors, you will not notice until after the
CloudFormation deployment successfully finishes and the next instance
fails to launch.
:default: true
"""
result = self._values.get("embed_fingerprint")
return result
@builtins.property
def ignore_failures(self) -> typing.Optional[builtins.bool]:
"""Don't fail the instance creation when cfn-init fails.
You can use this to prevent CloudFormation from rolling back when
instances fail to start up, to help in debugging.
:default: false
"""
result = self._values.get("ignore_failures")
return result
@builtins.property
def print_log(self) -> typing.Optional[builtins.bool]:
"""Print the results of running cfn-init to the Instance System Log.
By default, the output of running cfn-init is written to a log file
on the instance. Set this to ``true`` to print it to the System Log
(visible from the EC2 Console), ``false`` to not print it.
(Be aware that the system log is refreshed at certain points in
time of the instance life cycle, and successful execution may
not always show up).
:default: true
"""
result = self._values.get("print_log")
return result
@builtins.property
def timeout(self) -> typing.Optional[aws_cdk.core.Duration]:
"""Timeout waiting for the configuration to be applied.
:default: Duration.minutes(5)
"""
result = self._values.get("timeout")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ApplyCloudFormationInitOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.AttachInitOptions",
jsii_struct_bases=[],
name_mapping={
"instance_role": "instanceRole",
"platform": "platform",
"user_data": "userData",
"config_sets": "configSets",
"embed_fingerprint": "embedFingerprint",
"ignore_failures": "ignoreFailures",
"print_log": "printLog",
},
)
class AttachInitOptions:
def __init__(
self,
*,
instance_role: aws_cdk.aws_iam.IRole,
platform: "OperatingSystemType",
user_data: "UserData",
config_sets: typing.Optional[typing.List[builtins.str]] = None,
embed_fingerprint: typing.Optional[builtins.bool] = None,
ignore_failures: typing.Optional[builtins.bool] = None,
print_log: typing.Optional[builtins.bool] = None,
) -> None:
"""Options for attaching a CloudFormationInit to a resource.
:param instance_role: Instance role of the consuming instance or fleet.
:param platform: OS Platform the init config will be used for.
:param user_data: UserData to add commands to.
:param config_sets: ConfigSet to activate. Default: ['default']
:param embed_fingerprint: Whether to embed a hash into the userData. If ``true`` (the default), a hash of the config will be embedded into the UserData, so that if the config changes, the UserData changes and the instance will be replaced. If ``false``, no such hash will be embedded, and if the CloudFormation Init config changes nothing will happen to the running instance. Default: true
:param ignore_failures: Don't fail the instance creation when cfn-init fails. You can use this to prevent CloudFormation from rolling back when instances fail to start up, to help in debugging. Default: false
:param print_log: Print the results of running cfn-init to the Instance System Log. By default, the output of running cfn-init is written to a log file on the instance. Set this to ``true`` to print it to the System Log (visible from the EC2 Console), ``false`` to not print it. (Be aware that the system log is refreshed at certain points in time of the instance life cycle, and successful execution may not always show up). Default: true
"""
self._values: typing.Dict[str, typing.Any] = {
"instance_role": instance_role,
"platform": platform,
"user_data": user_data,
}
if config_sets is not None:
self._values["config_sets"] = config_sets
if embed_fingerprint is not None:
self._values["embed_fingerprint"] = embed_fingerprint
if ignore_failures is not None:
self._values["ignore_failures"] = ignore_failures
if print_log is not None:
self._values["print_log"] = print_log
@builtins.property
def instance_role(self) -> aws_cdk.aws_iam.IRole:
"""Instance role of the consuming instance or fleet."""
result = self._values.get("instance_role")
assert result is not None, "Required property 'instance_role' is missing"
return result
@builtins.property
def platform(self) -> "OperatingSystemType":
"""OS Platform the init config will be used for."""
result = self._values.get("platform")
assert result is not None, "Required property 'platform' is missing"
return result
@builtins.property
def user_data(self) -> "UserData":
"""UserData to add commands to."""
result = self._values.get("user_data")
assert result is not None, "Required property 'user_data' is missing"
return result
@builtins.property
def config_sets(self) -> typing.Optional[typing.List[builtins.str]]:
"""ConfigSet to activate.
:default: ['default']
"""
result = self._values.get("config_sets")
return result
@builtins.property
def embed_fingerprint(self) -> typing.Optional[builtins.bool]:
"""Whether to embed a hash into the userData.
If ``true`` (the default), a hash of the config will be embedded into the
UserData, so that if the config changes, the UserData changes and
the instance will be replaced.
If ``false``, no such hash will be embedded, and if the CloudFormation Init
config changes nothing will happen to the running instance.
:default: true
"""
result = self._values.get("embed_fingerprint")
return result
@builtins.property
def ignore_failures(self) -> typing.Optional[builtins.bool]:
"""Don't fail the instance creation when cfn-init fails.
You can use this to prevent CloudFormation from rolling back when
instances fail to start up, to help in debugging.
:default: false
"""
result = self._values.get("ignore_failures")
return result
@builtins.property
def print_log(self) -> typing.Optional[builtins.bool]:
"""Print the results of running cfn-init to the Instance System Log.
By default, the output of running cfn-init is written to a log file
on the instance. Set this to ``true`` to print it to the System Log
(visible from the EC2 Console), ``false`` to not print it.
(Be aware that the system log is refreshed at certain points in
time of the instance life cycle, and successful execution may
not always show up).
:default: true
"""
result = self._values.get("print_log")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AttachInitOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.BastionHostLinuxProps",
jsii_struct_bases=[],
name_mapping={
"vpc": "vpc",
"availability_zone": "availabilityZone",
"block_devices": "blockDevices",
"instance_name": "instanceName",
"instance_type": "instanceType",
"machine_image": "machineImage",
"security_group": "securityGroup",
"subnet_selection": "subnetSelection",
},
)
class BastionHostLinuxProps:
def __init__(
self,
*,
vpc: "IVpc",
availability_zone: typing.Optional[builtins.str] = None,
block_devices: typing.Optional[typing.List["BlockDevice"]] = None,
instance_name: typing.Optional[builtins.str] = None,
instance_type: typing.Optional["InstanceType"] = None,
machine_image: typing.Optional["IMachineImage"] = None,
security_group: typing.Optional["ISecurityGroup"] = None,
subnet_selection: typing.Optional["SubnetSelection"] = None,
) -> None:
"""(experimental) Properties of the bastion host.
:param vpc: (experimental) VPC to launch the instance in.
:param availability_zone: (experimental) In which AZ to place the instance within the VPC. Default: - Random zone.
:param block_devices: (experimental) Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched. Default: - Uses the block device mapping of the AMI
:param instance_name: (experimental) The name of the instance. Default: 'BastionHost'
:param instance_type: (experimental) Type of instance to launch. Default: 't3.nano'
:param machine_image: (experimental) The machine image to use, assumed to have SSM Agent preinstalled. Default: - An Amazon Linux 2 image which is kept up-to-date automatically (the instance may be replaced on every deployment) and already has SSM Agent installed.
:param security_group: (experimental) Security Group to assign to this instance. Default: - create new security group with no inbound and all outbound traffic allowed
:param subnet_selection: (experimental) Select the subnets to run the bastion host in. Set this to PUBLIC if you need to connect to this instance via the internet and cannot use SSM. You have to allow port 22 manually by using the connections field Default: - private subnets of the supplied VPC
:stability: experimental
"""
if isinstance(subnet_selection, dict):
subnet_selection = SubnetSelection(**subnet_selection)
self._values: typing.Dict[str, typing.Any] = {
"vpc": vpc,
}
if availability_zone is not None:
self._values["availability_zone"] = availability_zone
if block_devices is not None:
self._values["block_devices"] = block_devices
if instance_name is not None:
self._values["instance_name"] = instance_name
if instance_type is not None:
self._values["instance_type"] = instance_type
if machine_image is not None:
self._values["machine_image"] = machine_image
if security_group is not None:
self._values["security_group"] = security_group
if subnet_selection is not None:
self._values["subnet_selection"] = subnet_selection
@builtins.property
def vpc(self) -> "IVpc":
"""(experimental) VPC to launch the instance in.
:stability: experimental
"""
result = self._values.get("vpc")
assert result is not None, "Required property 'vpc' is missing"
return result
@builtins.property
def availability_zone(self) -> typing.Optional[builtins.str]:
"""(experimental) In which AZ to place the instance within the VPC.
:default: - Random zone.
:stability: experimental
"""
result = self._values.get("availability_zone")
return result
@builtins.property
def block_devices(self) -> typing.Optional[typing.List["BlockDevice"]]:
"""(experimental) Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.
Each instance that is launched has an associated root device volume,
either an Amazon EBS volume or an instance store volume.
You can use block device mappings to specify additional EBS volumes or
instance store volumes to attach to an instance when it is launched.
:default: - Uses the block device mapping of the AMI
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html
:stability: experimental
"""
result = self._values.get("block_devices")
return result
@builtins.property
def instance_name(self) -> typing.Optional[builtins.str]:
"""(experimental) The name of the instance.
:default: 'BastionHost'
:stability: experimental
"""
result = self._values.get("instance_name")
return result
@builtins.property
def instance_type(self) -> typing.Optional["InstanceType"]:
"""(experimental) Type of instance to launch.
:default: 't3.nano'
:stability: experimental
"""
result = self._values.get("instance_type")
return result
@builtins.property
def machine_image(self) -> typing.Optional["IMachineImage"]:
"""(experimental) The machine image to use, assumed to have SSM Agent preinstalled.
:default:
- An Amazon Linux 2 image which is kept up-to-date automatically (the instance
may be replaced on every deployment) and already has SSM Agent installed.
:stability: experimental
"""
result = self._values.get("machine_image")
return result
@builtins.property
def security_group(self) -> typing.Optional["ISecurityGroup"]:
"""(experimental) Security Group to assign to this instance.
:default: - create new security group with no inbound and all outbound traffic allowed
:stability: experimental
"""
result = self._values.get("security_group")
return result
@builtins.property
def subnet_selection(self) -> typing.Optional["SubnetSelection"]:
"""(experimental) Select the subnets to run the bastion host in.
Set this to PUBLIC if you need to connect to this instance via the internet and cannot use SSM.
You have to allow port 22 manually by using the connections field
:default: - private subnets of the supplied VPC
:stability: experimental
"""
result = self._values.get("subnet_selection")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "BastionHostLinuxProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.BlockDevice",
jsii_struct_bases=[],
name_mapping={
"device_name": "deviceName",
"volume": "volume",
"mapping_enabled": "mappingEnabled",
},
)
class BlockDevice:
def __init__(
self,
*,
device_name: builtins.str,
volume: "BlockDeviceVolume",
mapping_enabled: typing.Optional[builtins.bool] = None,
) -> None:
"""Block device.
:param device_name: The device name exposed to the EC2 instance.
:param volume: Defines the block device volume, to be either an Amazon EBS volume or an ephemeral instance store volume.
:param mapping_enabled: If false, the device mapping will be suppressed. If set to false for the root device, the instance might fail the Amazon EC2 health check. Amazon EC2 Auto Scaling launches a replacement instance if the instance fails the health check. Default: true - device mapping is left untouched
"""
self._values: typing.Dict[str, typing.Any] = {
"device_name": device_name,
"volume": volume,
}
if mapping_enabled is not None:
self._values["mapping_enabled"] = mapping_enabled
@builtins.property
def device_name(self) -> builtins.str:
"""The device name exposed to the EC2 instance.
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html
Example::
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
"/dev/sdh" , "xvdh"
"""
result = self._values.get("device_name")
assert result is not None, "Required property 'device_name' is missing"
return result
@builtins.property
def volume(self) -> "BlockDeviceVolume":
"""Defines the block device volume, to be either an Amazon EBS volume or an ephemeral instance store volume.
Example::
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
BlockDeviceVolume.ebs(15) , BlockDeviceVolume.ephemeral(0)
"""
result = self._values.get("volume")
assert result is not None, "Required property 'volume' is missing"
return result
@builtins.property
def mapping_enabled(self) -> typing.Optional[builtins.bool]:
"""If false, the device mapping will be suppressed.
If set to false for the root device, the instance might fail the Amazon EC2 health check.
Amazon EC2 Auto Scaling launches a replacement instance if the instance fails the health check.
:default: true - device mapping is left untouched
"""
result = self._values.get("mapping_enabled")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "BlockDevice(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class BlockDeviceVolume(
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.BlockDeviceVolume",
):
"""Describes a block device mapping for an EC2 instance or Auto Scaling group."""
def __init__(
self,
ebs_device: typing.Optional["EbsDeviceProps"] = None,
virtual_name: typing.Optional[builtins.str] = None,
) -> None:
"""
:param ebs_device: EBS device info.
:param virtual_name: Virtual device name.
"""
jsii.create(BlockDeviceVolume, self, [ebs_device, virtual_name])
@jsii.member(jsii_name="ebs")
@builtins.classmethod
def ebs(
cls,
volume_size: jsii.Number,
*,
encrypted: typing.Optional[builtins.bool] = None,
delete_on_termination: typing.Optional[builtins.bool] = None,
iops: typing.Optional[jsii.Number] = None,
volume_type: typing.Optional["EbsDeviceVolumeType"] = None,
) -> "BlockDeviceVolume":
"""Creates a new Elastic Block Storage device.
:param volume_size: The volume size, in Gibibytes (GiB).
:param encrypted: Specifies whether the EBS volume is encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption Default: false
:param delete_on_termination: Indicates whether to delete the volume when the instance is terminated. Default: - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)
:param iops: The number of I/O operations per second (IOPS) to provision for the volume. Must only be set for {@link volumeType}: {@link EbsDeviceVolumeType.IO1} The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS, you need at least 100 GiB storage on the volume. Default: - none, required for {@link EbsDeviceVolumeType.IO1}
:param volume_type: The EBS volume type. Default: {@link EbsDeviceVolumeType.GP2}
"""
options = EbsDeviceOptions(
encrypted=encrypted,
delete_on_termination=delete_on_termination,
iops=iops,
volume_type=volume_type,
)
return jsii.sinvoke(cls, "ebs", [volume_size, options])
@jsii.member(jsii_name="ebsFromSnapshot")
@builtins.classmethod
def ebs_from_snapshot(
cls,
snapshot_id: builtins.str,
*,
volume_size: typing.Optional[jsii.Number] = None,
delete_on_termination: typing.Optional[builtins.bool] = None,
iops: typing.Optional[jsii.Number] = None,
volume_type: typing.Optional["EbsDeviceVolumeType"] = None,
) -> "BlockDeviceVolume":
"""Creates a new Elastic Block Storage device from an existing snapshot.
:param snapshot_id: The snapshot ID of the volume to use.
:param volume_size: The volume size, in Gibibytes (GiB). If you specify volumeSize, it must be equal or greater than the size of the snapshot. Default: - The snapshot size
:param delete_on_termination: Indicates whether to delete the volume when the instance is terminated. Default: - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)
:param iops: The number of I/O operations per second (IOPS) to provision for the volume. Must only be set for {@link volumeType}: {@link EbsDeviceVolumeType.IO1} The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS, you need at least 100 GiB storage on the volume. Default: - none, required for {@link EbsDeviceVolumeType.IO1}
:param volume_type: The EBS volume type. Default: {@link EbsDeviceVolumeType.GP2}
"""
options = EbsDeviceSnapshotOptions(
volume_size=volume_size,
delete_on_termination=delete_on_termination,
iops=iops,
volume_type=volume_type,
)
return jsii.sinvoke(cls, "ebsFromSnapshot", [snapshot_id, options])
@jsii.member(jsii_name="ephemeral")
@builtins.classmethod
def ephemeral(cls, volume_index: jsii.Number) -> "BlockDeviceVolume":
"""Creates a virtual, ephemeral device.
The name will be in the form ephemeral{volumeIndex}.
:param volume_index: the volume index. Must be equal or greater than 0
"""
return jsii.sinvoke(cls, "ephemeral", [volume_index])
@builtins.property # type: ignore
@jsii.member(jsii_name="ebsDevice")
def ebs_device(self) -> typing.Optional["EbsDeviceProps"]:
"""EBS device info."""
return jsii.get(self, "ebsDevice")
@builtins.property # type: ignore
@jsii.member(jsii_name="virtualName")
def virtual_name(self) -> typing.Optional[builtins.str]:
"""Virtual device name."""
return jsii.get(self, "virtualName")
@jsii.implements(aws_cdk.core.IInspectable)
class CfnCapacityReservation(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnCapacityReservation",
):
"""A CloudFormation ``AWS::EC2::CapacityReservation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html
:cloudformationResource: AWS::EC2::CapacityReservation
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
availability_zone: builtins.str,
instance_count: jsii.Number,
instance_platform: builtins.str,
instance_type: builtins.str,
ebs_optimized: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
end_date: typing.Optional[builtins.str] = None,
end_date_type: typing.Optional[builtins.str] = None,
ephemeral_storage: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
instance_match_criteria: typing.Optional[builtins.str] = None,
tag_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnCapacityReservation.TagSpecificationProperty"]]]] = None,
tenancy: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::CapacityReservation``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param availability_zone: ``AWS::EC2::CapacityReservation.AvailabilityZone``.
:param instance_count: ``AWS::EC2::CapacityReservation.InstanceCount``.
:param instance_platform: ``AWS::EC2::CapacityReservation.InstancePlatform``.
:param instance_type: ``AWS::EC2::CapacityReservation.InstanceType``.
:param ebs_optimized: ``AWS::EC2::CapacityReservation.EbsOptimized``.
:param end_date: ``AWS::EC2::CapacityReservation.EndDate``.
:param end_date_type: ``AWS::EC2::CapacityReservation.EndDateType``.
:param ephemeral_storage: ``AWS::EC2::CapacityReservation.EphemeralStorage``.
:param instance_match_criteria: ``AWS::EC2::CapacityReservation.InstanceMatchCriteria``.
:param tag_specifications: ``AWS::EC2::CapacityReservation.TagSpecifications``.
:param tenancy: ``AWS::EC2::CapacityReservation.Tenancy``.
"""
props = CfnCapacityReservationProps(
availability_zone=availability_zone,
instance_count=instance_count,
instance_platform=instance_platform,
instance_type=instance_type,
ebs_optimized=ebs_optimized,
end_date=end_date,
end_date_type=end_date_type,
ephemeral_storage=ephemeral_storage,
instance_match_criteria=instance_match_criteria,
tag_specifications=tag_specifications,
tenancy=tenancy,
)
jsii.create(CfnCapacityReservation, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrAvailabilityZone")
def attr_availability_zone(self) -> builtins.str:
"""
:cloudformationAttribute: AvailabilityZone
"""
return jsii.get(self, "attrAvailabilityZone")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrAvailableInstanceCount")
def attr_available_instance_count(self) -> jsii.Number:
"""
:cloudformationAttribute: AvailableInstanceCount
"""
return jsii.get(self, "attrAvailableInstanceCount")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrInstanceType")
def attr_instance_type(self) -> builtins.str:
"""
:cloudformationAttribute: InstanceType
"""
return jsii.get(self, "attrInstanceType")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrTenancy")
def attr_tenancy(self) -> builtins.str:
"""
:cloudformationAttribute: Tenancy
"""
return jsii.get(self, "attrTenancy")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrTotalInstanceCount")
def attr_total_instance_count(self) -> jsii.Number:
"""
:cloudformationAttribute: TotalInstanceCount
"""
return jsii.get(self, "attrTotalInstanceCount")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZone")
def availability_zone(self) -> builtins.str:
"""``AWS::EC2::CapacityReservation.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-availabilityzone
"""
return jsii.get(self, "availabilityZone")
@availability_zone.setter # type: ignore
def availability_zone(self, value: builtins.str) -> None:
jsii.set(self, "availabilityZone", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceCount")
def instance_count(self) -> jsii.Number:
"""``AWS::EC2::CapacityReservation.InstanceCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-instancecount
"""
return jsii.get(self, "instanceCount")
@instance_count.setter # type: ignore
def instance_count(self, value: jsii.Number) -> None:
jsii.set(self, "instanceCount", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePlatform")
def instance_platform(self) -> builtins.str:
"""``AWS::EC2::CapacityReservation.InstancePlatform``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-instanceplatform
"""
return jsii.get(self, "instancePlatform")
@instance_platform.setter # type: ignore
def instance_platform(self, value: builtins.str) -> None:
jsii.set(self, "instancePlatform", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceType")
def instance_type(self) -> builtins.str:
"""``AWS::EC2::CapacityReservation.InstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-instancetype
"""
return jsii.get(self, "instanceType")
@instance_type.setter # type: ignore
def instance_type(self, value: builtins.str) -> None:
jsii.set(self, "instanceType", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ebsOptimized")
def ebs_optimized(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::CapacityReservation.EbsOptimized``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-ebsoptimized
"""
return jsii.get(self, "ebsOptimized")
@ebs_optimized.setter # type: ignore
def ebs_optimized(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "ebsOptimized", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="endDate")
def end_date(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::CapacityReservation.EndDate``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-enddate
"""
return jsii.get(self, "endDate")
@end_date.setter # type: ignore
def end_date(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "endDate", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="endDateType")
def end_date_type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::CapacityReservation.EndDateType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-enddatetype
"""
return jsii.get(self, "endDateType")
@end_date_type.setter # type: ignore
def end_date_type(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "endDateType", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ephemeralStorage")
def ephemeral_storage(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::CapacityReservation.EphemeralStorage``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-ephemeralstorage
"""
return jsii.get(self, "ephemeralStorage")
@ephemeral_storage.setter # type: ignore
def ephemeral_storage(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "ephemeralStorage", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceMatchCriteria")
def instance_match_criteria(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::CapacityReservation.InstanceMatchCriteria``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-instancematchcriteria
"""
return jsii.get(self, "instanceMatchCriteria")
@instance_match_criteria.setter # type: ignore
def instance_match_criteria(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "instanceMatchCriteria", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="tagSpecifications")
def tag_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnCapacityReservation.TagSpecificationProperty"]]]]:
"""``AWS::EC2::CapacityReservation.TagSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-tagspecifications
"""
return jsii.get(self, "tagSpecifications")
@tag_specifications.setter # type: ignore
def tag_specifications(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnCapacityReservation.TagSpecificationProperty"]]]],
) -> None:
jsii.set(self, "tagSpecifications", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="tenancy")
def tenancy(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::CapacityReservation.Tenancy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-tenancy
"""
return jsii.get(self, "tenancy")
@tenancy.setter # type: ignore
def tenancy(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "tenancy", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnCapacityReservation.TagSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"resource_type": "resourceType", "tags": "tags"},
)
class TagSpecificationProperty:
def __init__(
self,
*,
resource_type: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""
:param resource_type: ``CfnCapacityReservation.TagSpecificationProperty.ResourceType``.
:param tags: ``CfnCapacityReservation.TagSpecificationProperty.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-capacityreservation-tagspecification.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if resource_type is not None:
self._values["resource_type"] = resource_type
if tags is not None:
self._values["tags"] = tags
@builtins.property
def resource_type(self) -> typing.Optional[builtins.str]:
"""``CfnCapacityReservation.TagSpecificationProperty.ResourceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-capacityreservation-tagspecification.html#cfn-ec2-capacityreservation-tagspecification-resourcetype
"""
result = self._values.get("resource_type")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``CfnCapacityReservation.TagSpecificationProperty.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-capacityreservation-tagspecification.html#cfn-ec2-capacityreservation-tagspecification-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "TagSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnCapacityReservationProps",
jsii_struct_bases=[],
name_mapping={
"availability_zone": "availabilityZone",
"instance_count": "instanceCount",
"instance_platform": "instancePlatform",
"instance_type": "instanceType",
"ebs_optimized": "ebsOptimized",
"end_date": "endDate",
"end_date_type": "endDateType",
"ephemeral_storage": "ephemeralStorage",
"instance_match_criteria": "instanceMatchCriteria",
"tag_specifications": "tagSpecifications",
"tenancy": "tenancy",
},
)
class CfnCapacityReservationProps:
def __init__(
self,
*,
availability_zone: builtins.str,
instance_count: jsii.Number,
instance_platform: builtins.str,
instance_type: builtins.str,
ebs_optimized: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
end_date: typing.Optional[builtins.str] = None,
end_date_type: typing.Optional[builtins.str] = None,
ephemeral_storage: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
instance_match_criteria: typing.Optional[builtins.str] = None,
tag_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnCapacityReservation.TagSpecificationProperty]]]] = None,
tenancy: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::CapacityReservation``.
:param availability_zone: ``AWS::EC2::CapacityReservation.AvailabilityZone``.
:param instance_count: ``AWS::EC2::CapacityReservation.InstanceCount``.
:param instance_platform: ``AWS::EC2::CapacityReservation.InstancePlatform``.
:param instance_type: ``AWS::EC2::CapacityReservation.InstanceType``.
:param ebs_optimized: ``AWS::EC2::CapacityReservation.EbsOptimized``.
:param end_date: ``AWS::EC2::CapacityReservation.EndDate``.
:param end_date_type: ``AWS::EC2::CapacityReservation.EndDateType``.
:param ephemeral_storage: ``AWS::EC2::CapacityReservation.EphemeralStorage``.
:param instance_match_criteria: ``AWS::EC2::CapacityReservation.InstanceMatchCriteria``.
:param tag_specifications: ``AWS::EC2::CapacityReservation.TagSpecifications``.
:param tenancy: ``AWS::EC2::CapacityReservation.Tenancy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html
"""
self._values: typing.Dict[str, typing.Any] = {
"availability_zone": availability_zone,
"instance_count": instance_count,
"instance_platform": instance_platform,
"instance_type": instance_type,
}
if ebs_optimized is not None:
self._values["ebs_optimized"] = ebs_optimized
if end_date is not None:
self._values["end_date"] = end_date
if end_date_type is not None:
self._values["end_date_type"] = end_date_type
if ephemeral_storage is not None:
self._values["ephemeral_storage"] = ephemeral_storage
if instance_match_criteria is not None:
self._values["instance_match_criteria"] = instance_match_criteria
if tag_specifications is not None:
self._values["tag_specifications"] = tag_specifications
if tenancy is not None:
self._values["tenancy"] = tenancy
@builtins.property
def availability_zone(self) -> builtins.str:
"""``AWS::EC2::CapacityReservation.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-availabilityzone
"""
result = self._values.get("availability_zone")
assert result is not None, "Required property 'availability_zone' is missing"
return result
@builtins.property
def instance_count(self) -> jsii.Number:
"""``AWS::EC2::CapacityReservation.InstanceCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-instancecount
"""
result = self._values.get("instance_count")
assert result is not None, "Required property 'instance_count' is missing"
return result
@builtins.property
def instance_platform(self) -> builtins.str:
"""``AWS::EC2::CapacityReservation.InstancePlatform``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-instanceplatform
"""
result = self._values.get("instance_platform")
assert result is not None, "Required property 'instance_platform' is missing"
return result
@builtins.property
def instance_type(self) -> builtins.str:
"""``AWS::EC2::CapacityReservation.InstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-instancetype
"""
result = self._values.get("instance_type")
assert result is not None, "Required property 'instance_type' is missing"
return result
@builtins.property
def ebs_optimized(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::CapacityReservation.EbsOptimized``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-ebsoptimized
"""
result = self._values.get("ebs_optimized")
return result
@builtins.property
def end_date(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::CapacityReservation.EndDate``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-enddate
"""
result = self._values.get("end_date")
return result
@builtins.property
def end_date_type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::CapacityReservation.EndDateType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-enddatetype
"""
result = self._values.get("end_date_type")
return result
@builtins.property
def ephemeral_storage(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::CapacityReservation.EphemeralStorage``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-ephemeralstorage
"""
result = self._values.get("ephemeral_storage")
return result
@builtins.property
def instance_match_criteria(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::CapacityReservation.InstanceMatchCriteria``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-instancematchcriteria
"""
result = self._values.get("instance_match_criteria")
return result
@builtins.property
def tag_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnCapacityReservation.TagSpecificationProperty]]]]:
"""``AWS::EC2::CapacityReservation.TagSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-tagspecifications
"""
result = self._values.get("tag_specifications")
return result
@builtins.property
def tenancy(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::CapacityReservation.Tenancy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-capacityreservation.html#cfn-ec2-capacityreservation-tenancy
"""
result = self._values.get("tenancy")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnCapacityReservationProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnCarrierGateway(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnCarrierGateway",
):
"""A CloudFormation ``AWS::EC2::CarrierGateway``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-carriergateway.html
:cloudformationResource: AWS::EC2::CarrierGateway
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
vpc_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::CarrierGateway``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param vpc_id: ``AWS::EC2::CarrierGateway.VpcId``.
:param tags: ``AWS::EC2::CarrierGateway.Tags``.
"""
props = CfnCarrierGatewayProps(vpc_id=vpc_id, tags=tags)
jsii.create(CfnCarrierGateway, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrCarrierGatewayId")
def attr_carrier_gateway_id(self) -> builtins.str:
"""
:cloudformationAttribute: CarrierGatewayId
"""
return jsii.get(self, "attrCarrierGatewayId")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrOwnerId")
def attr_owner_id(self) -> builtins.str:
"""
:cloudformationAttribute: OwnerId
"""
return jsii.get(self, "attrOwnerId")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrState")
def attr_state(self) -> builtins.str:
"""
:cloudformationAttribute: State
"""
return jsii.get(self, "attrState")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::CarrierGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-carriergateway.html#cfn-ec2-carriergateway-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::CarrierGateway.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-carriergateway.html#cfn-ec2-carriergateway-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: builtins.str) -> None:
jsii.set(self, "vpcId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnCarrierGatewayProps",
jsii_struct_bases=[],
name_mapping={"vpc_id": "vpcId", "tags": "tags"},
)
class CfnCarrierGatewayProps:
def __init__(
self,
*,
vpc_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::CarrierGateway``.
:param vpc_id: ``AWS::EC2::CarrierGateway.VpcId``.
:param tags: ``AWS::EC2::CarrierGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-carriergateway.html
"""
self._values: typing.Dict[str, typing.Any] = {
"vpc_id": vpc_id,
}
if tags is not None:
self._values["tags"] = tags
@builtins.property
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::CarrierGateway.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-carriergateway.html#cfn-ec2-carriergateway-vpcid
"""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::CarrierGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-carriergateway.html#cfn-ec2-carriergateway-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnCarrierGatewayProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnClientVpnAuthorizationRule(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnAuthorizationRule",
):
"""A CloudFormation ``AWS::EC2::ClientVpnAuthorizationRule``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html
:cloudformationResource: AWS::EC2::ClientVpnAuthorizationRule
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
client_vpn_endpoint_id: builtins.str,
target_network_cidr: builtins.str,
access_group_id: typing.Optional[builtins.str] = None,
authorize_all_groups: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::ClientVpnAuthorizationRule``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param client_vpn_endpoint_id: ``AWS::EC2::ClientVpnAuthorizationRule.ClientVpnEndpointId``.
:param target_network_cidr: ``AWS::EC2::ClientVpnAuthorizationRule.TargetNetworkCidr``.
:param access_group_id: ``AWS::EC2::ClientVpnAuthorizationRule.AccessGroupId``.
:param authorize_all_groups: ``AWS::EC2::ClientVpnAuthorizationRule.AuthorizeAllGroups``.
:param description: ``AWS::EC2::ClientVpnAuthorizationRule.Description``.
"""
props = CfnClientVpnAuthorizationRuleProps(
client_vpn_endpoint_id=client_vpn_endpoint_id,
target_network_cidr=target_network_cidr,
access_group_id=access_group_id,
authorize_all_groups=authorize_all_groups,
description=description,
)
jsii.create(CfnClientVpnAuthorizationRule, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="clientVpnEndpointId")
def client_vpn_endpoint_id(self) -> builtins.str:
"""``AWS::EC2::ClientVpnAuthorizationRule.ClientVpnEndpointId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html#cfn-ec2-clientvpnauthorizationrule-clientvpnendpointid
"""
return jsii.get(self, "clientVpnEndpointId")
@client_vpn_endpoint_id.setter # type: ignore
def client_vpn_endpoint_id(self, value: builtins.str) -> None:
jsii.set(self, "clientVpnEndpointId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="targetNetworkCidr")
def target_network_cidr(self) -> builtins.str:
"""``AWS::EC2::ClientVpnAuthorizationRule.TargetNetworkCidr``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html#cfn-ec2-clientvpnauthorizationrule-targetnetworkcidr
"""
return jsii.get(self, "targetNetworkCidr")
@target_network_cidr.setter # type: ignore
def target_network_cidr(self, value: builtins.str) -> None:
jsii.set(self, "targetNetworkCidr", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="accessGroupId")
def access_group_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnAuthorizationRule.AccessGroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html#cfn-ec2-clientvpnauthorizationrule-accessgroupid
"""
return jsii.get(self, "accessGroupId")
@access_group_id.setter # type: ignore
def access_group_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "accessGroupId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="authorizeAllGroups")
def authorize_all_groups(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::ClientVpnAuthorizationRule.AuthorizeAllGroups``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html#cfn-ec2-clientvpnauthorizationrule-authorizeallgroups
"""
return jsii.get(self, "authorizeAllGroups")
@authorize_all_groups.setter # type: ignore
def authorize_all_groups(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "authorizeAllGroups", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="description")
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnAuthorizationRule.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html#cfn-ec2-clientvpnauthorizationrule-description
"""
return jsii.get(self, "description")
@description.setter # type: ignore
def description(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "description", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnAuthorizationRuleProps",
jsii_struct_bases=[],
name_mapping={
"client_vpn_endpoint_id": "clientVpnEndpointId",
"target_network_cidr": "targetNetworkCidr",
"access_group_id": "accessGroupId",
"authorize_all_groups": "authorizeAllGroups",
"description": "description",
},
)
class CfnClientVpnAuthorizationRuleProps:
def __init__(
self,
*,
client_vpn_endpoint_id: builtins.str,
target_network_cidr: builtins.str,
access_group_id: typing.Optional[builtins.str] = None,
authorize_all_groups: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::ClientVpnAuthorizationRule``.
:param client_vpn_endpoint_id: ``AWS::EC2::ClientVpnAuthorizationRule.ClientVpnEndpointId``.
:param target_network_cidr: ``AWS::EC2::ClientVpnAuthorizationRule.TargetNetworkCidr``.
:param access_group_id: ``AWS::EC2::ClientVpnAuthorizationRule.AccessGroupId``.
:param authorize_all_groups: ``AWS::EC2::ClientVpnAuthorizationRule.AuthorizeAllGroups``.
:param description: ``AWS::EC2::ClientVpnAuthorizationRule.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html
"""
self._values: typing.Dict[str, typing.Any] = {
"client_vpn_endpoint_id": client_vpn_endpoint_id,
"target_network_cidr": target_network_cidr,
}
if access_group_id is not None:
self._values["access_group_id"] = access_group_id
if authorize_all_groups is not None:
self._values["authorize_all_groups"] = authorize_all_groups
if description is not None:
self._values["description"] = description
@builtins.property
def client_vpn_endpoint_id(self) -> builtins.str:
"""``AWS::EC2::ClientVpnAuthorizationRule.ClientVpnEndpointId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html#cfn-ec2-clientvpnauthorizationrule-clientvpnendpointid
"""
result = self._values.get("client_vpn_endpoint_id")
assert result is not None, "Required property 'client_vpn_endpoint_id' is missing"
return result
@builtins.property
def target_network_cidr(self) -> builtins.str:
"""``AWS::EC2::ClientVpnAuthorizationRule.TargetNetworkCidr``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html#cfn-ec2-clientvpnauthorizationrule-targetnetworkcidr
"""
result = self._values.get("target_network_cidr")
assert result is not None, "Required property 'target_network_cidr' is missing"
return result
@builtins.property
def access_group_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnAuthorizationRule.AccessGroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html#cfn-ec2-clientvpnauthorizationrule-accessgroupid
"""
result = self._values.get("access_group_id")
return result
@builtins.property
def authorize_all_groups(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::ClientVpnAuthorizationRule.AuthorizeAllGroups``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html#cfn-ec2-clientvpnauthorizationrule-authorizeallgroups
"""
result = self._values.get("authorize_all_groups")
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnAuthorizationRule.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnauthorizationrule.html#cfn-ec2-clientvpnauthorizationrule-description
"""
result = self._values.get("description")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnClientVpnAuthorizationRuleProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnClientVpnEndpoint(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnEndpoint",
):
"""A CloudFormation ``AWS::EC2::ClientVpnEndpoint``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html
:cloudformationResource: AWS::EC2::ClientVpnEndpoint
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
authentication_options: typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union["CfnClientVpnEndpoint.ClientAuthenticationRequestProperty", aws_cdk.core.IResolvable]]],
client_cidr_block: builtins.str,
connection_log_options: typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.ConnectionLogOptionsProperty"],
server_certificate_arn: builtins.str,
client_connect_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.ClientConnectOptionsProperty"]] = None,
description: typing.Optional[builtins.str] = None,
dns_servers: typing.Optional[typing.List[builtins.str]] = None,
security_group_ids: typing.Optional[typing.List[builtins.str]] = None,
self_service_portal: typing.Optional[builtins.str] = None,
split_tunnel: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
tag_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.TagSpecificationProperty"]]]] = None,
transport_protocol: typing.Optional[builtins.str] = None,
vpc_id: typing.Optional[builtins.str] = None,
vpn_port: typing.Optional[jsii.Number] = None,
) -> None:
"""Create a new ``AWS::EC2::ClientVpnEndpoint``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param authentication_options: ``AWS::EC2::ClientVpnEndpoint.AuthenticationOptions``.
:param client_cidr_block: ``AWS::EC2::ClientVpnEndpoint.ClientCidrBlock``.
:param connection_log_options: ``AWS::EC2::ClientVpnEndpoint.ConnectionLogOptions``.
:param server_certificate_arn: ``AWS::EC2::ClientVpnEndpoint.ServerCertificateArn``.
:param client_connect_options: ``AWS::EC2::ClientVpnEndpoint.ClientConnectOptions``.
:param description: ``AWS::EC2::ClientVpnEndpoint.Description``.
:param dns_servers: ``AWS::EC2::ClientVpnEndpoint.DnsServers``.
:param security_group_ids: ``AWS::EC2::ClientVpnEndpoint.SecurityGroupIds``.
:param self_service_portal: ``AWS::EC2::ClientVpnEndpoint.SelfServicePortal``.
:param split_tunnel: ``AWS::EC2::ClientVpnEndpoint.SplitTunnel``.
:param tag_specifications: ``AWS::EC2::ClientVpnEndpoint.TagSpecifications``.
:param transport_protocol: ``AWS::EC2::ClientVpnEndpoint.TransportProtocol``.
:param vpc_id: ``AWS::EC2::ClientVpnEndpoint.VpcId``.
:param vpn_port: ``AWS::EC2::ClientVpnEndpoint.VpnPort``.
"""
props = CfnClientVpnEndpointProps(
authentication_options=authentication_options,
client_cidr_block=client_cidr_block,
connection_log_options=connection_log_options,
server_certificate_arn=server_certificate_arn,
client_connect_options=client_connect_options,
description=description,
dns_servers=dns_servers,
security_group_ids=security_group_ids,
self_service_portal=self_service_portal,
split_tunnel=split_tunnel,
tag_specifications=tag_specifications,
transport_protocol=transport_protocol,
vpc_id=vpc_id,
vpn_port=vpn_port,
)
jsii.create(CfnClientVpnEndpoint, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="authenticationOptions")
def authentication_options(
self,
) -> typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union["CfnClientVpnEndpoint.ClientAuthenticationRequestProperty", aws_cdk.core.IResolvable]]]:
"""``AWS::EC2::ClientVpnEndpoint.AuthenticationOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-authenticationoptions
"""
return jsii.get(self, "authenticationOptions")
@authentication_options.setter # type: ignore
def authentication_options(
self,
value: typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union["CfnClientVpnEndpoint.ClientAuthenticationRequestProperty", aws_cdk.core.IResolvable]]],
) -> None:
jsii.set(self, "authenticationOptions", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="clientCidrBlock")
def client_cidr_block(self) -> builtins.str:
"""``AWS::EC2::ClientVpnEndpoint.ClientCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-clientcidrblock
"""
return jsii.get(self, "clientCidrBlock")
@client_cidr_block.setter # type: ignore
def client_cidr_block(self, value: builtins.str) -> None:
jsii.set(self, "clientCidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="connectionLogOptions")
def connection_log_options(
self,
) -> typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.ConnectionLogOptionsProperty"]:
"""``AWS::EC2::ClientVpnEndpoint.ConnectionLogOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-connectionlogoptions
"""
return jsii.get(self, "connectionLogOptions")
@connection_log_options.setter # type: ignore
def connection_log_options(
self,
value: typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.ConnectionLogOptionsProperty"],
) -> None:
jsii.set(self, "connectionLogOptions", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="serverCertificateArn")
def server_certificate_arn(self) -> builtins.str:
"""``AWS::EC2::ClientVpnEndpoint.ServerCertificateArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-servercertificatearn
"""
return jsii.get(self, "serverCertificateArn")
@server_certificate_arn.setter # type: ignore
def server_certificate_arn(self, value: builtins.str) -> None:
jsii.set(self, "serverCertificateArn", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="clientConnectOptions")
def client_connect_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.ClientConnectOptionsProperty"]]:
"""``AWS::EC2::ClientVpnEndpoint.ClientConnectOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-clientconnectoptions
"""
return jsii.get(self, "clientConnectOptions")
@client_connect_options.setter # type: ignore
def client_connect_options(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.ClientConnectOptionsProperty"]],
) -> None:
jsii.set(self, "clientConnectOptions", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="description")
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnEndpoint.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-description
"""
return jsii.get(self, "description")
@description.setter # type: ignore
def description(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "description", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="dnsServers")
def dns_servers(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::ClientVpnEndpoint.DnsServers``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-dnsservers
"""
return jsii.get(self, "dnsServers")
@dns_servers.setter # type: ignore
def dns_servers(self, value: typing.Optional[typing.List[builtins.str]]) -> None:
jsii.set(self, "dnsServers", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroupIds")
def security_group_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::ClientVpnEndpoint.SecurityGroupIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-securitygroupids
"""
return jsii.get(self, "securityGroupIds")
@security_group_ids.setter # type: ignore
def security_group_ids(
self,
value: typing.Optional[typing.List[builtins.str]],
) -> None:
jsii.set(self, "securityGroupIds", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="selfServicePortal")
def self_service_portal(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnEndpoint.SelfServicePortal``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-selfserviceportal
"""
return jsii.get(self, "selfServicePortal")
@self_service_portal.setter # type: ignore
def self_service_portal(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "selfServicePortal", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="splitTunnel")
def split_tunnel(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::ClientVpnEndpoint.SplitTunnel``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-splittunnel
"""
return jsii.get(self, "splitTunnel")
@split_tunnel.setter # type: ignore
def split_tunnel(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "splitTunnel", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="tagSpecifications")
def tag_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.TagSpecificationProperty"]]]]:
"""``AWS::EC2::ClientVpnEndpoint.TagSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-tagspecifications
"""
return jsii.get(self, "tagSpecifications")
@tag_specifications.setter # type: ignore
def tag_specifications(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.TagSpecificationProperty"]]]],
) -> None:
jsii.set(self, "tagSpecifications", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="transportProtocol")
def transport_protocol(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnEndpoint.TransportProtocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-transportprotocol
"""
return jsii.get(self, "transportProtocol")
@transport_protocol.setter # type: ignore
def transport_protocol(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "transportProtocol", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnEndpoint.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "vpcId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpnPort")
def vpn_port(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::ClientVpnEndpoint.VpnPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-vpnport
"""
return jsii.get(self, "vpnPort")
@vpn_port.setter # type: ignore
def vpn_port(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "vpnPort", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnEndpoint.CertificateAuthenticationRequestProperty",
jsii_struct_bases=[],
name_mapping={
"client_root_certificate_chain_arn": "clientRootCertificateChainArn",
},
)
class CertificateAuthenticationRequestProperty:
def __init__(self, *, client_root_certificate_chain_arn: builtins.str) -> None:
"""
:param client_root_certificate_chain_arn: ``CfnClientVpnEndpoint.CertificateAuthenticationRequestProperty.ClientRootCertificateChainArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-certificateauthenticationrequest.html
"""
self._values: typing.Dict[str, typing.Any] = {
"client_root_certificate_chain_arn": client_root_certificate_chain_arn,
}
@builtins.property
def client_root_certificate_chain_arn(self) -> builtins.str:
"""``CfnClientVpnEndpoint.CertificateAuthenticationRequestProperty.ClientRootCertificateChainArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-certificateauthenticationrequest.html#cfn-ec2-clientvpnendpoint-certificateauthenticationrequest-clientrootcertificatechainarn
"""
result = self._values.get("client_root_certificate_chain_arn")
assert result is not None, "Required property 'client_root_certificate_chain_arn' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CertificateAuthenticationRequestProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnEndpoint.ClientAuthenticationRequestProperty",
jsii_struct_bases=[],
name_mapping={
"type": "type",
"active_directory": "activeDirectory",
"federated_authentication": "federatedAuthentication",
"mutual_authentication": "mutualAuthentication",
},
)
class ClientAuthenticationRequestProperty:
def __init__(
self,
*,
type: builtins.str,
active_directory: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.DirectoryServiceAuthenticationRequestProperty"]] = None,
federated_authentication: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.FederatedAuthenticationRequestProperty"]] = None,
mutual_authentication: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.CertificateAuthenticationRequestProperty"]] = None,
) -> None:
"""
:param type: ``CfnClientVpnEndpoint.ClientAuthenticationRequestProperty.Type``.
:param active_directory: ``CfnClientVpnEndpoint.ClientAuthenticationRequestProperty.ActiveDirectory``.
:param federated_authentication: ``CfnClientVpnEndpoint.ClientAuthenticationRequestProperty.FederatedAuthentication``.
:param mutual_authentication: ``CfnClientVpnEndpoint.ClientAuthenticationRequestProperty.MutualAuthentication``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-clientauthenticationrequest.html
"""
self._values: typing.Dict[str, typing.Any] = {
"type": type,
}
if active_directory is not None:
self._values["active_directory"] = active_directory
if federated_authentication is not None:
self._values["federated_authentication"] = federated_authentication
if mutual_authentication is not None:
self._values["mutual_authentication"] = mutual_authentication
@builtins.property
def type(self) -> builtins.str:
"""``CfnClientVpnEndpoint.ClientAuthenticationRequestProperty.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-clientauthenticationrequest.html#cfn-ec2-clientvpnendpoint-clientauthenticationrequest-type
"""
result = self._values.get("type")
assert result is not None, "Required property 'type' is missing"
return result
@builtins.property
def active_directory(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.DirectoryServiceAuthenticationRequestProperty"]]:
"""``CfnClientVpnEndpoint.ClientAuthenticationRequestProperty.ActiveDirectory``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-clientauthenticationrequest.html#cfn-ec2-clientvpnendpoint-clientauthenticationrequest-activedirectory
"""
result = self._values.get("active_directory")
return result
@builtins.property
def federated_authentication(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.FederatedAuthenticationRequestProperty"]]:
"""``CfnClientVpnEndpoint.ClientAuthenticationRequestProperty.FederatedAuthentication``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-clientauthenticationrequest.html#cfn-ec2-clientvpnendpoint-clientauthenticationrequest-federatedauthentication
"""
result = self._values.get("federated_authentication")
return result
@builtins.property
def mutual_authentication(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnClientVpnEndpoint.CertificateAuthenticationRequestProperty"]]:
"""``CfnClientVpnEndpoint.ClientAuthenticationRequestProperty.MutualAuthentication``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-clientauthenticationrequest.html#cfn-ec2-clientvpnendpoint-clientauthenticationrequest-mutualauthentication
"""
result = self._values.get("mutual_authentication")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ClientAuthenticationRequestProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnEndpoint.ClientConnectOptionsProperty",
jsii_struct_bases=[],
name_mapping={
"enabled": "enabled",
"lambda_function_arn": "lambdaFunctionArn",
},
)
class ClientConnectOptionsProperty:
def __init__(
self,
*,
enabled: typing.Union[builtins.bool, aws_cdk.core.IResolvable],
lambda_function_arn: typing.Optional[builtins.str] = None,
) -> None:
"""
:param enabled: ``CfnClientVpnEndpoint.ClientConnectOptionsProperty.Enabled``.
:param lambda_function_arn: ``CfnClientVpnEndpoint.ClientConnectOptionsProperty.LambdaFunctionArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-clientconnectoptions.html
"""
self._values: typing.Dict[str, typing.Any] = {
"enabled": enabled,
}
if lambda_function_arn is not None:
self._values["lambda_function_arn"] = lambda_function_arn
@builtins.property
def enabled(self) -> typing.Union[builtins.bool, aws_cdk.core.IResolvable]:
"""``CfnClientVpnEndpoint.ClientConnectOptionsProperty.Enabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-clientconnectoptions.html#cfn-ec2-clientvpnendpoint-clientconnectoptions-enabled
"""
result = self._values.get("enabled")
assert result is not None, "Required property 'enabled' is missing"
return result
@builtins.property
def lambda_function_arn(self) -> typing.Optional[builtins.str]:
"""``CfnClientVpnEndpoint.ClientConnectOptionsProperty.LambdaFunctionArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-clientconnectoptions.html#cfn-ec2-clientvpnendpoint-clientconnectoptions-lambdafunctionarn
"""
result = self._values.get("lambda_function_arn")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ClientConnectOptionsProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnEndpoint.ConnectionLogOptionsProperty",
jsii_struct_bases=[],
name_mapping={
"enabled": "enabled",
"cloudwatch_log_group": "cloudwatchLogGroup",
"cloudwatch_log_stream": "cloudwatchLogStream",
},
)
class ConnectionLogOptionsProperty:
def __init__(
self,
*,
enabled: typing.Union[builtins.bool, aws_cdk.core.IResolvable],
cloudwatch_log_group: typing.Optional[builtins.str] = None,
cloudwatch_log_stream: typing.Optional[builtins.str] = None,
) -> None:
"""
:param enabled: ``CfnClientVpnEndpoint.ConnectionLogOptionsProperty.Enabled``.
:param cloudwatch_log_group: ``CfnClientVpnEndpoint.ConnectionLogOptionsProperty.CloudwatchLogGroup``.
:param cloudwatch_log_stream: ``CfnClientVpnEndpoint.ConnectionLogOptionsProperty.CloudwatchLogStream``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-connectionlogoptions.html
"""
self._values: typing.Dict[str, typing.Any] = {
"enabled": enabled,
}
if cloudwatch_log_group is not None:
self._values["cloudwatch_log_group"] = cloudwatch_log_group
if cloudwatch_log_stream is not None:
self._values["cloudwatch_log_stream"] = cloudwatch_log_stream
@builtins.property
def enabled(self) -> typing.Union[builtins.bool, aws_cdk.core.IResolvable]:
"""``CfnClientVpnEndpoint.ConnectionLogOptionsProperty.Enabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-connectionlogoptions.html#cfn-ec2-clientvpnendpoint-connectionlogoptions-enabled
"""
result = self._values.get("enabled")
assert result is not None, "Required property 'enabled' is missing"
return result
@builtins.property
def cloudwatch_log_group(self) -> typing.Optional[builtins.str]:
"""``CfnClientVpnEndpoint.ConnectionLogOptionsProperty.CloudwatchLogGroup``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-connectionlogoptions.html#cfn-ec2-clientvpnendpoint-connectionlogoptions-cloudwatchloggroup
"""
result = self._values.get("cloudwatch_log_group")
return result
@builtins.property
def cloudwatch_log_stream(self) -> typing.Optional[builtins.str]:
"""``CfnClientVpnEndpoint.ConnectionLogOptionsProperty.CloudwatchLogStream``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-connectionlogoptions.html#cfn-ec2-clientvpnendpoint-connectionlogoptions-cloudwatchlogstream
"""
result = self._values.get("cloudwatch_log_stream")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ConnectionLogOptionsProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnEndpoint.DirectoryServiceAuthenticationRequestProperty",
jsii_struct_bases=[],
name_mapping={"directory_id": "directoryId"},
)
class DirectoryServiceAuthenticationRequestProperty:
def __init__(self, *, directory_id: builtins.str) -> None:
"""
:param directory_id: ``CfnClientVpnEndpoint.DirectoryServiceAuthenticationRequestProperty.DirectoryId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-directoryserviceauthenticationrequest.html
"""
self._values: typing.Dict[str, typing.Any] = {
"directory_id": directory_id,
}
@builtins.property
def directory_id(self) -> builtins.str:
"""``CfnClientVpnEndpoint.DirectoryServiceAuthenticationRequestProperty.DirectoryId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-directoryserviceauthenticationrequest.html#cfn-ec2-clientvpnendpoint-directoryserviceauthenticationrequest-directoryid
"""
result = self._values.get("directory_id")
assert result is not None, "Required property 'directory_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "DirectoryServiceAuthenticationRequestProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnEndpoint.FederatedAuthenticationRequestProperty",
jsii_struct_bases=[],
name_mapping={
"saml_provider_arn": "samlProviderArn",
"self_service_saml_provider_arn": "selfServiceSamlProviderArn",
},
)
class FederatedAuthenticationRequestProperty:
def __init__(
self,
*,
saml_provider_arn: builtins.str,
self_service_saml_provider_arn: typing.Optional[builtins.str] = None,
) -> None:
"""
:param saml_provider_arn: ``CfnClientVpnEndpoint.FederatedAuthenticationRequestProperty.SAMLProviderArn``.
:param self_service_saml_provider_arn: ``CfnClientVpnEndpoint.FederatedAuthenticationRequestProperty.SelfServiceSAMLProviderArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-federatedauthenticationrequest.html
"""
self._values: typing.Dict[str, typing.Any] = {
"saml_provider_arn": saml_provider_arn,
}
if self_service_saml_provider_arn is not None:
self._values["self_service_saml_provider_arn"] = self_service_saml_provider_arn
@builtins.property
def saml_provider_arn(self) -> builtins.str:
"""``CfnClientVpnEndpoint.FederatedAuthenticationRequestProperty.SAMLProviderArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-federatedauthenticationrequest.html#cfn-ec2-clientvpnendpoint-federatedauthenticationrequest-samlproviderarn
"""
result = self._values.get("saml_provider_arn")
assert result is not None, "Required property 'saml_provider_arn' is missing"
return result
@builtins.property
def self_service_saml_provider_arn(self) -> typing.Optional[builtins.str]:
"""``CfnClientVpnEndpoint.FederatedAuthenticationRequestProperty.SelfServiceSAMLProviderArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-federatedauthenticationrequest.html#cfn-ec2-clientvpnendpoint-federatedauthenticationrequest-selfservicesamlproviderarn
"""
result = self._values.get("self_service_saml_provider_arn")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "FederatedAuthenticationRequestProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnEndpoint.TagSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"resource_type": "resourceType", "tags": "tags"},
)
class TagSpecificationProperty:
def __init__(
self,
*,
resource_type: builtins.str,
tags: typing.List[aws_cdk.core.CfnTag],
) -> None:
"""
:param resource_type: ``CfnClientVpnEndpoint.TagSpecificationProperty.ResourceType``.
:param tags: ``CfnClientVpnEndpoint.TagSpecificationProperty.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-tagspecification.html
"""
self._values: typing.Dict[str, typing.Any] = {
"resource_type": resource_type,
"tags": tags,
}
@builtins.property
def resource_type(self) -> builtins.str:
"""``CfnClientVpnEndpoint.TagSpecificationProperty.ResourceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-tagspecification.html#cfn-ec2-clientvpnendpoint-tagspecification-resourcetype
"""
result = self._values.get("resource_type")
assert result is not None, "Required property 'resource_type' is missing"
return result
@builtins.property
def tags(self) -> typing.List[aws_cdk.core.CfnTag]:
"""``CfnClientVpnEndpoint.TagSpecificationProperty.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-clientvpnendpoint-tagspecification.html#cfn-ec2-clientvpnendpoint-tagspecification-tags
"""
result = self._values.get("tags")
assert result is not None, "Required property 'tags' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "TagSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnEndpointProps",
jsii_struct_bases=[],
name_mapping={
"authentication_options": "authenticationOptions",
"client_cidr_block": "clientCidrBlock",
"connection_log_options": "connectionLogOptions",
"server_certificate_arn": "serverCertificateArn",
"client_connect_options": "clientConnectOptions",
"description": "description",
"dns_servers": "dnsServers",
"security_group_ids": "securityGroupIds",
"self_service_portal": "selfServicePortal",
"split_tunnel": "splitTunnel",
"tag_specifications": "tagSpecifications",
"transport_protocol": "transportProtocol",
"vpc_id": "vpcId",
"vpn_port": "vpnPort",
},
)
class CfnClientVpnEndpointProps:
def __init__(
self,
*,
authentication_options: typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[CfnClientVpnEndpoint.ClientAuthenticationRequestProperty, aws_cdk.core.IResolvable]]],
client_cidr_block: builtins.str,
connection_log_options: typing.Union[aws_cdk.core.IResolvable, CfnClientVpnEndpoint.ConnectionLogOptionsProperty],
server_certificate_arn: builtins.str,
client_connect_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnClientVpnEndpoint.ClientConnectOptionsProperty]] = None,
description: typing.Optional[builtins.str] = None,
dns_servers: typing.Optional[typing.List[builtins.str]] = None,
security_group_ids: typing.Optional[typing.List[builtins.str]] = None,
self_service_portal: typing.Optional[builtins.str] = None,
split_tunnel: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
tag_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnClientVpnEndpoint.TagSpecificationProperty]]]] = None,
transport_protocol: typing.Optional[builtins.str] = None,
vpc_id: typing.Optional[builtins.str] = None,
vpn_port: typing.Optional[jsii.Number] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::ClientVpnEndpoint``.
:param authentication_options: ``AWS::EC2::ClientVpnEndpoint.AuthenticationOptions``.
:param client_cidr_block: ``AWS::EC2::ClientVpnEndpoint.ClientCidrBlock``.
:param connection_log_options: ``AWS::EC2::ClientVpnEndpoint.ConnectionLogOptions``.
:param server_certificate_arn: ``AWS::EC2::ClientVpnEndpoint.ServerCertificateArn``.
:param client_connect_options: ``AWS::EC2::ClientVpnEndpoint.ClientConnectOptions``.
:param description: ``AWS::EC2::ClientVpnEndpoint.Description``.
:param dns_servers: ``AWS::EC2::ClientVpnEndpoint.DnsServers``.
:param security_group_ids: ``AWS::EC2::ClientVpnEndpoint.SecurityGroupIds``.
:param self_service_portal: ``AWS::EC2::ClientVpnEndpoint.SelfServicePortal``.
:param split_tunnel: ``AWS::EC2::ClientVpnEndpoint.SplitTunnel``.
:param tag_specifications: ``AWS::EC2::ClientVpnEndpoint.TagSpecifications``.
:param transport_protocol: ``AWS::EC2::ClientVpnEndpoint.TransportProtocol``.
:param vpc_id: ``AWS::EC2::ClientVpnEndpoint.VpcId``.
:param vpn_port: ``AWS::EC2::ClientVpnEndpoint.VpnPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html
"""
self._values: typing.Dict[str, typing.Any] = {
"authentication_options": authentication_options,
"client_cidr_block": client_cidr_block,
"connection_log_options": connection_log_options,
"server_certificate_arn": server_certificate_arn,
}
if client_connect_options is not None:
self._values["client_connect_options"] = client_connect_options
if description is not None:
self._values["description"] = description
if dns_servers is not None:
self._values["dns_servers"] = dns_servers
if security_group_ids is not None:
self._values["security_group_ids"] = security_group_ids
if self_service_portal is not None:
self._values["self_service_portal"] = self_service_portal
if split_tunnel is not None:
self._values["split_tunnel"] = split_tunnel
if tag_specifications is not None:
self._values["tag_specifications"] = tag_specifications
if transport_protocol is not None:
self._values["transport_protocol"] = transport_protocol
if vpc_id is not None:
self._values["vpc_id"] = vpc_id
if vpn_port is not None:
self._values["vpn_port"] = vpn_port
@builtins.property
def authentication_options(
self,
) -> typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[CfnClientVpnEndpoint.ClientAuthenticationRequestProperty, aws_cdk.core.IResolvable]]]:
"""``AWS::EC2::ClientVpnEndpoint.AuthenticationOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-authenticationoptions
"""
result = self._values.get("authentication_options")
assert result is not None, "Required property 'authentication_options' is missing"
return result
@builtins.property
def client_cidr_block(self) -> builtins.str:
"""``AWS::EC2::ClientVpnEndpoint.ClientCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-clientcidrblock
"""
result = self._values.get("client_cidr_block")
assert result is not None, "Required property 'client_cidr_block' is missing"
return result
@builtins.property
def connection_log_options(
self,
) -> typing.Union[aws_cdk.core.IResolvable, CfnClientVpnEndpoint.ConnectionLogOptionsProperty]:
"""``AWS::EC2::ClientVpnEndpoint.ConnectionLogOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-connectionlogoptions
"""
result = self._values.get("connection_log_options")
assert result is not None, "Required property 'connection_log_options' is missing"
return result
@builtins.property
def server_certificate_arn(self) -> builtins.str:
"""``AWS::EC2::ClientVpnEndpoint.ServerCertificateArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-servercertificatearn
"""
result = self._values.get("server_certificate_arn")
assert result is not None, "Required property 'server_certificate_arn' is missing"
return result
@builtins.property
def client_connect_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnClientVpnEndpoint.ClientConnectOptionsProperty]]:
"""``AWS::EC2::ClientVpnEndpoint.ClientConnectOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-clientconnectoptions
"""
result = self._values.get("client_connect_options")
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnEndpoint.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-description
"""
result = self._values.get("description")
return result
@builtins.property
def dns_servers(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::ClientVpnEndpoint.DnsServers``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-dnsservers
"""
result = self._values.get("dns_servers")
return result
@builtins.property
def security_group_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::ClientVpnEndpoint.SecurityGroupIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-securitygroupids
"""
result = self._values.get("security_group_ids")
return result
@builtins.property
def self_service_portal(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnEndpoint.SelfServicePortal``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-selfserviceportal
"""
result = self._values.get("self_service_portal")
return result
@builtins.property
def split_tunnel(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::ClientVpnEndpoint.SplitTunnel``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-splittunnel
"""
result = self._values.get("split_tunnel")
return result
@builtins.property
def tag_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnClientVpnEndpoint.TagSpecificationProperty]]]]:
"""``AWS::EC2::ClientVpnEndpoint.TagSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-tagspecifications
"""
result = self._values.get("tag_specifications")
return result
@builtins.property
def transport_protocol(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnEndpoint.TransportProtocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-transportprotocol
"""
result = self._values.get("transport_protocol")
return result
@builtins.property
def vpc_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnEndpoint.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-vpcid
"""
result = self._values.get("vpc_id")
return result
@builtins.property
def vpn_port(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::ClientVpnEndpoint.VpnPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnendpoint.html#cfn-ec2-clientvpnendpoint-vpnport
"""
result = self._values.get("vpn_port")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnClientVpnEndpointProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnClientVpnRoute(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnRoute",
):
"""A CloudFormation ``AWS::EC2::ClientVpnRoute``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnroute.html
:cloudformationResource: AWS::EC2::ClientVpnRoute
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
client_vpn_endpoint_id: builtins.str,
destination_cidr_block: builtins.str,
target_vpc_subnet_id: builtins.str,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::ClientVpnRoute``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param client_vpn_endpoint_id: ``AWS::EC2::ClientVpnRoute.ClientVpnEndpointId``.
:param destination_cidr_block: ``AWS::EC2::ClientVpnRoute.DestinationCidrBlock``.
:param target_vpc_subnet_id: ``AWS::EC2::ClientVpnRoute.TargetVpcSubnetId``.
:param description: ``AWS::EC2::ClientVpnRoute.Description``.
"""
props = CfnClientVpnRouteProps(
client_vpn_endpoint_id=client_vpn_endpoint_id,
destination_cidr_block=destination_cidr_block,
target_vpc_subnet_id=target_vpc_subnet_id,
description=description,
)
jsii.create(CfnClientVpnRoute, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="clientVpnEndpointId")
def client_vpn_endpoint_id(self) -> builtins.str:
"""``AWS::EC2::ClientVpnRoute.ClientVpnEndpointId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnroute.html#cfn-ec2-clientvpnroute-clientvpnendpointid
"""
return jsii.get(self, "clientVpnEndpointId")
@client_vpn_endpoint_id.setter # type: ignore
def client_vpn_endpoint_id(self, value: builtins.str) -> None:
jsii.set(self, "clientVpnEndpointId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="destinationCidrBlock")
def destination_cidr_block(self) -> builtins.str:
"""``AWS::EC2::ClientVpnRoute.DestinationCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnroute.html#cfn-ec2-clientvpnroute-destinationcidrblock
"""
return jsii.get(self, "destinationCidrBlock")
@destination_cidr_block.setter # type: ignore
def destination_cidr_block(self, value: builtins.str) -> None:
jsii.set(self, "destinationCidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="targetVpcSubnetId")
def target_vpc_subnet_id(self) -> builtins.str:
"""``AWS::EC2::ClientVpnRoute.TargetVpcSubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnroute.html#cfn-ec2-clientvpnroute-targetvpcsubnetid
"""
return jsii.get(self, "targetVpcSubnetId")
@target_vpc_subnet_id.setter # type: ignore
def target_vpc_subnet_id(self, value: builtins.str) -> None:
jsii.set(self, "targetVpcSubnetId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="description")
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnRoute.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnroute.html#cfn-ec2-clientvpnroute-description
"""
return jsii.get(self, "description")
@description.setter # type: ignore
def description(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "description", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnRouteProps",
jsii_struct_bases=[],
name_mapping={
"client_vpn_endpoint_id": "clientVpnEndpointId",
"destination_cidr_block": "destinationCidrBlock",
"target_vpc_subnet_id": "targetVpcSubnetId",
"description": "description",
},
)
class CfnClientVpnRouteProps:
def __init__(
self,
*,
client_vpn_endpoint_id: builtins.str,
destination_cidr_block: builtins.str,
target_vpc_subnet_id: builtins.str,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::ClientVpnRoute``.
:param client_vpn_endpoint_id: ``AWS::EC2::ClientVpnRoute.ClientVpnEndpointId``.
:param destination_cidr_block: ``AWS::EC2::ClientVpnRoute.DestinationCidrBlock``.
:param target_vpc_subnet_id: ``AWS::EC2::ClientVpnRoute.TargetVpcSubnetId``.
:param description: ``AWS::EC2::ClientVpnRoute.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnroute.html
"""
self._values: typing.Dict[str, typing.Any] = {
"client_vpn_endpoint_id": client_vpn_endpoint_id,
"destination_cidr_block": destination_cidr_block,
"target_vpc_subnet_id": target_vpc_subnet_id,
}
if description is not None:
self._values["description"] = description
@builtins.property
def client_vpn_endpoint_id(self) -> builtins.str:
"""``AWS::EC2::ClientVpnRoute.ClientVpnEndpointId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnroute.html#cfn-ec2-clientvpnroute-clientvpnendpointid
"""
result = self._values.get("client_vpn_endpoint_id")
assert result is not None, "Required property 'client_vpn_endpoint_id' is missing"
return result
@builtins.property
def destination_cidr_block(self) -> builtins.str:
"""``AWS::EC2::ClientVpnRoute.DestinationCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnroute.html#cfn-ec2-clientvpnroute-destinationcidrblock
"""
result = self._values.get("destination_cidr_block")
assert result is not None, "Required property 'destination_cidr_block' is missing"
return result
@builtins.property
def target_vpc_subnet_id(self) -> builtins.str:
"""``AWS::EC2::ClientVpnRoute.TargetVpcSubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnroute.html#cfn-ec2-clientvpnroute-targetvpcsubnetid
"""
result = self._values.get("target_vpc_subnet_id")
assert result is not None, "Required property 'target_vpc_subnet_id' is missing"
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::ClientVpnRoute.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpnroute.html#cfn-ec2-clientvpnroute-description
"""
result = self._values.get("description")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnClientVpnRouteProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnClientVpnTargetNetworkAssociation(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnTargetNetworkAssociation",
):
"""A CloudFormation ``AWS::EC2::ClientVpnTargetNetworkAssociation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpntargetnetworkassociation.html
:cloudformationResource: AWS::EC2::ClientVpnTargetNetworkAssociation
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
client_vpn_endpoint_id: builtins.str,
subnet_id: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::ClientVpnTargetNetworkAssociation``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param client_vpn_endpoint_id: ``AWS::EC2::ClientVpnTargetNetworkAssociation.ClientVpnEndpointId``.
:param subnet_id: ``AWS::EC2::ClientVpnTargetNetworkAssociation.SubnetId``.
"""
props = CfnClientVpnTargetNetworkAssociationProps(
client_vpn_endpoint_id=client_vpn_endpoint_id, subnet_id=subnet_id
)
jsii.create(CfnClientVpnTargetNetworkAssociation, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="clientVpnEndpointId")
def client_vpn_endpoint_id(self) -> builtins.str:
"""``AWS::EC2::ClientVpnTargetNetworkAssociation.ClientVpnEndpointId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpntargetnetworkassociation.html#cfn-ec2-clientvpntargetnetworkassociation-clientvpnendpointid
"""
return jsii.get(self, "clientVpnEndpointId")
@client_vpn_endpoint_id.setter # type: ignore
def client_vpn_endpoint_id(self, value: builtins.str) -> None:
jsii.set(self, "clientVpnEndpointId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetId")
def subnet_id(self) -> builtins.str:
"""``AWS::EC2::ClientVpnTargetNetworkAssociation.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpntargetnetworkassociation.html#cfn-ec2-clientvpntargetnetworkassociation-subnetid
"""
return jsii.get(self, "subnetId")
@subnet_id.setter # type: ignore
def subnet_id(self, value: builtins.str) -> None:
jsii.set(self, "subnetId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnClientVpnTargetNetworkAssociationProps",
jsii_struct_bases=[],
name_mapping={
"client_vpn_endpoint_id": "clientVpnEndpointId",
"subnet_id": "subnetId",
},
)
class CfnClientVpnTargetNetworkAssociationProps:
def __init__(
self,
*,
client_vpn_endpoint_id: builtins.str,
subnet_id: builtins.str,
) -> None:
"""Properties for defining a ``AWS::EC2::ClientVpnTargetNetworkAssociation``.
:param client_vpn_endpoint_id: ``AWS::EC2::ClientVpnTargetNetworkAssociation.ClientVpnEndpointId``.
:param subnet_id: ``AWS::EC2::ClientVpnTargetNetworkAssociation.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpntargetnetworkassociation.html
"""
self._values: typing.Dict[str, typing.Any] = {
"client_vpn_endpoint_id": client_vpn_endpoint_id,
"subnet_id": subnet_id,
}
@builtins.property
def client_vpn_endpoint_id(self) -> builtins.str:
"""``AWS::EC2::ClientVpnTargetNetworkAssociation.ClientVpnEndpointId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpntargetnetworkassociation.html#cfn-ec2-clientvpntargetnetworkassociation-clientvpnendpointid
"""
result = self._values.get("client_vpn_endpoint_id")
assert result is not None, "Required property 'client_vpn_endpoint_id' is missing"
return result
@builtins.property
def subnet_id(self) -> builtins.str:
"""``AWS::EC2::ClientVpnTargetNetworkAssociation.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-clientvpntargetnetworkassociation.html#cfn-ec2-clientvpntargetnetworkassociation-subnetid
"""
result = self._values.get("subnet_id")
assert result is not None, "Required property 'subnet_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnClientVpnTargetNetworkAssociationProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnCustomerGateway(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnCustomerGateway",
):
"""A CloudFormation ``AWS::EC2::CustomerGateway``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html
:cloudformationResource: AWS::EC2::CustomerGateway
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
bgp_asn: jsii.Number,
ip_address: builtins.str,
type: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::CustomerGateway``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param bgp_asn: ``AWS::EC2::CustomerGateway.BgpAsn``.
:param ip_address: ``AWS::EC2::CustomerGateway.IpAddress``.
:param type: ``AWS::EC2::CustomerGateway.Type``.
:param tags: ``AWS::EC2::CustomerGateway.Tags``.
"""
props = CfnCustomerGatewayProps(
bgp_asn=bgp_asn, ip_address=ip_address, type=type, tags=tags
)
jsii.create(CfnCustomerGateway, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::CustomerGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html#cfn-ec2-customergateway-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="bgpAsn")
def bgp_asn(self) -> jsii.Number:
"""``AWS::EC2::CustomerGateway.BgpAsn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html#cfn-ec2-customergateway-bgpasn
"""
return jsii.get(self, "bgpAsn")
@bgp_asn.setter # type: ignore
def bgp_asn(self, value: jsii.Number) -> None:
jsii.set(self, "bgpAsn", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ipAddress")
def ip_address(self) -> builtins.str:
"""``AWS::EC2::CustomerGateway.IpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html#cfn-ec2-customergateway-ipaddress
"""
return jsii.get(self, "ipAddress")
@ip_address.setter # type: ignore
def ip_address(self, value: builtins.str) -> None:
jsii.set(self, "ipAddress", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="type")
def type(self) -> builtins.str:
"""``AWS::EC2::CustomerGateway.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html#cfn-ec2-customergateway-type
"""
return jsii.get(self, "type")
@type.setter # type: ignore
def type(self, value: builtins.str) -> None:
jsii.set(self, "type", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnCustomerGatewayProps",
jsii_struct_bases=[],
name_mapping={
"bgp_asn": "bgpAsn",
"ip_address": "ipAddress",
"type": "type",
"tags": "tags",
},
)
class CfnCustomerGatewayProps:
def __init__(
self,
*,
bgp_asn: jsii.Number,
ip_address: builtins.str,
type: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::CustomerGateway``.
:param bgp_asn: ``AWS::EC2::CustomerGateway.BgpAsn``.
:param ip_address: ``AWS::EC2::CustomerGateway.IpAddress``.
:param type: ``AWS::EC2::CustomerGateway.Type``.
:param tags: ``AWS::EC2::CustomerGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html
"""
self._values: typing.Dict[str, typing.Any] = {
"bgp_asn": bgp_asn,
"ip_address": ip_address,
"type": type,
}
if tags is not None:
self._values["tags"] = tags
@builtins.property
def bgp_asn(self) -> jsii.Number:
"""``AWS::EC2::CustomerGateway.BgpAsn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html#cfn-ec2-customergateway-bgpasn
"""
result = self._values.get("bgp_asn")
assert result is not None, "Required property 'bgp_asn' is missing"
return result
@builtins.property
def ip_address(self) -> builtins.str:
"""``AWS::EC2::CustomerGateway.IpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html#cfn-ec2-customergateway-ipaddress
"""
result = self._values.get("ip_address")
assert result is not None, "Required property 'ip_address' is missing"
return result
@builtins.property
def type(self) -> builtins.str:
"""``AWS::EC2::CustomerGateway.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html#cfn-ec2-customergateway-type
"""
result = self._values.get("type")
assert result is not None, "Required property 'type' is missing"
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::CustomerGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-customer-gateway.html#cfn-ec2-customergateway-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnCustomerGatewayProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnDHCPOptions(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnDHCPOptions",
):
"""A CloudFormation ``AWS::EC2::DHCPOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html
:cloudformationResource: AWS::EC2::DHCPOptions
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
domain_name: typing.Optional[builtins.str] = None,
domain_name_servers: typing.Optional[typing.List[builtins.str]] = None,
netbios_name_servers: typing.Optional[typing.List[builtins.str]] = None,
netbios_node_type: typing.Optional[jsii.Number] = None,
ntp_servers: typing.Optional[typing.List[builtins.str]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::DHCPOptions``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param domain_name: ``AWS::EC2::DHCPOptions.DomainName``.
:param domain_name_servers: ``AWS::EC2::DHCPOptions.DomainNameServers``.
:param netbios_name_servers: ``AWS::EC2::DHCPOptions.NetbiosNameServers``.
:param netbios_node_type: ``AWS::EC2::DHCPOptions.NetbiosNodeType``.
:param ntp_servers: ``AWS::EC2::DHCPOptions.NtpServers``.
:param tags: ``AWS::EC2::DHCPOptions.Tags``.
"""
props = CfnDHCPOptionsProps(
domain_name=domain_name,
domain_name_servers=domain_name_servers,
netbios_name_servers=netbios_name_servers,
netbios_node_type=netbios_node_type,
ntp_servers=ntp_servers,
tags=tags,
)
jsii.create(CfnDHCPOptions, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::DHCPOptions.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="domainName")
def domain_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::DHCPOptions.DomainName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-domainname
"""
return jsii.get(self, "domainName")
@domain_name.setter # type: ignore
def domain_name(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "domainName", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="domainNameServers")
def domain_name_servers(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::DHCPOptions.DomainNameServers``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-domainnameservers
"""
return jsii.get(self, "domainNameServers")
@domain_name_servers.setter # type: ignore
def domain_name_servers(
self,
value: typing.Optional[typing.List[builtins.str]],
) -> None:
jsii.set(self, "domainNameServers", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="netbiosNameServers")
def netbios_name_servers(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::DHCPOptions.NetbiosNameServers``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-netbiosnameservers
"""
return jsii.get(self, "netbiosNameServers")
@netbios_name_servers.setter # type: ignore
def netbios_name_servers(
self,
value: typing.Optional[typing.List[builtins.str]],
) -> None:
jsii.set(self, "netbiosNameServers", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="netbiosNodeType")
def netbios_node_type(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::DHCPOptions.NetbiosNodeType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-netbiosnodetype
"""
return jsii.get(self, "netbiosNodeType")
@netbios_node_type.setter # type: ignore
def netbios_node_type(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "netbiosNodeType", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ntpServers")
def ntp_servers(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::DHCPOptions.NtpServers``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-ntpservers
"""
return jsii.get(self, "ntpServers")
@ntp_servers.setter # type: ignore
def ntp_servers(self, value: typing.Optional[typing.List[builtins.str]]) -> None:
jsii.set(self, "ntpServers", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnDHCPOptionsProps",
jsii_struct_bases=[],
name_mapping={
"domain_name": "domainName",
"domain_name_servers": "domainNameServers",
"netbios_name_servers": "netbiosNameServers",
"netbios_node_type": "netbiosNodeType",
"ntp_servers": "ntpServers",
"tags": "tags",
},
)
class CfnDHCPOptionsProps:
def __init__(
self,
*,
domain_name: typing.Optional[builtins.str] = None,
domain_name_servers: typing.Optional[typing.List[builtins.str]] = None,
netbios_name_servers: typing.Optional[typing.List[builtins.str]] = None,
netbios_node_type: typing.Optional[jsii.Number] = None,
ntp_servers: typing.Optional[typing.List[builtins.str]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::DHCPOptions``.
:param domain_name: ``AWS::EC2::DHCPOptions.DomainName``.
:param domain_name_servers: ``AWS::EC2::DHCPOptions.DomainNameServers``.
:param netbios_name_servers: ``AWS::EC2::DHCPOptions.NetbiosNameServers``.
:param netbios_node_type: ``AWS::EC2::DHCPOptions.NetbiosNodeType``.
:param ntp_servers: ``AWS::EC2::DHCPOptions.NtpServers``.
:param tags: ``AWS::EC2::DHCPOptions.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if domain_name is not None:
self._values["domain_name"] = domain_name
if domain_name_servers is not None:
self._values["domain_name_servers"] = domain_name_servers
if netbios_name_servers is not None:
self._values["netbios_name_servers"] = netbios_name_servers
if netbios_node_type is not None:
self._values["netbios_node_type"] = netbios_node_type
if ntp_servers is not None:
self._values["ntp_servers"] = ntp_servers
if tags is not None:
self._values["tags"] = tags
@builtins.property
def domain_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::DHCPOptions.DomainName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-domainname
"""
result = self._values.get("domain_name")
return result
@builtins.property
def domain_name_servers(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::DHCPOptions.DomainNameServers``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-domainnameservers
"""
result = self._values.get("domain_name_servers")
return result
@builtins.property
def netbios_name_servers(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::DHCPOptions.NetbiosNameServers``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-netbiosnameservers
"""
result = self._values.get("netbios_name_servers")
return result
@builtins.property
def netbios_node_type(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::DHCPOptions.NetbiosNodeType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-netbiosnodetype
"""
result = self._values.get("netbios_node_type")
return result
@builtins.property
def ntp_servers(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::DHCPOptions.NtpServers``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-ntpservers
"""
result = self._values.get("ntp_servers")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::DHCPOptions.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-dhcp-options.html#cfn-ec2-dhcpoptions-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnDHCPOptionsProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnEC2Fleet(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnEC2Fleet",
):
"""A CloudFormation ``AWS::EC2::EC2Fleet``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html
:cloudformationResource: AWS::EC2::EC2Fleet
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
launch_template_configs: typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.FleetLaunchTemplateConfigRequestProperty"]]],
target_capacity_specification: typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.TargetCapacitySpecificationRequestProperty"],
excess_capacity_termination_policy: typing.Optional[builtins.str] = None,
on_demand_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.OnDemandOptionsRequestProperty"]] = None,
replace_unhealthy_instances: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
spot_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.SpotOptionsRequestProperty"]] = None,
tag_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.TagSpecificationProperty"]]]] = None,
terminate_instances_with_expiration: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
type: typing.Optional[builtins.str] = None,
valid_from: typing.Optional[builtins.str] = None,
valid_until: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::EC2Fleet``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param launch_template_configs: ``AWS::EC2::EC2Fleet.LaunchTemplateConfigs``.
:param target_capacity_specification: ``AWS::EC2::EC2Fleet.TargetCapacitySpecification``.
:param excess_capacity_termination_policy: ``AWS::EC2::EC2Fleet.ExcessCapacityTerminationPolicy``.
:param on_demand_options: ``AWS::EC2::EC2Fleet.OnDemandOptions``.
:param replace_unhealthy_instances: ``AWS::EC2::EC2Fleet.ReplaceUnhealthyInstances``.
:param spot_options: ``AWS::EC2::EC2Fleet.SpotOptions``.
:param tag_specifications: ``AWS::EC2::EC2Fleet.TagSpecifications``.
:param terminate_instances_with_expiration: ``AWS::EC2::EC2Fleet.TerminateInstancesWithExpiration``.
:param type: ``AWS::EC2::EC2Fleet.Type``.
:param valid_from: ``AWS::EC2::EC2Fleet.ValidFrom``.
:param valid_until: ``AWS::EC2::EC2Fleet.ValidUntil``.
"""
props = CfnEC2FleetProps(
launch_template_configs=launch_template_configs,
target_capacity_specification=target_capacity_specification,
excess_capacity_termination_policy=excess_capacity_termination_policy,
on_demand_options=on_demand_options,
replace_unhealthy_instances=replace_unhealthy_instances,
spot_options=spot_options,
tag_specifications=tag_specifications,
terminate_instances_with_expiration=terminate_instances_with_expiration,
type=type,
valid_from=valid_from,
valid_until=valid_until,
)
jsii.create(CfnEC2Fleet, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="launchTemplateConfigs")
def launch_template_configs(
self,
) -> typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.FleetLaunchTemplateConfigRequestProperty"]]]:
"""``AWS::EC2::EC2Fleet.LaunchTemplateConfigs``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-launchtemplateconfigs
"""
return jsii.get(self, "launchTemplateConfigs")
@launch_template_configs.setter # type: ignore
def launch_template_configs(
self,
value: typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.FleetLaunchTemplateConfigRequestProperty"]]],
) -> None:
jsii.set(self, "launchTemplateConfigs", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="targetCapacitySpecification")
def target_capacity_specification(
self,
) -> typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.TargetCapacitySpecificationRequestProperty"]:
"""``AWS::EC2::EC2Fleet.TargetCapacitySpecification``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-targetcapacityspecification
"""
return jsii.get(self, "targetCapacitySpecification")
@target_capacity_specification.setter # type: ignore
def target_capacity_specification(
self,
value: typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.TargetCapacitySpecificationRequestProperty"],
) -> None:
jsii.set(self, "targetCapacitySpecification", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="excessCapacityTerminationPolicy")
def excess_capacity_termination_policy(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EC2Fleet.ExcessCapacityTerminationPolicy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-excesscapacityterminationpolicy
"""
return jsii.get(self, "excessCapacityTerminationPolicy")
@excess_capacity_termination_policy.setter # type: ignore
def excess_capacity_termination_policy(
self,
value: typing.Optional[builtins.str],
) -> None:
jsii.set(self, "excessCapacityTerminationPolicy", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="onDemandOptions")
def on_demand_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.OnDemandOptionsRequestProperty"]]:
"""``AWS::EC2::EC2Fleet.OnDemandOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-ondemandoptions
"""
return jsii.get(self, "onDemandOptions")
@on_demand_options.setter # type: ignore
def on_demand_options(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.OnDemandOptionsRequestProperty"]],
) -> None:
jsii.set(self, "onDemandOptions", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="replaceUnhealthyInstances")
def replace_unhealthy_instances(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::EC2Fleet.ReplaceUnhealthyInstances``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-replaceunhealthyinstances
"""
return jsii.get(self, "replaceUnhealthyInstances")
@replace_unhealthy_instances.setter # type: ignore
def replace_unhealthy_instances(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "replaceUnhealthyInstances", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="spotOptions")
def spot_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.SpotOptionsRequestProperty"]]:
"""``AWS::EC2::EC2Fleet.SpotOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-spotoptions
"""
return jsii.get(self, "spotOptions")
@spot_options.setter # type: ignore
def spot_options(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.SpotOptionsRequestProperty"]],
) -> None:
jsii.set(self, "spotOptions", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="tagSpecifications")
def tag_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.TagSpecificationProperty"]]]]:
"""``AWS::EC2::EC2Fleet.TagSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-tagspecifications
"""
return jsii.get(self, "tagSpecifications")
@tag_specifications.setter # type: ignore
def tag_specifications(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.TagSpecificationProperty"]]]],
) -> None:
jsii.set(self, "tagSpecifications", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="terminateInstancesWithExpiration")
def terminate_instances_with_expiration(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::EC2Fleet.TerminateInstancesWithExpiration``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-terminateinstanceswithexpiration
"""
return jsii.get(self, "terminateInstancesWithExpiration")
@terminate_instances_with_expiration.setter # type: ignore
def terminate_instances_with_expiration(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "terminateInstancesWithExpiration", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="type")
def type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EC2Fleet.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-type
"""
return jsii.get(self, "type")
@type.setter # type: ignore
def type(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "type", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="validFrom")
def valid_from(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EC2Fleet.ValidFrom``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-validfrom
"""
return jsii.get(self, "validFrom")
@valid_from.setter # type: ignore
def valid_from(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "validFrom", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="validUntil")
def valid_until(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EC2Fleet.ValidUntil``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-validuntil
"""
return jsii.get(self, "validUntil")
@valid_until.setter # type: ignore
def valid_until(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "validUntil", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnEC2Fleet.CapacityReservationOptionsRequestProperty",
jsii_struct_bases=[],
name_mapping={"usage_strategy": "usageStrategy"},
)
class CapacityReservationOptionsRequestProperty:
def __init__(
self,
*,
usage_strategy: typing.Optional[builtins.str] = None,
) -> None:
"""
:param usage_strategy: ``CfnEC2Fleet.CapacityReservationOptionsRequestProperty.UsageStrategy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-capacityreservationoptionsrequest.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if usage_strategy is not None:
self._values["usage_strategy"] = usage_strategy
@builtins.property
def usage_strategy(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.CapacityReservationOptionsRequestProperty.UsageStrategy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-capacityreservationoptionsrequest.html#cfn-ec2-ec2fleet-capacityreservationoptionsrequest-usagestrategy
"""
result = self._values.get("usage_strategy")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CapacityReservationOptionsRequestProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnEC2Fleet.FleetLaunchTemplateConfigRequestProperty",
jsii_struct_bases=[],
name_mapping={
"launch_template_specification": "launchTemplateSpecification",
"overrides": "overrides",
},
)
class FleetLaunchTemplateConfigRequestProperty:
def __init__(
self,
*,
launch_template_specification: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.FleetLaunchTemplateSpecificationRequestProperty"]] = None,
overrides: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty"]]]] = None,
) -> None:
"""
:param launch_template_specification: ``CfnEC2Fleet.FleetLaunchTemplateConfigRequestProperty.LaunchTemplateSpecification``.
:param overrides: ``CfnEC2Fleet.FleetLaunchTemplateConfigRequestProperty.Overrides``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplateconfigrequest.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if launch_template_specification is not None:
self._values["launch_template_specification"] = launch_template_specification
if overrides is not None:
self._values["overrides"] = overrides
@builtins.property
def launch_template_specification(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.FleetLaunchTemplateSpecificationRequestProperty"]]:
"""``CfnEC2Fleet.FleetLaunchTemplateConfigRequestProperty.LaunchTemplateSpecification``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplateconfigrequest.html#cfn-ec2-ec2fleet-fleetlaunchtemplateconfigrequest-launchtemplatespecification
"""
result = self._values.get("launch_template_specification")
return result
@builtins.property
def overrides(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty"]]]]:
"""``CfnEC2Fleet.FleetLaunchTemplateConfigRequestProperty.Overrides``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplateconfigrequest.html#cfn-ec2-ec2fleet-fleetlaunchtemplateconfigrequest-overrides
"""
result = self._values.get("overrides")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "FleetLaunchTemplateConfigRequestProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty",
jsii_struct_bases=[],
name_mapping={
"availability_zone": "availabilityZone",
"instance_type": "instanceType",
"max_price": "maxPrice",
"placement": "placement",
"priority": "priority",
"subnet_id": "subnetId",
"weighted_capacity": "weightedCapacity",
},
)
class FleetLaunchTemplateOverridesRequestProperty:
def __init__(
self,
*,
availability_zone: typing.Optional[builtins.str] = None,
instance_type: typing.Optional[builtins.str] = None,
max_price: typing.Optional[builtins.str] = None,
placement: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.PlacementProperty"]] = None,
priority: typing.Optional[jsii.Number] = None,
subnet_id: typing.Optional[builtins.str] = None,
weighted_capacity: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param availability_zone: ``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.AvailabilityZone``.
:param instance_type: ``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.InstanceType``.
:param max_price: ``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.MaxPrice``.
:param placement: ``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.Placement``.
:param priority: ``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.Priority``.
:param subnet_id: ``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.SubnetId``.
:param weighted_capacity: ``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.WeightedCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if availability_zone is not None:
self._values["availability_zone"] = availability_zone
if instance_type is not None:
self._values["instance_type"] = instance_type
if max_price is not None:
self._values["max_price"] = max_price
if placement is not None:
self._values["placement"] = placement
if priority is not None:
self._values["priority"] = priority
if subnet_id is not None:
self._values["subnet_id"] = subnet_id
if weighted_capacity is not None:
self._values["weighted_capacity"] = weighted_capacity
@builtins.property
def availability_zone(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest.html#cfn-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest-availabilityzone
"""
result = self._values.get("availability_zone")
return result
@builtins.property
def instance_type(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.InstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest.html#cfn-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest-instancetype
"""
result = self._values.get("instance_type")
return result
@builtins.property
def max_price(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.MaxPrice``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest.html#cfn-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest-maxprice
"""
result = self._values.get("max_price")
return result
@builtins.property
def placement(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.PlacementProperty"]]:
"""``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.Placement``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest.html#cfn-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest-placement
"""
result = self._values.get("placement")
return result
@builtins.property
def priority(self) -> typing.Optional[jsii.Number]:
"""``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.Priority``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest.html#cfn-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest-priority
"""
result = self._values.get("priority")
return result
@builtins.property
def subnet_id(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest.html#cfn-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest-subnetid
"""
result = self._values.get("subnet_id")
return result
@builtins.property
def weighted_capacity(self) -> typing.Optional[jsii.Number]:
"""``CfnEC2Fleet.FleetLaunchTemplateOverridesRequestProperty.WeightedCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest.html#cfn-ec2-ec2fleet-fleetlaunchtemplateoverridesrequest-weightedcapacity
"""
result = self._values.get("weighted_capacity")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "FleetLaunchTemplateOverridesRequestProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnEC2Fleet.FleetLaunchTemplateSpecificationRequestProperty",
jsii_struct_bases=[],
name_mapping={
"launch_template_id": "launchTemplateId",
"launch_template_name": "launchTemplateName",
"version": "version",
},
)
class FleetLaunchTemplateSpecificationRequestProperty:
def __init__(
self,
*,
launch_template_id: typing.Optional[builtins.str] = None,
launch_template_name: typing.Optional[builtins.str] = None,
version: typing.Optional[builtins.str] = None,
) -> None:
"""
:param launch_template_id: ``CfnEC2Fleet.FleetLaunchTemplateSpecificationRequestProperty.LaunchTemplateId``.
:param launch_template_name: ``CfnEC2Fleet.FleetLaunchTemplateSpecificationRequestProperty.LaunchTemplateName``.
:param version: ``CfnEC2Fleet.FleetLaunchTemplateSpecificationRequestProperty.Version``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplatespecificationrequest.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if launch_template_id is not None:
self._values["launch_template_id"] = launch_template_id
if launch_template_name is not None:
self._values["launch_template_name"] = launch_template_name
if version is not None:
self._values["version"] = version
@builtins.property
def launch_template_id(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.FleetLaunchTemplateSpecificationRequestProperty.LaunchTemplateId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplatespecificationrequest.html#cfn-ec2-ec2fleet-fleetlaunchtemplatespecificationrequest-launchtemplateid
"""
result = self._values.get("launch_template_id")
return result
@builtins.property
def launch_template_name(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.FleetLaunchTemplateSpecificationRequestProperty.LaunchTemplateName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplatespecificationrequest.html#cfn-ec2-ec2fleet-fleetlaunchtemplatespecificationrequest-launchtemplatename
"""
result = self._values.get("launch_template_name")
return result
@builtins.property
def version(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.FleetLaunchTemplateSpecificationRequestProperty.Version``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-fleetlaunchtemplatespecificationrequest.html#cfn-ec2-ec2fleet-fleetlaunchtemplatespecificationrequest-version
"""
result = self._values.get("version")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "FleetLaunchTemplateSpecificationRequestProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnEC2Fleet.OnDemandOptionsRequestProperty",
jsii_struct_bases=[],
name_mapping={
"allocation_strategy": "allocationStrategy",
"capacity_reservation_options": "capacityReservationOptions",
"max_total_price": "maxTotalPrice",
"min_target_capacity": "minTargetCapacity",
"single_availability_zone": "singleAvailabilityZone",
"single_instance_type": "singleInstanceType",
},
)
class OnDemandOptionsRequestProperty:
def __init__(
self,
*,
allocation_strategy: typing.Optional[builtins.str] = None,
capacity_reservation_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.CapacityReservationOptionsRequestProperty"]] = None,
max_total_price: typing.Optional[builtins.str] = None,
min_target_capacity: typing.Optional[jsii.Number] = None,
single_availability_zone: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
single_instance_type: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
) -> None:
"""
:param allocation_strategy: ``CfnEC2Fleet.OnDemandOptionsRequestProperty.AllocationStrategy``.
:param capacity_reservation_options: ``CfnEC2Fleet.OnDemandOptionsRequestProperty.CapacityReservationOptions``.
:param max_total_price: ``CfnEC2Fleet.OnDemandOptionsRequestProperty.MaxTotalPrice``.
:param min_target_capacity: ``CfnEC2Fleet.OnDemandOptionsRequestProperty.MinTargetCapacity``.
:param single_availability_zone: ``CfnEC2Fleet.OnDemandOptionsRequestProperty.SingleAvailabilityZone``.
:param single_instance_type: ``CfnEC2Fleet.OnDemandOptionsRequestProperty.SingleInstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-ondemandoptionsrequest.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if allocation_strategy is not None:
self._values["allocation_strategy"] = allocation_strategy
if capacity_reservation_options is not None:
self._values["capacity_reservation_options"] = capacity_reservation_options
if max_total_price is not None:
self._values["max_total_price"] = max_total_price
if min_target_capacity is not None:
self._values["min_target_capacity"] = min_target_capacity
if single_availability_zone is not None:
self._values["single_availability_zone"] = single_availability_zone
if single_instance_type is not None:
self._values["single_instance_type"] = single_instance_type
@builtins.property
def allocation_strategy(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.OnDemandOptionsRequestProperty.AllocationStrategy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-ondemandoptionsrequest.html#cfn-ec2-ec2fleet-ondemandoptionsrequest-allocationstrategy
"""
result = self._values.get("allocation_strategy")
return result
@builtins.property
def capacity_reservation_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnEC2Fleet.CapacityReservationOptionsRequestProperty"]]:
"""``CfnEC2Fleet.OnDemandOptionsRequestProperty.CapacityReservationOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-ondemandoptionsrequest.html#cfn-ec2-ec2fleet-ondemandoptionsrequest-capacityreservationoptions
"""
result = self._values.get("capacity_reservation_options")
return result
@builtins.property
def max_total_price(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.OnDemandOptionsRequestProperty.MaxTotalPrice``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-ondemandoptionsrequest.html#cfn-ec2-ec2fleet-ondemandoptionsrequest-maxtotalprice
"""
result = self._values.get("max_total_price")
return result
@builtins.property
def min_target_capacity(self) -> typing.Optional[jsii.Number]:
"""``CfnEC2Fleet.OnDemandOptionsRequestProperty.MinTargetCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-ondemandoptionsrequest.html#cfn-ec2-ec2fleet-ondemandoptionsrequest-mintargetcapacity
"""
result = self._values.get("min_target_capacity")
return result
@builtins.property
def single_availability_zone(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnEC2Fleet.OnDemandOptionsRequestProperty.SingleAvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-ondemandoptionsrequest.html#cfn-ec2-ec2fleet-ondemandoptionsrequest-singleavailabilityzone
"""
result = self._values.get("single_availability_zone")
return result
@builtins.property
def single_instance_type(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnEC2Fleet.OnDemandOptionsRequestProperty.SingleInstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-ondemandoptionsrequest.html#cfn-ec2-ec2fleet-ondemandoptionsrequest-singleinstancetype
"""
result = self._values.get("single_instance_type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "OnDemandOptionsRequestProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnEC2Fleet.PlacementProperty",
jsii_struct_bases=[],
name_mapping={
"affinity": "affinity",
"availability_zone": "availabilityZone",
"group_name": "groupName",
"host_id": "hostId",
"host_resource_group_arn": "hostResourceGroupArn",
"partition_number": "partitionNumber",
"spread_domain": "spreadDomain",
"tenancy": "tenancy",
},
)
class PlacementProperty:
def __init__(
self,
*,
affinity: typing.Optional[builtins.str] = None,
availability_zone: typing.Optional[builtins.str] = None,
group_name: typing.Optional[builtins.str] = None,
host_id: typing.Optional[builtins.str] = None,
host_resource_group_arn: typing.Optional[builtins.str] = None,
partition_number: typing.Optional[jsii.Number] = None,
spread_domain: typing.Optional[builtins.str] = None,
tenancy: typing.Optional[builtins.str] = None,
) -> None:
"""
:param affinity: ``CfnEC2Fleet.PlacementProperty.Affinity``.
:param availability_zone: ``CfnEC2Fleet.PlacementProperty.AvailabilityZone``.
:param group_name: ``CfnEC2Fleet.PlacementProperty.GroupName``.
:param host_id: ``CfnEC2Fleet.PlacementProperty.HostId``.
:param host_resource_group_arn: ``CfnEC2Fleet.PlacementProperty.HostResourceGroupArn``.
:param partition_number: ``CfnEC2Fleet.PlacementProperty.PartitionNumber``.
:param spread_domain: ``CfnEC2Fleet.PlacementProperty.SpreadDomain``.
:param tenancy: ``CfnEC2Fleet.PlacementProperty.Tenancy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-placement.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if affinity is not None:
self._values["affinity"] = affinity
if availability_zone is not None:
self._values["availability_zone"] = availability_zone
if group_name is not None:
self._values["group_name"] = group_name
if host_id is not None:
self._values["host_id"] = host_id
if host_resource_group_arn is not None:
self._values["host_resource_group_arn"] = host_resource_group_arn
if partition_number is not None:
self._values["partition_number"] = partition_number
if spread_domain is not None:
self._values["spread_domain"] = spread_domain
if tenancy is not None:
self._values["tenancy"] = tenancy
@builtins.property
def affinity(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.PlacementProperty.Affinity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-placement.html#cfn-ec2-ec2fleet-placement-affinity
"""
result = self._values.get("affinity")
return result
@builtins.property
def availability_zone(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.PlacementProperty.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-placement.html#cfn-ec2-ec2fleet-placement-availabilityzone
"""
result = self._values.get("availability_zone")
return result
@builtins.property
def group_name(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.PlacementProperty.GroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-placement.html#cfn-ec2-ec2fleet-placement-groupname
"""
result = self._values.get("group_name")
return result
@builtins.property
def host_id(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.PlacementProperty.HostId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-placement.html#cfn-ec2-ec2fleet-placement-hostid
"""
result = self._values.get("host_id")
return result
@builtins.property
def host_resource_group_arn(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.PlacementProperty.HostResourceGroupArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-placement.html#cfn-ec2-ec2fleet-placement-hostresourcegrouparn
"""
result = self._values.get("host_resource_group_arn")
return result
@builtins.property
def partition_number(self) -> typing.Optional[jsii.Number]:
"""``CfnEC2Fleet.PlacementProperty.PartitionNumber``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-placement.html#cfn-ec2-ec2fleet-placement-partitionnumber
"""
result = self._values.get("partition_number")
return result
@builtins.property
def spread_domain(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.PlacementProperty.SpreadDomain``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-placement.html#cfn-ec2-ec2fleet-placement-spreaddomain
"""
result = self._values.get("spread_domain")
return result
@builtins.property
def tenancy(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.PlacementProperty.Tenancy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-placement.html#cfn-ec2-ec2fleet-placement-tenancy
"""
result = self._values.get("tenancy")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PlacementProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnEC2Fleet.SpotOptionsRequestProperty",
jsii_struct_bases=[],
name_mapping={
"allocation_strategy": "allocationStrategy",
"instance_interruption_behavior": "instanceInterruptionBehavior",
"instance_pools_to_use_count": "instancePoolsToUseCount",
"max_total_price": "maxTotalPrice",
"min_target_capacity": "minTargetCapacity",
"single_availability_zone": "singleAvailabilityZone",
"single_instance_type": "singleInstanceType",
},
)
class SpotOptionsRequestProperty:
def __init__(
self,
*,
allocation_strategy: typing.Optional[builtins.str] = None,
instance_interruption_behavior: typing.Optional[builtins.str] = None,
instance_pools_to_use_count: typing.Optional[jsii.Number] = None,
max_total_price: typing.Optional[builtins.str] = None,
min_target_capacity: typing.Optional[jsii.Number] = None,
single_availability_zone: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
single_instance_type: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
) -> None:
"""
:param allocation_strategy: ``CfnEC2Fleet.SpotOptionsRequestProperty.AllocationStrategy``.
:param instance_interruption_behavior: ``CfnEC2Fleet.SpotOptionsRequestProperty.InstanceInterruptionBehavior``.
:param instance_pools_to_use_count: ``CfnEC2Fleet.SpotOptionsRequestProperty.InstancePoolsToUseCount``.
:param max_total_price: ``CfnEC2Fleet.SpotOptionsRequestProperty.MaxTotalPrice``.
:param min_target_capacity: ``CfnEC2Fleet.SpotOptionsRequestProperty.MinTargetCapacity``.
:param single_availability_zone: ``CfnEC2Fleet.SpotOptionsRequestProperty.SingleAvailabilityZone``.
:param single_instance_type: ``CfnEC2Fleet.SpotOptionsRequestProperty.SingleInstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-spotoptionsrequest.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if allocation_strategy is not None:
self._values["allocation_strategy"] = allocation_strategy
if instance_interruption_behavior is not None:
self._values["instance_interruption_behavior"] = instance_interruption_behavior
if instance_pools_to_use_count is not None:
self._values["instance_pools_to_use_count"] = instance_pools_to_use_count
if max_total_price is not None:
self._values["max_total_price"] = max_total_price
if min_target_capacity is not None:
self._values["min_target_capacity"] = min_target_capacity
if single_availability_zone is not None:
self._values["single_availability_zone"] = single_availability_zone
if single_instance_type is not None:
self._values["single_instance_type"] = single_instance_type
@builtins.property
def allocation_strategy(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.SpotOptionsRequestProperty.AllocationStrategy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-spotoptionsrequest.html#cfn-ec2-ec2fleet-spotoptionsrequest-allocationstrategy
"""
result = self._values.get("allocation_strategy")
return result
@builtins.property
def instance_interruption_behavior(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.SpotOptionsRequestProperty.InstanceInterruptionBehavior``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-spotoptionsrequest.html#cfn-ec2-ec2fleet-spotoptionsrequest-instanceinterruptionbehavior
"""
result = self._values.get("instance_interruption_behavior")
return result
@builtins.property
def instance_pools_to_use_count(self) -> typing.Optional[jsii.Number]:
"""``CfnEC2Fleet.SpotOptionsRequestProperty.InstancePoolsToUseCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-spotoptionsrequest.html#cfn-ec2-ec2fleet-spotoptionsrequest-instancepoolstousecount
"""
result = self._values.get("instance_pools_to_use_count")
return result
@builtins.property
def max_total_price(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.SpotOptionsRequestProperty.MaxTotalPrice``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-spotoptionsrequest.html#cfn-ec2-ec2fleet-spotoptionsrequest-maxtotalprice
"""
result = self._values.get("max_total_price")
return result
@builtins.property
def min_target_capacity(self) -> typing.Optional[jsii.Number]:
"""``CfnEC2Fleet.SpotOptionsRequestProperty.MinTargetCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-spotoptionsrequest.html#cfn-ec2-ec2fleet-spotoptionsrequest-mintargetcapacity
"""
result = self._values.get("min_target_capacity")
return result
@builtins.property
def single_availability_zone(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnEC2Fleet.SpotOptionsRequestProperty.SingleAvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-spotoptionsrequest.html#cfn-ec2-ec2fleet-spotoptionsrequest-singleavailabilityzone
"""
result = self._values.get("single_availability_zone")
return result
@builtins.property
def single_instance_type(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnEC2Fleet.SpotOptionsRequestProperty.SingleInstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-spotoptionsrequest.html#cfn-ec2-ec2fleet-spotoptionsrequest-singleinstancetype
"""
result = self._values.get("single_instance_type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SpotOptionsRequestProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnEC2Fleet.TagSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"resource_type": "resourceType", "tags": "tags"},
)
class TagSpecificationProperty:
def __init__(
self,
*,
resource_type: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""
:param resource_type: ``CfnEC2Fleet.TagSpecificationProperty.ResourceType``.
:param tags: ``CfnEC2Fleet.TagSpecificationProperty.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-tagspecification.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if resource_type is not None:
self._values["resource_type"] = resource_type
if tags is not None:
self._values["tags"] = tags
@builtins.property
def resource_type(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.TagSpecificationProperty.ResourceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-tagspecification.html#cfn-ec2-ec2fleet-tagspecification-resourcetype
"""
result = self._values.get("resource_type")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``CfnEC2Fleet.TagSpecificationProperty.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-tagspecification.html#cfn-ec2-ec2fleet-tagspecification-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "TagSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnEC2Fleet.TargetCapacitySpecificationRequestProperty",
jsii_struct_bases=[],
name_mapping={
"total_target_capacity": "totalTargetCapacity",
"default_target_capacity_type": "defaultTargetCapacityType",
"on_demand_target_capacity": "onDemandTargetCapacity",
"spot_target_capacity": "spotTargetCapacity",
},
)
class TargetCapacitySpecificationRequestProperty:
def __init__(
self,
*,
total_target_capacity: jsii.Number,
default_target_capacity_type: typing.Optional[builtins.str] = None,
on_demand_target_capacity: typing.Optional[jsii.Number] = None,
spot_target_capacity: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param total_target_capacity: ``CfnEC2Fleet.TargetCapacitySpecificationRequestProperty.TotalTargetCapacity``.
:param default_target_capacity_type: ``CfnEC2Fleet.TargetCapacitySpecificationRequestProperty.DefaultTargetCapacityType``.
:param on_demand_target_capacity: ``CfnEC2Fleet.TargetCapacitySpecificationRequestProperty.OnDemandTargetCapacity``.
:param spot_target_capacity: ``CfnEC2Fleet.TargetCapacitySpecificationRequestProperty.SpotTargetCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-targetcapacityspecificationrequest.html
"""
self._values: typing.Dict[str, typing.Any] = {
"total_target_capacity": total_target_capacity,
}
if default_target_capacity_type is not None:
self._values["default_target_capacity_type"] = default_target_capacity_type
if on_demand_target_capacity is not None:
self._values["on_demand_target_capacity"] = on_demand_target_capacity
if spot_target_capacity is not None:
self._values["spot_target_capacity"] = spot_target_capacity
@builtins.property
def total_target_capacity(self) -> jsii.Number:
"""``CfnEC2Fleet.TargetCapacitySpecificationRequestProperty.TotalTargetCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-targetcapacityspecificationrequest.html#cfn-ec2-ec2fleet-targetcapacityspecificationrequest-totaltargetcapacity
"""
result = self._values.get("total_target_capacity")
assert result is not None, "Required property 'total_target_capacity' is missing"
return result
@builtins.property
def default_target_capacity_type(self) -> typing.Optional[builtins.str]:
"""``CfnEC2Fleet.TargetCapacitySpecificationRequestProperty.DefaultTargetCapacityType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-targetcapacityspecificationrequest.html#cfn-ec2-ec2fleet-targetcapacityspecificationrequest-defaulttargetcapacitytype
"""
result = self._values.get("default_target_capacity_type")
return result
@builtins.property
def on_demand_target_capacity(self) -> typing.Optional[jsii.Number]:
"""``CfnEC2Fleet.TargetCapacitySpecificationRequestProperty.OnDemandTargetCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-targetcapacityspecificationrequest.html#cfn-ec2-ec2fleet-targetcapacityspecificationrequest-ondemandtargetcapacity
"""
result = self._values.get("on_demand_target_capacity")
return result
@builtins.property
def spot_target_capacity(self) -> typing.Optional[jsii.Number]:
"""``CfnEC2Fleet.TargetCapacitySpecificationRequestProperty.SpotTargetCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ec2fleet-targetcapacityspecificationrequest.html#cfn-ec2-ec2fleet-targetcapacityspecificationrequest-spottargetcapacity
"""
result = self._values.get("spot_target_capacity")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "TargetCapacitySpecificationRequestProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnEC2FleetProps",
jsii_struct_bases=[],
name_mapping={
"launch_template_configs": "launchTemplateConfigs",
"target_capacity_specification": "targetCapacitySpecification",
"excess_capacity_termination_policy": "excessCapacityTerminationPolicy",
"on_demand_options": "onDemandOptions",
"replace_unhealthy_instances": "replaceUnhealthyInstances",
"spot_options": "spotOptions",
"tag_specifications": "tagSpecifications",
"terminate_instances_with_expiration": "terminateInstancesWithExpiration",
"type": "type",
"valid_from": "validFrom",
"valid_until": "validUntil",
},
)
class CfnEC2FleetProps:
def __init__(
self,
*,
launch_template_configs: typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnEC2Fleet.FleetLaunchTemplateConfigRequestProperty]]],
target_capacity_specification: typing.Union[aws_cdk.core.IResolvable, CfnEC2Fleet.TargetCapacitySpecificationRequestProperty],
excess_capacity_termination_policy: typing.Optional[builtins.str] = None,
on_demand_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnEC2Fleet.OnDemandOptionsRequestProperty]] = None,
replace_unhealthy_instances: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
spot_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnEC2Fleet.SpotOptionsRequestProperty]] = None,
tag_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnEC2Fleet.TagSpecificationProperty]]]] = None,
terminate_instances_with_expiration: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
type: typing.Optional[builtins.str] = None,
valid_from: typing.Optional[builtins.str] = None,
valid_until: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::EC2Fleet``.
:param launch_template_configs: ``AWS::EC2::EC2Fleet.LaunchTemplateConfigs``.
:param target_capacity_specification: ``AWS::EC2::EC2Fleet.TargetCapacitySpecification``.
:param excess_capacity_termination_policy: ``AWS::EC2::EC2Fleet.ExcessCapacityTerminationPolicy``.
:param on_demand_options: ``AWS::EC2::EC2Fleet.OnDemandOptions``.
:param replace_unhealthy_instances: ``AWS::EC2::EC2Fleet.ReplaceUnhealthyInstances``.
:param spot_options: ``AWS::EC2::EC2Fleet.SpotOptions``.
:param tag_specifications: ``AWS::EC2::EC2Fleet.TagSpecifications``.
:param terminate_instances_with_expiration: ``AWS::EC2::EC2Fleet.TerminateInstancesWithExpiration``.
:param type: ``AWS::EC2::EC2Fleet.Type``.
:param valid_from: ``AWS::EC2::EC2Fleet.ValidFrom``.
:param valid_until: ``AWS::EC2::EC2Fleet.ValidUntil``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html
"""
self._values: typing.Dict[str, typing.Any] = {
"launch_template_configs": launch_template_configs,
"target_capacity_specification": target_capacity_specification,
}
if excess_capacity_termination_policy is not None:
self._values["excess_capacity_termination_policy"] = excess_capacity_termination_policy
if on_demand_options is not None:
self._values["on_demand_options"] = on_demand_options
if replace_unhealthy_instances is not None:
self._values["replace_unhealthy_instances"] = replace_unhealthy_instances
if spot_options is not None:
self._values["spot_options"] = spot_options
if tag_specifications is not None:
self._values["tag_specifications"] = tag_specifications
if terminate_instances_with_expiration is not None:
self._values["terminate_instances_with_expiration"] = terminate_instances_with_expiration
if type is not None:
self._values["type"] = type
if valid_from is not None:
self._values["valid_from"] = valid_from
if valid_until is not None:
self._values["valid_until"] = valid_until
@builtins.property
def launch_template_configs(
self,
) -> typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnEC2Fleet.FleetLaunchTemplateConfigRequestProperty]]]:
"""``AWS::EC2::EC2Fleet.LaunchTemplateConfigs``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-launchtemplateconfigs
"""
result = self._values.get("launch_template_configs")
assert result is not None, "Required property 'launch_template_configs' is missing"
return result
@builtins.property
def target_capacity_specification(
self,
) -> typing.Union[aws_cdk.core.IResolvable, CfnEC2Fleet.TargetCapacitySpecificationRequestProperty]:
"""``AWS::EC2::EC2Fleet.TargetCapacitySpecification``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-targetcapacityspecification
"""
result = self._values.get("target_capacity_specification")
assert result is not None, "Required property 'target_capacity_specification' is missing"
return result
@builtins.property
def excess_capacity_termination_policy(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EC2Fleet.ExcessCapacityTerminationPolicy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-excesscapacityterminationpolicy
"""
result = self._values.get("excess_capacity_termination_policy")
return result
@builtins.property
def on_demand_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnEC2Fleet.OnDemandOptionsRequestProperty]]:
"""``AWS::EC2::EC2Fleet.OnDemandOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-ondemandoptions
"""
result = self._values.get("on_demand_options")
return result
@builtins.property
def replace_unhealthy_instances(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::EC2Fleet.ReplaceUnhealthyInstances``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-replaceunhealthyinstances
"""
result = self._values.get("replace_unhealthy_instances")
return result
@builtins.property
def spot_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnEC2Fleet.SpotOptionsRequestProperty]]:
"""``AWS::EC2::EC2Fleet.SpotOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-spotoptions
"""
result = self._values.get("spot_options")
return result
@builtins.property
def tag_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnEC2Fleet.TagSpecificationProperty]]]]:
"""``AWS::EC2::EC2Fleet.TagSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-tagspecifications
"""
result = self._values.get("tag_specifications")
return result
@builtins.property
def terminate_instances_with_expiration(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::EC2Fleet.TerminateInstancesWithExpiration``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-terminateinstanceswithexpiration
"""
result = self._values.get("terminate_instances_with_expiration")
return result
@builtins.property
def type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EC2Fleet.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-type
"""
result = self._values.get("type")
return result
@builtins.property
def valid_from(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EC2Fleet.ValidFrom``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-validfrom
"""
result = self._values.get("valid_from")
return result
@builtins.property
def valid_until(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EC2Fleet.ValidUntil``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ec2fleet.html#cfn-ec2-ec2fleet-validuntil
"""
result = self._values.get("valid_until")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnEC2FleetProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnEIP(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnEIP",
):
"""A CloudFormation ``AWS::EC2::EIP``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html
:cloudformationResource: AWS::EC2::EIP
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
domain: typing.Optional[builtins.str] = None,
instance_id: typing.Optional[builtins.str] = None,
public_ipv4_pool: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::EIP``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param domain: ``AWS::EC2::EIP.Domain``.
:param instance_id: ``AWS::EC2::EIP.InstanceId``.
:param public_ipv4_pool: ``AWS::EC2::EIP.PublicIpv4Pool``.
:param tags: ``AWS::EC2::EIP.Tags``.
"""
props = CfnEIPProps(
domain=domain,
instance_id=instance_id,
public_ipv4_pool=public_ipv4_pool,
tags=tags,
)
jsii.create(CfnEIP, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrAllocationId")
def attr_allocation_id(self) -> builtins.str:
"""
:cloudformationAttribute: AllocationId
"""
return jsii.get(self, "attrAllocationId")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::EIP.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="domain")
def domain(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIP.Domain``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-domain
"""
return jsii.get(self, "domain")
@domain.setter # type: ignore
def domain(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "domain", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceId")
def instance_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIP.InstanceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-instanceid
"""
return jsii.get(self, "instanceId")
@instance_id.setter # type: ignore
def instance_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "instanceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="publicIpv4Pool")
def public_ipv4_pool(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIP.PublicIpv4Pool``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-publicipv4pool
"""
return jsii.get(self, "publicIpv4Pool")
@public_ipv4_pool.setter # type: ignore
def public_ipv4_pool(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "publicIpv4Pool", value)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnEIPAssociation(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnEIPAssociation",
):
"""A CloudFormation ``AWS::EC2::EIPAssociation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html
:cloudformationResource: AWS::EC2::EIPAssociation
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
allocation_id: typing.Optional[builtins.str] = None,
eip: typing.Optional[builtins.str] = None,
instance_id: typing.Optional[builtins.str] = None,
network_interface_id: typing.Optional[builtins.str] = None,
private_ip_address: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::EIPAssociation``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param allocation_id: ``AWS::EC2::EIPAssociation.AllocationId``.
:param eip: ``AWS::EC2::EIPAssociation.EIP``.
:param instance_id: ``AWS::EC2::EIPAssociation.InstanceId``.
:param network_interface_id: ``AWS::EC2::EIPAssociation.NetworkInterfaceId``.
:param private_ip_address: ``AWS::EC2::EIPAssociation.PrivateIpAddress``.
"""
props = CfnEIPAssociationProps(
allocation_id=allocation_id,
eip=eip,
instance_id=instance_id,
network_interface_id=network_interface_id,
private_ip_address=private_ip_address,
)
jsii.create(CfnEIPAssociation, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="allocationId")
def allocation_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIPAssociation.AllocationId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-allocationid
"""
return jsii.get(self, "allocationId")
@allocation_id.setter # type: ignore
def allocation_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "allocationId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="eip")
def eip(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIPAssociation.EIP``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-eip
"""
return jsii.get(self, "eip")
@eip.setter # type: ignore
def eip(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "eip", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceId")
def instance_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIPAssociation.InstanceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-instanceid
"""
return jsii.get(self, "instanceId")
@instance_id.setter # type: ignore
def instance_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "instanceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="networkInterfaceId")
def network_interface_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIPAssociation.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-networkinterfaceid
"""
return jsii.get(self, "networkInterfaceId")
@network_interface_id.setter # type: ignore
def network_interface_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "networkInterfaceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="privateIpAddress")
def private_ip_address(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIPAssociation.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-PrivateIpAddress
"""
return jsii.get(self, "privateIpAddress")
@private_ip_address.setter # type: ignore
def private_ip_address(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "privateIpAddress", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnEIPAssociationProps",
jsii_struct_bases=[],
name_mapping={
"allocation_id": "allocationId",
"eip": "eip",
"instance_id": "instanceId",
"network_interface_id": "networkInterfaceId",
"private_ip_address": "privateIpAddress",
},
)
class CfnEIPAssociationProps:
def __init__(
self,
*,
allocation_id: typing.Optional[builtins.str] = None,
eip: typing.Optional[builtins.str] = None,
instance_id: typing.Optional[builtins.str] = None,
network_interface_id: typing.Optional[builtins.str] = None,
private_ip_address: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::EIPAssociation``.
:param allocation_id: ``AWS::EC2::EIPAssociation.AllocationId``.
:param eip: ``AWS::EC2::EIPAssociation.EIP``.
:param instance_id: ``AWS::EC2::EIPAssociation.InstanceId``.
:param network_interface_id: ``AWS::EC2::EIPAssociation.NetworkInterfaceId``.
:param private_ip_address: ``AWS::EC2::EIPAssociation.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if allocation_id is not None:
self._values["allocation_id"] = allocation_id
if eip is not None:
self._values["eip"] = eip
if instance_id is not None:
self._values["instance_id"] = instance_id
if network_interface_id is not None:
self._values["network_interface_id"] = network_interface_id
if private_ip_address is not None:
self._values["private_ip_address"] = private_ip_address
@builtins.property
def allocation_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIPAssociation.AllocationId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-allocationid
"""
result = self._values.get("allocation_id")
return result
@builtins.property
def eip(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIPAssociation.EIP``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-eip
"""
result = self._values.get("eip")
return result
@builtins.property
def instance_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIPAssociation.InstanceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-instanceid
"""
result = self._values.get("instance_id")
return result
@builtins.property
def network_interface_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIPAssociation.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-networkinterfaceid
"""
result = self._values.get("network_interface_id")
return result
@builtins.property
def private_ip_address(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIPAssociation.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip-association.html#cfn-ec2-eipassociation-PrivateIpAddress
"""
result = self._values.get("private_ip_address")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnEIPAssociationProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnEIPProps",
jsii_struct_bases=[],
name_mapping={
"domain": "domain",
"instance_id": "instanceId",
"public_ipv4_pool": "publicIpv4Pool",
"tags": "tags",
},
)
class CfnEIPProps:
def __init__(
self,
*,
domain: typing.Optional[builtins.str] = None,
instance_id: typing.Optional[builtins.str] = None,
public_ipv4_pool: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::EIP``.
:param domain: ``AWS::EC2::EIP.Domain``.
:param instance_id: ``AWS::EC2::EIP.InstanceId``.
:param public_ipv4_pool: ``AWS::EC2::EIP.PublicIpv4Pool``.
:param tags: ``AWS::EC2::EIP.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if domain is not None:
self._values["domain"] = domain
if instance_id is not None:
self._values["instance_id"] = instance_id
if public_ipv4_pool is not None:
self._values["public_ipv4_pool"] = public_ipv4_pool
if tags is not None:
self._values["tags"] = tags
@builtins.property
def domain(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIP.Domain``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-domain
"""
result = self._values.get("domain")
return result
@builtins.property
def instance_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIP.InstanceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-instanceid
"""
result = self._values.get("instance_id")
return result
@builtins.property
def public_ipv4_pool(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::EIP.PublicIpv4Pool``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-publicipv4pool
"""
result = self._values.get("public_ipv4_pool")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::EIP.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html#cfn-ec2-eip-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnEIPProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnEgressOnlyInternetGateway(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnEgressOnlyInternetGateway",
):
"""A CloudFormation ``AWS::EC2::EgressOnlyInternetGateway``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-egressonlyinternetgateway.html
:cloudformationResource: AWS::EC2::EgressOnlyInternetGateway
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
vpc_id: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::EgressOnlyInternetGateway``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param vpc_id: ``AWS::EC2::EgressOnlyInternetGateway.VpcId``.
"""
props = CfnEgressOnlyInternetGatewayProps(vpc_id=vpc_id)
jsii.create(CfnEgressOnlyInternetGateway, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::EgressOnlyInternetGateway.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-egressonlyinternetgateway.html#cfn-ec2-egressonlyinternetgateway-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: builtins.str) -> None:
jsii.set(self, "vpcId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnEgressOnlyInternetGatewayProps",
jsii_struct_bases=[],
name_mapping={"vpc_id": "vpcId"},
)
class CfnEgressOnlyInternetGatewayProps:
def __init__(self, *, vpc_id: builtins.str) -> None:
"""Properties for defining a ``AWS::EC2::EgressOnlyInternetGateway``.
:param vpc_id: ``AWS::EC2::EgressOnlyInternetGateway.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-egressonlyinternetgateway.html
"""
self._values: typing.Dict[str, typing.Any] = {
"vpc_id": vpc_id,
}
@builtins.property
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::EgressOnlyInternetGateway.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-egressonlyinternetgateway.html#cfn-ec2-egressonlyinternetgateway-vpcid
"""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnEgressOnlyInternetGatewayProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnFlowLog(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnFlowLog",
):
"""A CloudFormation ``AWS::EC2::FlowLog``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html
:cloudformationResource: AWS::EC2::FlowLog
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
resource_id: builtins.str,
resource_type: builtins.str,
traffic_type: builtins.str,
deliver_logs_permission_arn: typing.Optional[builtins.str] = None,
log_destination: typing.Optional[builtins.str] = None,
log_destination_type: typing.Optional[builtins.str] = None,
log_format: typing.Optional[builtins.str] = None,
log_group_name: typing.Optional[builtins.str] = None,
max_aggregation_interval: typing.Optional[jsii.Number] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::FlowLog``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param resource_id: ``AWS::EC2::FlowLog.ResourceId``.
:param resource_type: ``AWS::EC2::FlowLog.ResourceType``.
:param traffic_type: ``AWS::EC2::FlowLog.TrafficType``.
:param deliver_logs_permission_arn: ``AWS::EC2::FlowLog.DeliverLogsPermissionArn``.
:param log_destination: ``AWS::EC2::FlowLog.LogDestination``.
:param log_destination_type: ``AWS::EC2::FlowLog.LogDestinationType``.
:param log_format: ``AWS::EC2::FlowLog.LogFormat``.
:param log_group_name: ``AWS::EC2::FlowLog.LogGroupName``.
:param max_aggregation_interval: ``AWS::EC2::FlowLog.MaxAggregationInterval``.
:param tags: ``AWS::EC2::FlowLog.Tags``.
"""
props = CfnFlowLogProps(
resource_id=resource_id,
resource_type=resource_type,
traffic_type=traffic_type,
deliver_logs_permission_arn=deliver_logs_permission_arn,
log_destination=log_destination,
log_destination_type=log_destination_type,
log_format=log_format,
log_group_name=log_group_name,
max_aggregation_interval=max_aggregation_interval,
tags=tags,
)
jsii.create(CfnFlowLog, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrId")
def attr_id(self) -> builtins.str:
"""
:cloudformationAttribute: Id
"""
return jsii.get(self, "attrId")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::FlowLog.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="resourceId")
def resource_id(self) -> builtins.str:
"""``AWS::EC2::FlowLog.ResourceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-resourceid
"""
return jsii.get(self, "resourceId")
@resource_id.setter # type: ignore
def resource_id(self, value: builtins.str) -> None:
jsii.set(self, "resourceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="resourceType")
def resource_type(self) -> builtins.str:
"""``AWS::EC2::FlowLog.ResourceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-resourcetype
"""
return jsii.get(self, "resourceType")
@resource_type.setter # type: ignore
def resource_type(self, value: builtins.str) -> None:
jsii.set(self, "resourceType", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="trafficType")
def traffic_type(self) -> builtins.str:
"""``AWS::EC2::FlowLog.TrafficType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-traffictype
"""
return jsii.get(self, "trafficType")
@traffic_type.setter # type: ignore
def traffic_type(self, value: builtins.str) -> None:
jsii.set(self, "trafficType", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="deliverLogsPermissionArn")
def deliver_logs_permission_arn(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::FlowLog.DeliverLogsPermissionArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-deliverlogspermissionarn
"""
return jsii.get(self, "deliverLogsPermissionArn")
@deliver_logs_permission_arn.setter # type: ignore
def deliver_logs_permission_arn(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "deliverLogsPermissionArn", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="logDestination")
def log_destination(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::FlowLog.LogDestination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-logdestination
"""
return jsii.get(self, "logDestination")
@log_destination.setter # type: ignore
def log_destination(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "logDestination", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="logDestinationType")
def log_destination_type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::FlowLog.LogDestinationType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-logdestinationtype
"""
return jsii.get(self, "logDestinationType")
@log_destination_type.setter # type: ignore
def log_destination_type(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "logDestinationType", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="logFormat")
def log_format(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::FlowLog.LogFormat``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-logformat
"""
return jsii.get(self, "logFormat")
@log_format.setter # type: ignore
def log_format(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "logFormat", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="logGroupName")
def log_group_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::FlowLog.LogGroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-loggroupname
"""
return jsii.get(self, "logGroupName")
@log_group_name.setter # type: ignore
def log_group_name(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "logGroupName", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="maxAggregationInterval")
def max_aggregation_interval(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::FlowLog.MaxAggregationInterval``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-maxaggregationinterval
"""
return jsii.get(self, "maxAggregationInterval")
@max_aggregation_interval.setter # type: ignore
def max_aggregation_interval(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "maxAggregationInterval", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnFlowLogProps",
jsii_struct_bases=[],
name_mapping={
"resource_id": "resourceId",
"resource_type": "resourceType",
"traffic_type": "trafficType",
"deliver_logs_permission_arn": "deliverLogsPermissionArn",
"log_destination": "logDestination",
"log_destination_type": "logDestinationType",
"log_format": "logFormat",
"log_group_name": "logGroupName",
"max_aggregation_interval": "maxAggregationInterval",
"tags": "tags",
},
)
class CfnFlowLogProps:
def __init__(
self,
*,
resource_id: builtins.str,
resource_type: builtins.str,
traffic_type: builtins.str,
deliver_logs_permission_arn: typing.Optional[builtins.str] = None,
log_destination: typing.Optional[builtins.str] = None,
log_destination_type: typing.Optional[builtins.str] = None,
log_format: typing.Optional[builtins.str] = None,
log_group_name: typing.Optional[builtins.str] = None,
max_aggregation_interval: typing.Optional[jsii.Number] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::FlowLog``.
:param resource_id: ``AWS::EC2::FlowLog.ResourceId``.
:param resource_type: ``AWS::EC2::FlowLog.ResourceType``.
:param traffic_type: ``AWS::EC2::FlowLog.TrafficType``.
:param deliver_logs_permission_arn: ``AWS::EC2::FlowLog.DeliverLogsPermissionArn``.
:param log_destination: ``AWS::EC2::FlowLog.LogDestination``.
:param log_destination_type: ``AWS::EC2::FlowLog.LogDestinationType``.
:param log_format: ``AWS::EC2::FlowLog.LogFormat``.
:param log_group_name: ``AWS::EC2::FlowLog.LogGroupName``.
:param max_aggregation_interval: ``AWS::EC2::FlowLog.MaxAggregationInterval``.
:param tags: ``AWS::EC2::FlowLog.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html
"""
self._values: typing.Dict[str, typing.Any] = {
"resource_id": resource_id,
"resource_type": resource_type,
"traffic_type": traffic_type,
}
if deliver_logs_permission_arn is not None:
self._values["deliver_logs_permission_arn"] = deliver_logs_permission_arn
if log_destination is not None:
self._values["log_destination"] = log_destination
if log_destination_type is not None:
self._values["log_destination_type"] = log_destination_type
if log_format is not None:
self._values["log_format"] = log_format
if log_group_name is not None:
self._values["log_group_name"] = log_group_name
if max_aggregation_interval is not None:
self._values["max_aggregation_interval"] = max_aggregation_interval
if tags is not None:
self._values["tags"] = tags
@builtins.property
def resource_id(self) -> builtins.str:
"""``AWS::EC2::FlowLog.ResourceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-resourceid
"""
result = self._values.get("resource_id")
assert result is not None, "Required property 'resource_id' is missing"
return result
@builtins.property
def resource_type(self) -> builtins.str:
"""``AWS::EC2::FlowLog.ResourceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-resourcetype
"""
result = self._values.get("resource_type")
assert result is not None, "Required property 'resource_type' is missing"
return result
@builtins.property
def traffic_type(self) -> builtins.str:
"""``AWS::EC2::FlowLog.TrafficType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-traffictype
"""
result = self._values.get("traffic_type")
assert result is not None, "Required property 'traffic_type' is missing"
return result
@builtins.property
def deliver_logs_permission_arn(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::FlowLog.DeliverLogsPermissionArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-deliverlogspermissionarn
"""
result = self._values.get("deliver_logs_permission_arn")
return result
@builtins.property
def log_destination(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::FlowLog.LogDestination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-logdestination
"""
result = self._values.get("log_destination")
return result
@builtins.property
def log_destination_type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::FlowLog.LogDestinationType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-logdestinationtype
"""
result = self._values.get("log_destination_type")
return result
@builtins.property
def log_format(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::FlowLog.LogFormat``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-logformat
"""
result = self._values.get("log_format")
return result
@builtins.property
def log_group_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::FlowLog.LogGroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-loggroupname
"""
result = self._values.get("log_group_name")
return result
@builtins.property
def max_aggregation_interval(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::FlowLog.MaxAggregationInterval``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-maxaggregationinterval
"""
result = self._values.get("max_aggregation_interval")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::FlowLog.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-flowlog.html#cfn-ec2-flowlog-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnFlowLogProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnGatewayRouteTableAssociation(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnGatewayRouteTableAssociation",
):
"""A CloudFormation ``AWS::EC2::GatewayRouteTableAssociation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-gatewayroutetableassociation.html
:cloudformationResource: AWS::EC2::GatewayRouteTableAssociation
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
gateway_id: builtins.str,
route_table_id: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::GatewayRouteTableAssociation``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param gateway_id: ``AWS::EC2::GatewayRouteTableAssociation.GatewayId``.
:param route_table_id: ``AWS::EC2::GatewayRouteTableAssociation.RouteTableId``.
"""
props = CfnGatewayRouteTableAssociationProps(
gateway_id=gateway_id, route_table_id=route_table_id
)
jsii.create(CfnGatewayRouteTableAssociation, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrAssociationId")
def attr_association_id(self) -> builtins.str:
"""
:cloudformationAttribute: AssociationId
"""
return jsii.get(self, "attrAssociationId")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="gatewayId")
def gateway_id(self) -> builtins.str:
"""``AWS::EC2::GatewayRouteTableAssociation.GatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-gatewayroutetableassociation.html#cfn-ec2-gatewayroutetableassociation-gatewayid
"""
return jsii.get(self, "gatewayId")
@gateway_id.setter # type: ignore
def gateway_id(self, value: builtins.str) -> None:
jsii.set(self, "gatewayId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="routeTableId")
def route_table_id(self) -> builtins.str:
"""``AWS::EC2::GatewayRouteTableAssociation.RouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-gatewayroutetableassociation.html#cfn-ec2-gatewayroutetableassociation-routetableid
"""
return jsii.get(self, "routeTableId")
@route_table_id.setter # type: ignore
def route_table_id(self, value: builtins.str) -> None:
jsii.set(self, "routeTableId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnGatewayRouteTableAssociationProps",
jsii_struct_bases=[],
name_mapping={"gateway_id": "gatewayId", "route_table_id": "routeTableId"},
)
class CfnGatewayRouteTableAssociationProps:
def __init__(
self,
*,
gateway_id: builtins.str,
route_table_id: builtins.str,
) -> None:
"""Properties for defining a ``AWS::EC2::GatewayRouteTableAssociation``.
:param gateway_id: ``AWS::EC2::GatewayRouteTableAssociation.GatewayId``.
:param route_table_id: ``AWS::EC2::GatewayRouteTableAssociation.RouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-gatewayroutetableassociation.html
"""
self._values: typing.Dict[str, typing.Any] = {
"gateway_id": gateway_id,
"route_table_id": route_table_id,
}
@builtins.property
def gateway_id(self) -> builtins.str:
"""``AWS::EC2::GatewayRouteTableAssociation.GatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-gatewayroutetableassociation.html#cfn-ec2-gatewayroutetableassociation-gatewayid
"""
result = self._values.get("gateway_id")
assert result is not None, "Required property 'gateway_id' is missing"
return result
@builtins.property
def route_table_id(self) -> builtins.str:
"""``AWS::EC2::GatewayRouteTableAssociation.RouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-gatewayroutetableassociation.html#cfn-ec2-gatewayroutetableassociation-routetableid
"""
result = self._values.get("route_table_id")
assert result is not None, "Required property 'route_table_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnGatewayRouteTableAssociationProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnHost(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnHost",
):
"""A CloudFormation ``AWS::EC2::Host``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html
:cloudformationResource: AWS::EC2::Host
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
availability_zone: builtins.str,
instance_type: builtins.str,
auto_placement: typing.Optional[builtins.str] = None,
host_recovery: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::Host``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param availability_zone: ``AWS::EC2::Host.AvailabilityZone``.
:param instance_type: ``AWS::EC2::Host.InstanceType``.
:param auto_placement: ``AWS::EC2::Host.AutoPlacement``.
:param host_recovery: ``AWS::EC2::Host.HostRecovery``.
"""
props = CfnHostProps(
availability_zone=availability_zone,
instance_type=instance_type,
auto_placement=auto_placement,
host_recovery=host_recovery,
)
jsii.create(CfnHost, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZone")
def availability_zone(self) -> builtins.str:
"""``AWS::EC2::Host.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html#cfn-ec2-host-availabilityzone
"""
return jsii.get(self, "availabilityZone")
@availability_zone.setter # type: ignore
def availability_zone(self, value: builtins.str) -> None:
jsii.set(self, "availabilityZone", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceType")
def instance_type(self) -> builtins.str:
"""``AWS::EC2::Host.InstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html#cfn-ec2-host-instancetype
"""
return jsii.get(self, "instanceType")
@instance_type.setter # type: ignore
def instance_type(self, value: builtins.str) -> None:
jsii.set(self, "instanceType", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="autoPlacement")
def auto_placement(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Host.AutoPlacement``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html#cfn-ec2-host-autoplacement
"""
return jsii.get(self, "autoPlacement")
@auto_placement.setter # type: ignore
def auto_placement(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "autoPlacement", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="hostRecovery")
def host_recovery(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Host.HostRecovery``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html#cfn-ec2-host-hostrecovery
"""
return jsii.get(self, "hostRecovery")
@host_recovery.setter # type: ignore
def host_recovery(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "hostRecovery", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnHostProps",
jsii_struct_bases=[],
name_mapping={
"availability_zone": "availabilityZone",
"instance_type": "instanceType",
"auto_placement": "autoPlacement",
"host_recovery": "hostRecovery",
},
)
class CfnHostProps:
def __init__(
self,
*,
availability_zone: builtins.str,
instance_type: builtins.str,
auto_placement: typing.Optional[builtins.str] = None,
host_recovery: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::Host``.
:param availability_zone: ``AWS::EC2::Host.AvailabilityZone``.
:param instance_type: ``AWS::EC2::Host.InstanceType``.
:param auto_placement: ``AWS::EC2::Host.AutoPlacement``.
:param host_recovery: ``AWS::EC2::Host.HostRecovery``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html
"""
self._values: typing.Dict[str, typing.Any] = {
"availability_zone": availability_zone,
"instance_type": instance_type,
}
if auto_placement is not None:
self._values["auto_placement"] = auto_placement
if host_recovery is not None:
self._values["host_recovery"] = host_recovery
@builtins.property
def availability_zone(self) -> builtins.str:
"""``AWS::EC2::Host.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html#cfn-ec2-host-availabilityzone
"""
result = self._values.get("availability_zone")
assert result is not None, "Required property 'availability_zone' is missing"
return result
@builtins.property
def instance_type(self) -> builtins.str:
"""``AWS::EC2::Host.InstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html#cfn-ec2-host-instancetype
"""
result = self._values.get("instance_type")
assert result is not None, "Required property 'instance_type' is missing"
return result
@builtins.property
def auto_placement(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Host.AutoPlacement``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html#cfn-ec2-host-autoplacement
"""
result = self._values.get("auto_placement")
return result
@builtins.property
def host_recovery(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Host.HostRecovery``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-host.html#cfn-ec2-host-hostrecovery
"""
result = self._values.get("host_recovery")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnHostProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnInstance(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnInstance",
):
"""A CloudFormation ``AWS::EC2::Instance``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html
:cloudformationResource: AWS::EC2::Instance
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
additional_info: typing.Optional[builtins.str] = None,
affinity: typing.Optional[builtins.str] = None,
availability_zone: typing.Optional[builtins.str] = None,
block_device_mappings: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.BlockDeviceMappingProperty"]]]] = None,
cpu_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.CpuOptionsProperty"]] = None,
credit_specification: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.CreditSpecificationProperty"]] = None,
disable_api_termination: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
ebs_optimized: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
elastic_gpu_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.ElasticGpuSpecificationProperty"]]]] = None,
elastic_inference_accelerators: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.ElasticInferenceAcceleratorProperty"]]]] = None,
enclave_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.EnclaveOptionsProperty"]] = None,
hibernation_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.HibernationOptionsProperty"]] = None,
host_id: typing.Optional[builtins.str] = None,
host_resource_group_arn: typing.Optional[builtins.str] = None,
iam_instance_profile: typing.Optional[builtins.str] = None,
image_id: typing.Optional[builtins.str] = None,
instance_initiated_shutdown_behavior: typing.Optional[builtins.str] = None,
instance_type: typing.Optional[builtins.str] = None,
ipv6_address_count: typing.Optional[jsii.Number] = None,
ipv6_addresses: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.InstanceIpv6AddressProperty"]]]] = None,
kernel_id: typing.Optional[builtins.str] = None,
key_name: typing.Optional[builtins.str] = None,
launch_template: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.LaunchTemplateSpecificationProperty"]] = None,
license_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.LicenseSpecificationProperty"]]]] = None,
monitoring: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
network_interfaces: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.NetworkInterfaceProperty"]]]] = None,
placement_group_name: typing.Optional[builtins.str] = None,
private_ip_address: typing.Optional[builtins.str] = None,
ramdisk_id: typing.Optional[builtins.str] = None,
security_group_ids: typing.Optional[typing.List[builtins.str]] = None,
security_groups: typing.Optional[typing.List[builtins.str]] = None,
source_dest_check: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
ssm_associations: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.SsmAssociationProperty"]]]] = None,
subnet_id: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
tenancy: typing.Optional[builtins.str] = None,
user_data: typing.Optional[builtins.str] = None,
volumes: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.VolumeProperty"]]]] = None,
) -> None:
"""Create a new ``AWS::EC2::Instance``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param additional_info: ``AWS::EC2::Instance.AdditionalInfo``.
:param affinity: ``AWS::EC2::Instance.Affinity``.
:param availability_zone: ``AWS::EC2::Instance.AvailabilityZone``.
:param block_device_mappings: ``AWS::EC2::Instance.BlockDeviceMappings``.
:param cpu_options: ``AWS::EC2::Instance.CpuOptions``.
:param credit_specification: ``AWS::EC2::Instance.CreditSpecification``.
:param disable_api_termination: ``AWS::EC2::Instance.DisableApiTermination``.
:param ebs_optimized: ``AWS::EC2::Instance.EbsOptimized``.
:param elastic_gpu_specifications: ``AWS::EC2::Instance.ElasticGpuSpecifications``.
:param elastic_inference_accelerators: ``AWS::EC2::Instance.ElasticInferenceAccelerators``.
:param enclave_options: ``AWS::EC2::Instance.EnclaveOptions``.
:param hibernation_options: ``AWS::EC2::Instance.HibernationOptions``.
:param host_id: ``AWS::EC2::Instance.HostId``.
:param host_resource_group_arn: ``AWS::EC2::Instance.HostResourceGroupArn``.
:param iam_instance_profile: ``AWS::EC2::Instance.IamInstanceProfile``.
:param image_id: ``AWS::EC2::Instance.ImageId``.
:param instance_initiated_shutdown_behavior: ``AWS::EC2::Instance.InstanceInitiatedShutdownBehavior``.
:param instance_type: ``AWS::EC2::Instance.InstanceType``.
:param ipv6_address_count: ``AWS::EC2::Instance.Ipv6AddressCount``.
:param ipv6_addresses: ``AWS::EC2::Instance.Ipv6Addresses``.
:param kernel_id: ``AWS::EC2::Instance.KernelId``.
:param key_name: ``AWS::EC2::Instance.KeyName``.
:param launch_template: ``AWS::EC2::Instance.LaunchTemplate``.
:param license_specifications: ``AWS::EC2::Instance.LicenseSpecifications``.
:param monitoring: ``AWS::EC2::Instance.Monitoring``.
:param network_interfaces: ``AWS::EC2::Instance.NetworkInterfaces``.
:param placement_group_name: ``AWS::EC2::Instance.PlacementGroupName``.
:param private_ip_address: ``AWS::EC2::Instance.PrivateIpAddress``.
:param ramdisk_id: ``AWS::EC2::Instance.RamdiskId``.
:param security_group_ids: ``AWS::EC2::Instance.SecurityGroupIds``.
:param security_groups: ``AWS::EC2::Instance.SecurityGroups``.
:param source_dest_check: ``AWS::EC2::Instance.SourceDestCheck``.
:param ssm_associations: ``AWS::EC2::Instance.SsmAssociations``.
:param subnet_id: ``AWS::EC2::Instance.SubnetId``.
:param tags: ``AWS::EC2::Instance.Tags``.
:param tenancy: ``AWS::EC2::Instance.Tenancy``.
:param user_data: ``AWS::EC2::Instance.UserData``.
:param volumes: ``AWS::EC2::Instance.Volumes``.
"""
props = CfnInstanceProps(
additional_info=additional_info,
affinity=affinity,
availability_zone=availability_zone,
block_device_mappings=block_device_mappings,
cpu_options=cpu_options,
credit_specification=credit_specification,
disable_api_termination=disable_api_termination,
ebs_optimized=ebs_optimized,
elastic_gpu_specifications=elastic_gpu_specifications,
elastic_inference_accelerators=elastic_inference_accelerators,
enclave_options=enclave_options,
hibernation_options=hibernation_options,
host_id=host_id,
host_resource_group_arn=host_resource_group_arn,
iam_instance_profile=iam_instance_profile,
image_id=image_id,
instance_initiated_shutdown_behavior=instance_initiated_shutdown_behavior,
instance_type=instance_type,
ipv6_address_count=ipv6_address_count,
ipv6_addresses=ipv6_addresses,
kernel_id=kernel_id,
key_name=key_name,
launch_template=launch_template,
license_specifications=license_specifications,
monitoring=monitoring,
network_interfaces=network_interfaces,
placement_group_name=placement_group_name,
private_ip_address=private_ip_address,
ramdisk_id=ramdisk_id,
security_group_ids=security_group_ids,
security_groups=security_groups,
source_dest_check=source_dest_check,
ssm_associations=ssm_associations,
subnet_id=subnet_id,
tags=tags,
tenancy=tenancy,
user_data=user_data,
volumes=volumes,
)
jsii.create(CfnInstance, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrAvailabilityZone")
def attr_availability_zone(self) -> builtins.str:
"""
:cloudformationAttribute: AvailabilityZone
"""
return jsii.get(self, "attrAvailabilityZone")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrPrivateDnsName")
def attr_private_dns_name(self) -> builtins.str:
"""
:cloudformationAttribute: PrivateDnsName
"""
return jsii.get(self, "attrPrivateDnsName")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrPrivateIp")
def attr_private_ip(self) -> builtins.str:
"""
:cloudformationAttribute: PrivateIp
"""
return jsii.get(self, "attrPrivateIp")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrPublicDnsName")
def attr_public_dns_name(self) -> builtins.str:
"""
:cloudformationAttribute: PublicDnsName
"""
return jsii.get(self, "attrPublicDnsName")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrPublicIp")
def attr_public_ip(self) -> builtins.str:
"""
:cloudformationAttribute: PublicIp
"""
return jsii.get(self, "attrPublicIp")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::Instance.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="additionalInfo")
def additional_info(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.AdditionalInfo``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-additionalinfo
"""
return jsii.get(self, "additionalInfo")
@additional_info.setter # type: ignore
def additional_info(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "additionalInfo", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="affinity")
def affinity(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.Affinity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-affinity
"""
return jsii.get(self, "affinity")
@affinity.setter # type: ignore
def affinity(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "affinity", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZone")
def availability_zone(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-availabilityzone
"""
return jsii.get(self, "availabilityZone")
@availability_zone.setter # type: ignore
def availability_zone(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "availabilityZone", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="blockDeviceMappings")
def block_device_mappings(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.BlockDeviceMappingProperty"]]]]:
"""``AWS::EC2::Instance.BlockDeviceMappings``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-blockdevicemappings
"""
return jsii.get(self, "blockDeviceMappings")
@block_device_mappings.setter # type: ignore
def block_device_mappings(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.BlockDeviceMappingProperty"]]]],
) -> None:
jsii.set(self, "blockDeviceMappings", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="cpuOptions")
def cpu_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.CpuOptionsProperty"]]:
"""``AWS::EC2::Instance.CpuOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-cpuoptions
"""
return jsii.get(self, "cpuOptions")
@cpu_options.setter # type: ignore
def cpu_options(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.CpuOptionsProperty"]],
) -> None:
jsii.set(self, "cpuOptions", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="creditSpecification")
def credit_specification(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.CreditSpecificationProperty"]]:
"""``AWS::EC2::Instance.CreditSpecification``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-creditspecification
"""
return jsii.get(self, "creditSpecification")
@credit_specification.setter # type: ignore
def credit_specification(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.CreditSpecificationProperty"]],
) -> None:
jsii.set(self, "creditSpecification", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="disableApiTermination")
def disable_api_termination(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Instance.DisableApiTermination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-disableapitermination
"""
return jsii.get(self, "disableApiTermination")
@disable_api_termination.setter # type: ignore
def disable_api_termination(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "disableApiTermination", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ebsOptimized")
def ebs_optimized(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Instance.EbsOptimized``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ebsoptimized
"""
return jsii.get(self, "ebsOptimized")
@ebs_optimized.setter # type: ignore
def ebs_optimized(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "ebsOptimized", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="elasticGpuSpecifications")
def elastic_gpu_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.ElasticGpuSpecificationProperty"]]]]:
"""``AWS::EC2::Instance.ElasticGpuSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-elasticgpuspecifications
"""
return jsii.get(self, "elasticGpuSpecifications")
@elastic_gpu_specifications.setter # type: ignore
def elastic_gpu_specifications(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.ElasticGpuSpecificationProperty"]]]],
) -> None:
jsii.set(self, "elasticGpuSpecifications", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="elasticInferenceAccelerators")
def elastic_inference_accelerators(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.ElasticInferenceAcceleratorProperty"]]]]:
"""``AWS::EC2::Instance.ElasticInferenceAccelerators``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-elasticinferenceaccelerators
"""
return jsii.get(self, "elasticInferenceAccelerators")
@elastic_inference_accelerators.setter # type: ignore
def elastic_inference_accelerators(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.ElasticInferenceAcceleratorProperty"]]]],
) -> None:
jsii.set(self, "elasticInferenceAccelerators", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="enclaveOptions")
def enclave_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.EnclaveOptionsProperty"]]:
"""``AWS::EC2::Instance.EnclaveOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-enclaveoptions
"""
return jsii.get(self, "enclaveOptions")
@enclave_options.setter # type: ignore
def enclave_options(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.EnclaveOptionsProperty"]],
) -> None:
jsii.set(self, "enclaveOptions", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="hibernationOptions")
def hibernation_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.HibernationOptionsProperty"]]:
"""``AWS::EC2::Instance.HibernationOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-hibernationoptions
"""
return jsii.get(self, "hibernationOptions")
@hibernation_options.setter # type: ignore
def hibernation_options(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.HibernationOptionsProperty"]],
) -> None:
jsii.set(self, "hibernationOptions", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="hostId")
def host_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.HostId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-hostid
"""
return jsii.get(self, "hostId")
@host_id.setter # type: ignore
def host_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "hostId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="hostResourceGroupArn")
def host_resource_group_arn(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.HostResourceGroupArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-hostresourcegrouparn
"""
return jsii.get(self, "hostResourceGroupArn")
@host_resource_group_arn.setter # type: ignore
def host_resource_group_arn(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "hostResourceGroupArn", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="iamInstanceProfile")
def iam_instance_profile(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.IamInstanceProfile``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-iaminstanceprofile
"""
return jsii.get(self, "iamInstanceProfile")
@iam_instance_profile.setter # type: ignore
def iam_instance_profile(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "iamInstanceProfile", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="imageId")
def image_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.ImageId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-imageid
"""
return jsii.get(self, "imageId")
@image_id.setter # type: ignore
def image_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "imageId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceInitiatedShutdownBehavior")
def instance_initiated_shutdown_behavior(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.InstanceInitiatedShutdownBehavior``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-instanceinitiatedshutdownbehavior
"""
return jsii.get(self, "instanceInitiatedShutdownBehavior")
@instance_initiated_shutdown_behavior.setter # type: ignore
def instance_initiated_shutdown_behavior(
self,
value: typing.Optional[builtins.str],
) -> None:
jsii.set(self, "instanceInitiatedShutdownBehavior", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceType")
def instance_type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.InstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-instancetype
"""
return jsii.get(self, "instanceType")
@instance_type.setter # type: ignore
def instance_type(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "instanceType", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ipv6AddressCount")
def ipv6_address_count(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::Instance.Ipv6AddressCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ipv6addresscount
"""
return jsii.get(self, "ipv6AddressCount")
@ipv6_address_count.setter # type: ignore
def ipv6_address_count(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "ipv6AddressCount", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ipv6Addresses")
def ipv6_addresses(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.InstanceIpv6AddressProperty"]]]]:
"""``AWS::EC2::Instance.Ipv6Addresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ipv6addresses
"""
return jsii.get(self, "ipv6Addresses")
@ipv6_addresses.setter # type: ignore
def ipv6_addresses(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.InstanceIpv6AddressProperty"]]]],
) -> None:
jsii.set(self, "ipv6Addresses", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="kernelId")
def kernel_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.KernelId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-kernelid
"""
return jsii.get(self, "kernelId")
@kernel_id.setter # type: ignore
def kernel_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "kernelId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="keyName")
def key_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.KeyName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-keyname
"""
return jsii.get(self, "keyName")
@key_name.setter # type: ignore
def key_name(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "keyName", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="launchTemplate")
def launch_template(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.LaunchTemplateSpecificationProperty"]]:
"""``AWS::EC2::Instance.LaunchTemplate``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-launchtemplate
"""
return jsii.get(self, "launchTemplate")
@launch_template.setter # type: ignore
def launch_template(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.LaunchTemplateSpecificationProperty"]],
) -> None:
jsii.set(self, "launchTemplate", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="licenseSpecifications")
def license_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.LicenseSpecificationProperty"]]]]:
"""``AWS::EC2::Instance.LicenseSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-licensespecifications
"""
return jsii.get(self, "licenseSpecifications")
@license_specifications.setter # type: ignore
def license_specifications(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.LicenseSpecificationProperty"]]]],
) -> None:
jsii.set(self, "licenseSpecifications", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="monitoring")
def monitoring(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Instance.Monitoring``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-monitoring
"""
return jsii.get(self, "monitoring")
@monitoring.setter # type: ignore
def monitoring(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "monitoring", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="networkInterfaces")
def network_interfaces(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.NetworkInterfaceProperty"]]]]:
"""``AWS::EC2::Instance.NetworkInterfaces``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-networkinterfaces
"""
return jsii.get(self, "networkInterfaces")
@network_interfaces.setter # type: ignore
def network_interfaces(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.NetworkInterfaceProperty"]]]],
) -> None:
jsii.set(self, "networkInterfaces", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="placementGroupName")
def placement_group_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.PlacementGroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-placementgroupname
"""
return jsii.get(self, "placementGroupName")
@placement_group_name.setter # type: ignore
def placement_group_name(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "placementGroupName", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="privateIpAddress")
def private_ip_address(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-privateipaddress
"""
return jsii.get(self, "privateIpAddress")
@private_ip_address.setter # type: ignore
def private_ip_address(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "privateIpAddress", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ramdiskId")
def ramdisk_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.RamdiskId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ramdiskid
"""
return jsii.get(self, "ramdiskId")
@ramdisk_id.setter # type: ignore
def ramdisk_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "ramdiskId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroupIds")
def security_group_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::Instance.SecurityGroupIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-securitygroupids
"""
return jsii.get(self, "securityGroupIds")
@security_group_ids.setter # type: ignore
def security_group_ids(
self,
value: typing.Optional[typing.List[builtins.str]],
) -> None:
jsii.set(self, "securityGroupIds", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroups")
def security_groups(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::Instance.SecurityGroups``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-securitygroups
"""
return jsii.get(self, "securityGroups")
@security_groups.setter # type: ignore
def security_groups(
self,
value: typing.Optional[typing.List[builtins.str]],
) -> None:
jsii.set(self, "securityGroups", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="sourceDestCheck")
def source_dest_check(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Instance.SourceDestCheck``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-sourcedestcheck
"""
return jsii.get(self, "sourceDestCheck")
@source_dest_check.setter # type: ignore
def source_dest_check(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "sourceDestCheck", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ssmAssociations")
def ssm_associations(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.SsmAssociationProperty"]]]]:
"""``AWS::EC2::Instance.SsmAssociations``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ssmassociations
"""
return jsii.get(self, "ssmAssociations")
@ssm_associations.setter # type: ignore
def ssm_associations(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.SsmAssociationProperty"]]]],
) -> None:
jsii.set(self, "ssmAssociations", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetId")
def subnet_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-subnetid
"""
return jsii.get(self, "subnetId")
@subnet_id.setter # type: ignore
def subnet_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "subnetId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="tenancy")
def tenancy(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.Tenancy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-tenancy
"""
return jsii.get(self, "tenancy")
@tenancy.setter # type: ignore
def tenancy(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "tenancy", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="userData")
def user_data(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.UserData``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-userdata
"""
return jsii.get(self, "userData")
@user_data.setter # type: ignore
def user_data(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "userData", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="volumes")
def volumes(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.VolumeProperty"]]]]:
"""``AWS::EC2::Instance.Volumes``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-volumes
"""
return jsii.get(self, "volumes")
@volumes.setter # type: ignore
def volumes(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.VolumeProperty"]]]],
) -> None:
jsii.set(self, "volumes", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.AssociationParameterProperty",
jsii_struct_bases=[],
name_mapping={"key": "key", "value": "value"},
)
class AssociationParameterProperty:
def __init__(
self,
*,
key: builtins.str,
value: typing.List[builtins.str],
) -> None:
"""
:param key: ``CfnInstance.AssociationParameterProperty.Key``.
:param value: ``CfnInstance.AssociationParameterProperty.Value``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations-associationparameters.html
"""
self._values: typing.Dict[str, typing.Any] = {
"key": key,
"value": value,
}
@builtins.property
def key(self) -> builtins.str:
"""``CfnInstance.AssociationParameterProperty.Key``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations-associationparameters.html#cfn-ec2-instance-ssmassociations-associationparameters-key
"""
result = self._values.get("key")
assert result is not None, "Required property 'key' is missing"
return result
@builtins.property
def value(self) -> typing.List[builtins.str]:
"""``CfnInstance.AssociationParameterProperty.Value``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations-associationparameters.html#cfn-ec2-instance-ssmassociations-associationparameters-value
"""
result = self._values.get("value")
assert result is not None, "Required property 'value' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AssociationParameterProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.BlockDeviceMappingProperty",
jsii_struct_bases=[],
name_mapping={
"device_name": "deviceName",
"ebs": "ebs",
"no_device": "noDevice",
"virtual_name": "virtualName",
},
)
class BlockDeviceMappingProperty:
def __init__(
self,
*,
device_name: builtins.str,
ebs: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.EbsProperty"]] = None,
no_device: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.NoDeviceProperty"]] = None,
virtual_name: typing.Optional[builtins.str] = None,
) -> None:
"""
:param device_name: ``CfnInstance.BlockDeviceMappingProperty.DeviceName``.
:param ebs: ``CfnInstance.BlockDeviceMappingProperty.Ebs``.
:param no_device: ``CfnInstance.BlockDeviceMappingProperty.NoDevice``.
:param virtual_name: ``CfnInstance.BlockDeviceMappingProperty.VirtualName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html
"""
self._values: typing.Dict[str, typing.Any] = {
"device_name": device_name,
}
if ebs is not None:
self._values["ebs"] = ebs
if no_device is not None:
self._values["no_device"] = no_device
if virtual_name is not None:
self._values["virtual_name"] = virtual_name
@builtins.property
def device_name(self) -> builtins.str:
"""``CfnInstance.BlockDeviceMappingProperty.DeviceName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html#cfn-ec2-blockdev-mapping-devicename
"""
result = self._values.get("device_name")
assert result is not None, "Required property 'device_name' is missing"
return result
@builtins.property
def ebs(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.EbsProperty"]]:
"""``CfnInstance.BlockDeviceMappingProperty.Ebs``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html#cfn-ec2-blockdev-mapping-ebs
"""
result = self._values.get("ebs")
return result
@builtins.property
def no_device(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.NoDeviceProperty"]]:
"""``CfnInstance.BlockDeviceMappingProperty.NoDevice``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html#cfn-ec2-blockdev-mapping-nodevice
"""
result = self._values.get("no_device")
return result
@builtins.property
def virtual_name(self) -> typing.Optional[builtins.str]:
"""``CfnInstance.BlockDeviceMappingProperty.VirtualName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-mapping.html#cfn-ec2-blockdev-mapping-virtualname
"""
result = self._values.get("virtual_name")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "BlockDeviceMappingProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.CpuOptionsProperty",
jsii_struct_bases=[],
name_mapping={"core_count": "coreCount", "threads_per_core": "threadsPerCore"},
)
class CpuOptionsProperty:
def __init__(
self,
*,
core_count: typing.Optional[jsii.Number] = None,
threads_per_core: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param core_count: ``CfnInstance.CpuOptionsProperty.CoreCount``.
:param threads_per_core: ``CfnInstance.CpuOptionsProperty.ThreadsPerCore``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-cpuoptions.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if core_count is not None:
self._values["core_count"] = core_count
if threads_per_core is not None:
self._values["threads_per_core"] = threads_per_core
@builtins.property
def core_count(self) -> typing.Optional[jsii.Number]:
"""``CfnInstance.CpuOptionsProperty.CoreCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-cpuoptions.html#cfn-ec2-instance-cpuoptions-corecount
"""
result = self._values.get("core_count")
return result
@builtins.property
def threads_per_core(self) -> typing.Optional[jsii.Number]:
"""``CfnInstance.CpuOptionsProperty.ThreadsPerCore``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-cpuoptions.html#cfn-ec2-instance-cpuoptions-threadspercore
"""
result = self._values.get("threads_per_core")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CpuOptionsProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.CreditSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"cpu_credits": "cpuCredits"},
)
class CreditSpecificationProperty:
def __init__(
self,
*,
cpu_credits: typing.Optional[builtins.str] = None,
) -> None:
"""
:param cpu_credits: ``CfnInstance.CreditSpecificationProperty.CPUCredits``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-creditspecification.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if cpu_credits is not None:
self._values["cpu_credits"] = cpu_credits
@builtins.property
def cpu_credits(self) -> typing.Optional[builtins.str]:
"""``CfnInstance.CreditSpecificationProperty.CPUCredits``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-creditspecification.html#cfn-ec2-instance-creditspecification-cpucredits
"""
result = self._values.get("cpu_credits")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CreditSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.EbsProperty",
jsii_struct_bases=[],
name_mapping={
"delete_on_termination": "deleteOnTermination",
"encrypted": "encrypted",
"iops": "iops",
"kms_key_id": "kmsKeyId",
"snapshot_id": "snapshotId",
"volume_size": "volumeSize",
"volume_type": "volumeType",
},
)
class EbsProperty:
def __init__(
self,
*,
delete_on_termination: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
encrypted: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
iops: typing.Optional[jsii.Number] = None,
kms_key_id: typing.Optional[builtins.str] = None,
snapshot_id: typing.Optional[builtins.str] = None,
volume_size: typing.Optional[jsii.Number] = None,
volume_type: typing.Optional[builtins.str] = None,
) -> None:
"""
:param delete_on_termination: ``CfnInstance.EbsProperty.DeleteOnTermination``.
:param encrypted: ``CfnInstance.EbsProperty.Encrypted``.
:param iops: ``CfnInstance.EbsProperty.Iops``.
:param kms_key_id: ``CfnInstance.EbsProperty.KmsKeyId``.
:param snapshot_id: ``CfnInstance.EbsProperty.SnapshotId``.
:param volume_size: ``CfnInstance.EbsProperty.VolumeSize``.
:param volume_type: ``CfnInstance.EbsProperty.VolumeType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if delete_on_termination is not None:
self._values["delete_on_termination"] = delete_on_termination
if encrypted is not None:
self._values["encrypted"] = encrypted
if iops is not None:
self._values["iops"] = iops
if kms_key_id is not None:
self._values["kms_key_id"] = kms_key_id
if snapshot_id is not None:
self._values["snapshot_id"] = snapshot_id
if volume_size is not None:
self._values["volume_size"] = volume_size
if volume_type is not None:
self._values["volume_type"] = volume_type
@builtins.property
def delete_on_termination(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnInstance.EbsProperty.DeleteOnTermination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-deleteontermination
"""
result = self._values.get("delete_on_termination")
return result
@builtins.property
def encrypted(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnInstance.EbsProperty.Encrypted``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-encrypted
"""
result = self._values.get("encrypted")
return result
@builtins.property
def iops(self) -> typing.Optional[jsii.Number]:
"""``CfnInstance.EbsProperty.Iops``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-iops
"""
result = self._values.get("iops")
return result
@builtins.property
def kms_key_id(self) -> typing.Optional[builtins.str]:
"""``CfnInstance.EbsProperty.KmsKeyId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-instance-ebs-kmskeyid
"""
result = self._values.get("kms_key_id")
return result
@builtins.property
def snapshot_id(self) -> typing.Optional[builtins.str]:
"""``CfnInstance.EbsProperty.SnapshotId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-snapshotid
"""
result = self._values.get("snapshot_id")
return result
@builtins.property
def volume_size(self) -> typing.Optional[jsii.Number]:
"""``CfnInstance.EbsProperty.VolumeSize``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-volumesize
"""
result = self._values.get("volume_size")
return result
@builtins.property
def volume_type(self) -> typing.Optional[builtins.str]:
"""``CfnInstance.EbsProperty.VolumeType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html#cfn-ec2-blockdev-template-volumetype
"""
result = self._values.get("volume_type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "EbsProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.ElasticGpuSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"type": "type"},
)
class ElasticGpuSpecificationProperty:
def __init__(self, *, type: builtins.str) -> None:
"""
:param type: ``CfnInstance.ElasticGpuSpecificationProperty.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-elasticgpuspecification.html
"""
self._values: typing.Dict[str, typing.Any] = {
"type": type,
}
@builtins.property
def type(self) -> builtins.str:
"""``CfnInstance.ElasticGpuSpecificationProperty.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-elasticgpuspecification.html#cfn-ec2-instance-elasticgpuspecification-type
"""
result = self._values.get("type")
assert result is not None, "Required property 'type' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ElasticGpuSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.ElasticInferenceAcceleratorProperty",
jsii_struct_bases=[],
name_mapping={"type": "type", "count": "count"},
)
class ElasticInferenceAcceleratorProperty:
def __init__(
self,
*,
type: builtins.str,
count: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param type: ``CfnInstance.ElasticInferenceAcceleratorProperty.Type``.
:param count: ``CfnInstance.ElasticInferenceAcceleratorProperty.Count``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-elasticinferenceaccelerator.html
"""
self._values: typing.Dict[str, typing.Any] = {
"type": type,
}
if count is not None:
self._values["count"] = count
@builtins.property
def type(self) -> builtins.str:
"""``CfnInstance.ElasticInferenceAcceleratorProperty.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-elasticinferenceaccelerator.html#cfn-ec2-instance-elasticinferenceaccelerator-type
"""
result = self._values.get("type")
assert result is not None, "Required property 'type' is missing"
return result
@builtins.property
def count(self) -> typing.Optional[jsii.Number]:
"""``CfnInstance.ElasticInferenceAcceleratorProperty.Count``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-elasticinferenceaccelerator.html#cfn-ec2-instance-elasticinferenceaccelerator-count
"""
result = self._values.get("count")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ElasticInferenceAcceleratorProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.EnclaveOptionsProperty",
jsii_struct_bases=[],
name_mapping={"enabled": "enabled"},
)
class EnclaveOptionsProperty:
def __init__(
self,
*,
enabled: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
) -> None:
"""
:param enabled: ``CfnInstance.EnclaveOptionsProperty.Enabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-enclaveoptions.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if enabled is not None:
self._values["enabled"] = enabled
@builtins.property
def enabled(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnInstance.EnclaveOptionsProperty.Enabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-enclaveoptions.html#cfn-ec2-instance-enclaveoptions-enabled
"""
result = self._values.get("enabled")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "EnclaveOptionsProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.HibernationOptionsProperty",
jsii_struct_bases=[],
name_mapping={"configured": "configured"},
)
class HibernationOptionsProperty:
def __init__(
self,
*,
configured: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
) -> None:
"""
:param configured: ``CfnInstance.HibernationOptionsProperty.Configured``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-hibernationoptions.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if configured is not None:
self._values["configured"] = configured
@builtins.property
def configured(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnInstance.HibernationOptionsProperty.Configured``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-hibernationoptions.html#cfn-ec2-instance-hibernationoptions-configured
"""
result = self._values.get("configured")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "HibernationOptionsProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.InstanceIpv6AddressProperty",
jsii_struct_bases=[],
name_mapping={"ipv6_address": "ipv6Address"},
)
class InstanceIpv6AddressProperty:
def __init__(self, *, ipv6_address: builtins.str) -> None:
"""
:param ipv6_address: ``CfnInstance.InstanceIpv6AddressProperty.Ipv6Address``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-instanceipv6address.html
"""
self._values: typing.Dict[str, typing.Any] = {
"ipv6_address": ipv6_address,
}
@builtins.property
def ipv6_address(self) -> builtins.str:
"""``CfnInstance.InstanceIpv6AddressProperty.Ipv6Address``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-instanceipv6address.html#cfn-ec2-instance-instanceipv6address-ipv6address
"""
result = self._values.get("ipv6_address")
assert result is not None, "Required property 'ipv6_address' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InstanceIpv6AddressProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.LaunchTemplateSpecificationProperty",
jsii_struct_bases=[],
name_mapping={
"version": "version",
"launch_template_id": "launchTemplateId",
"launch_template_name": "launchTemplateName",
},
)
class LaunchTemplateSpecificationProperty:
def __init__(
self,
*,
version: builtins.str,
launch_template_id: typing.Optional[builtins.str] = None,
launch_template_name: typing.Optional[builtins.str] = None,
) -> None:
"""
:param version: ``CfnInstance.LaunchTemplateSpecificationProperty.Version``.
:param launch_template_id: ``CfnInstance.LaunchTemplateSpecificationProperty.LaunchTemplateId``.
:param launch_template_name: ``CfnInstance.LaunchTemplateSpecificationProperty.LaunchTemplateName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-launchtemplatespecification.html
"""
self._values: typing.Dict[str, typing.Any] = {
"version": version,
}
if launch_template_id is not None:
self._values["launch_template_id"] = launch_template_id
if launch_template_name is not None:
self._values["launch_template_name"] = launch_template_name
@builtins.property
def version(self) -> builtins.str:
"""``CfnInstance.LaunchTemplateSpecificationProperty.Version``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-launchtemplatespecification.html#cfn-ec2-instance-launchtemplatespecification-version
"""
result = self._values.get("version")
assert result is not None, "Required property 'version' is missing"
return result
@builtins.property
def launch_template_id(self) -> typing.Optional[builtins.str]:
"""``CfnInstance.LaunchTemplateSpecificationProperty.LaunchTemplateId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-launchtemplatespecification.html#cfn-ec2-instance-launchtemplatespecification-launchtemplateid
"""
result = self._values.get("launch_template_id")
return result
@builtins.property
def launch_template_name(self) -> typing.Optional[builtins.str]:
"""``CfnInstance.LaunchTemplateSpecificationProperty.LaunchTemplateName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-launchtemplatespecification.html#cfn-ec2-instance-launchtemplatespecification-launchtemplatename
"""
result = self._values.get("launch_template_name")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LaunchTemplateSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.LicenseSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"license_configuration_arn": "licenseConfigurationArn"},
)
class LicenseSpecificationProperty:
def __init__(self, *, license_configuration_arn: builtins.str) -> None:
"""
:param license_configuration_arn: ``CfnInstance.LicenseSpecificationProperty.LicenseConfigurationArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-licensespecification.html
"""
self._values: typing.Dict[str, typing.Any] = {
"license_configuration_arn": license_configuration_arn,
}
@builtins.property
def license_configuration_arn(self) -> builtins.str:
"""``CfnInstance.LicenseSpecificationProperty.LicenseConfigurationArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-licensespecification.html#cfn-ec2-instance-licensespecification-licenseconfigurationarn
"""
result = self._values.get("license_configuration_arn")
assert result is not None, "Required property 'license_configuration_arn' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LicenseSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.NetworkInterfaceProperty",
jsii_struct_bases=[],
name_mapping={
"device_index": "deviceIndex",
"associate_public_ip_address": "associatePublicIpAddress",
"delete_on_termination": "deleteOnTermination",
"description": "description",
"group_set": "groupSet",
"ipv6_address_count": "ipv6AddressCount",
"ipv6_addresses": "ipv6Addresses",
"network_interface_id": "networkInterfaceId",
"private_ip_address": "privateIpAddress",
"private_ip_addresses": "privateIpAddresses",
"secondary_private_ip_address_count": "secondaryPrivateIpAddressCount",
"subnet_id": "subnetId",
},
)
class NetworkInterfaceProperty:
def __init__(
self,
*,
device_index: builtins.str,
associate_public_ip_address: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
delete_on_termination: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
description: typing.Optional[builtins.str] = None,
group_set: typing.Optional[typing.List[builtins.str]] = None,
ipv6_address_count: typing.Optional[jsii.Number] = None,
ipv6_addresses: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.InstanceIpv6AddressProperty"]]]] = None,
network_interface_id: typing.Optional[builtins.str] = None,
private_ip_address: typing.Optional[builtins.str] = None,
private_ip_addresses: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.PrivateIpAddressSpecificationProperty"]]]] = None,
secondary_private_ip_address_count: typing.Optional[jsii.Number] = None,
subnet_id: typing.Optional[builtins.str] = None,
) -> None:
"""
:param device_index: ``CfnInstance.NetworkInterfaceProperty.DeviceIndex``.
:param associate_public_ip_address: ``CfnInstance.NetworkInterfaceProperty.AssociatePublicIpAddress``.
:param delete_on_termination: ``CfnInstance.NetworkInterfaceProperty.DeleteOnTermination``.
:param description: ``CfnInstance.NetworkInterfaceProperty.Description``.
:param group_set: ``CfnInstance.NetworkInterfaceProperty.GroupSet``.
:param ipv6_address_count: ``CfnInstance.NetworkInterfaceProperty.Ipv6AddressCount``.
:param ipv6_addresses: ``CfnInstance.NetworkInterfaceProperty.Ipv6Addresses``.
:param network_interface_id: ``CfnInstance.NetworkInterfaceProperty.NetworkInterfaceId``.
:param private_ip_address: ``CfnInstance.NetworkInterfaceProperty.PrivateIpAddress``.
:param private_ip_addresses: ``CfnInstance.NetworkInterfaceProperty.PrivateIpAddresses``.
:param secondary_private_ip_address_count: ``CfnInstance.NetworkInterfaceProperty.SecondaryPrivateIpAddressCount``.
:param subnet_id: ``CfnInstance.NetworkInterfaceProperty.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html
"""
self._values: typing.Dict[str, typing.Any] = {
"device_index": device_index,
}
if associate_public_ip_address is not None:
self._values["associate_public_ip_address"] = associate_public_ip_address
if delete_on_termination is not None:
self._values["delete_on_termination"] = delete_on_termination
if description is not None:
self._values["description"] = description
if group_set is not None:
self._values["group_set"] = group_set
if ipv6_address_count is not None:
self._values["ipv6_address_count"] = ipv6_address_count
if ipv6_addresses is not None:
self._values["ipv6_addresses"] = ipv6_addresses
if network_interface_id is not None:
self._values["network_interface_id"] = network_interface_id
if private_ip_address is not None:
self._values["private_ip_address"] = private_ip_address
if private_ip_addresses is not None:
self._values["private_ip_addresses"] = private_ip_addresses
if secondary_private_ip_address_count is not None:
self._values["secondary_private_ip_address_count"] = secondary_private_ip_address_count
if subnet_id is not None:
self._values["subnet_id"] = subnet_id
@builtins.property
def device_index(self) -> builtins.str:
"""``CfnInstance.NetworkInterfaceProperty.DeviceIndex``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-deviceindex
"""
result = self._values.get("device_index")
assert result is not None, "Required property 'device_index' is missing"
return result
@builtins.property
def associate_public_ip_address(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnInstance.NetworkInterfaceProperty.AssociatePublicIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-associatepubip
"""
result = self._values.get("associate_public_ip_address")
return result
@builtins.property
def delete_on_termination(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnInstance.NetworkInterfaceProperty.DeleteOnTermination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-delete
"""
result = self._values.get("delete_on_termination")
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``CfnInstance.NetworkInterfaceProperty.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-description
"""
result = self._values.get("description")
return result
@builtins.property
def group_set(self) -> typing.Optional[typing.List[builtins.str]]:
"""``CfnInstance.NetworkInterfaceProperty.GroupSet``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-groupset
"""
result = self._values.get("group_set")
return result
@builtins.property
def ipv6_address_count(self) -> typing.Optional[jsii.Number]:
"""``CfnInstance.NetworkInterfaceProperty.Ipv6AddressCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#cfn-ec2-instance-networkinterface-ipv6addresscount
"""
result = self._values.get("ipv6_address_count")
return result
@builtins.property
def ipv6_addresses(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.InstanceIpv6AddressProperty"]]]]:
"""``CfnInstance.NetworkInterfaceProperty.Ipv6Addresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#cfn-ec2-instance-networkinterface-ipv6addresses
"""
result = self._values.get("ipv6_addresses")
return result
@builtins.property
def network_interface_id(self) -> typing.Optional[builtins.str]:
"""``CfnInstance.NetworkInterfaceProperty.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-network-iface
"""
result = self._values.get("network_interface_id")
return result
@builtins.property
def private_ip_address(self) -> typing.Optional[builtins.str]:
"""``CfnInstance.NetworkInterfaceProperty.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-privateipaddress
"""
result = self._values.get("private_ip_address")
return result
@builtins.property
def private_ip_addresses(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.PrivateIpAddressSpecificationProperty"]]]]:
"""``CfnInstance.NetworkInterfaceProperty.PrivateIpAddresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-privateipaddresses
"""
result = self._values.get("private_ip_addresses")
return result
@builtins.property
def secondary_private_ip_address_count(self) -> typing.Optional[jsii.Number]:
"""``CfnInstance.NetworkInterfaceProperty.SecondaryPrivateIpAddressCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-secondprivateip
"""
result = self._values.get("secondary_private_ip_address_count")
return result
@builtins.property
def subnet_id(self) -> typing.Optional[builtins.str]:
"""``CfnInstance.NetworkInterfaceProperty.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-iface-embedded.html#aws-properties-ec2-network-iface-embedded-subnetid
"""
result = self._values.get("subnet_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "NetworkInterfaceProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.NoDeviceProperty",
jsii_struct_bases=[],
name_mapping={},
)
class NoDeviceProperty:
def __init__(self) -> None:
"""
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-nodevice.html
"""
self._values: typing.Dict[str, typing.Any] = {}
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "NoDeviceProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.PrivateIpAddressSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"primary": "primary", "private_ip_address": "privateIpAddress"},
)
class PrivateIpAddressSpecificationProperty:
def __init__(
self,
*,
primary: typing.Union[builtins.bool, aws_cdk.core.IResolvable],
private_ip_address: builtins.str,
) -> None:
"""
:param primary: ``CfnInstance.PrivateIpAddressSpecificationProperty.Primary``.
:param private_ip_address: ``CfnInstance.PrivateIpAddressSpecificationProperty.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html
"""
self._values: typing.Dict[str, typing.Any] = {
"primary": primary,
"private_ip_address": private_ip_address,
}
@builtins.property
def primary(self) -> typing.Union[builtins.bool, aws_cdk.core.IResolvable]:
"""``CfnInstance.PrivateIpAddressSpecificationProperty.Primary``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html#cfn-ec2-networkinterface-privateipspecification-primary
"""
result = self._values.get("primary")
assert result is not None, "Required property 'primary' is missing"
return result
@builtins.property
def private_ip_address(self) -> builtins.str:
"""``CfnInstance.PrivateIpAddressSpecificationProperty.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html#cfn-ec2-networkinterface-privateipspecification-privateipaddress
"""
result = self._values.get("private_ip_address")
assert result is not None, "Required property 'private_ip_address' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PrivateIpAddressSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.SsmAssociationProperty",
jsii_struct_bases=[],
name_mapping={
"document_name": "documentName",
"association_parameters": "associationParameters",
},
)
class SsmAssociationProperty:
def __init__(
self,
*,
document_name: builtins.str,
association_parameters: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.AssociationParameterProperty"]]]] = None,
) -> None:
"""
:param document_name: ``CfnInstance.SsmAssociationProperty.DocumentName``.
:param association_parameters: ``CfnInstance.SsmAssociationProperty.AssociationParameters``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations.html
"""
self._values: typing.Dict[str, typing.Any] = {
"document_name": document_name,
}
if association_parameters is not None:
self._values["association_parameters"] = association_parameters
@builtins.property
def document_name(self) -> builtins.str:
"""``CfnInstance.SsmAssociationProperty.DocumentName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations.html#cfn-ec2-instance-ssmassociations-documentname
"""
result = self._values.get("document_name")
assert result is not None, "Required property 'document_name' is missing"
return result
@builtins.property
def association_parameters(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnInstance.AssociationParameterProperty"]]]]:
"""``CfnInstance.SsmAssociationProperty.AssociationParameters``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance-ssmassociations.html#cfn-ec2-instance-ssmassociations-associationparameters
"""
result = self._values.get("association_parameters")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SsmAssociationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstance.VolumeProperty",
jsii_struct_bases=[],
name_mapping={"device": "device", "volume_id": "volumeId"},
)
class VolumeProperty:
def __init__(self, *, device: builtins.str, volume_id: builtins.str) -> None:
"""
:param device: ``CfnInstance.VolumeProperty.Device``.
:param volume_id: ``CfnInstance.VolumeProperty.VolumeId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-mount-point.html
"""
self._values: typing.Dict[str, typing.Any] = {
"device": device,
"volume_id": volume_id,
}
@builtins.property
def device(self) -> builtins.str:
"""``CfnInstance.VolumeProperty.Device``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-mount-point.html#cfn-ec2-mountpoint-device
"""
result = self._values.get("device")
assert result is not None, "Required property 'device' is missing"
return result
@builtins.property
def volume_id(self) -> builtins.str:
"""``CfnInstance.VolumeProperty.VolumeId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-mount-point.html#cfn-ec2-mountpoint-volumeid
"""
result = self._values.get("volume_id")
assert result is not None, "Required property 'volume_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "VolumeProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInstanceProps",
jsii_struct_bases=[],
name_mapping={
"additional_info": "additionalInfo",
"affinity": "affinity",
"availability_zone": "availabilityZone",
"block_device_mappings": "blockDeviceMappings",
"cpu_options": "cpuOptions",
"credit_specification": "creditSpecification",
"disable_api_termination": "disableApiTermination",
"ebs_optimized": "ebsOptimized",
"elastic_gpu_specifications": "elasticGpuSpecifications",
"elastic_inference_accelerators": "elasticInferenceAccelerators",
"enclave_options": "enclaveOptions",
"hibernation_options": "hibernationOptions",
"host_id": "hostId",
"host_resource_group_arn": "hostResourceGroupArn",
"iam_instance_profile": "iamInstanceProfile",
"image_id": "imageId",
"instance_initiated_shutdown_behavior": "instanceInitiatedShutdownBehavior",
"instance_type": "instanceType",
"ipv6_address_count": "ipv6AddressCount",
"ipv6_addresses": "ipv6Addresses",
"kernel_id": "kernelId",
"key_name": "keyName",
"launch_template": "launchTemplate",
"license_specifications": "licenseSpecifications",
"monitoring": "monitoring",
"network_interfaces": "networkInterfaces",
"placement_group_name": "placementGroupName",
"private_ip_address": "privateIpAddress",
"ramdisk_id": "ramdiskId",
"security_group_ids": "securityGroupIds",
"security_groups": "securityGroups",
"source_dest_check": "sourceDestCheck",
"ssm_associations": "ssmAssociations",
"subnet_id": "subnetId",
"tags": "tags",
"tenancy": "tenancy",
"user_data": "userData",
"volumes": "volumes",
},
)
class CfnInstanceProps:
def __init__(
self,
*,
additional_info: typing.Optional[builtins.str] = None,
affinity: typing.Optional[builtins.str] = None,
availability_zone: typing.Optional[builtins.str] = None,
block_device_mappings: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.BlockDeviceMappingProperty]]]] = None,
cpu_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnInstance.CpuOptionsProperty]] = None,
credit_specification: typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnInstance.CreditSpecificationProperty]] = None,
disable_api_termination: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
ebs_optimized: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
elastic_gpu_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.ElasticGpuSpecificationProperty]]]] = None,
elastic_inference_accelerators: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.ElasticInferenceAcceleratorProperty]]]] = None,
enclave_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnInstance.EnclaveOptionsProperty]] = None,
hibernation_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnInstance.HibernationOptionsProperty]] = None,
host_id: typing.Optional[builtins.str] = None,
host_resource_group_arn: typing.Optional[builtins.str] = None,
iam_instance_profile: typing.Optional[builtins.str] = None,
image_id: typing.Optional[builtins.str] = None,
instance_initiated_shutdown_behavior: typing.Optional[builtins.str] = None,
instance_type: typing.Optional[builtins.str] = None,
ipv6_address_count: typing.Optional[jsii.Number] = None,
ipv6_addresses: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.InstanceIpv6AddressProperty]]]] = None,
kernel_id: typing.Optional[builtins.str] = None,
key_name: typing.Optional[builtins.str] = None,
launch_template: typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnInstance.LaunchTemplateSpecificationProperty]] = None,
license_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.LicenseSpecificationProperty]]]] = None,
monitoring: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
network_interfaces: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.NetworkInterfaceProperty]]]] = None,
placement_group_name: typing.Optional[builtins.str] = None,
private_ip_address: typing.Optional[builtins.str] = None,
ramdisk_id: typing.Optional[builtins.str] = None,
security_group_ids: typing.Optional[typing.List[builtins.str]] = None,
security_groups: typing.Optional[typing.List[builtins.str]] = None,
source_dest_check: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
ssm_associations: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.SsmAssociationProperty]]]] = None,
subnet_id: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
tenancy: typing.Optional[builtins.str] = None,
user_data: typing.Optional[builtins.str] = None,
volumes: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.VolumeProperty]]]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::Instance``.
:param additional_info: ``AWS::EC2::Instance.AdditionalInfo``.
:param affinity: ``AWS::EC2::Instance.Affinity``.
:param availability_zone: ``AWS::EC2::Instance.AvailabilityZone``.
:param block_device_mappings: ``AWS::EC2::Instance.BlockDeviceMappings``.
:param cpu_options: ``AWS::EC2::Instance.CpuOptions``.
:param credit_specification: ``AWS::EC2::Instance.CreditSpecification``.
:param disable_api_termination: ``AWS::EC2::Instance.DisableApiTermination``.
:param ebs_optimized: ``AWS::EC2::Instance.EbsOptimized``.
:param elastic_gpu_specifications: ``AWS::EC2::Instance.ElasticGpuSpecifications``.
:param elastic_inference_accelerators: ``AWS::EC2::Instance.ElasticInferenceAccelerators``.
:param enclave_options: ``AWS::EC2::Instance.EnclaveOptions``.
:param hibernation_options: ``AWS::EC2::Instance.HibernationOptions``.
:param host_id: ``AWS::EC2::Instance.HostId``.
:param host_resource_group_arn: ``AWS::EC2::Instance.HostResourceGroupArn``.
:param iam_instance_profile: ``AWS::EC2::Instance.IamInstanceProfile``.
:param image_id: ``AWS::EC2::Instance.ImageId``.
:param instance_initiated_shutdown_behavior: ``AWS::EC2::Instance.InstanceInitiatedShutdownBehavior``.
:param instance_type: ``AWS::EC2::Instance.InstanceType``.
:param ipv6_address_count: ``AWS::EC2::Instance.Ipv6AddressCount``.
:param ipv6_addresses: ``AWS::EC2::Instance.Ipv6Addresses``.
:param kernel_id: ``AWS::EC2::Instance.KernelId``.
:param key_name: ``AWS::EC2::Instance.KeyName``.
:param launch_template: ``AWS::EC2::Instance.LaunchTemplate``.
:param license_specifications: ``AWS::EC2::Instance.LicenseSpecifications``.
:param monitoring: ``AWS::EC2::Instance.Monitoring``.
:param network_interfaces: ``AWS::EC2::Instance.NetworkInterfaces``.
:param placement_group_name: ``AWS::EC2::Instance.PlacementGroupName``.
:param private_ip_address: ``AWS::EC2::Instance.PrivateIpAddress``.
:param ramdisk_id: ``AWS::EC2::Instance.RamdiskId``.
:param security_group_ids: ``AWS::EC2::Instance.SecurityGroupIds``.
:param security_groups: ``AWS::EC2::Instance.SecurityGroups``.
:param source_dest_check: ``AWS::EC2::Instance.SourceDestCheck``.
:param ssm_associations: ``AWS::EC2::Instance.SsmAssociations``.
:param subnet_id: ``AWS::EC2::Instance.SubnetId``.
:param tags: ``AWS::EC2::Instance.Tags``.
:param tenancy: ``AWS::EC2::Instance.Tenancy``.
:param user_data: ``AWS::EC2::Instance.UserData``.
:param volumes: ``AWS::EC2::Instance.Volumes``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if additional_info is not None:
self._values["additional_info"] = additional_info
if affinity is not None:
self._values["affinity"] = affinity
if availability_zone is not None:
self._values["availability_zone"] = availability_zone
if block_device_mappings is not None:
self._values["block_device_mappings"] = block_device_mappings
if cpu_options is not None:
self._values["cpu_options"] = cpu_options
if credit_specification is not None:
self._values["credit_specification"] = credit_specification
if disable_api_termination is not None:
self._values["disable_api_termination"] = disable_api_termination
if ebs_optimized is not None:
self._values["ebs_optimized"] = ebs_optimized
if elastic_gpu_specifications is not None:
self._values["elastic_gpu_specifications"] = elastic_gpu_specifications
if elastic_inference_accelerators is not None:
self._values["elastic_inference_accelerators"] = elastic_inference_accelerators
if enclave_options is not None:
self._values["enclave_options"] = enclave_options
if hibernation_options is not None:
self._values["hibernation_options"] = hibernation_options
if host_id is not None:
self._values["host_id"] = host_id
if host_resource_group_arn is not None:
self._values["host_resource_group_arn"] = host_resource_group_arn
if iam_instance_profile is not None:
self._values["iam_instance_profile"] = iam_instance_profile
if image_id is not None:
self._values["image_id"] = image_id
if instance_initiated_shutdown_behavior is not None:
self._values["instance_initiated_shutdown_behavior"] = instance_initiated_shutdown_behavior
if instance_type is not None:
self._values["instance_type"] = instance_type
if ipv6_address_count is not None:
self._values["ipv6_address_count"] = ipv6_address_count
if ipv6_addresses is not None:
self._values["ipv6_addresses"] = ipv6_addresses
if kernel_id is not None:
self._values["kernel_id"] = kernel_id
if key_name is not None:
self._values["key_name"] = key_name
if launch_template is not None:
self._values["launch_template"] = launch_template
if license_specifications is not None:
self._values["license_specifications"] = license_specifications
if monitoring is not None:
self._values["monitoring"] = monitoring
if network_interfaces is not None:
self._values["network_interfaces"] = network_interfaces
if placement_group_name is not None:
self._values["placement_group_name"] = placement_group_name
if private_ip_address is not None:
self._values["private_ip_address"] = private_ip_address
if ramdisk_id is not None:
self._values["ramdisk_id"] = ramdisk_id
if security_group_ids is not None:
self._values["security_group_ids"] = security_group_ids
if security_groups is not None:
self._values["security_groups"] = security_groups
if source_dest_check is not None:
self._values["source_dest_check"] = source_dest_check
if ssm_associations is not None:
self._values["ssm_associations"] = ssm_associations
if subnet_id is not None:
self._values["subnet_id"] = subnet_id
if tags is not None:
self._values["tags"] = tags
if tenancy is not None:
self._values["tenancy"] = tenancy
if user_data is not None:
self._values["user_data"] = user_data
if volumes is not None:
self._values["volumes"] = volumes
@builtins.property
def additional_info(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.AdditionalInfo``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-additionalinfo
"""
result = self._values.get("additional_info")
return result
@builtins.property
def affinity(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.Affinity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-affinity
"""
result = self._values.get("affinity")
return result
@builtins.property
def availability_zone(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-availabilityzone
"""
result = self._values.get("availability_zone")
return result
@builtins.property
def block_device_mappings(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.BlockDeviceMappingProperty]]]]:
"""``AWS::EC2::Instance.BlockDeviceMappings``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-blockdevicemappings
"""
result = self._values.get("block_device_mappings")
return result
@builtins.property
def cpu_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnInstance.CpuOptionsProperty]]:
"""``AWS::EC2::Instance.CpuOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-cpuoptions
"""
result = self._values.get("cpu_options")
return result
@builtins.property
def credit_specification(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnInstance.CreditSpecificationProperty]]:
"""``AWS::EC2::Instance.CreditSpecification``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-creditspecification
"""
result = self._values.get("credit_specification")
return result
@builtins.property
def disable_api_termination(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Instance.DisableApiTermination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-disableapitermination
"""
result = self._values.get("disable_api_termination")
return result
@builtins.property
def ebs_optimized(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Instance.EbsOptimized``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ebsoptimized
"""
result = self._values.get("ebs_optimized")
return result
@builtins.property
def elastic_gpu_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.ElasticGpuSpecificationProperty]]]]:
"""``AWS::EC2::Instance.ElasticGpuSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-elasticgpuspecifications
"""
result = self._values.get("elastic_gpu_specifications")
return result
@builtins.property
def elastic_inference_accelerators(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.ElasticInferenceAcceleratorProperty]]]]:
"""``AWS::EC2::Instance.ElasticInferenceAccelerators``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-elasticinferenceaccelerators
"""
result = self._values.get("elastic_inference_accelerators")
return result
@builtins.property
def enclave_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnInstance.EnclaveOptionsProperty]]:
"""``AWS::EC2::Instance.EnclaveOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-enclaveoptions
"""
result = self._values.get("enclave_options")
return result
@builtins.property
def hibernation_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnInstance.HibernationOptionsProperty]]:
"""``AWS::EC2::Instance.HibernationOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-hibernationoptions
"""
result = self._values.get("hibernation_options")
return result
@builtins.property
def host_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.HostId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-hostid
"""
result = self._values.get("host_id")
return result
@builtins.property
def host_resource_group_arn(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.HostResourceGroupArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-hostresourcegrouparn
"""
result = self._values.get("host_resource_group_arn")
return result
@builtins.property
def iam_instance_profile(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.IamInstanceProfile``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-iaminstanceprofile
"""
result = self._values.get("iam_instance_profile")
return result
@builtins.property
def image_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.ImageId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-imageid
"""
result = self._values.get("image_id")
return result
@builtins.property
def instance_initiated_shutdown_behavior(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.InstanceInitiatedShutdownBehavior``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-instanceinitiatedshutdownbehavior
"""
result = self._values.get("instance_initiated_shutdown_behavior")
return result
@builtins.property
def instance_type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.InstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-instancetype
"""
result = self._values.get("instance_type")
return result
@builtins.property
def ipv6_address_count(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::Instance.Ipv6AddressCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ipv6addresscount
"""
result = self._values.get("ipv6_address_count")
return result
@builtins.property
def ipv6_addresses(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.InstanceIpv6AddressProperty]]]]:
"""``AWS::EC2::Instance.Ipv6Addresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ipv6addresses
"""
result = self._values.get("ipv6_addresses")
return result
@builtins.property
def kernel_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.KernelId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-kernelid
"""
result = self._values.get("kernel_id")
return result
@builtins.property
def key_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.KeyName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-keyname
"""
result = self._values.get("key_name")
return result
@builtins.property
def launch_template(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnInstance.LaunchTemplateSpecificationProperty]]:
"""``AWS::EC2::Instance.LaunchTemplate``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-launchtemplate
"""
result = self._values.get("launch_template")
return result
@builtins.property
def license_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.LicenseSpecificationProperty]]]]:
"""``AWS::EC2::Instance.LicenseSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-licensespecifications
"""
result = self._values.get("license_specifications")
return result
@builtins.property
def monitoring(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Instance.Monitoring``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-monitoring
"""
result = self._values.get("monitoring")
return result
@builtins.property
def network_interfaces(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.NetworkInterfaceProperty]]]]:
"""``AWS::EC2::Instance.NetworkInterfaces``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-networkinterfaces
"""
result = self._values.get("network_interfaces")
return result
@builtins.property
def placement_group_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.PlacementGroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-placementgroupname
"""
result = self._values.get("placement_group_name")
return result
@builtins.property
def private_ip_address(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-privateipaddress
"""
result = self._values.get("private_ip_address")
return result
@builtins.property
def ramdisk_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.RamdiskId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ramdiskid
"""
result = self._values.get("ramdisk_id")
return result
@builtins.property
def security_group_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::Instance.SecurityGroupIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-securitygroupids
"""
result = self._values.get("security_group_ids")
return result
@builtins.property
def security_groups(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::Instance.SecurityGroups``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-securitygroups
"""
result = self._values.get("security_groups")
return result
@builtins.property
def source_dest_check(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Instance.SourceDestCheck``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-sourcedestcheck
"""
result = self._values.get("source_dest_check")
return result
@builtins.property
def ssm_associations(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.SsmAssociationProperty]]]]:
"""``AWS::EC2::Instance.SsmAssociations``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-ssmassociations
"""
result = self._values.get("ssm_associations")
return result
@builtins.property
def subnet_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-subnetid
"""
result = self._values.get("subnet_id")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::Instance.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-tags
"""
result = self._values.get("tags")
return result
@builtins.property
def tenancy(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.Tenancy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-tenancy
"""
result = self._values.get("tenancy")
return result
@builtins.property
def user_data(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Instance.UserData``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-userdata
"""
result = self._values.get("user_data")
return result
@builtins.property
def volumes(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnInstance.VolumeProperty]]]]:
"""``AWS::EC2::Instance.Volumes``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-volumes
"""
result = self._values.get("volumes")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnInstanceProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnInternetGateway(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnInternetGateway",
):
"""A CloudFormation ``AWS::EC2::InternetGateway``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internetgateway.html
:cloudformationResource: AWS::EC2::InternetGateway
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::InternetGateway``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param tags: ``AWS::EC2::InternetGateway.Tags``.
"""
props = CfnInternetGatewayProps(tags=tags)
jsii.create(CfnInternetGateway, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::InternetGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internetgateway.html#cfn-ec2-internetgateway-tags
"""
return jsii.get(self, "tags")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnInternetGatewayProps",
jsii_struct_bases=[],
name_mapping={"tags": "tags"},
)
class CfnInternetGatewayProps:
def __init__(
self,
*,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::InternetGateway``.
:param tags: ``AWS::EC2::InternetGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internetgateway.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if tags is not None:
self._values["tags"] = tags
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::InternetGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-internetgateway.html#cfn-ec2-internetgateway-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnInternetGatewayProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnLaunchTemplate(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate",
):
"""A CloudFormation ``AWS::EC2::LaunchTemplate``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html
:cloudformationResource: AWS::EC2::LaunchTemplate
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
launch_template_data: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.LaunchTemplateDataProperty"]] = None,
launch_template_name: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::LaunchTemplate``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param launch_template_data: ``AWS::EC2::LaunchTemplate.LaunchTemplateData``.
:param launch_template_name: ``AWS::EC2::LaunchTemplate.LaunchTemplateName``.
"""
props = CfnLaunchTemplateProps(
launch_template_data=launch_template_data,
launch_template_name=launch_template_name,
)
jsii.create(CfnLaunchTemplate, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrDefaultVersionNumber")
def attr_default_version_number(self) -> builtins.str:
"""
:cloudformationAttribute: DefaultVersionNumber
"""
return jsii.get(self, "attrDefaultVersionNumber")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrLatestVersionNumber")
def attr_latest_version_number(self) -> builtins.str:
"""
:cloudformationAttribute: LatestVersionNumber
"""
return jsii.get(self, "attrLatestVersionNumber")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="launchTemplateData")
def launch_template_data(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.LaunchTemplateDataProperty"]]:
"""``AWS::EC2::LaunchTemplate.LaunchTemplateData``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html#cfn-ec2-launchtemplate-launchtemplatedata
"""
return jsii.get(self, "launchTemplateData")
@launch_template_data.setter # type: ignore
def launch_template_data(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.LaunchTemplateDataProperty"]],
) -> None:
jsii.set(self, "launchTemplateData", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="launchTemplateName")
def launch_template_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::LaunchTemplate.LaunchTemplateName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html#cfn-ec2-launchtemplate-launchtemplatename
"""
return jsii.get(self, "launchTemplateName")
@launch_template_name.setter # type: ignore
def launch_template_name(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "launchTemplateName", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.BlockDeviceMappingProperty",
jsii_struct_bases=[],
name_mapping={
"device_name": "deviceName",
"ebs": "ebs",
"no_device": "noDevice",
"virtual_name": "virtualName",
},
)
class BlockDeviceMappingProperty:
def __init__(
self,
*,
device_name: typing.Optional[builtins.str] = None,
ebs: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.EbsProperty"]] = None,
no_device: typing.Optional[builtins.str] = None,
virtual_name: typing.Optional[builtins.str] = None,
) -> None:
"""
:param device_name: ``CfnLaunchTemplate.BlockDeviceMappingProperty.DeviceName``.
:param ebs: ``CfnLaunchTemplate.BlockDeviceMappingProperty.Ebs``.
:param no_device: ``CfnLaunchTemplate.BlockDeviceMappingProperty.NoDevice``.
:param virtual_name: ``CfnLaunchTemplate.BlockDeviceMappingProperty.VirtualName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if device_name is not None:
self._values["device_name"] = device_name
if ebs is not None:
self._values["ebs"] = ebs
if no_device is not None:
self._values["no_device"] = no_device
if virtual_name is not None:
self._values["virtual_name"] = virtual_name
@builtins.property
def device_name(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.BlockDeviceMappingProperty.DeviceName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping.html#cfn-ec2-launchtemplate-blockdevicemapping-devicename
"""
result = self._values.get("device_name")
return result
@builtins.property
def ebs(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.EbsProperty"]]:
"""``CfnLaunchTemplate.BlockDeviceMappingProperty.Ebs``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs
"""
result = self._values.get("ebs")
return result
@builtins.property
def no_device(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.BlockDeviceMappingProperty.NoDevice``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping.html#cfn-ec2-launchtemplate-blockdevicemapping-nodevice
"""
result = self._values.get("no_device")
return result
@builtins.property
def virtual_name(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.BlockDeviceMappingProperty.VirtualName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping.html#cfn-ec2-launchtemplate-blockdevicemapping-virtualname
"""
result = self._values.get("virtual_name")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "BlockDeviceMappingProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.CapacityReservationSpecificationProperty",
jsii_struct_bases=[],
name_mapping={
"capacity_reservation_preference": "capacityReservationPreference",
"capacity_reservation_target": "capacityReservationTarget",
},
)
class CapacityReservationSpecificationProperty:
def __init__(
self,
*,
capacity_reservation_preference: typing.Optional[builtins.str] = None,
capacity_reservation_target: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.CapacityReservationTargetProperty"]] = None,
) -> None:
"""
:param capacity_reservation_preference: ``CfnLaunchTemplate.CapacityReservationSpecificationProperty.CapacityReservationPreference``.
:param capacity_reservation_target: ``CfnLaunchTemplate.CapacityReservationSpecificationProperty.CapacityReservationTarget``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-capacityreservationspecification.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if capacity_reservation_preference is not None:
self._values["capacity_reservation_preference"] = capacity_reservation_preference
if capacity_reservation_target is not None:
self._values["capacity_reservation_target"] = capacity_reservation_target
@builtins.property
def capacity_reservation_preference(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.CapacityReservationSpecificationProperty.CapacityReservationPreference``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-capacityreservationspecification.html#cfn-ec2-launchtemplate-launchtemplatedata-capacityreservationspecification-capacityreservationpreference
"""
result = self._values.get("capacity_reservation_preference")
return result
@builtins.property
def capacity_reservation_target(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.CapacityReservationTargetProperty"]]:
"""``CfnLaunchTemplate.CapacityReservationSpecificationProperty.CapacityReservationTarget``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-capacityreservationspecification.html#cfn-ec2-launchtemplate-launchtemplatedata-capacityreservationspecification-capacityreservationtarget
"""
result = self._values.get("capacity_reservation_target")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CapacityReservationSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.CapacityReservationTargetProperty",
jsii_struct_bases=[],
name_mapping={
"capacity_reservation_id": "capacityReservationId",
"capacity_reservation_resource_group_arn": "capacityReservationResourceGroupArn",
},
)
class CapacityReservationTargetProperty:
def __init__(
self,
*,
capacity_reservation_id: typing.Optional[builtins.str] = None,
capacity_reservation_resource_group_arn: typing.Optional[builtins.str] = None,
) -> None:
"""
:param capacity_reservation_id: ``CfnLaunchTemplate.CapacityReservationTargetProperty.CapacityReservationId``.
:param capacity_reservation_resource_group_arn: ``CfnLaunchTemplate.CapacityReservationTargetProperty.CapacityReservationResourceGroupArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-capacityreservationtarget.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if capacity_reservation_id is not None:
self._values["capacity_reservation_id"] = capacity_reservation_id
if capacity_reservation_resource_group_arn is not None:
self._values["capacity_reservation_resource_group_arn"] = capacity_reservation_resource_group_arn
@builtins.property
def capacity_reservation_id(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.CapacityReservationTargetProperty.CapacityReservationId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-capacityreservationtarget.html#cfn-ec2-launchtemplate-capacityreservationtarget-capacityreservationid
"""
result = self._values.get("capacity_reservation_id")
return result
@builtins.property
def capacity_reservation_resource_group_arn(
self,
) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.CapacityReservationTargetProperty.CapacityReservationResourceGroupArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-capacityreservationtarget.html#cfn-ec2-launchtemplate-capacityreservationtarget-capacityreservationresourcegrouparn
"""
result = self._values.get("capacity_reservation_resource_group_arn")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CapacityReservationTargetProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.CpuOptionsProperty",
jsii_struct_bases=[],
name_mapping={"core_count": "coreCount", "threads_per_core": "threadsPerCore"},
)
class CpuOptionsProperty:
def __init__(
self,
*,
core_count: typing.Optional[jsii.Number] = None,
threads_per_core: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param core_count: ``CfnLaunchTemplate.CpuOptionsProperty.CoreCount``.
:param threads_per_core: ``CfnLaunchTemplate.CpuOptionsProperty.ThreadsPerCore``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-cpuoptions.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if core_count is not None:
self._values["core_count"] = core_count
if threads_per_core is not None:
self._values["threads_per_core"] = threads_per_core
@builtins.property
def core_count(self) -> typing.Optional[jsii.Number]:
"""``CfnLaunchTemplate.CpuOptionsProperty.CoreCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-cpuoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-cpuoptions-corecount
"""
result = self._values.get("core_count")
return result
@builtins.property
def threads_per_core(self) -> typing.Optional[jsii.Number]:
"""``CfnLaunchTemplate.CpuOptionsProperty.ThreadsPerCore``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-cpuoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-cpuoptions-threadspercore
"""
result = self._values.get("threads_per_core")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CpuOptionsProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.CreditSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"cpu_credits": "cpuCredits"},
)
class CreditSpecificationProperty:
def __init__(
self,
*,
cpu_credits: typing.Optional[builtins.str] = None,
) -> None:
"""
:param cpu_credits: ``CfnLaunchTemplate.CreditSpecificationProperty.CpuCredits``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-creditspecification.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if cpu_credits is not None:
self._values["cpu_credits"] = cpu_credits
@builtins.property
def cpu_credits(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.CreditSpecificationProperty.CpuCredits``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-creditspecification.html#cfn-ec2-launchtemplate-launchtemplatedata-creditspecification-cpucredits
"""
result = self._values.get("cpu_credits")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CreditSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.EbsProperty",
jsii_struct_bases=[],
name_mapping={
"delete_on_termination": "deleteOnTermination",
"encrypted": "encrypted",
"iops": "iops",
"kms_key_id": "kmsKeyId",
"snapshot_id": "snapshotId",
"throughput": "throughput",
"volume_size": "volumeSize",
"volume_type": "volumeType",
},
)
class EbsProperty:
def __init__(
self,
*,
delete_on_termination: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
encrypted: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
iops: typing.Optional[jsii.Number] = None,
kms_key_id: typing.Optional[builtins.str] = None,
snapshot_id: typing.Optional[builtins.str] = None,
throughput: typing.Optional[jsii.Number] = None,
volume_size: typing.Optional[jsii.Number] = None,
volume_type: typing.Optional[builtins.str] = None,
) -> None:
"""
:param delete_on_termination: ``CfnLaunchTemplate.EbsProperty.DeleteOnTermination``.
:param encrypted: ``CfnLaunchTemplate.EbsProperty.Encrypted``.
:param iops: ``CfnLaunchTemplate.EbsProperty.Iops``.
:param kms_key_id: ``CfnLaunchTemplate.EbsProperty.KmsKeyId``.
:param snapshot_id: ``CfnLaunchTemplate.EbsProperty.SnapshotId``.
:param throughput: ``CfnLaunchTemplate.EbsProperty.Throughput``.
:param volume_size: ``CfnLaunchTemplate.EbsProperty.VolumeSize``.
:param volume_type: ``CfnLaunchTemplate.EbsProperty.VolumeType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if delete_on_termination is not None:
self._values["delete_on_termination"] = delete_on_termination
if encrypted is not None:
self._values["encrypted"] = encrypted
if iops is not None:
self._values["iops"] = iops
if kms_key_id is not None:
self._values["kms_key_id"] = kms_key_id
if snapshot_id is not None:
self._values["snapshot_id"] = snapshot_id
if throughput is not None:
self._values["throughput"] = throughput
if volume_size is not None:
self._values["volume_size"] = volume_size
if volume_type is not None:
self._values["volume_type"] = volume_type
@builtins.property
def delete_on_termination(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnLaunchTemplate.EbsProperty.DeleteOnTermination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-deleteontermination
"""
result = self._values.get("delete_on_termination")
return result
@builtins.property
def encrypted(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnLaunchTemplate.EbsProperty.Encrypted``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-encrypted
"""
result = self._values.get("encrypted")
return result
@builtins.property
def iops(self) -> typing.Optional[jsii.Number]:
"""``CfnLaunchTemplate.EbsProperty.Iops``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-iops
"""
result = self._values.get("iops")
return result
@builtins.property
def kms_key_id(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.EbsProperty.KmsKeyId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-kmskeyid
"""
result = self._values.get("kms_key_id")
return result
@builtins.property
def snapshot_id(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.EbsProperty.SnapshotId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-snapshotid
"""
result = self._values.get("snapshot_id")
return result
@builtins.property
def throughput(self) -> typing.Optional[jsii.Number]:
"""``CfnLaunchTemplate.EbsProperty.Throughput``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-throughput
"""
result = self._values.get("throughput")
return result
@builtins.property
def volume_size(self) -> typing.Optional[jsii.Number]:
"""``CfnLaunchTemplate.EbsProperty.VolumeSize``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-volumesize
"""
result = self._values.get("volume_size")
return result
@builtins.property
def volume_type(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.EbsProperty.VolumeType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-blockdevicemapping-ebs.html#cfn-ec2-launchtemplate-blockdevicemapping-ebs-volumetype
"""
result = self._values.get("volume_type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "EbsProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.ElasticGpuSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"type": "type"},
)
class ElasticGpuSpecificationProperty:
def __init__(self, *, type: typing.Optional[builtins.str] = None) -> None:
"""
:param type: ``CfnLaunchTemplate.ElasticGpuSpecificationProperty.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-elasticgpuspecification.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if type is not None:
self._values["type"] = type
@builtins.property
def type(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.ElasticGpuSpecificationProperty.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-elasticgpuspecification.html#cfn-ec2-launchtemplate-elasticgpuspecification-type
"""
result = self._values.get("type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ElasticGpuSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.EnclaveOptionsProperty",
jsii_struct_bases=[],
name_mapping={"enabled": "enabled"},
)
class EnclaveOptionsProperty:
def __init__(
self,
*,
enabled: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
) -> None:
"""
:param enabled: ``CfnLaunchTemplate.EnclaveOptionsProperty.Enabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-enclaveoptions.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if enabled is not None:
self._values["enabled"] = enabled
@builtins.property
def enabled(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnLaunchTemplate.EnclaveOptionsProperty.Enabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-enclaveoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-enclaveoptions-enabled
"""
result = self._values.get("enabled")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "EnclaveOptionsProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.HibernationOptionsProperty",
jsii_struct_bases=[],
name_mapping={"configured": "configured"},
)
class HibernationOptionsProperty:
def __init__(
self,
*,
configured: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
) -> None:
"""
:param configured: ``CfnLaunchTemplate.HibernationOptionsProperty.Configured``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-hibernationoptions.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if configured is not None:
self._values["configured"] = configured
@builtins.property
def configured(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnLaunchTemplate.HibernationOptionsProperty.Configured``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-hibernationoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-hibernationoptions-configured
"""
result = self._values.get("configured")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "HibernationOptionsProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.IamInstanceProfileProperty",
jsii_struct_bases=[],
name_mapping={"arn": "arn", "name": "name"},
)
class IamInstanceProfileProperty:
def __init__(
self,
*,
arn: typing.Optional[builtins.str] = None,
name: typing.Optional[builtins.str] = None,
) -> None:
"""
:param arn: ``CfnLaunchTemplate.IamInstanceProfileProperty.Arn``.
:param name: ``CfnLaunchTemplate.IamInstanceProfileProperty.Name``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-iaminstanceprofile.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if arn is not None:
self._values["arn"] = arn
if name is not None:
self._values["name"] = name
@builtins.property
def arn(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.IamInstanceProfileProperty.Arn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-iaminstanceprofile.html#cfn-ec2-launchtemplate-launchtemplatedata-iaminstanceprofile-arn
"""
result = self._values.get("arn")
return result
@builtins.property
def name(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.IamInstanceProfileProperty.Name``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-iaminstanceprofile.html#cfn-ec2-launchtemplate-launchtemplatedata-iaminstanceprofile-name
"""
result = self._values.get("name")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "IamInstanceProfileProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.InstanceMarketOptionsProperty",
jsii_struct_bases=[],
name_mapping={"market_type": "marketType", "spot_options": "spotOptions"},
)
class InstanceMarketOptionsProperty:
def __init__(
self,
*,
market_type: typing.Optional[builtins.str] = None,
spot_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.SpotOptionsProperty"]] = None,
) -> None:
"""
:param market_type: ``CfnLaunchTemplate.InstanceMarketOptionsProperty.MarketType``.
:param spot_options: ``CfnLaunchTemplate.InstanceMarketOptionsProperty.SpotOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if market_type is not None:
self._values["market_type"] = market_type
if spot_options is not None:
self._values["spot_options"] = spot_options
@builtins.property
def market_type(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.InstanceMarketOptionsProperty.MarketType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-markettype
"""
result = self._values.get("market_type")
return result
@builtins.property
def spot_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.SpotOptionsProperty"]]:
"""``CfnLaunchTemplate.InstanceMarketOptionsProperty.SpotOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions
"""
result = self._values.get("spot_options")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InstanceMarketOptionsProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.Ipv6AddProperty",
jsii_struct_bases=[],
name_mapping={"ipv6_address": "ipv6Address"},
)
class Ipv6AddProperty:
def __init__(
self,
*,
ipv6_address: typing.Optional[builtins.str] = None,
) -> None:
"""
:param ipv6_address: ``CfnLaunchTemplate.Ipv6AddProperty.Ipv6Address``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-ipv6add.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if ipv6_address is not None:
self._values["ipv6_address"] = ipv6_address
@builtins.property
def ipv6_address(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.Ipv6AddProperty.Ipv6Address``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-ipv6add.html#cfn-ec2-launchtemplate-ipv6add-ipv6address
"""
result = self._values.get("ipv6_address")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "Ipv6AddProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.LaunchTemplateDataProperty",
jsii_struct_bases=[],
name_mapping={
"block_device_mappings": "blockDeviceMappings",
"capacity_reservation_specification": "capacityReservationSpecification",
"cpu_options": "cpuOptions",
"credit_specification": "creditSpecification",
"disable_api_termination": "disableApiTermination",
"ebs_optimized": "ebsOptimized",
"elastic_gpu_specifications": "elasticGpuSpecifications",
"elastic_inference_accelerators": "elasticInferenceAccelerators",
"enclave_options": "enclaveOptions",
"hibernation_options": "hibernationOptions",
"iam_instance_profile": "iamInstanceProfile",
"image_id": "imageId",
"instance_initiated_shutdown_behavior": "instanceInitiatedShutdownBehavior",
"instance_market_options": "instanceMarketOptions",
"instance_type": "instanceType",
"kernel_id": "kernelId",
"key_name": "keyName",
"license_specifications": "licenseSpecifications",
"metadata_options": "metadataOptions",
"monitoring": "monitoring",
"network_interfaces": "networkInterfaces",
"placement": "placement",
"ram_disk_id": "ramDiskId",
"security_group_ids": "securityGroupIds",
"security_groups": "securityGroups",
"tag_specifications": "tagSpecifications",
"user_data": "userData",
},
)
class LaunchTemplateDataProperty:
def __init__(
self,
*,
block_device_mappings: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.BlockDeviceMappingProperty"]]]] = None,
capacity_reservation_specification: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.CapacityReservationSpecificationProperty"]] = None,
cpu_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.CpuOptionsProperty"]] = None,
credit_specification: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.CreditSpecificationProperty"]] = None,
disable_api_termination: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
ebs_optimized: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
elastic_gpu_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.ElasticGpuSpecificationProperty"]]]] = None,
elastic_inference_accelerators: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.LaunchTemplateElasticInferenceAcceleratorProperty"]]]] = None,
enclave_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.EnclaveOptionsProperty"]] = None,
hibernation_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.HibernationOptionsProperty"]] = None,
iam_instance_profile: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.IamInstanceProfileProperty"]] = None,
image_id: typing.Optional[builtins.str] = None,
instance_initiated_shutdown_behavior: typing.Optional[builtins.str] = None,
instance_market_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.InstanceMarketOptionsProperty"]] = None,
instance_type: typing.Optional[builtins.str] = None,
kernel_id: typing.Optional[builtins.str] = None,
key_name: typing.Optional[builtins.str] = None,
license_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.LicenseSpecificationProperty"]]]] = None,
metadata_options: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.MetadataOptionsProperty"]] = None,
monitoring: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.MonitoringProperty"]] = None,
network_interfaces: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.NetworkInterfaceProperty"]]]] = None,
placement: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.PlacementProperty"]] = None,
ram_disk_id: typing.Optional[builtins.str] = None,
security_group_ids: typing.Optional[typing.List[builtins.str]] = None,
security_groups: typing.Optional[typing.List[builtins.str]] = None,
tag_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.TagSpecificationProperty"]]]] = None,
user_data: typing.Optional[builtins.str] = None,
) -> None:
"""
:param block_device_mappings: ``CfnLaunchTemplate.LaunchTemplateDataProperty.BlockDeviceMappings``.
:param capacity_reservation_specification: ``CfnLaunchTemplate.LaunchTemplateDataProperty.CapacityReservationSpecification``.
:param cpu_options: ``CfnLaunchTemplate.LaunchTemplateDataProperty.CpuOptions``.
:param credit_specification: ``CfnLaunchTemplate.LaunchTemplateDataProperty.CreditSpecification``.
:param disable_api_termination: ``CfnLaunchTemplate.LaunchTemplateDataProperty.DisableApiTermination``.
:param ebs_optimized: ``CfnLaunchTemplate.LaunchTemplateDataProperty.EbsOptimized``.
:param elastic_gpu_specifications: ``CfnLaunchTemplate.LaunchTemplateDataProperty.ElasticGpuSpecifications``.
:param elastic_inference_accelerators: ``CfnLaunchTemplate.LaunchTemplateDataProperty.ElasticInferenceAccelerators``.
:param enclave_options: ``CfnLaunchTemplate.LaunchTemplateDataProperty.EnclaveOptions``.
:param hibernation_options: ``CfnLaunchTemplate.LaunchTemplateDataProperty.HibernationOptions``.
:param iam_instance_profile: ``CfnLaunchTemplate.LaunchTemplateDataProperty.IamInstanceProfile``.
:param image_id: ``CfnLaunchTemplate.LaunchTemplateDataProperty.ImageId``.
:param instance_initiated_shutdown_behavior: ``CfnLaunchTemplate.LaunchTemplateDataProperty.InstanceInitiatedShutdownBehavior``.
:param instance_market_options: ``CfnLaunchTemplate.LaunchTemplateDataProperty.InstanceMarketOptions``.
:param instance_type: ``CfnLaunchTemplate.LaunchTemplateDataProperty.InstanceType``.
:param kernel_id: ``CfnLaunchTemplate.LaunchTemplateDataProperty.KernelId``.
:param key_name: ``CfnLaunchTemplate.LaunchTemplateDataProperty.KeyName``.
:param license_specifications: ``CfnLaunchTemplate.LaunchTemplateDataProperty.LicenseSpecifications``.
:param metadata_options: ``CfnLaunchTemplate.LaunchTemplateDataProperty.MetadataOptions``.
:param monitoring: ``CfnLaunchTemplate.LaunchTemplateDataProperty.Monitoring``.
:param network_interfaces: ``CfnLaunchTemplate.LaunchTemplateDataProperty.NetworkInterfaces``.
:param placement: ``CfnLaunchTemplate.LaunchTemplateDataProperty.Placement``.
:param ram_disk_id: ``CfnLaunchTemplate.LaunchTemplateDataProperty.RamDiskId``.
:param security_group_ids: ``CfnLaunchTemplate.LaunchTemplateDataProperty.SecurityGroupIds``.
:param security_groups: ``CfnLaunchTemplate.LaunchTemplateDataProperty.SecurityGroups``.
:param tag_specifications: ``CfnLaunchTemplate.LaunchTemplateDataProperty.TagSpecifications``.
:param user_data: ``CfnLaunchTemplate.LaunchTemplateDataProperty.UserData``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if block_device_mappings is not None:
self._values["block_device_mappings"] = block_device_mappings
if capacity_reservation_specification is not None:
self._values["capacity_reservation_specification"] = capacity_reservation_specification
if cpu_options is not None:
self._values["cpu_options"] = cpu_options
if credit_specification is not None:
self._values["credit_specification"] = credit_specification
if disable_api_termination is not None:
self._values["disable_api_termination"] = disable_api_termination
if ebs_optimized is not None:
self._values["ebs_optimized"] = ebs_optimized
if elastic_gpu_specifications is not None:
self._values["elastic_gpu_specifications"] = elastic_gpu_specifications
if elastic_inference_accelerators is not None:
self._values["elastic_inference_accelerators"] = elastic_inference_accelerators
if enclave_options is not None:
self._values["enclave_options"] = enclave_options
if hibernation_options is not None:
self._values["hibernation_options"] = hibernation_options
if iam_instance_profile is not None:
self._values["iam_instance_profile"] = iam_instance_profile
if image_id is not None:
self._values["image_id"] = image_id
if instance_initiated_shutdown_behavior is not None:
self._values["instance_initiated_shutdown_behavior"] = instance_initiated_shutdown_behavior
if instance_market_options is not None:
self._values["instance_market_options"] = instance_market_options
if instance_type is not None:
self._values["instance_type"] = instance_type
if kernel_id is not None:
self._values["kernel_id"] = kernel_id
if key_name is not None:
self._values["key_name"] = key_name
if license_specifications is not None:
self._values["license_specifications"] = license_specifications
if metadata_options is not None:
self._values["metadata_options"] = metadata_options
if monitoring is not None:
self._values["monitoring"] = monitoring
if network_interfaces is not None:
self._values["network_interfaces"] = network_interfaces
if placement is not None:
self._values["placement"] = placement
if ram_disk_id is not None:
self._values["ram_disk_id"] = ram_disk_id
if security_group_ids is not None:
self._values["security_group_ids"] = security_group_ids
if security_groups is not None:
self._values["security_groups"] = security_groups
if tag_specifications is not None:
self._values["tag_specifications"] = tag_specifications
if user_data is not None:
self._values["user_data"] = user_data
@builtins.property
def block_device_mappings(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.BlockDeviceMappingProperty"]]]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.BlockDeviceMappings``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-blockdevicemappings
"""
result = self._values.get("block_device_mappings")
return result
@builtins.property
def capacity_reservation_specification(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.CapacityReservationSpecificationProperty"]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.CapacityReservationSpecification``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-capacityreservationspecification
"""
result = self._values.get("capacity_reservation_specification")
return result
@builtins.property
def cpu_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.CpuOptionsProperty"]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.CpuOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-cpuoptions
"""
result = self._values.get("cpu_options")
return result
@builtins.property
def credit_specification(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.CreditSpecificationProperty"]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.CreditSpecification``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-creditspecification
"""
result = self._values.get("credit_specification")
return result
@builtins.property
def disable_api_termination(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.DisableApiTermination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-disableapitermination
"""
result = self._values.get("disable_api_termination")
return result
@builtins.property
def ebs_optimized(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.EbsOptimized``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-ebsoptimized
"""
result = self._values.get("ebs_optimized")
return result
@builtins.property
def elastic_gpu_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.ElasticGpuSpecificationProperty"]]]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.ElasticGpuSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-elasticgpuspecifications
"""
result = self._values.get("elastic_gpu_specifications")
return result
@builtins.property
def elastic_inference_accelerators(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.LaunchTemplateElasticInferenceAcceleratorProperty"]]]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.ElasticInferenceAccelerators``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-elasticinferenceaccelerators
"""
result = self._values.get("elastic_inference_accelerators")
return result
@builtins.property
def enclave_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.EnclaveOptionsProperty"]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.EnclaveOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-enclaveoptions
"""
result = self._values.get("enclave_options")
return result
@builtins.property
def hibernation_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.HibernationOptionsProperty"]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.HibernationOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-hibernationoptions
"""
result = self._values.get("hibernation_options")
return result
@builtins.property
def iam_instance_profile(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.IamInstanceProfileProperty"]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.IamInstanceProfile``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-iaminstanceprofile
"""
result = self._values.get("iam_instance_profile")
return result
@builtins.property
def image_id(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.ImageId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-imageid
"""
result = self._values.get("image_id")
return result
@builtins.property
def instance_initiated_shutdown_behavior(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.InstanceInitiatedShutdownBehavior``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-instanceinitiatedshutdownbehavior
"""
result = self._values.get("instance_initiated_shutdown_behavior")
return result
@builtins.property
def instance_market_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.InstanceMarketOptionsProperty"]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.InstanceMarketOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions
"""
result = self._values.get("instance_market_options")
return result
@builtins.property
def instance_type(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.InstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-instancetype
"""
result = self._values.get("instance_type")
return result
@builtins.property
def kernel_id(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.KernelId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-kernelid
"""
result = self._values.get("kernel_id")
return result
@builtins.property
def key_name(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.KeyName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-keyname
"""
result = self._values.get("key_name")
return result
@builtins.property
def license_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.LicenseSpecificationProperty"]]]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.LicenseSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-licensespecifications
"""
result = self._values.get("license_specifications")
return result
@builtins.property
def metadata_options(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.MetadataOptionsProperty"]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.MetadataOptions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-metadataoptions
"""
result = self._values.get("metadata_options")
return result
@builtins.property
def monitoring(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.MonitoringProperty"]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.Monitoring``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-monitoring
"""
result = self._values.get("monitoring")
return result
@builtins.property
def network_interfaces(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.NetworkInterfaceProperty"]]]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.NetworkInterfaces``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-networkinterfaces
"""
result = self._values.get("network_interfaces")
return result
@builtins.property
def placement(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.PlacementProperty"]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.Placement``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-placement
"""
result = self._values.get("placement")
return result
@builtins.property
def ram_disk_id(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.RamDiskId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-ramdiskid
"""
result = self._values.get("ram_disk_id")
return result
@builtins.property
def security_group_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.SecurityGroupIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-securitygroupids
"""
result = self._values.get("security_group_ids")
return result
@builtins.property
def security_groups(self) -> typing.Optional[typing.List[builtins.str]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.SecurityGroups``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-securitygroups
"""
result = self._values.get("security_groups")
return result
@builtins.property
def tag_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.TagSpecificationProperty"]]]]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.TagSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-tagspecifications
"""
result = self._values.get("tag_specifications")
return result
@builtins.property
def user_data(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.LaunchTemplateDataProperty.UserData``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-userdata
"""
result = self._values.get("user_data")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LaunchTemplateDataProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.LaunchTemplateElasticInferenceAcceleratorProperty",
jsii_struct_bases=[],
name_mapping={"count": "count", "type": "type"},
)
class LaunchTemplateElasticInferenceAcceleratorProperty:
def __init__(
self,
*,
count: typing.Optional[jsii.Number] = None,
type: typing.Optional[builtins.str] = None,
) -> None:
"""
:param count: ``CfnLaunchTemplate.LaunchTemplateElasticInferenceAcceleratorProperty.Count``.
:param type: ``CfnLaunchTemplate.LaunchTemplateElasticInferenceAcceleratorProperty.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplateelasticinferenceaccelerator.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if count is not None:
self._values["count"] = count
if type is not None:
self._values["type"] = type
@builtins.property
def count(self) -> typing.Optional[jsii.Number]:
"""``CfnLaunchTemplate.LaunchTemplateElasticInferenceAcceleratorProperty.Count``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplateelasticinferenceaccelerator.html#cfn-ec2-launchtemplate-launchtemplateelasticinferenceaccelerator-count
"""
result = self._values.get("count")
return result
@builtins.property
def type(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.LaunchTemplateElasticInferenceAcceleratorProperty.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplateelasticinferenceaccelerator.html#cfn-ec2-launchtemplate-launchtemplateelasticinferenceaccelerator-type
"""
result = self._values.get("type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LaunchTemplateElasticInferenceAcceleratorProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.LicenseSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"license_configuration_arn": "licenseConfigurationArn"},
)
class LicenseSpecificationProperty:
def __init__(
self,
*,
license_configuration_arn: typing.Optional[builtins.str] = None,
) -> None:
"""
:param license_configuration_arn: ``CfnLaunchTemplate.LicenseSpecificationProperty.LicenseConfigurationArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-licensespecification.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if license_configuration_arn is not None:
self._values["license_configuration_arn"] = license_configuration_arn
@builtins.property
def license_configuration_arn(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.LicenseSpecificationProperty.LicenseConfigurationArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-licensespecification.html#cfn-ec2-launchtemplate-licensespecification-licenseconfigurationarn
"""
result = self._values.get("license_configuration_arn")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LicenseSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.MetadataOptionsProperty",
jsii_struct_bases=[],
name_mapping={
"http_endpoint": "httpEndpoint",
"http_put_response_hop_limit": "httpPutResponseHopLimit",
"http_tokens": "httpTokens",
},
)
class MetadataOptionsProperty:
def __init__(
self,
*,
http_endpoint: typing.Optional[builtins.str] = None,
http_put_response_hop_limit: typing.Optional[jsii.Number] = None,
http_tokens: typing.Optional[builtins.str] = None,
) -> None:
"""
:param http_endpoint: ``CfnLaunchTemplate.MetadataOptionsProperty.HttpEndpoint``.
:param http_put_response_hop_limit: ``CfnLaunchTemplate.MetadataOptionsProperty.HttpPutResponseHopLimit``.
:param http_tokens: ``CfnLaunchTemplate.MetadataOptionsProperty.HttpTokens``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-metadataoptions.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if http_endpoint is not None:
self._values["http_endpoint"] = http_endpoint
if http_put_response_hop_limit is not None:
self._values["http_put_response_hop_limit"] = http_put_response_hop_limit
if http_tokens is not None:
self._values["http_tokens"] = http_tokens
@builtins.property
def http_endpoint(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.MetadataOptionsProperty.HttpEndpoint``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-metadataoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-metadataoptions-httpendpoint
"""
result = self._values.get("http_endpoint")
return result
@builtins.property
def http_put_response_hop_limit(self) -> typing.Optional[jsii.Number]:
"""``CfnLaunchTemplate.MetadataOptionsProperty.HttpPutResponseHopLimit``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-metadataoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-metadataoptions-httpputresponsehoplimit
"""
result = self._values.get("http_put_response_hop_limit")
return result
@builtins.property
def http_tokens(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.MetadataOptionsProperty.HttpTokens``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-metadataoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-metadataoptions-httptokens
"""
result = self._values.get("http_tokens")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "MetadataOptionsProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.MonitoringProperty",
jsii_struct_bases=[],
name_mapping={"enabled": "enabled"},
)
class MonitoringProperty:
def __init__(
self,
*,
enabled: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
) -> None:
"""
:param enabled: ``CfnLaunchTemplate.MonitoringProperty.Enabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-monitoring.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if enabled is not None:
self._values["enabled"] = enabled
@builtins.property
def enabled(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnLaunchTemplate.MonitoringProperty.Enabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-monitoring.html#cfn-ec2-launchtemplate-launchtemplatedata-monitoring-enabled
"""
result = self._values.get("enabled")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "MonitoringProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.NetworkInterfaceProperty",
jsii_struct_bases=[],
name_mapping={
"associate_carrier_ip_address": "associateCarrierIpAddress",
"associate_public_ip_address": "associatePublicIpAddress",
"delete_on_termination": "deleteOnTermination",
"description": "description",
"device_index": "deviceIndex",
"groups": "groups",
"interface_type": "interfaceType",
"ipv6_address_count": "ipv6AddressCount",
"ipv6_addresses": "ipv6Addresses",
"network_card_index": "networkCardIndex",
"network_interface_id": "networkInterfaceId",
"private_ip_address": "privateIpAddress",
"private_ip_addresses": "privateIpAddresses",
"secondary_private_ip_address_count": "secondaryPrivateIpAddressCount",
"subnet_id": "subnetId",
},
)
class NetworkInterfaceProperty:
def __init__(
self,
*,
associate_carrier_ip_address: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
associate_public_ip_address: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
delete_on_termination: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
description: typing.Optional[builtins.str] = None,
device_index: typing.Optional[jsii.Number] = None,
groups: typing.Optional[typing.List[builtins.str]] = None,
interface_type: typing.Optional[builtins.str] = None,
ipv6_address_count: typing.Optional[jsii.Number] = None,
ipv6_addresses: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.Ipv6AddProperty"]]]] = None,
network_card_index: typing.Optional[jsii.Number] = None,
network_interface_id: typing.Optional[builtins.str] = None,
private_ip_address: typing.Optional[builtins.str] = None,
private_ip_addresses: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.PrivateIpAddProperty"]]]] = None,
secondary_private_ip_address_count: typing.Optional[jsii.Number] = None,
subnet_id: typing.Optional[builtins.str] = None,
) -> None:
"""
:param associate_carrier_ip_address: ``CfnLaunchTemplate.NetworkInterfaceProperty.AssociateCarrierIpAddress``.
:param associate_public_ip_address: ``CfnLaunchTemplate.NetworkInterfaceProperty.AssociatePublicIpAddress``.
:param delete_on_termination: ``CfnLaunchTemplate.NetworkInterfaceProperty.DeleteOnTermination``.
:param description: ``CfnLaunchTemplate.NetworkInterfaceProperty.Description``.
:param device_index: ``CfnLaunchTemplate.NetworkInterfaceProperty.DeviceIndex``.
:param groups: ``CfnLaunchTemplate.NetworkInterfaceProperty.Groups``.
:param interface_type: ``CfnLaunchTemplate.NetworkInterfaceProperty.InterfaceType``.
:param ipv6_address_count: ``CfnLaunchTemplate.NetworkInterfaceProperty.Ipv6AddressCount``.
:param ipv6_addresses: ``CfnLaunchTemplate.NetworkInterfaceProperty.Ipv6Addresses``.
:param network_card_index: ``CfnLaunchTemplate.NetworkInterfaceProperty.NetworkCardIndex``.
:param network_interface_id: ``CfnLaunchTemplate.NetworkInterfaceProperty.NetworkInterfaceId``.
:param private_ip_address: ``CfnLaunchTemplate.NetworkInterfaceProperty.PrivateIpAddress``.
:param private_ip_addresses: ``CfnLaunchTemplate.NetworkInterfaceProperty.PrivateIpAddresses``.
:param secondary_private_ip_address_count: ``CfnLaunchTemplate.NetworkInterfaceProperty.SecondaryPrivateIpAddressCount``.
:param subnet_id: ``CfnLaunchTemplate.NetworkInterfaceProperty.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if associate_carrier_ip_address is not None:
self._values["associate_carrier_ip_address"] = associate_carrier_ip_address
if associate_public_ip_address is not None:
self._values["associate_public_ip_address"] = associate_public_ip_address
if delete_on_termination is not None:
self._values["delete_on_termination"] = delete_on_termination
if description is not None:
self._values["description"] = description
if device_index is not None:
self._values["device_index"] = device_index
if groups is not None:
self._values["groups"] = groups
if interface_type is not None:
self._values["interface_type"] = interface_type
if ipv6_address_count is not None:
self._values["ipv6_address_count"] = ipv6_address_count
if ipv6_addresses is not None:
self._values["ipv6_addresses"] = ipv6_addresses
if network_card_index is not None:
self._values["network_card_index"] = network_card_index
if network_interface_id is not None:
self._values["network_interface_id"] = network_interface_id
if private_ip_address is not None:
self._values["private_ip_address"] = private_ip_address
if private_ip_addresses is not None:
self._values["private_ip_addresses"] = private_ip_addresses
if secondary_private_ip_address_count is not None:
self._values["secondary_private_ip_address_count"] = secondary_private_ip_address_count
if subnet_id is not None:
self._values["subnet_id"] = subnet_id
@builtins.property
def associate_carrier_ip_address(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.AssociateCarrierIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-associatecarrieripaddress
"""
result = self._values.get("associate_carrier_ip_address")
return result
@builtins.property
def associate_public_ip_address(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.AssociatePublicIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-associatepublicipaddress
"""
result = self._values.get("associate_public_ip_address")
return result
@builtins.property
def delete_on_termination(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.DeleteOnTermination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-deleteontermination
"""
result = self._values.get("delete_on_termination")
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-description
"""
result = self._values.get("description")
return result
@builtins.property
def device_index(self) -> typing.Optional[jsii.Number]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.DeviceIndex``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-deviceindex
"""
result = self._values.get("device_index")
return result
@builtins.property
def groups(self) -> typing.Optional[typing.List[builtins.str]]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.Groups``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-groups
"""
result = self._values.get("groups")
return result
@builtins.property
def interface_type(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.InterfaceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-interfacetype
"""
result = self._values.get("interface_type")
return result
@builtins.property
def ipv6_address_count(self) -> typing.Optional[jsii.Number]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.Ipv6AddressCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-ipv6addresscount
"""
result = self._values.get("ipv6_address_count")
return result
@builtins.property
def ipv6_addresses(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.Ipv6AddProperty"]]]]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.Ipv6Addresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-ipv6addresses
"""
result = self._values.get("ipv6_addresses")
return result
@builtins.property
def network_card_index(self) -> typing.Optional[jsii.Number]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.NetworkCardIndex``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-networkcardindex
"""
result = self._values.get("network_card_index")
return result
@builtins.property
def network_interface_id(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-networkinterfaceid
"""
result = self._values.get("network_interface_id")
return result
@builtins.property
def private_ip_address(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-privateipaddress
"""
result = self._values.get("private_ip_address")
return result
@builtins.property
def private_ip_addresses(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnLaunchTemplate.PrivateIpAddProperty"]]]]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.PrivateIpAddresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-privateipaddresses
"""
result = self._values.get("private_ip_addresses")
return result
@builtins.property
def secondary_private_ip_address_count(self) -> typing.Optional[jsii.Number]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.SecondaryPrivateIpAddressCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-secondaryprivateipaddresscount
"""
result = self._values.get("secondary_private_ip_address_count")
return result
@builtins.property
def subnet_id(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.NetworkInterfaceProperty.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html#cfn-ec2-launchtemplate-networkinterface-subnetid
"""
result = self._values.get("subnet_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "NetworkInterfaceProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.PlacementProperty",
jsii_struct_bases=[],
name_mapping={
"affinity": "affinity",
"availability_zone": "availabilityZone",
"group_name": "groupName",
"host_id": "hostId",
"host_resource_group_arn": "hostResourceGroupArn",
"partition_number": "partitionNumber",
"spread_domain": "spreadDomain",
"tenancy": "tenancy",
},
)
class PlacementProperty:
def __init__(
self,
*,
affinity: typing.Optional[builtins.str] = None,
availability_zone: typing.Optional[builtins.str] = None,
group_name: typing.Optional[builtins.str] = None,
host_id: typing.Optional[builtins.str] = None,
host_resource_group_arn: typing.Optional[builtins.str] = None,
partition_number: typing.Optional[jsii.Number] = None,
spread_domain: typing.Optional[builtins.str] = None,
tenancy: typing.Optional[builtins.str] = None,
) -> None:
"""
:param affinity: ``CfnLaunchTemplate.PlacementProperty.Affinity``.
:param availability_zone: ``CfnLaunchTemplate.PlacementProperty.AvailabilityZone``.
:param group_name: ``CfnLaunchTemplate.PlacementProperty.GroupName``.
:param host_id: ``CfnLaunchTemplate.PlacementProperty.HostId``.
:param host_resource_group_arn: ``CfnLaunchTemplate.PlacementProperty.HostResourceGroupArn``.
:param partition_number: ``CfnLaunchTemplate.PlacementProperty.PartitionNumber``.
:param spread_domain: ``CfnLaunchTemplate.PlacementProperty.SpreadDomain``.
:param tenancy: ``CfnLaunchTemplate.PlacementProperty.Tenancy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if affinity is not None:
self._values["affinity"] = affinity
if availability_zone is not None:
self._values["availability_zone"] = availability_zone
if group_name is not None:
self._values["group_name"] = group_name
if host_id is not None:
self._values["host_id"] = host_id
if host_resource_group_arn is not None:
self._values["host_resource_group_arn"] = host_resource_group_arn
if partition_number is not None:
self._values["partition_number"] = partition_number
if spread_domain is not None:
self._values["spread_domain"] = spread_domain
if tenancy is not None:
self._values["tenancy"] = tenancy
@builtins.property
def affinity(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.PlacementProperty.Affinity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html#cfn-ec2-launchtemplate-launchtemplatedata-placement-affinity
"""
result = self._values.get("affinity")
return result
@builtins.property
def availability_zone(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.PlacementProperty.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html#cfn-ec2-launchtemplate-launchtemplatedata-placement-availabilityzone
"""
result = self._values.get("availability_zone")
return result
@builtins.property
def group_name(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.PlacementProperty.GroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html#cfn-ec2-launchtemplate-launchtemplatedata-placement-groupname
"""
result = self._values.get("group_name")
return result
@builtins.property
def host_id(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.PlacementProperty.HostId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html#cfn-ec2-launchtemplate-launchtemplatedata-placement-hostid
"""
result = self._values.get("host_id")
return result
@builtins.property
def host_resource_group_arn(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.PlacementProperty.HostResourceGroupArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html#cfn-ec2-launchtemplate-launchtemplatedata-placement-hostresourcegrouparn
"""
result = self._values.get("host_resource_group_arn")
return result
@builtins.property
def partition_number(self) -> typing.Optional[jsii.Number]:
"""``CfnLaunchTemplate.PlacementProperty.PartitionNumber``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html#cfn-ec2-launchtemplate-launchtemplatedata-placement-partitionnumber
"""
result = self._values.get("partition_number")
return result
@builtins.property
def spread_domain(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.PlacementProperty.SpreadDomain``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html#cfn-ec2-launchtemplate-launchtemplatedata-placement-spreaddomain
"""
result = self._values.get("spread_domain")
return result
@builtins.property
def tenancy(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.PlacementProperty.Tenancy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-placement.html#cfn-ec2-launchtemplate-launchtemplatedata-placement-tenancy
"""
result = self._values.get("tenancy")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PlacementProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.PrivateIpAddProperty",
jsii_struct_bases=[],
name_mapping={"primary": "primary", "private_ip_address": "privateIpAddress"},
)
class PrivateIpAddProperty:
def __init__(
self,
*,
primary: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
private_ip_address: typing.Optional[builtins.str] = None,
) -> None:
"""
:param primary: ``CfnLaunchTemplate.PrivateIpAddProperty.Primary``.
:param private_ip_address: ``CfnLaunchTemplate.PrivateIpAddProperty.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-privateipadd.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if primary is not None:
self._values["primary"] = primary
if private_ip_address is not None:
self._values["private_ip_address"] = private_ip_address
@builtins.property
def primary(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnLaunchTemplate.PrivateIpAddProperty.Primary``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-privateipadd.html#cfn-ec2-launchtemplate-privateipadd-primary
"""
result = self._values.get("primary")
return result
@builtins.property
def private_ip_address(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.PrivateIpAddProperty.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-privateipadd.html#cfn-ec2-launchtemplate-privateipadd-privateipaddress
"""
result = self._values.get("private_ip_address")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PrivateIpAddProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.SpotOptionsProperty",
jsii_struct_bases=[],
name_mapping={
"block_duration_minutes": "blockDurationMinutes",
"instance_interruption_behavior": "instanceInterruptionBehavior",
"max_price": "maxPrice",
"spot_instance_type": "spotInstanceType",
"valid_until": "validUntil",
},
)
class SpotOptionsProperty:
def __init__(
self,
*,
block_duration_minutes: typing.Optional[jsii.Number] = None,
instance_interruption_behavior: typing.Optional[builtins.str] = None,
max_price: typing.Optional[builtins.str] = None,
spot_instance_type: typing.Optional[builtins.str] = None,
valid_until: typing.Optional[builtins.str] = None,
) -> None:
"""
:param block_duration_minutes: ``CfnLaunchTemplate.SpotOptionsProperty.BlockDurationMinutes``.
:param instance_interruption_behavior: ``CfnLaunchTemplate.SpotOptionsProperty.InstanceInterruptionBehavior``.
:param max_price: ``CfnLaunchTemplate.SpotOptionsProperty.MaxPrice``.
:param spot_instance_type: ``CfnLaunchTemplate.SpotOptionsProperty.SpotInstanceType``.
:param valid_until: ``CfnLaunchTemplate.SpotOptionsProperty.ValidUntil``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if block_duration_minutes is not None:
self._values["block_duration_minutes"] = block_duration_minutes
if instance_interruption_behavior is not None:
self._values["instance_interruption_behavior"] = instance_interruption_behavior
if max_price is not None:
self._values["max_price"] = max_price
if spot_instance_type is not None:
self._values["spot_instance_type"] = spot_instance_type
if valid_until is not None:
self._values["valid_until"] = valid_until
@builtins.property
def block_duration_minutes(self) -> typing.Optional[jsii.Number]:
"""``CfnLaunchTemplate.SpotOptionsProperty.BlockDurationMinutes``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions-blockdurationminutes
"""
result = self._values.get("block_duration_minutes")
return result
@builtins.property
def instance_interruption_behavior(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.SpotOptionsProperty.InstanceInterruptionBehavior``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions-instanceinterruptionbehavior
"""
result = self._values.get("instance_interruption_behavior")
return result
@builtins.property
def max_price(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.SpotOptionsProperty.MaxPrice``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions-maxprice
"""
result = self._values.get("max_price")
return result
@builtins.property
def spot_instance_type(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.SpotOptionsProperty.SpotInstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions-spotinstancetype
"""
result = self._values.get("spot_instance_type")
return result
@builtins.property
def valid_until(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.SpotOptionsProperty.ValidUntil``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-instancemarketoptions-spotoptions-validuntil
"""
result = self._values.get("valid_until")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SpotOptionsProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplate.TagSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"resource_type": "resourceType", "tags": "tags"},
)
class TagSpecificationProperty:
def __init__(
self,
*,
resource_type: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""
:param resource_type: ``CfnLaunchTemplate.TagSpecificationProperty.ResourceType``.
:param tags: ``CfnLaunchTemplate.TagSpecificationProperty.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-tagspecification.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if resource_type is not None:
self._values["resource_type"] = resource_type
if tags is not None:
self._values["tags"] = tags
@builtins.property
def resource_type(self) -> typing.Optional[builtins.str]:
"""``CfnLaunchTemplate.TagSpecificationProperty.ResourceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-tagspecification.html#cfn-ec2-launchtemplate-tagspecification-resourcetype
"""
result = self._values.get("resource_type")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``CfnLaunchTemplate.TagSpecificationProperty.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-tagspecification.html#cfn-ec2-launchtemplate-tagspecification-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "TagSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLaunchTemplateProps",
jsii_struct_bases=[],
name_mapping={
"launch_template_data": "launchTemplateData",
"launch_template_name": "launchTemplateName",
},
)
class CfnLaunchTemplateProps:
def __init__(
self,
*,
launch_template_data: typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnLaunchTemplate.LaunchTemplateDataProperty]] = None,
launch_template_name: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::LaunchTemplate``.
:param launch_template_data: ``AWS::EC2::LaunchTemplate.LaunchTemplateData``.
:param launch_template_name: ``AWS::EC2::LaunchTemplate.LaunchTemplateName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if launch_template_data is not None:
self._values["launch_template_data"] = launch_template_data
if launch_template_name is not None:
self._values["launch_template_name"] = launch_template_name
@builtins.property
def launch_template_data(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnLaunchTemplate.LaunchTemplateDataProperty]]:
"""``AWS::EC2::LaunchTemplate.LaunchTemplateData``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html#cfn-ec2-launchtemplate-launchtemplatedata
"""
result = self._values.get("launch_template_data")
return result
@builtins.property
def launch_template_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::LaunchTemplate.LaunchTemplateName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html#cfn-ec2-launchtemplate-launchtemplatename
"""
result = self._values.get("launch_template_name")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnLaunchTemplateProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnLocalGatewayRoute(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnLocalGatewayRoute",
):
"""A CloudFormation ``AWS::EC2::LocalGatewayRoute``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroute.html
:cloudformationResource: AWS::EC2::LocalGatewayRoute
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
destination_cidr_block: builtins.str,
local_gateway_route_table_id: builtins.str,
local_gateway_virtual_interface_group_id: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::LocalGatewayRoute``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param destination_cidr_block: ``AWS::EC2::LocalGatewayRoute.DestinationCidrBlock``.
:param local_gateway_route_table_id: ``AWS::EC2::LocalGatewayRoute.LocalGatewayRouteTableId``.
:param local_gateway_virtual_interface_group_id: ``AWS::EC2::LocalGatewayRoute.LocalGatewayVirtualInterfaceGroupId``.
"""
props = CfnLocalGatewayRouteProps(
destination_cidr_block=destination_cidr_block,
local_gateway_route_table_id=local_gateway_route_table_id,
local_gateway_virtual_interface_group_id=local_gateway_virtual_interface_group_id,
)
jsii.create(CfnLocalGatewayRoute, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrState")
def attr_state(self) -> builtins.str:
"""
:cloudformationAttribute: State
"""
return jsii.get(self, "attrState")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrType")
def attr_type(self) -> builtins.str:
"""
:cloudformationAttribute: Type
"""
return jsii.get(self, "attrType")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="destinationCidrBlock")
def destination_cidr_block(self) -> builtins.str:
"""``AWS::EC2::LocalGatewayRoute.DestinationCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroute.html#cfn-ec2-localgatewayroute-destinationcidrblock
"""
return jsii.get(self, "destinationCidrBlock")
@destination_cidr_block.setter # type: ignore
def destination_cidr_block(self, value: builtins.str) -> None:
jsii.set(self, "destinationCidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="localGatewayRouteTableId")
def local_gateway_route_table_id(self) -> builtins.str:
"""``AWS::EC2::LocalGatewayRoute.LocalGatewayRouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroute.html#cfn-ec2-localgatewayroute-localgatewayroutetableid
"""
return jsii.get(self, "localGatewayRouteTableId")
@local_gateway_route_table_id.setter # type: ignore
def local_gateway_route_table_id(self, value: builtins.str) -> None:
jsii.set(self, "localGatewayRouteTableId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="localGatewayVirtualInterfaceGroupId")
def local_gateway_virtual_interface_group_id(self) -> builtins.str:
"""``AWS::EC2::LocalGatewayRoute.LocalGatewayVirtualInterfaceGroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroute.html#cfn-ec2-localgatewayroute-localgatewayvirtualinterfacegroupid
"""
return jsii.get(self, "localGatewayVirtualInterfaceGroupId")
@local_gateway_virtual_interface_group_id.setter # type: ignore
def local_gateway_virtual_interface_group_id(self, value: builtins.str) -> None:
jsii.set(self, "localGatewayVirtualInterfaceGroupId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLocalGatewayRouteProps",
jsii_struct_bases=[],
name_mapping={
"destination_cidr_block": "destinationCidrBlock",
"local_gateway_route_table_id": "localGatewayRouteTableId",
"local_gateway_virtual_interface_group_id": "localGatewayVirtualInterfaceGroupId",
},
)
class CfnLocalGatewayRouteProps:
def __init__(
self,
*,
destination_cidr_block: builtins.str,
local_gateway_route_table_id: builtins.str,
local_gateway_virtual_interface_group_id: builtins.str,
) -> None:
"""Properties for defining a ``AWS::EC2::LocalGatewayRoute``.
:param destination_cidr_block: ``AWS::EC2::LocalGatewayRoute.DestinationCidrBlock``.
:param local_gateway_route_table_id: ``AWS::EC2::LocalGatewayRoute.LocalGatewayRouteTableId``.
:param local_gateway_virtual_interface_group_id: ``AWS::EC2::LocalGatewayRoute.LocalGatewayVirtualInterfaceGroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroute.html
"""
self._values: typing.Dict[str, typing.Any] = {
"destination_cidr_block": destination_cidr_block,
"local_gateway_route_table_id": local_gateway_route_table_id,
"local_gateway_virtual_interface_group_id": local_gateway_virtual_interface_group_id,
}
@builtins.property
def destination_cidr_block(self) -> builtins.str:
"""``AWS::EC2::LocalGatewayRoute.DestinationCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroute.html#cfn-ec2-localgatewayroute-destinationcidrblock
"""
result = self._values.get("destination_cidr_block")
assert result is not None, "Required property 'destination_cidr_block' is missing"
return result
@builtins.property
def local_gateway_route_table_id(self) -> builtins.str:
"""``AWS::EC2::LocalGatewayRoute.LocalGatewayRouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroute.html#cfn-ec2-localgatewayroute-localgatewayroutetableid
"""
result = self._values.get("local_gateway_route_table_id")
assert result is not None, "Required property 'local_gateway_route_table_id' is missing"
return result
@builtins.property
def local_gateway_virtual_interface_group_id(self) -> builtins.str:
"""``AWS::EC2::LocalGatewayRoute.LocalGatewayVirtualInterfaceGroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroute.html#cfn-ec2-localgatewayroute-localgatewayvirtualinterfacegroupid
"""
result = self._values.get("local_gateway_virtual_interface_group_id")
assert result is not None, "Required property 'local_gateway_virtual_interface_group_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnLocalGatewayRouteProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnLocalGatewayRouteTableVPCAssociation(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnLocalGatewayRouteTableVPCAssociation",
):
"""A CloudFormation ``AWS::EC2::LocalGatewayRouteTableVPCAssociation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroutetablevpcassociation.html
:cloudformationResource: AWS::EC2::LocalGatewayRouteTableVPCAssociation
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
local_gateway_route_table_id: builtins.str,
vpc_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::LocalGatewayRouteTableVPCAssociation``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param local_gateway_route_table_id: ``AWS::EC2::LocalGatewayRouteTableVPCAssociation.LocalGatewayRouteTableId``.
:param vpc_id: ``AWS::EC2::LocalGatewayRouteTableVPCAssociation.VpcId``.
:param tags: ``AWS::EC2::LocalGatewayRouteTableVPCAssociation.Tags``.
"""
props = CfnLocalGatewayRouteTableVPCAssociationProps(
local_gateway_route_table_id=local_gateway_route_table_id,
vpc_id=vpc_id,
tags=tags,
)
jsii.create(CfnLocalGatewayRouteTableVPCAssociation, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrLocalGatewayId")
def attr_local_gateway_id(self) -> builtins.str:
"""
:cloudformationAttribute: LocalGatewayId
"""
return jsii.get(self, "attrLocalGatewayId")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrLocalGatewayRouteTableVpcAssociationId")
def attr_local_gateway_route_table_vpc_association_id(self) -> builtins.str:
"""
:cloudformationAttribute: LocalGatewayRouteTableVpcAssociationId
"""
return jsii.get(self, "attrLocalGatewayRouteTableVpcAssociationId")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrState")
def attr_state(self) -> builtins.str:
"""
:cloudformationAttribute: State
"""
return jsii.get(self, "attrState")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::LocalGatewayRouteTableVPCAssociation.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroutetablevpcassociation.html#cfn-ec2-localgatewayroutetablevpcassociation-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="localGatewayRouteTableId")
def local_gateway_route_table_id(self) -> builtins.str:
"""``AWS::EC2::LocalGatewayRouteTableVPCAssociation.LocalGatewayRouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroutetablevpcassociation.html#cfn-ec2-localgatewayroutetablevpcassociation-localgatewayroutetableid
"""
return jsii.get(self, "localGatewayRouteTableId")
@local_gateway_route_table_id.setter # type: ignore
def local_gateway_route_table_id(self, value: builtins.str) -> None:
jsii.set(self, "localGatewayRouteTableId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::LocalGatewayRouteTableVPCAssociation.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroutetablevpcassociation.html#cfn-ec2-localgatewayroutetablevpcassociation-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: builtins.str) -> None:
jsii.set(self, "vpcId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnLocalGatewayRouteTableVPCAssociationProps",
jsii_struct_bases=[],
name_mapping={
"local_gateway_route_table_id": "localGatewayRouteTableId",
"vpc_id": "vpcId",
"tags": "tags",
},
)
class CfnLocalGatewayRouteTableVPCAssociationProps:
def __init__(
self,
*,
local_gateway_route_table_id: builtins.str,
vpc_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::LocalGatewayRouteTableVPCAssociation``.
:param local_gateway_route_table_id: ``AWS::EC2::LocalGatewayRouteTableVPCAssociation.LocalGatewayRouteTableId``.
:param vpc_id: ``AWS::EC2::LocalGatewayRouteTableVPCAssociation.VpcId``.
:param tags: ``AWS::EC2::LocalGatewayRouteTableVPCAssociation.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroutetablevpcassociation.html
"""
self._values: typing.Dict[str, typing.Any] = {
"local_gateway_route_table_id": local_gateway_route_table_id,
"vpc_id": vpc_id,
}
if tags is not None:
self._values["tags"] = tags
@builtins.property
def local_gateway_route_table_id(self) -> builtins.str:
"""``AWS::EC2::LocalGatewayRouteTableVPCAssociation.LocalGatewayRouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroutetablevpcassociation.html#cfn-ec2-localgatewayroutetablevpcassociation-localgatewayroutetableid
"""
result = self._values.get("local_gateway_route_table_id")
assert result is not None, "Required property 'local_gateway_route_table_id' is missing"
return result
@builtins.property
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::LocalGatewayRouteTableVPCAssociation.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroutetablevpcassociation.html#cfn-ec2-localgatewayroutetablevpcassociation-vpcid
"""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::LocalGatewayRouteTableVPCAssociation.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-localgatewayroutetablevpcassociation.html#cfn-ec2-localgatewayroutetablevpcassociation-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnLocalGatewayRouteTableVPCAssociationProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnNatGateway(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnNatGateway",
):
"""A CloudFormation ``AWS::EC2::NatGateway``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html
:cloudformationResource: AWS::EC2::NatGateway
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
allocation_id: builtins.str,
subnet_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::NatGateway``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param allocation_id: ``AWS::EC2::NatGateway.AllocationId``.
:param subnet_id: ``AWS::EC2::NatGateway.SubnetId``.
:param tags: ``AWS::EC2::NatGateway.Tags``.
"""
props = CfnNatGatewayProps(
allocation_id=allocation_id, subnet_id=subnet_id, tags=tags
)
jsii.create(CfnNatGateway, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::NatGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html#cfn-ec2-natgateway-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="allocationId")
def allocation_id(self) -> builtins.str:
"""``AWS::EC2::NatGateway.AllocationId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html#cfn-ec2-natgateway-allocationid
"""
return jsii.get(self, "allocationId")
@allocation_id.setter # type: ignore
def allocation_id(self, value: builtins.str) -> None:
jsii.set(self, "allocationId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetId")
def subnet_id(self) -> builtins.str:
"""``AWS::EC2::NatGateway.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html#cfn-ec2-natgateway-subnetid
"""
return jsii.get(self, "subnetId")
@subnet_id.setter # type: ignore
def subnet_id(self, value: builtins.str) -> None:
jsii.set(self, "subnetId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNatGatewayProps",
jsii_struct_bases=[],
name_mapping={
"allocation_id": "allocationId",
"subnet_id": "subnetId",
"tags": "tags",
},
)
class CfnNatGatewayProps:
def __init__(
self,
*,
allocation_id: builtins.str,
subnet_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::NatGateway``.
:param allocation_id: ``AWS::EC2::NatGateway.AllocationId``.
:param subnet_id: ``AWS::EC2::NatGateway.SubnetId``.
:param tags: ``AWS::EC2::NatGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html
"""
self._values: typing.Dict[str, typing.Any] = {
"allocation_id": allocation_id,
"subnet_id": subnet_id,
}
if tags is not None:
self._values["tags"] = tags
@builtins.property
def allocation_id(self) -> builtins.str:
"""``AWS::EC2::NatGateway.AllocationId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html#cfn-ec2-natgateway-allocationid
"""
result = self._values.get("allocation_id")
assert result is not None, "Required property 'allocation_id' is missing"
return result
@builtins.property
def subnet_id(self) -> builtins.str:
"""``AWS::EC2::NatGateway.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html#cfn-ec2-natgateway-subnetid
"""
result = self._values.get("subnet_id")
assert result is not None, "Required property 'subnet_id' is missing"
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::NatGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html#cfn-ec2-natgateway-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnNatGatewayProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnNetworkAcl(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnNetworkAcl",
):
"""A CloudFormation ``AWS::EC2::NetworkAcl``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl.html
:cloudformationResource: AWS::EC2::NetworkAcl
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
vpc_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::NetworkAcl``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param vpc_id: ``AWS::EC2::NetworkAcl.VpcId``.
:param tags: ``AWS::EC2::NetworkAcl.Tags``.
"""
props = CfnNetworkAclProps(vpc_id=vpc_id, tags=tags)
jsii.create(CfnNetworkAcl, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::NetworkAcl.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl.html#cfn-ec2-networkacl-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::NetworkAcl.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl.html#cfn-ec2-networkacl-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: builtins.str) -> None:
jsii.set(self, "vpcId", value)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnNetworkAclEntry(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnNetworkAclEntry",
):
"""A CloudFormation ``AWS::EC2::NetworkAclEntry``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html
:cloudformationResource: AWS::EC2::NetworkAclEntry
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
network_acl_id: builtins.str,
protocol: jsii.Number,
rule_action: builtins.str,
rule_number: jsii.Number,
cidr_block: typing.Optional[builtins.str] = None,
egress: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
icmp: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkAclEntry.IcmpProperty"]] = None,
ipv6_cidr_block: typing.Optional[builtins.str] = None,
port_range: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkAclEntry.PortRangeProperty"]] = None,
) -> None:
"""Create a new ``AWS::EC2::NetworkAclEntry``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param network_acl_id: ``AWS::EC2::NetworkAclEntry.NetworkAclId``.
:param protocol: ``AWS::EC2::NetworkAclEntry.Protocol``.
:param rule_action: ``AWS::EC2::NetworkAclEntry.RuleAction``.
:param rule_number: ``AWS::EC2::NetworkAclEntry.RuleNumber``.
:param cidr_block: ``AWS::EC2::NetworkAclEntry.CidrBlock``.
:param egress: ``AWS::EC2::NetworkAclEntry.Egress``.
:param icmp: ``AWS::EC2::NetworkAclEntry.Icmp``.
:param ipv6_cidr_block: ``AWS::EC2::NetworkAclEntry.Ipv6CidrBlock``.
:param port_range: ``AWS::EC2::NetworkAclEntry.PortRange``.
"""
props = CfnNetworkAclEntryProps(
network_acl_id=network_acl_id,
protocol=protocol,
rule_action=rule_action,
rule_number=rule_number,
cidr_block=cidr_block,
egress=egress,
icmp=icmp,
ipv6_cidr_block=ipv6_cidr_block,
port_range=port_range,
)
jsii.create(CfnNetworkAclEntry, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="networkAclId")
def network_acl_id(self) -> builtins.str:
"""``AWS::EC2::NetworkAclEntry.NetworkAclId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-networkaclid
"""
return jsii.get(self, "networkAclId")
@network_acl_id.setter # type: ignore
def network_acl_id(self, value: builtins.str) -> None:
jsii.set(self, "networkAclId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="protocol")
def protocol(self) -> jsii.Number:
"""``AWS::EC2::NetworkAclEntry.Protocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-protocol
"""
return jsii.get(self, "protocol")
@protocol.setter # type: ignore
def protocol(self, value: jsii.Number) -> None:
jsii.set(self, "protocol", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ruleAction")
def rule_action(self) -> builtins.str:
"""``AWS::EC2::NetworkAclEntry.RuleAction``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-ruleaction
"""
return jsii.get(self, "ruleAction")
@rule_action.setter # type: ignore
def rule_action(self, value: builtins.str) -> None:
jsii.set(self, "ruleAction", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ruleNumber")
def rule_number(self) -> jsii.Number:
"""``AWS::EC2::NetworkAclEntry.RuleNumber``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-rulenumber
"""
return jsii.get(self, "ruleNumber")
@rule_number.setter # type: ignore
def rule_number(self, value: jsii.Number) -> None:
jsii.set(self, "ruleNumber", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="cidrBlock")
def cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkAclEntry.CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-cidrblock
"""
return jsii.get(self, "cidrBlock")
@cidr_block.setter # type: ignore
def cidr_block(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "cidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="egress")
def egress(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::NetworkAclEntry.Egress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-egress
"""
return jsii.get(self, "egress")
@egress.setter # type: ignore
def egress(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "egress", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="icmp")
def icmp(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkAclEntry.IcmpProperty"]]:
"""``AWS::EC2::NetworkAclEntry.Icmp``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-icmp
"""
return jsii.get(self, "icmp")
@icmp.setter # type: ignore
def icmp(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkAclEntry.IcmpProperty"]],
) -> None:
jsii.set(self, "icmp", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ipv6CidrBlock")
def ipv6_cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkAclEntry.Ipv6CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-ipv6cidrblock
"""
return jsii.get(self, "ipv6CidrBlock")
@ipv6_cidr_block.setter # type: ignore
def ipv6_cidr_block(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "ipv6CidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="portRange")
def port_range(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkAclEntry.PortRangeProperty"]]:
"""``AWS::EC2::NetworkAclEntry.PortRange``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-portrange
"""
return jsii.get(self, "portRange")
@port_range.setter # type: ignore
def port_range(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkAclEntry.PortRangeProperty"]],
) -> None:
jsii.set(self, "portRange", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkAclEntry.IcmpProperty",
jsii_struct_bases=[],
name_mapping={"code": "code", "type": "type"},
)
class IcmpProperty:
def __init__(
self,
*,
code: typing.Optional[jsii.Number] = None,
type: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param code: ``CfnNetworkAclEntry.IcmpProperty.Code``.
:param type: ``CfnNetworkAclEntry.IcmpProperty.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkaclentry-icmp.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if code is not None:
self._values["code"] = code
if type is not None:
self._values["type"] = type
@builtins.property
def code(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkAclEntry.IcmpProperty.Code``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkaclentry-icmp.html#cfn-ec2-networkaclentry-icmp-code
"""
result = self._values.get("code")
return result
@builtins.property
def type(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkAclEntry.IcmpProperty.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkaclentry-icmp.html#cfn-ec2-networkaclentry-icmp-type
"""
result = self._values.get("type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "IcmpProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkAclEntry.PortRangeProperty",
jsii_struct_bases=[],
name_mapping={"from_": "from", "to": "to"},
)
class PortRangeProperty:
def __init__(
self,
*,
from_: typing.Optional[jsii.Number] = None,
to: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param from_: ``CfnNetworkAclEntry.PortRangeProperty.From``.
:param to: ``CfnNetworkAclEntry.PortRangeProperty.To``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkaclentry-portrange.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if from_ is not None:
self._values["from_"] = from_
if to is not None:
self._values["to"] = to
@builtins.property
def from_(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkAclEntry.PortRangeProperty.From``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkaclentry-portrange.html#cfn-ec2-networkaclentry-portrange-from
"""
result = self._values.get("from_")
return result
@builtins.property
def to(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkAclEntry.PortRangeProperty.To``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkaclentry-portrange.html#cfn-ec2-networkaclentry-portrange-to
"""
result = self._values.get("to")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PortRangeProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkAclEntryProps",
jsii_struct_bases=[],
name_mapping={
"network_acl_id": "networkAclId",
"protocol": "protocol",
"rule_action": "ruleAction",
"rule_number": "ruleNumber",
"cidr_block": "cidrBlock",
"egress": "egress",
"icmp": "icmp",
"ipv6_cidr_block": "ipv6CidrBlock",
"port_range": "portRange",
},
)
class CfnNetworkAclEntryProps:
def __init__(
self,
*,
network_acl_id: builtins.str,
protocol: jsii.Number,
rule_action: builtins.str,
rule_number: jsii.Number,
cidr_block: typing.Optional[builtins.str] = None,
egress: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
icmp: typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnNetworkAclEntry.IcmpProperty]] = None,
ipv6_cidr_block: typing.Optional[builtins.str] = None,
port_range: typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnNetworkAclEntry.PortRangeProperty]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::NetworkAclEntry``.
:param network_acl_id: ``AWS::EC2::NetworkAclEntry.NetworkAclId``.
:param protocol: ``AWS::EC2::NetworkAclEntry.Protocol``.
:param rule_action: ``AWS::EC2::NetworkAclEntry.RuleAction``.
:param rule_number: ``AWS::EC2::NetworkAclEntry.RuleNumber``.
:param cidr_block: ``AWS::EC2::NetworkAclEntry.CidrBlock``.
:param egress: ``AWS::EC2::NetworkAclEntry.Egress``.
:param icmp: ``AWS::EC2::NetworkAclEntry.Icmp``.
:param ipv6_cidr_block: ``AWS::EC2::NetworkAclEntry.Ipv6CidrBlock``.
:param port_range: ``AWS::EC2::NetworkAclEntry.PortRange``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html
"""
self._values: typing.Dict[str, typing.Any] = {
"network_acl_id": network_acl_id,
"protocol": protocol,
"rule_action": rule_action,
"rule_number": rule_number,
}
if cidr_block is not None:
self._values["cidr_block"] = cidr_block
if egress is not None:
self._values["egress"] = egress
if icmp is not None:
self._values["icmp"] = icmp
if ipv6_cidr_block is not None:
self._values["ipv6_cidr_block"] = ipv6_cidr_block
if port_range is not None:
self._values["port_range"] = port_range
@builtins.property
def network_acl_id(self) -> builtins.str:
"""``AWS::EC2::NetworkAclEntry.NetworkAclId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-networkaclid
"""
result = self._values.get("network_acl_id")
assert result is not None, "Required property 'network_acl_id' is missing"
return result
@builtins.property
def protocol(self) -> jsii.Number:
"""``AWS::EC2::NetworkAclEntry.Protocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-protocol
"""
result = self._values.get("protocol")
assert result is not None, "Required property 'protocol' is missing"
return result
@builtins.property
def rule_action(self) -> builtins.str:
"""``AWS::EC2::NetworkAclEntry.RuleAction``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-ruleaction
"""
result = self._values.get("rule_action")
assert result is not None, "Required property 'rule_action' is missing"
return result
@builtins.property
def rule_number(self) -> jsii.Number:
"""``AWS::EC2::NetworkAclEntry.RuleNumber``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-rulenumber
"""
result = self._values.get("rule_number")
assert result is not None, "Required property 'rule_number' is missing"
return result
@builtins.property
def cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkAclEntry.CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-cidrblock
"""
result = self._values.get("cidr_block")
return result
@builtins.property
def egress(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::NetworkAclEntry.Egress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-egress
"""
result = self._values.get("egress")
return result
@builtins.property
def icmp(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnNetworkAclEntry.IcmpProperty]]:
"""``AWS::EC2::NetworkAclEntry.Icmp``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-icmp
"""
result = self._values.get("icmp")
return result
@builtins.property
def ipv6_cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkAclEntry.Ipv6CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-ipv6cidrblock
"""
result = self._values.get("ipv6_cidr_block")
return result
@builtins.property
def port_range(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnNetworkAclEntry.PortRangeProperty]]:
"""``AWS::EC2::NetworkAclEntry.PortRange``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl-entry.html#cfn-ec2-networkaclentry-portrange
"""
result = self._values.get("port_range")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnNetworkAclEntryProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkAclProps",
jsii_struct_bases=[],
name_mapping={"vpc_id": "vpcId", "tags": "tags"},
)
class CfnNetworkAclProps:
def __init__(
self,
*,
vpc_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::NetworkAcl``.
:param vpc_id: ``AWS::EC2::NetworkAcl.VpcId``.
:param tags: ``AWS::EC2::NetworkAcl.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl.html
"""
self._values: typing.Dict[str, typing.Any] = {
"vpc_id": vpc_id,
}
if tags is not None:
self._values["tags"] = tags
@builtins.property
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::NetworkAcl.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl.html#cfn-ec2-networkacl-vpcid
"""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::NetworkAcl.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-acl.html#cfn-ec2-networkacl-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnNetworkAclProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnNetworkInsightsAnalysis(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsAnalysis",
):
"""A CloudFormation ``AWS::EC2::NetworkInsightsAnalysis``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightsanalysis.html
:cloudformationResource: AWS::EC2::NetworkInsightsAnalysis
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
network_insights_path_id: builtins.str,
filter_in_arns: typing.Optional[typing.List[builtins.str]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::NetworkInsightsAnalysis``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param network_insights_path_id: ``AWS::EC2::NetworkInsightsAnalysis.NetworkInsightsPathId``.
:param filter_in_arns: ``AWS::EC2::NetworkInsightsAnalysis.FilterInArns``.
:param tags: ``AWS::EC2::NetworkInsightsAnalysis.Tags``.
"""
props = CfnNetworkInsightsAnalysisProps(
network_insights_path_id=network_insights_path_id,
filter_in_arns=filter_in_arns,
tags=tags,
)
jsii.create(CfnNetworkInsightsAnalysis, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrAlternatePathHints")
def attr_alternate_path_hints(self) -> aws_cdk.core.IResolvable:
"""
:cloudformationAttribute: AlternatePathHints
"""
return jsii.get(self, "attrAlternatePathHints")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrExplanations")
def attr_explanations(self) -> aws_cdk.core.IResolvable:
"""
:cloudformationAttribute: Explanations
"""
return jsii.get(self, "attrExplanations")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrForwardPathComponents")
def attr_forward_path_components(self) -> aws_cdk.core.IResolvable:
"""
:cloudformationAttribute: ForwardPathComponents
"""
return jsii.get(self, "attrForwardPathComponents")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrNetworkInsightsAnalysisArn")
def attr_network_insights_analysis_arn(self) -> builtins.str:
"""
:cloudformationAttribute: NetworkInsightsAnalysisArn
"""
return jsii.get(self, "attrNetworkInsightsAnalysisArn")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrNetworkInsightsAnalysisId")
def attr_network_insights_analysis_id(self) -> builtins.str:
"""
:cloudformationAttribute: NetworkInsightsAnalysisId
"""
return jsii.get(self, "attrNetworkInsightsAnalysisId")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrNetworkPathFound")
def attr_network_path_found(self) -> aws_cdk.core.IResolvable:
"""
:cloudformationAttribute: NetworkPathFound
"""
return jsii.get(self, "attrNetworkPathFound")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrReturnPathComponents")
def attr_return_path_components(self) -> aws_cdk.core.IResolvable:
"""
:cloudformationAttribute: ReturnPathComponents
"""
return jsii.get(self, "attrReturnPathComponents")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrStartDate")
def attr_start_date(self) -> builtins.str:
"""
:cloudformationAttribute: StartDate
"""
return jsii.get(self, "attrStartDate")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrStatus")
def attr_status(self) -> builtins.str:
"""
:cloudformationAttribute: Status
"""
return jsii.get(self, "attrStatus")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrStatusMessage")
def attr_status_message(self) -> builtins.str:
"""
:cloudformationAttribute: StatusMessage
"""
return jsii.get(self, "attrStatusMessage")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::NetworkInsightsAnalysis.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightsanalysis.html#cfn-ec2-networkinsightsanalysis-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="networkInsightsPathId")
def network_insights_path_id(self) -> builtins.str:
"""``AWS::EC2::NetworkInsightsAnalysis.NetworkInsightsPathId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightsanalysis.html#cfn-ec2-networkinsightsanalysis-networkinsightspathid
"""
return jsii.get(self, "networkInsightsPathId")
@network_insights_path_id.setter # type: ignore
def network_insights_path_id(self, value: builtins.str) -> None:
jsii.set(self, "networkInsightsPathId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="filterInArns")
def filter_in_arns(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::NetworkInsightsAnalysis.FilterInArns``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightsanalysis.html#cfn-ec2-networkinsightsanalysis-filterinarns
"""
return jsii.get(self, "filterInArns")
@filter_in_arns.setter # type: ignore
def filter_in_arns(self, value: typing.Optional[typing.List[builtins.str]]) -> None:
jsii.set(self, "filterInArns", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsAnalysis.AlternatePathHintProperty",
jsii_struct_bases=[],
name_mapping={"component_arn": "componentArn", "component_id": "componentId"},
)
class AlternatePathHintProperty:
def __init__(
self,
*,
component_arn: typing.Optional[builtins.str] = None,
component_id: typing.Optional[builtins.str] = None,
) -> None:
"""
:param component_arn: ``CfnNetworkInsightsAnalysis.AlternatePathHintProperty.ComponentArn``.
:param component_id: ``CfnNetworkInsightsAnalysis.AlternatePathHintProperty.ComponentId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-alternatepathhint.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if component_arn is not None:
self._values["component_arn"] = component_arn
if component_id is not None:
self._values["component_id"] = component_id
@builtins.property
def component_arn(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AlternatePathHintProperty.ComponentArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-alternatepathhint.html#cfn-ec2-networkinsightsanalysis-alternatepathhint-componentarn
"""
result = self._values.get("component_arn")
return result
@builtins.property
def component_id(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AlternatePathHintProperty.ComponentId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-alternatepathhint.html#cfn-ec2-networkinsightsanalysis-alternatepathhint-componentid
"""
result = self._values.get("component_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AlternatePathHintProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty",
jsii_struct_bases=[],
name_mapping={
"cidr": "cidr",
"egress": "egress",
"port_range": "portRange",
"protocol": "protocol",
"rule_action": "ruleAction",
"rule_number": "ruleNumber",
},
)
class AnalysisAclRuleProperty:
def __init__(
self,
*,
cidr: typing.Optional[builtins.str] = None,
egress: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
port_range: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.PortRangeProperty"]] = None,
protocol: typing.Optional[builtins.str] = None,
rule_action: typing.Optional[builtins.str] = None,
rule_number: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param cidr: ``CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty.Cidr``.
:param egress: ``CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty.Egress``.
:param port_range: ``CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty.PortRange``.
:param protocol: ``CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty.Protocol``.
:param rule_action: ``CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty.RuleAction``.
:param rule_number: ``CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty.RuleNumber``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisaclrule.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if cidr is not None:
self._values["cidr"] = cidr
if egress is not None:
self._values["egress"] = egress
if port_range is not None:
self._values["port_range"] = port_range
if protocol is not None:
self._values["protocol"] = protocol
if rule_action is not None:
self._values["rule_action"] = rule_action
if rule_number is not None:
self._values["rule_number"] = rule_number
@builtins.property
def cidr(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty.Cidr``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisaclrule.html#cfn-ec2-networkinsightsanalysis-analysisaclrule-cidr
"""
result = self._values.get("cidr")
return result
@builtins.property
def egress(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty.Egress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisaclrule.html#cfn-ec2-networkinsightsanalysis-analysisaclrule-egress
"""
result = self._values.get("egress")
return result
@builtins.property
def port_range(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.PortRangeProperty"]]:
"""``CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty.PortRange``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisaclrule.html#cfn-ec2-networkinsightsanalysis-analysisaclrule-portrange
"""
result = self._values.get("port_range")
return result
@builtins.property
def protocol(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty.Protocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisaclrule.html#cfn-ec2-networkinsightsanalysis-analysisaclrule-protocol
"""
result = self._values.get("protocol")
return result
@builtins.property
def rule_action(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty.RuleAction``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisaclrule.html#cfn-ec2-networkinsightsanalysis-analysisaclrule-ruleaction
"""
result = self._values.get("rule_action")
return result
@builtins.property
def rule_number(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty.RuleNumber``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisaclrule.html#cfn-ec2-networkinsightsanalysis-analysisaclrule-rulenumber
"""
result = self._values.get("rule_number")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AnalysisAclRuleProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsAnalysis.AnalysisComponentProperty",
jsii_struct_bases=[],
name_mapping={"arn": "arn", "id": "id"},
)
class AnalysisComponentProperty:
def __init__(
self,
*,
arn: typing.Optional[builtins.str] = None,
id: typing.Optional[builtins.str] = None,
) -> None:
"""
:param arn: ``CfnNetworkInsightsAnalysis.AnalysisComponentProperty.Arn``.
:param id: ``CfnNetworkInsightsAnalysis.AnalysisComponentProperty.Id``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysiscomponent.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if arn is not None:
self._values["arn"] = arn
if id is not None:
self._values["id"] = id
@builtins.property
def arn(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisComponentProperty.Arn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysiscomponent.html#cfn-ec2-networkinsightsanalysis-analysiscomponent-arn
"""
result = self._values.get("arn")
return result
@builtins.property
def id(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisComponentProperty.Id``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysiscomponent.html#cfn-ec2-networkinsightsanalysis-analysiscomponent-id
"""
result = self._values.get("id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AnalysisComponentProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsAnalysis.AnalysisLoadBalancerListenerProperty",
jsii_struct_bases=[],
name_mapping={
"instance_port": "instancePort",
"load_balancer_port": "loadBalancerPort",
},
)
class AnalysisLoadBalancerListenerProperty:
def __init__(
self,
*,
instance_port: typing.Optional[jsii.Number] = None,
load_balancer_port: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param instance_port: ``CfnNetworkInsightsAnalysis.AnalysisLoadBalancerListenerProperty.InstancePort``.
:param load_balancer_port: ``CfnNetworkInsightsAnalysis.AnalysisLoadBalancerListenerProperty.LoadBalancerPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisloadbalancerlistener.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if instance_port is not None:
self._values["instance_port"] = instance_port
if load_balancer_port is not None:
self._values["load_balancer_port"] = load_balancer_port
@builtins.property
def instance_port(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkInsightsAnalysis.AnalysisLoadBalancerListenerProperty.InstancePort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisloadbalancerlistener.html#cfn-ec2-networkinsightsanalysis-analysisloadbalancerlistener-instanceport
"""
result = self._values.get("instance_port")
return result
@builtins.property
def load_balancer_port(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkInsightsAnalysis.AnalysisLoadBalancerListenerProperty.LoadBalancerPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisloadbalancerlistener.html#cfn-ec2-networkinsightsanalysis-analysisloadbalancerlistener-loadbalancerport
"""
result = self._values.get("load_balancer_port")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AnalysisLoadBalancerListenerProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsAnalysis.AnalysisLoadBalancerTargetProperty",
jsii_struct_bases=[],
name_mapping={
"address": "address",
"availability_zone": "availabilityZone",
"instance": "instance",
"port": "port",
},
)
class AnalysisLoadBalancerTargetProperty:
def __init__(
self,
*,
address: typing.Optional[builtins.str] = None,
availability_zone: typing.Optional[builtins.str] = None,
instance: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
port: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param address: ``CfnNetworkInsightsAnalysis.AnalysisLoadBalancerTargetProperty.Address``.
:param availability_zone: ``CfnNetworkInsightsAnalysis.AnalysisLoadBalancerTargetProperty.AvailabilityZone``.
:param instance: ``CfnNetworkInsightsAnalysis.AnalysisLoadBalancerTargetProperty.Instance``.
:param port: ``CfnNetworkInsightsAnalysis.AnalysisLoadBalancerTargetProperty.Port``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisloadbalancertarget.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if address is not None:
self._values["address"] = address
if availability_zone is not None:
self._values["availability_zone"] = availability_zone
if instance is not None:
self._values["instance"] = instance
if port is not None:
self._values["port"] = port
@builtins.property
def address(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisLoadBalancerTargetProperty.Address``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisloadbalancertarget.html#cfn-ec2-networkinsightsanalysis-analysisloadbalancertarget-address
"""
result = self._values.get("address")
return result
@builtins.property
def availability_zone(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisLoadBalancerTargetProperty.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisloadbalancertarget.html#cfn-ec2-networkinsightsanalysis-analysisloadbalancertarget-availabilityzone
"""
result = self._values.get("availability_zone")
return result
@builtins.property
def instance(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.AnalysisLoadBalancerTargetProperty.Instance``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisloadbalancertarget.html#cfn-ec2-networkinsightsanalysis-analysisloadbalancertarget-instance
"""
result = self._values.get("instance")
return result
@builtins.property
def port(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkInsightsAnalysis.AnalysisLoadBalancerTargetProperty.Port``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisloadbalancertarget.html#cfn-ec2-networkinsightsanalysis-analysisloadbalancertarget-port
"""
result = self._values.get("port")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AnalysisLoadBalancerTargetProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty",
jsii_struct_bases=[],
name_mapping={
"destination_addresses": "destinationAddresses",
"destination_port_ranges": "destinationPortRanges",
"protocol": "protocol",
"source_addresses": "sourceAddresses",
"source_port_ranges": "sourcePortRanges",
},
)
class AnalysisPacketHeaderProperty:
def __init__(
self,
*,
destination_addresses: typing.Optional[typing.List[builtins.str]] = None,
destination_port_ranges: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.PortRangeProperty"]]]] = None,
protocol: typing.Optional[builtins.str] = None,
source_addresses: typing.Optional[typing.List[builtins.str]] = None,
source_port_ranges: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.PortRangeProperty"]]]] = None,
) -> None:
"""
:param destination_addresses: ``CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty.DestinationAddresses``.
:param destination_port_ranges: ``CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty.DestinationPortRanges``.
:param protocol: ``CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty.Protocol``.
:param source_addresses: ``CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty.SourceAddresses``.
:param source_port_ranges: ``CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty.SourcePortRanges``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysispacketheader.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if destination_addresses is not None:
self._values["destination_addresses"] = destination_addresses
if destination_port_ranges is not None:
self._values["destination_port_ranges"] = destination_port_ranges
if protocol is not None:
self._values["protocol"] = protocol
if source_addresses is not None:
self._values["source_addresses"] = source_addresses
if source_port_ranges is not None:
self._values["source_port_ranges"] = source_port_ranges
@builtins.property
def destination_addresses(self) -> typing.Optional[typing.List[builtins.str]]:
"""``CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty.DestinationAddresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysispacketheader.html#cfn-ec2-networkinsightsanalysis-analysispacketheader-destinationaddresses
"""
result = self._values.get("destination_addresses")
return result
@builtins.property
def destination_port_ranges(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.PortRangeProperty"]]]]:
"""``CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty.DestinationPortRanges``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysispacketheader.html#cfn-ec2-networkinsightsanalysis-analysispacketheader-destinationportranges
"""
result = self._values.get("destination_port_ranges")
return result
@builtins.property
def protocol(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty.Protocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysispacketheader.html#cfn-ec2-networkinsightsanalysis-analysispacketheader-protocol
"""
result = self._values.get("protocol")
return result
@builtins.property
def source_addresses(self) -> typing.Optional[typing.List[builtins.str]]:
"""``CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty.SourceAddresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysispacketheader.html#cfn-ec2-networkinsightsanalysis-analysispacketheader-sourceaddresses
"""
result = self._values.get("source_addresses")
return result
@builtins.property
def source_port_ranges(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.PortRangeProperty"]]]]:
"""``CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty.SourcePortRanges``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysispacketheader.html#cfn-ec2-networkinsightsanalysis-analysispacketheader-sourceportranges
"""
result = self._values.get("source_port_ranges")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AnalysisPacketHeaderProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty",
jsii_struct_bases=[],
name_mapping={
"destination_cidr": "destinationCidr",
"destination_prefix_list_id": "destinationPrefixListId",
"egress_only_internet_gateway_id": "egressOnlyInternetGatewayId",
"gateway_id": "gatewayId",
"instance_id": "instanceId",
"nat_gateway_id": "natGatewayId",
"network_interface_id": "networkInterfaceId",
"origin": "origin",
"transit_gateway_id": "transitGatewayId",
"vpc_peering_connection_id": "vpcPeeringConnectionId",
},
)
class AnalysisRouteTableRouteProperty:
def __init__(
self,
*,
destination_cidr: typing.Optional[builtins.str] = None,
destination_prefix_list_id: typing.Optional[builtins.str] = None,
egress_only_internet_gateway_id: typing.Optional[builtins.str] = None,
gateway_id: typing.Optional[builtins.str] = None,
instance_id: typing.Optional[builtins.str] = None,
nat_gateway_id: typing.Optional[builtins.str] = None,
network_interface_id: typing.Optional[builtins.str] = None,
origin: typing.Optional[builtins.str] = None,
transit_gateway_id: typing.Optional[builtins.str] = None,
vpc_peering_connection_id: typing.Optional[builtins.str] = None,
) -> None:
"""
:param destination_cidr: ``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.destinationCidr``.
:param destination_prefix_list_id: ``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.destinationPrefixListId``.
:param egress_only_internet_gateway_id: ``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.egressOnlyInternetGatewayId``.
:param gateway_id: ``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.gatewayId``.
:param instance_id: ``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.instanceId``.
:param nat_gateway_id: ``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.NatGatewayId``.
:param network_interface_id: ``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.NetworkInterfaceId``.
:param origin: ``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.Origin``.
:param transit_gateway_id: ``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.TransitGatewayId``.
:param vpc_peering_connection_id: ``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.VpcPeeringConnectionId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisroutetableroute.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if destination_cidr is not None:
self._values["destination_cidr"] = destination_cidr
if destination_prefix_list_id is not None:
self._values["destination_prefix_list_id"] = destination_prefix_list_id
if egress_only_internet_gateway_id is not None:
self._values["egress_only_internet_gateway_id"] = egress_only_internet_gateway_id
if gateway_id is not None:
self._values["gateway_id"] = gateway_id
if instance_id is not None:
self._values["instance_id"] = instance_id
if nat_gateway_id is not None:
self._values["nat_gateway_id"] = nat_gateway_id
if network_interface_id is not None:
self._values["network_interface_id"] = network_interface_id
if origin is not None:
self._values["origin"] = origin
if transit_gateway_id is not None:
self._values["transit_gateway_id"] = transit_gateway_id
if vpc_peering_connection_id is not None:
self._values["vpc_peering_connection_id"] = vpc_peering_connection_id
@builtins.property
def destination_cidr(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.destinationCidr``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisroutetableroute.html#cfn-ec2-networkinsightsanalysis-analysisroutetableroute-destinationcidr
"""
result = self._values.get("destination_cidr")
return result
@builtins.property
def destination_prefix_list_id(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.destinationPrefixListId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisroutetableroute.html#cfn-ec2-networkinsightsanalysis-analysisroutetableroute-destinationprefixlistid
"""
result = self._values.get("destination_prefix_list_id")
return result
@builtins.property
def egress_only_internet_gateway_id(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.egressOnlyInternetGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisroutetableroute.html#cfn-ec2-networkinsightsanalysis-analysisroutetableroute-egressonlyinternetgatewayid
"""
result = self._values.get("egress_only_internet_gateway_id")
return result
@builtins.property
def gateway_id(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.gatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisroutetableroute.html#cfn-ec2-networkinsightsanalysis-analysisroutetableroute-gatewayid
"""
result = self._values.get("gateway_id")
return result
@builtins.property
def instance_id(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.instanceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisroutetableroute.html#cfn-ec2-networkinsightsanalysis-analysisroutetableroute-instanceid
"""
result = self._values.get("instance_id")
return result
@builtins.property
def nat_gateway_id(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.NatGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisroutetableroute.html#cfn-ec2-networkinsightsanalysis-analysisroutetableroute-natgatewayid
"""
result = self._values.get("nat_gateway_id")
return result
@builtins.property
def network_interface_id(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisroutetableroute.html#cfn-ec2-networkinsightsanalysis-analysisroutetableroute-networkinterfaceid
"""
result = self._values.get("network_interface_id")
return result
@builtins.property
def origin(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.Origin``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisroutetableroute.html#cfn-ec2-networkinsightsanalysis-analysisroutetableroute-origin
"""
result = self._values.get("origin")
return result
@builtins.property
def transit_gateway_id(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.TransitGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisroutetableroute.html#cfn-ec2-networkinsightsanalysis-analysisroutetableroute-transitgatewayid
"""
result = self._values.get("transit_gateway_id")
return result
@builtins.property
def vpc_peering_connection_id(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty.VpcPeeringConnectionId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysisroutetableroute.html#cfn-ec2-networkinsightsanalysis-analysisroutetableroute-vpcpeeringconnectionid
"""
result = self._values.get("vpc_peering_connection_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AnalysisRouteTableRouteProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty",
jsii_struct_bases=[],
name_mapping={
"cidr": "cidr",
"direction": "direction",
"port_range": "portRange",
"prefix_list_id": "prefixListId",
"protocol": "protocol",
"security_group_id": "securityGroupId",
},
)
class AnalysisSecurityGroupRuleProperty:
def __init__(
self,
*,
cidr: typing.Optional[builtins.str] = None,
direction: typing.Optional[builtins.str] = None,
port_range: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.PortRangeProperty"]] = None,
prefix_list_id: typing.Optional[builtins.str] = None,
protocol: typing.Optional[builtins.str] = None,
security_group_id: typing.Optional[builtins.str] = None,
) -> None:
"""
:param cidr: ``CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty.Cidr``.
:param direction: ``CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty.Direction``.
:param port_range: ``CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty.PortRange``.
:param prefix_list_id: ``CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty.PrefixListId``.
:param protocol: ``CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty.Protocol``.
:param security_group_id: ``CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty.SecurityGroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysissecuritygrouprule.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if cidr is not None:
self._values["cidr"] = cidr
if direction is not None:
self._values["direction"] = direction
if port_range is not None:
self._values["port_range"] = port_range
if prefix_list_id is not None:
self._values["prefix_list_id"] = prefix_list_id
if protocol is not None:
self._values["protocol"] = protocol
if security_group_id is not None:
self._values["security_group_id"] = security_group_id
@builtins.property
def cidr(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty.Cidr``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysissecuritygrouprule.html#cfn-ec2-networkinsightsanalysis-analysissecuritygrouprule-cidr
"""
result = self._values.get("cidr")
return result
@builtins.property
def direction(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty.Direction``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysissecuritygrouprule.html#cfn-ec2-networkinsightsanalysis-analysissecuritygrouprule-direction
"""
result = self._values.get("direction")
return result
@builtins.property
def port_range(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.PortRangeProperty"]]:
"""``CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty.PortRange``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysissecuritygrouprule.html#cfn-ec2-networkinsightsanalysis-analysissecuritygrouprule-portrange
"""
result = self._values.get("port_range")
return result
@builtins.property
def prefix_list_id(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty.PrefixListId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysissecuritygrouprule.html#cfn-ec2-networkinsightsanalysis-analysissecuritygrouprule-prefixlistid
"""
result = self._values.get("prefix_list_id")
return result
@builtins.property
def protocol(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty.Protocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysissecuritygrouprule.html#cfn-ec2-networkinsightsanalysis-analysissecuritygrouprule-protocol
"""
result = self._values.get("protocol")
return result
@builtins.property
def security_group_id(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty.SecurityGroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-analysissecuritygrouprule.html#cfn-ec2-networkinsightsanalysis-analysissecuritygrouprule-securitygroupid
"""
result = self._values.get("security_group_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "AnalysisSecurityGroupRuleProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsAnalysis.ExplanationProperty",
jsii_struct_bases=[],
name_mapping={
"acl": "acl",
"acl_rule": "aclRule",
"address": "address",
"addresses": "addresses",
"attached_to": "attachedTo",
"availability_zones": "availabilityZones",
"cidrs": "cidrs",
"classic_load_balancer_listener": "classicLoadBalancerListener",
"component": "component",
"customer_gateway": "customerGateway",
"destination": "destination",
"destination_vpc": "destinationVpc",
"direction": "direction",
"elastic_load_balancer_listener": "elasticLoadBalancerListener",
"explanation_code": "explanationCode",
"ingress_route_table": "ingressRouteTable",
"internet_gateway": "internetGateway",
"load_balancer_arn": "loadBalancerArn",
"load_balancer_listener_port": "loadBalancerListenerPort",
"load_balancer_target": "loadBalancerTarget",
"load_balancer_target_group": "loadBalancerTargetGroup",
"load_balancer_target_groups": "loadBalancerTargetGroups",
"load_balancer_target_port": "loadBalancerTargetPort",
"missing_component": "missingComponent",
"nat_gateway": "natGateway",
"network_interface": "networkInterface",
"packet_field": "packetField",
"port": "port",
"port_ranges": "portRanges",
"prefix_list": "prefixList",
"protocols": "protocols",
"route_table": "routeTable",
"route_table_route": "routeTableRoute",
"security_group": "securityGroup",
"security_group_rule": "securityGroupRule",
"security_groups": "securityGroups",
"source_vpc": "sourceVpc",
"state": "state",
"subnet": "subnet",
"subnet_route_table": "subnetRouteTable",
"vpc": "vpc",
"vpc_endpoint": "vpcEndpoint",
"vpc_peering_connection": "vpcPeeringConnection",
"vpn_connection": "vpnConnection",
"vpn_gateway": "vpnGateway",
},
)
class ExplanationProperty:
def __init__(
self,
*,
acl: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
acl_rule: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty"]] = None,
address: typing.Optional[builtins.str] = None,
addresses: typing.Optional[typing.List[builtins.str]] = None,
attached_to: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
availability_zones: typing.Optional[typing.List[builtins.str]] = None,
cidrs: typing.Optional[typing.List[builtins.str]] = None,
classic_load_balancer_listener: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisLoadBalancerListenerProperty"]] = None,
component: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
customer_gateway: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
destination: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
destination_vpc: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
direction: typing.Optional[builtins.str] = None,
elastic_load_balancer_listener: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
explanation_code: typing.Optional[builtins.str] = None,
ingress_route_table: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
internet_gateway: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
load_balancer_arn: typing.Optional[builtins.str] = None,
load_balancer_listener_port: typing.Optional[jsii.Number] = None,
load_balancer_target: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisLoadBalancerTargetProperty"]] = None,
load_balancer_target_group: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
load_balancer_target_groups: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]]] = None,
load_balancer_target_port: typing.Optional[jsii.Number] = None,
missing_component: typing.Optional[builtins.str] = None,
nat_gateway: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
network_interface: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
packet_field: typing.Optional[builtins.str] = None,
port: typing.Optional[jsii.Number] = None,
port_ranges: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.PortRangeProperty"]]]] = None,
prefix_list: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
protocols: typing.Optional[typing.List[builtins.str]] = None,
route_table: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
route_table_route: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty"]] = None,
security_group: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
security_group_rule: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty"]] = None,
security_groups: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]]] = None,
source_vpc: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
state: typing.Optional[builtins.str] = None,
subnet: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
subnet_route_table: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
vpc: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
vpc_endpoint: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
vpc_peering_connection: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
vpn_connection: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
vpn_gateway: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
) -> None:
"""
:param acl: ``CfnNetworkInsightsAnalysis.ExplanationProperty.Acl``.
:param acl_rule: ``CfnNetworkInsightsAnalysis.ExplanationProperty.AclRule``.
:param address: ``CfnNetworkInsightsAnalysis.ExplanationProperty.Address``.
:param addresses: ``CfnNetworkInsightsAnalysis.ExplanationProperty.Addresses``.
:param attached_to: ``CfnNetworkInsightsAnalysis.ExplanationProperty.AttachedTo``.
:param availability_zones: ``CfnNetworkInsightsAnalysis.ExplanationProperty.AvailabilityZones``.
:param cidrs: ``CfnNetworkInsightsAnalysis.ExplanationProperty.Cidrs``.
:param classic_load_balancer_listener: ``CfnNetworkInsightsAnalysis.ExplanationProperty.ClassicLoadBalancerListener``.
:param component: ``CfnNetworkInsightsAnalysis.ExplanationProperty.Component``.
:param customer_gateway: ``CfnNetworkInsightsAnalysis.ExplanationProperty.CustomerGateway``.
:param destination: ``CfnNetworkInsightsAnalysis.ExplanationProperty.Destination``.
:param destination_vpc: ``CfnNetworkInsightsAnalysis.ExplanationProperty.DestinationVpc``.
:param direction: ``CfnNetworkInsightsAnalysis.ExplanationProperty.Direction``.
:param elastic_load_balancer_listener: ``CfnNetworkInsightsAnalysis.ExplanationProperty.ElasticLoadBalancerListener``.
:param explanation_code: ``CfnNetworkInsightsAnalysis.ExplanationProperty.ExplanationCode``.
:param ingress_route_table: ``CfnNetworkInsightsAnalysis.ExplanationProperty.IngressRouteTable``.
:param internet_gateway: ``CfnNetworkInsightsAnalysis.ExplanationProperty.InternetGateway``.
:param load_balancer_arn: ``CfnNetworkInsightsAnalysis.ExplanationProperty.LoadBalancerArn``.
:param load_balancer_listener_port: ``CfnNetworkInsightsAnalysis.ExplanationProperty.LoadBalancerListenerPort``.
:param load_balancer_target: ``CfnNetworkInsightsAnalysis.ExplanationProperty.LoadBalancerTarget``.
:param load_balancer_target_group: ``CfnNetworkInsightsAnalysis.ExplanationProperty.LoadBalancerTargetGroup``.
:param load_balancer_target_groups: ``CfnNetworkInsightsAnalysis.ExplanationProperty.LoadBalancerTargetGroups``.
:param load_balancer_target_port: ``CfnNetworkInsightsAnalysis.ExplanationProperty.LoadBalancerTargetPort``.
:param missing_component: ``CfnNetworkInsightsAnalysis.ExplanationProperty.MissingComponent``.
:param nat_gateway: ``CfnNetworkInsightsAnalysis.ExplanationProperty.NatGateway``.
:param network_interface: ``CfnNetworkInsightsAnalysis.ExplanationProperty.NetworkInterface``.
:param packet_field: ``CfnNetworkInsightsAnalysis.ExplanationProperty.PacketField``.
:param port: ``CfnNetworkInsightsAnalysis.ExplanationProperty.Port``.
:param port_ranges: ``CfnNetworkInsightsAnalysis.ExplanationProperty.PortRanges``.
:param prefix_list: ``CfnNetworkInsightsAnalysis.ExplanationProperty.PrefixList``.
:param protocols: ``CfnNetworkInsightsAnalysis.ExplanationProperty.Protocols``.
:param route_table: ``CfnNetworkInsightsAnalysis.ExplanationProperty.RouteTable``.
:param route_table_route: ``CfnNetworkInsightsAnalysis.ExplanationProperty.RouteTableRoute``.
:param security_group: ``CfnNetworkInsightsAnalysis.ExplanationProperty.SecurityGroup``.
:param security_group_rule: ``CfnNetworkInsightsAnalysis.ExplanationProperty.SecurityGroupRule``.
:param security_groups: ``CfnNetworkInsightsAnalysis.ExplanationProperty.SecurityGroups``.
:param source_vpc: ``CfnNetworkInsightsAnalysis.ExplanationProperty.SourceVpc``.
:param state: ``CfnNetworkInsightsAnalysis.ExplanationProperty.State``.
:param subnet: ``CfnNetworkInsightsAnalysis.ExplanationProperty.Subnet``.
:param subnet_route_table: ``CfnNetworkInsightsAnalysis.ExplanationProperty.SubnetRouteTable``.
:param vpc: ``CfnNetworkInsightsAnalysis.ExplanationProperty.Vpc``.
:param vpc_endpoint: ``CfnNetworkInsightsAnalysis.ExplanationProperty.vpcEndpoint``.
:param vpc_peering_connection: ``CfnNetworkInsightsAnalysis.ExplanationProperty.VpcPeeringConnection``.
:param vpn_connection: ``CfnNetworkInsightsAnalysis.ExplanationProperty.VpnConnection``.
:param vpn_gateway: ``CfnNetworkInsightsAnalysis.ExplanationProperty.VpnGateway``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if acl is not None:
self._values["acl"] = acl
if acl_rule is not None:
self._values["acl_rule"] = acl_rule
if address is not None:
self._values["address"] = address
if addresses is not None:
self._values["addresses"] = addresses
if attached_to is not None:
self._values["attached_to"] = attached_to
if availability_zones is not None:
self._values["availability_zones"] = availability_zones
if cidrs is not None:
self._values["cidrs"] = cidrs
if classic_load_balancer_listener is not None:
self._values["classic_load_balancer_listener"] = classic_load_balancer_listener
if component is not None:
self._values["component"] = component
if customer_gateway is not None:
self._values["customer_gateway"] = customer_gateway
if destination is not None:
self._values["destination"] = destination
if destination_vpc is not None:
self._values["destination_vpc"] = destination_vpc
if direction is not None:
self._values["direction"] = direction
if elastic_load_balancer_listener is not None:
self._values["elastic_load_balancer_listener"] = elastic_load_balancer_listener
if explanation_code is not None:
self._values["explanation_code"] = explanation_code
if ingress_route_table is not None:
self._values["ingress_route_table"] = ingress_route_table
if internet_gateway is not None:
self._values["internet_gateway"] = internet_gateway
if load_balancer_arn is not None:
self._values["load_balancer_arn"] = load_balancer_arn
if load_balancer_listener_port is not None:
self._values["load_balancer_listener_port"] = load_balancer_listener_port
if load_balancer_target is not None:
self._values["load_balancer_target"] = load_balancer_target
if load_balancer_target_group is not None:
self._values["load_balancer_target_group"] = load_balancer_target_group
if load_balancer_target_groups is not None:
self._values["load_balancer_target_groups"] = load_balancer_target_groups
if load_balancer_target_port is not None:
self._values["load_balancer_target_port"] = load_balancer_target_port
if missing_component is not None:
self._values["missing_component"] = missing_component
if nat_gateway is not None:
self._values["nat_gateway"] = nat_gateway
if network_interface is not None:
self._values["network_interface"] = network_interface
if packet_field is not None:
self._values["packet_field"] = packet_field
if port is not None:
self._values["port"] = port
if port_ranges is not None:
self._values["port_ranges"] = port_ranges
if prefix_list is not None:
self._values["prefix_list"] = prefix_list
if protocols is not None:
self._values["protocols"] = protocols
if route_table is not None:
self._values["route_table"] = route_table
if route_table_route is not None:
self._values["route_table_route"] = route_table_route
if security_group is not None:
self._values["security_group"] = security_group
if security_group_rule is not None:
self._values["security_group_rule"] = security_group_rule
if security_groups is not None:
self._values["security_groups"] = security_groups
if source_vpc is not None:
self._values["source_vpc"] = source_vpc
if state is not None:
self._values["state"] = state
if subnet is not None:
self._values["subnet"] = subnet
if subnet_route_table is not None:
self._values["subnet_route_table"] = subnet_route_table
if vpc is not None:
self._values["vpc"] = vpc
if vpc_endpoint is not None:
self._values["vpc_endpoint"] = vpc_endpoint
if vpc_peering_connection is not None:
self._values["vpc_peering_connection"] = vpc_peering_connection
if vpn_connection is not None:
self._values["vpn_connection"] = vpn_connection
if vpn_gateway is not None:
self._values["vpn_gateway"] = vpn_gateway
@builtins.property
def acl(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.Acl``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-acl
"""
result = self._values.get("acl")
return result
@builtins.property
def acl_rule(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.AclRule``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-aclrule
"""
result = self._values.get("acl_rule")
return result
@builtins.property
def address(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.Address``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-address
"""
result = self._values.get("address")
return result
@builtins.property
def addresses(self) -> typing.Optional[typing.List[builtins.str]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.Addresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-addresses
"""
result = self._values.get("addresses")
return result
@builtins.property
def attached_to(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.AttachedTo``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-attachedto
"""
result = self._values.get("attached_to")
return result
@builtins.property
def availability_zones(self) -> typing.Optional[typing.List[builtins.str]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.AvailabilityZones``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-availabilityzones
"""
result = self._values.get("availability_zones")
return result
@builtins.property
def cidrs(self) -> typing.Optional[typing.List[builtins.str]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.Cidrs``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-cidrs
"""
result = self._values.get("cidrs")
return result
@builtins.property
def classic_load_balancer_listener(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisLoadBalancerListenerProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.ClassicLoadBalancerListener``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-classicloadbalancerlistener
"""
result = self._values.get("classic_load_balancer_listener")
return result
@builtins.property
def component(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.Component``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-component
"""
result = self._values.get("component")
return result
@builtins.property
def customer_gateway(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.CustomerGateway``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-customergateway
"""
result = self._values.get("customer_gateway")
return result
@builtins.property
def destination(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.Destination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-destination
"""
result = self._values.get("destination")
return result
@builtins.property
def destination_vpc(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.DestinationVpc``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-destinationvpc
"""
result = self._values.get("destination_vpc")
return result
@builtins.property
def direction(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.Direction``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-direction
"""
result = self._values.get("direction")
return result
@builtins.property
def elastic_load_balancer_listener(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.ElasticLoadBalancerListener``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-elasticloadbalancerlistener
"""
result = self._values.get("elastic_load_balancer_listener")
return result
@builtins.property
def explanation_code(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.ExplanationCode``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-explanationcode
"""
result = self._values.get("explanation_code")
return result
@builtins.property
def ingress_route_table(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.IngressRouteTable``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-ingressroutetable
"""
result = self._values.get("ingress_route_table")
return result
@builtins.property
def internet_gateway(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.InternetGateway``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-internetgateway
"""
result = self._values.get("internet_gateway")
return result
@builtins.property
def load_balancer_arn(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.LoadBalancerArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-loadbalancerarn
"""
result = self._values.get("load_balancer_arn")
return result
@builtins.property
def load_balancer_listener_port(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.LoadBalancerListenerPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-loadbalancerlistenerport
"""
result = self._values.get("load_balancer_listener_port")
return result
@builtins.property
def load_balancer_target(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisLoadBalancerTargetProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.LoadBalancerTarget``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-loadbalancertarget
"""
result = self._values.get("load_balancer_target")
return result
@builtins.property
def load_balancer_target_group(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.LoadBalancerTargetGroup``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-loadbalancertargetgroup
"""
result = self._values.get("load_balancer_target_group")
return result
@builtins.property
def load_balancer_target_groups(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.LoadBalancerTargetGroups``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-loadbalancertargetgroups
"""
result = self._values.get("load_balancer_target_groups")
return result
@builtins.property
def load_balancer_target_port(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.LoadBalancerTargetPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-loadbalancertargetport
"""
result = self._values.get("load_balancer_target_port")
return result
@builtins.property
def missing_component(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.MissingComponent``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-missingcomponent
"""
result = self._values.get("missing_component")
return result
@builtins.property
def nat_gateway(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.NatGateway``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-natgateway
"""
result = self._values.get("nat_gateway")
return result
@builtins.property
def network_interface(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.NetworkInterface``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-networkinterface
"""
result = self._values.get("network_interface")
return result
@builtins.property
def packet_field(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.PacketField``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-packetfield
"""
result = self._values.get("packet_field")
return result
@builtins.property
def port(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.Port``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-port
"""
result = self._values.get("port")
return result
@builtins.property
def port_ranges(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.PortRangeProperty"]]]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.PortRanges``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-portranges
"""
result = self._values.get("port_ranges")
return result
@builtins.property
def prefix_list(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.PrefixList``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-prefixlist
"""
result = self._values.get("prefix_list")
return result
@builtins.property
def protocols(self) -> typing.Optional[typing.List[builtins.str]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.Protocols``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-protocols
"""
result = self._values.get("protocols")
return result
@builtins.property
def route_table(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.RouteTable``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-routetable
"""
result = self._values.get("route_table")
return result
@builtins.property
def route_table_route(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.RouteTableRoute``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-routetableroute
"""
result = self._values.get("route_table_route")
return result
@builtins.property
def security_group(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.SecurityGroup``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-securitygroup
"""
result = self._values.get("security_group")
return result
@builtins.property
def security_group_rule(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.SecurityGroupRule``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-securitygrouprule
"""
result = self._values.get("security_group_rule")
return result
@builtins.property
def security_groups(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.SecurityGroups``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-securitygroups
"""
result = self._values.get("security_groups")
return result
@builtins.property
def source_vpc(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.SourceVpc``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-sourcevpc
"""
result = self._values.get("source_vpc")
return result
@builtins.property
def state(self) -> typing.Optional[builtins.str]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.State``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-state
"""
result = self._values.get("state")
return result
@builtins.property
def subnet(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.Subnet``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-subnet
"""
result = self._values.get("subnet")
return result
@builtins.property
def subnet_route_table(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.SubnetRouteTable``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-subnetroutetable
"""
result = self._values.get("subnet_route_table")
return result
@builtins.property
def vpc(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.Vpc``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-vpc
"""
result = self._values.get("vpc")
return result
@builtins.property
def vpc_endpoint(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.vpcEndpoint``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-vpcendpoint
"""
result = self._values.get("vpc_endpoint")
return result
@builtins.property
def vpc_peering_connection(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.VpcPeeringConnection``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-vpcpeeringconnection
"""
result = self._values.get("vpc_peering_connection")
return result
@builtins.property
def vpn_connection(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.VpnConnection``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-vpnconnection
"""
result = self._values.get("vpn_connection")
return result
@builtins.property
def vpn_gateway(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.ExplanationProperty.VpnGateway``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-explanation.html#cfn-ec2-networkinsightsanalysis-explanation-vpngateway
"""
result = self._values.get("vpn_gateway")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ExplanationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsAnalysis.PathComponentProperty",
jsii_struct_bases=[],
name_mapping={
"acl_rule": "aclRule",
"component": "component",
"destination_vpc": "destinationVpc",
"inbound_header": "inboundHeader",
"outbound_header": "outboundHeader",
"route_table_route": "routeTableRoute",
"security_group_rule": "securityGroupRule",
"sequence_number": "sequenceNumber",
"source_vpc": "sourceVpc",
"subnet": "subnet",
"vpc": "vpc",
},
)
class PathComponentProperty:
def __init__(
self,
*,
acl_rule: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty"]] = None,
component: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
destination_vpc: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
inbound_header: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty"]] = None,
outbound_header: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty"]] = None,
route_table_route: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty"]] = None,
security_group_rule: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty"]] = None,
sequence_number: typing.Optional[jsii.Number] = None,
source_vpc: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
subnet: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
vpc: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]] = None,
) -> None:
"""
:param acl_rule: ``CfnNetworkInsightsAnalysis.PathComponentProperty.AclRule``.
:param component: ``CfnNetworkInsightsAnalysis.PathComponentProperty.Component``.
:param destination_vpc: ``CfnNetworkInsightsAnalysis.PathComponentProperty.DestinationVpc``.
:param inbound_header: ``CfnNetworkInsightsAnalysis.PathComponentProperty.InboundHeader``.
:param outbound_header: ``CfnNetworkInsightsAnalysis.PathComponentProperty.OutboundHeader``.
:param route_table_route: ``CfnNetworkInsightsAnalysis.PathComponentProperty.RouteTableRoute``.
:param security_group_rule: ``CfnNetworkInsightsAnalysis.PathComponentProperty.SecurityGroupRule``.
:param sequence_number: ``CfnNetworkInsightsAnalysis.PathComponentProperty.SequenceNumber``.
:param source_vpc: ``CfnNetworkInsightsAnalysis.PathComponentProperty.SourceVpc``.
:param subnet: ``CfnNetworkInsightsAnalysis.PathComponentProperty.Subnet``.
:param vpc: ``CfnNetworkInsightsAnalysis.PathComponentProperty.Vpc``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-pathcomponent.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if acl_rule is not None:
self._values["acl_rule"] = acl_rule
if component is not None:
self._values["component"] = component
if destination_vpc is not None:
self._values["destination_vpc"] = destination_vpc
if inbound_header is not None:
self._values["inbound_header"] = inbound_header
if outbound_header is not None:
self._values["outbound_header"] = outbound_header
if route_table_route is not None:
self._values["route_table_route"] = route_table_route
if security_group_rule is not None:
self._values["security_group_rule"] = security_group_rule
if sequence_number is not None:
self._values["sequence_number"] = sequence_number
if source_vpc is not None:
self._values["source_vpc"] = source_vpc
if subnet is not None:
self._values["subnet"] = subnet
if vpc is not None:
self._values["vpc"] = vpc
@builtins.property
def acl_rule(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisAclRuleProperty"]]:
"""``CfnNetworkInsightsAnalysis.PathComponentProperty.AclRule``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-pathcomponent.html#cfn-ec2-networkinsightsanalysis-pathcomponent-aclrule
"""
result = self._values.get("acl_rule")
return result
@builtins.property
def component(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.PathComponentProperty.Component``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-pathcomponent.html#cfn-ec2-networkinsightsanalysis-pathcomponent-component
"""
result = self._values.get("component")
return result
@builtins.property
def destination_vpc(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.PathComponentProperty.DestinationVpc``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-pathcomponent.html#cfn-ec2-networkinsightsanalysis-pathcomponent-destinationvpc
"""
result = self._values.get("destination_vpc")
return result
@builtins.property
def inbound_header(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty"]]:
"""``CfnNetworkInsightsAnalysis.PathComponentProperty.InboundHeader``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-pathcomponent.html#cfn-ec2-networkinsightsanalysis-pathcomponent-inboundheader
"""
result = self._values.get("inbound_header")
return result
@builtins.property
def outbound_header(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisPacketHeaderProperty"]]:
"""``CfnNetworkInsightsAnalysis.PathComponentProperty.OutboundHeader``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-pathcomponent.html#cfn-ec2-networkinsightsanalysis-pathcomponent-outboundheader
"""
result = self._values.get("outbound_header")
return result
@builtins.property
def route_table_route(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisRouteTableRouteProperty"]]:
"""``CfnNetworkInsightsAnalysis.PathComponentProperty.RouteTableRoute``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-pathcomponent.html#cfn-ec2-networkinsightsanalysis-pathcomponent-routetableroute
"""
result = self._values.get("route_table_route")
return result
@builtins.property
def security_group_rule(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisSecurityGroupRuleProperty"]]:
"""``CfnNetworkInsightsAnalysis.PathComponentProperty.SecurityGroupRule``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-pathcomponent.html#cfn-ec2-networkinsightsanalysis-pathcomponent-securitygrouprule
"""
result = self._values.get("security_group_rule")
return result
@builtins.property
def sequence_number(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkInsightsAnalysis.PathComponentProperty.SequenceNumber``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-pathcomponent.html#cfn-ec2-networkinsightsanalysis-pathcomponent-sequencenumber
"""
result = self._values.get("sequence_number")
return result
@builtins.property
def source_vpc(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.PathComponentProperty.SourceVpc``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-pathcomponent.html#cfn-ec2-networkinsightsanalysis-pathcomponent-sourcevpc
"""
result = self._values.get("source_vpc")
return result
@builtins.property
def subnet(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.PathComponentProperty.Subnet``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-pathcomponent.html#cfn-ec2-networkinsightsanalysis-pathcomponent-subnet
"""
result = self._values.get("subnet")
return result
@builtins.property
def vpc(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInsightsAnalysis.AnalysisComponentProperty"]]:
"""``CfnNetworkInsightsAnalysis.PathComponentProperty.Vpc``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-pathcomponent.html#cfn-ec2-networkinsightsanalysis-pathcomponent-vpc
"""
result = self._values.get("vpc")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PathComponentProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsAnalysis.PortRangeProperty",
jsii_struct_bases=[],
name_mapping={"from_": "from", "to": "to"},
)
class PortRangeProperty:
def __init__(
self,
*,
from_: typing.Optional[jsii.Number] = None,
to: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param from_: ``CfnNetworkInsightsAnalysis.PortRangeProperty.From``.
:param to: ``CfnNetworkInsightsAnalysis.PortRangeProperty.To``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-portrange.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if from_ is not None:
self._values["from_"] = from_
if to is not None:
self._values["to"] = to
@builtins.property
def from_(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkInsightsAnalysis.PortRangeProperty.From``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-portrange.html#cfn-ec2-networkinsightsanalysis-portrange-from
"""
result = self._values.get("from_")
return result
@builtins.property
def to(self) -> typing.Optional[jsii.Number]:
"""``CfnNetworkInsightsAnalysis.PortRangeProperty.To``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinsightsanalysis-portrange.html#cfn-ec2-networkinsightsanalysis-portrange-to
"""
result = self._values.get("to")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PortRangeProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsAnalysisProps",
jsii_struct_bases=[],
name_mapping={
"network_insights_path_id": "networkInsightsPathId",
"filter_in_arns": "filterInArns",
"tags": "tags",
},
)
class CfnNetworkInsightsAnalysisProps:
def __init__(
self,
*,
network_insights_path_id: builtins.str,
filter_in_arns: typing.Optional[typing.List[builtins.str]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::NetworkInsightsAnalysis``.
:param network_insights_path_id: ``AWS::EC2::NetworkInsightsAnalysis.NetworkInsightsPathId``.
:param filter_in_arns: ``AWS::EC2::NetworkInsightsAnalysis.FilterInArns``.
:param tags: ``AWS::EC2::NetworkInsightsAnalysis.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightsanalysis.html
"""
self._values: typing.Dict[str, typing.Any] = {
"network_insights_path_id": network_insights_path_id,
}
if filter_in_arns is not None:
self._values["filter_in_arns"] = filter_in_arns
if tags is not None:
self._values["tags"] = tags
@builtins.property
def network_insights_path_id(self) -> builtins.str:
"""``AWS::EC2::NetworkInsightsAnalysis.NetworkInsightsPathId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightsanalysis.html#cfn-ec2-networkinsightsanalysis-networkinsightspathid
"""
result = self._values.get("network_insights_path_id")
assert result is not None, "Required property 'network_insights_path_id' is missing"
return result
@builtins.property
def filter_in_arns(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::NetworkInsightsAnalysis.FilterInArns``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightsanalysis.html#cfn-ec2-networkinsightsanalysis-filterinarns
"""
result = self._values.get("filter_in_arns")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::NetworkInsightsAnalysis.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightsanalysis.html#cfn-ec2-networkinsightsanalysis-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnNetworkInsightsAnalysisProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnNetworkInsightsPath(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsPath",
):
"""A CloudFormation ``AWS::EC2::NetworkInsightsPath``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html
:cloudformationResource: AWS::EC2::NetworkInsightsPath
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
destination: builtins.str,
protocol: builtins.str,
source: builtins.str,
destination_ip: typing.Optional[builtins.str] = None,
destination_port: typing.Optional[jsii.Number] = None,
source_ip: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::NetworkInsightsPath``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param destination: ``AWS::EC2::NetworkInsightsPath.Destination``.
:param protocol: ``AWS::EC2::NetworkInsightsPath.Protocol``.
:param source: ``AWS::EC2::NetworkInsightsPath.Source``.
:param destination_ip: ``AWS::EC2::NetworkInsightsPath.DestinationIp``.
:param destination_port: ``AWS::EC2::NetworkInsightsPath.DestinationPort``.
:param source_ip: ``AWS::EC2::NetworkInsightsPath.SourceIp``.
:param tags: ``AWS::EC2::NetworkInsightsPath.Tags``.
"""
props = CfnNetworkInsightsPathProps(
destination=destination,
protocol=protocol,
source=source,
destination_ip=destination_ip,
destination_port=destination_port,
source_ip=source_ip,
tags=tags,
)
jsii.create(CfnNetworkInsightsPath, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrCreatedDate")
def attr_created_date(self) -> builtins.str:
"""
:cloudformationAttribute: CreatedDate
"""
return jsii.get(self, "attrCreatedDate")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrNetworkInsightsPathArn")
def attr_network_insights_path_arn(self) -> builtins.str:
"""
:cloudformationAttribute: NetworkInsightsPathArn
"""
return jsii.get(self, "attrNetworkInsightsPathArn")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrNetworkInsightsPathId")
def attr_network_insights_path_id(self) -> builtins.str:
"""
:cloudformationAttribute: NetworkInsightsPathId
"""
return jsii.get(self, "attrNetworkInsightsPathId")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::NetworkInsightsPath.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="destination")
def destination(self) -> builtins.str:
"""``AWS::EC2::NetworkInsightsPath.Destination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-destination
"""
return jsii.get(self, "destination")
@destination.setter # type: ignore
def destination(self, value: builtins.str) -> None:
jsii.set(self, "destination", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="protocol")
def protocol(self) -> builtins.str:
"""``AWS::EC2::NetworkInsightsPath.Protocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-protocol
"""
return jsii.get(self, "protocol")
@protocol.setter # type: ignore
def protocol(self, value: builtins.str) -> None:
jsii.set(self, "protocol", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="source")
def source(self) -> builtins.str:
"""``AWS::EC2::NetworkInsightsPath.Source``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-source
"""
return jsii.get(self, "source")
@source.setter # type: ignore
def source(self, value: builtins.str) -> None:
jsii.set(self, "source", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="destinationIp")
def destination_ip(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkInsightsPath.DestinationIp``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-destinationip
"""
return jsii.get(self, "destinationIp")
@destination_ip.setter # type: ignore
def destination_ip(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "destinationIp", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="destinationPort")
def destination_port(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::NetworkInsightsPath.DestinationPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-destinationport
"""
return jsii.get(self, "destinationPort")
@destination_port.setter # type: ignore
def destination_port(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "destinationPort", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="sourceIp")
def source_ip(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkInsightsPath.SourceIp``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-sourceip
"""
return jsii.get(self, "sourceIp")
@source_ip.setter # type: ignore
def source_ip(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "sourceIp", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInsightsPathProps",
jsii_struct_bases=[],
name_mapping={
"destination": "destination",
"protocol": "protocol",
"source": "source",
"destination_ip": "destinationIp",
"destination_port": "destinationPort",
"source_ip": "sourceIp",
"tags": "tags",
},
)
class CfnNetworkInsightsPathProps:
def __init__(
self,
*,
destination: builtins.str,
protocol: builtins.str,
source: builtins.str,
destination_ip: typing.Optional[builtins.str] = None,
destination_port: typing.Optional[jsii.Number] = None,
source_ip: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::NetworkInsightsPath``.
:param destination: ``AWS::EC2::NetworkInsightsPath.Destination``.
:param protocol: ``AWS::EC2::NetworkInsightsPath.Protocol``.
:param source: ``AWS::EC2::NetworkInsightsPath.Source``.
:param destination_ip: ``AWS::EC2::NetworkInsightsPath.DestinationIp``.
:param destination_port: ``AWS::EC2::NetworkInsightsPath.DestinationPort``.
:param source_ip: ``AWS::EC2::NetworkInsightsPath.SourceIp``.
:param tags: ``AWS::EC2::NetworkInsightsPath.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html
"""
self._values: typing.Dict[str, typing.Any] = {
"destination": destination,
"protocol": protocol,
"source": source,
}
if destination_ip is not None:
self._values["destination_ip"] = destination_ip
if destination_port is not None:
self._values["destination_port"] = destination_port
if source_ip is not None:
self._values["source_ip"] = source_ip
if tags is not None:
self._values["tags"] = tags
@builtins.property
def destination(self) -> builtins.str:
"""``AWS::EC2::NetworkInsightsPath.Destination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-destination
"""
result = self._values.get("destination")
assert result is not None, "Required property 'destination' is missing"
return result
@builtins.property
def protocol(self) -> builtins.str:
"""``AWS::EC2::NetworkInsightsPath.Protocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-protocol
"""
result = self._values.get("protocol")
assert result is not None, "Required property 'protocol' is missing"
return result
@builtins.property
def source(self) -> builtins.str:
"""``AWS::EC2::NetworkInsightsPath.Source``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-source
"""
result = self._values.get("source")
assert result is not None, "Required property 'source' is missing"
return result
@builtins.property
def destination_ip(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkInsightsPath.DestinationIp``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-destinationip
"""
result = self._values.get("destination_ip")
return result
@builtins.property
def destination_port(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::NetworkInsightsPath.DestinationPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-destinationport
"""
result = self._values.get("destination_port")
return result
@builtins.property
def source_ip(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkInsightsPath.SourceIp``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-sourceip
"""
result = self._values.get("source_ip")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::NetworkInsightsPath.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinsightspath.html#cfn-ec2-networkinsightspath-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnNetworkInsightsPathProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnNetworkInterface(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInterface",
):
"""A CloudFormation ``AWS::EC2::NetworkInterface``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html
:cloudformationResource: AWS::EC2::NetworkInterface
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
subnet_id: builtins.str,
description: typing.Optional[builtins.str] = None,
group_set: typing.Optional[typing.List[builtins.str]] = None,
interface_type: typing.Optional[builtins.str] = None,
ipv6_address_count: typing.Optional[jsii.Number] = None,
ipv6_addresses: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInterface.InstanceIpv6AddressProperty"]]]] = None,
private_ip_address: typing.Optional[builtins.str] = None,
private_ip_addresses: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInterface.PrivateIpAddressSpecificationProperty"]]]] = None,
secondary_private_ip_address_count: typing.Optional[jsii.Number] = None,
source_dest_check: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::NetworkInterface``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param subnet_id: ``AWS::EC2::NetworkInterface.SubnetId``.
:param description: ``AWS::EC2::NetworkInterface.Description``.
:param group_set: ``AWS::EC2::NetworkInterface.GroupSet``.
:param interface_type: ``AWS::EC2::NetworkInterface.InterfaceType``.
:param ipv6_address_count: ``AWS::EC2::NetworkInterface.Ipv6AddressCount``.
:param ipv6_addresses: ``AWS::EC2::NetworkInterface.Ipv6Addresses``.
:param private_ip_address: ``AWS::EC2::NetworkInterface.PrivateIpAddress``.
:param private_ip_addresses: ``AWS::EC2::NetworkInterface.PrivateIpAddresses``.
:param secondary_private_ip_address_count: ``AWS::EC2::NetworkInterface.SecondaryPrivateIpAddressCount``.
:param source_dest_check: ``AWS::EC2::NetworkInterface.SourceDestCheck``.
:param tags: ``AWS::EC2::NetworkInterface.Tags``.
"""
props = CfnNetworkInterfaceProps(
subnet_id=subnet_id,
description=description,
group_set=group_set,
interface_type=interface_type,
ipv6_address_count=ipv6_address_count,
ipv6_addresses=ipv6_addresses,
private_ip_address=private_ip_address,
private_ip_addresses=private_ip_addresses,
secondary_private_ip_address_count=secondary_private_ip_address_count,
source_dest_check=source_dest_check,
tags=tags,
)
jsii.create(CfnNetworkInterface, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrPrimaryPrivateIpAddress")
def attr_primary_private_ip_address(self) -> builtins.str:
"""
:cloudformationAttribute: PrimaryPrivateIpAddress
"""
return jsii.get(self, "attrPrimaryPrivateIpAddress")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrSecondaryPrivateIpAddresses")
def attr_secondary_private_ip_addresses(self) -> typing.List[builtins.str]:
"""
:cloudformationAttribute: SecondaryPrivateIpAddresses
"""
return jsii.get(self, "attrSecondaryPrivateIpAddresses")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::NetworkInterface.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetId")
def subnet_id(self) -> builtins.str:
"""``AWS::EC2::NetworkInterface.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-subnetid
"""
return jsii.get(self, "subnetId")
@subnet_id.setter # type: ignore
def subnet_id(self, value: builtins.str) -> None:
jsii.set(self, "subnetId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="description")
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkInterface.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-description
"""
return jsii.get(self, "description")
@description.setter # type: ignore
def description(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "description", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="groupSet")
def group_set(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::NetworkInterface.GroupSet``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-groupset
"""
return jsii.get(self, "groupSet")
@group_set.setter # type: ignore
def group_set(self, value: typing.Optional[typing.List[builtins.str]]) -> None:
jsii.set(self, "groupSet", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="interfaceType")
def interface_type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkInterface.InterfaceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-ec2-networkinterface-interfacetype
"""
return jsii.get(self, "interfaceType")
@interface_type.setter # type: ignore
def interface_type(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "interfaceType", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ipv6AddressCount")
def ipv6_address_count(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::NetworkInterface.Ipv6AddressCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-ec2-networkinterface-ipv6addresscount
"""
return jsii.get(self, "ipv6AddressCount")
@ipv6_address_count.setter # type: ignore
def ipv6_address_count(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "ipv6AddressCount", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ipv6Addresses")
def ipv6_addresses(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInterface.InstanceIpv6AddressProperty"]]]]:
"""``AWS::EC2::NetworkInterface.Ipv6Addresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-ec2-networkinterface-ipv6addresses
"""
return jsii.get(self, "ipv6Addresses")
@ipv6_addresses.setter # type: ignore
def ipv6_addresses(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInterface.InstanceIpv6AddressProperty"]]]],
) -> None:
jsii.set(self, "ipv6Addresses", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="privateIpAddress")
def private_ip_address(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkInterface.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-privateipaddress
"""
return jsii.get(self, "privateIpAddress")
@private_ip_address.setter # type: ignore
def private_ip_address(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "privateIpAddress", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="privateIpAddresses")
def private_ip_addresses(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInterface.PrivateIpAddressSpecificationProperty"]]]]:
"""``AWS::EC2::NetworkInterface.PrivateIpAddresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-privateipaddresses
"""
return jsii.get(self, "privateIpAddresses")
@private_ip_addresses.setter # type: ignore
def private_ip_addresses(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnNetworkInterface.PrivateIpAddressSpecificationProperty"]]]],
) -> None:
jsii.set(self, "privateIpAddresses", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="secondaryPrivateIpAddressCount")
def secondary_private_ip_address_count(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::NetworkInterface.SecondaryPrivateIpAddressCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-secondaryprivateipcount
"""
return jsii.get(self, "secondaryPrivateIpAddressCount")
@secondary_private_ip_address_count.setter # type: ignore
def secondary_private_ip_address_count(
self,
value: typing.Optional[jsii.Number],
) -> None:
jsii.set(self, "secondaryPrivateIpAddressCount", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="sourceDestCheck")
def source_dest_check(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::NetworkInterface.SourceDestCheck``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-sourcedestcheck
"""
return jsii.get(self, "sourceDestCheck")
@source_dest_check.setter # type: ignore
def source_dest_check(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "sourceDestCheck", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInterface.InstanceIpv6AddressProperty",
jsii_struct_bases=[],
name_mapping={"ipv6_address": "ipv6Address"},
)
class InstanceIpv6AddressProperty:
def __init__(self, *, ipv6_address: builtins.str) -> None:
"""
:param ipv6_address: ``CfnNetworkInterface.InstanceIpv6AddressProperty.Ipv6Address``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinterface-instanceipv6address.html
"""
self._values: typing.Dict[str, typing.Any] = {
"ipv6_address": ipv6_address,
}
@builtins.property
def ipv6_address(self) -> builtins.str:
"""``CfnNetworkInterface.InstanceIpv6AddressProperty.Ipv6Address``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-networkinterface-instanceipv6address.html#cfn-ec2-networkinterface-instanceipv6address-ipv6address
"""
result = self._values.get("ipv6_address")
assert result is not None, "Required property 'ipv6_address' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InstanceIpv6AddressProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInterface.PrivateIpAddressSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"primary": "primary", "private_ip_address": "privateIpAddress"},
)
class PrivateIpAddressSpecificationProperty:
def __init__(
self,
*,
primary: typing.Union[builtins.bool, aws_cdk.core.IResolvable],
private_ip_address: builtins.str,
) -> None:
"""
:param primary: ``CfnNetworkInterface.PrivateIpAddressSpecificationProperty.Primary``.
:param private_ip_address: ``CfnNetworkInterface.PrivateIpAddressSpecificationProperty.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html
"""
self._values: typing.Dict[str, typing.Any] = {
"primary": primary,
"private_ip_address": private_ip_address,
}
@builtins.property
def primary(self) -> typing.Union[builtins.bool, aws_cdk.core.IResolvable]:
"""``CfnNetworkInterface.PrivateIpAddressSpecificationProperty.Primary``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html#cfn-ec2-networkinterface-privateipspecification-primary
"""
result = self._values.get("primary")
assert result is not None, "Required property 'primary' is missing"
return result
@builtins.property
def private_ip_address(self) -> builtins.str:
"""``CfnNetworkInterface.PrivateIpAddressSpecificationProperty.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-network-interface-privateipspec.html#cfn-ec2-networkinterface-privateipspecification-privateipaddress
"""
result = self._values.get("private_ip_address")
assert result is not None, "Required property 'private_ip_address' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PrivateIpAddressSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnNetworkInterfaceAttachment(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInterfaceAttachment",
):
"""A CloudFormation ``AWS::EC2::NetworkInterfaceAttachment``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html
:cloudformationResource: AWS::EC2::NetworkInterfaceAttachment
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
device_index: builtins.str,
instance_id: builtins.str,
network_interface_id: builtins.str,
delete_on_termination: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
) -> None:
"""Create a new ``AWS::EC2::NetworkInterfaceAttachment``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param device_index: ``AWS::EC2::NetworkInterfaceAttachment.DeviceIndex``.
:param instance_id: ``AWS::EC2::NetworkInterfaceAttachment.InstanceId``.
:param network_interface_id: ``AWS::EC2::NetworkInterfaceAttachment.NetworkInterfaceId``.
:param delete_on_termination: ``AWS::EC2::NetworkInterfaceAttachment.DeleteOnTermination``.
"""
props = CfnNetworkInterfaceAttachmentProps(
device_index=device_index,
instance_id=instance_id,
network_interface_id=network_interface_id,
delete_on_termination=delete_on_termination,
)
jsii.create(CfnNetworkInterfaceAttachment, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="deviceIndex")
def device_index(self) -> builtins.str:
"""``AWS::EC2::NetworkInterfaceAttachment.DeviceIndex``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html#cfn-ec2-network-interface-attachment-deviceindex
"""
return jsii.get(self, "deviceIndex")
@device_index.setter # type: ignore
def device_index(self, value: builtins.str) -> None:
jsii.set(self, "deviceIndex", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceId")
def instance_id(self) -> builtins.str:
"""``AWS::EC2::NetworkInterfaceAttachment.InstanceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html#cfn-ec2-network-interface-attachment-instanceid
"""
return jsii.get(self, "instanceId")
@instance_id.setter # type: ignore
def instance_id(self, value: builtins.str) -> None:
jsii.set(self, "instanceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="networkInterfaceId")
def network_interface_id(self) -> builtins.str:
"""``AWS::EC2::NetworkInterfaceAttachment.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html#cfn-ec2-network-interface-attachment-networkinterfaceid
"""
return jsii.get(self, "networkInterfaceId")
@network_interface_id.setter # type: ignore
def network_interface_id(self, value: builtins.str) -> None:
jsii.set(self, "networkInterfaceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="deleteOnTermination")
def delete_on_termination(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::NetworkInterfaceAttachment.DeleteOnTermination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html#cfn-ec2-network-interface-attachment-deleteonterm
"""
return jsii.get(self, "deleteOnTermination")
@delete_on_termination.setter # type: ignore
def delete_on_termination(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "deleteOnTermination", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInterfaceAttachmentProps",
jsii_struct_bases=[],
name_mapping={
"device_index": "deviceIndex",
"instance_id": "instanceId",
"network_interface_id": "networkInterfaceId",
"delete_on_termination": "deleteOnTermination",
},
)
class CfnNetworkInterfaceAttachmentProps:
def __init__(
self,
*,
device_index: builtins.str,
instance_id: builtins.str,
network_interface_id: builtins.str,
delete_on_termination: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::NetworkInterfaceAttachment``.
:param device_index: ``AWS::EC2::NetworkInterfaceAttachment.DeviceIndex``.
:param instance_id: ``AWS::EC2::NetworkInterfaceAttachment.InstanceId``.
:param network_interface_id: ``AWS::EC2::NetworkInterfaceAttachment.NetworkInterfaceId``.
:param delete_on_termination: ``AWS::EC2::NetworkInterfaceAttachment.DeleteOnTermination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html
"""
self._values: typing.Dict[str, typing.Any] = {
"device_index": device_index,
"instance_id": instance_id,
"network_interface_id": network_interface_id,
}
if delete_on_termination is not None:
self._values["delete_on_termination"] = delete_on_termination
@builtins.property
def device_index(self) -> builtins.str:
"""``AWS::EC2::NetworkInterfaceAttachment.DeviceIndex``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html#cfn-ec2-network-interface-attachment-deviceindex
"""
result = self._values.get("device_index")
assert result is not None, "Required property 'device_index' is missing"
return result
@builtins.property
def instance_id(self) -> builtins.str:
"""``AWS::EC2::NetworkInterfaceAttachment.InstanceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html#cfn-ec2-network-interface-attachment-instanceid
"""
result = self._values.get("instance_id")
assert result is not None, "Required property 'instance_id' is missing"
return result
@builtins.property
def network_interface_id(self) -> builtins.str:
"""``AWS::EC2::NetworkInterfaceAttachment.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html#cfn-ec2-network-interface-attachment-networkinterfaceid
"""
result = self._values.get("network_interface_id")
assert result is not None, "Required property 'network_interface_id' is missing"
return result
@builtins.property
def delete_on_termination(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::NetworkInterfaceAttachment.DeleteOnTermination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface-attachment.html#cfn-ec2-network-interface-attachment-deleteonterm
"""
result = self._values.get("delete_on_termination")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnNetworkInterfaceAttachmentProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnNetworkInterfacePermission(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInterfacePermission",
):
"""A CloudFormation ``AWS::EC2::NetworkInterfacePermission``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinterfacepermission.html
:cloudformationResource: AWS::EC2::NetworkInterfacePermission
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
aws_account_id: builtins.str,
network_interface_id: builtins.str,
permission: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::NetworkInterfacePermission``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param aws_account_id: ``AWS::EC2::NetworkInterfacePermission.AwsAccountId``.
:param network_interface_id: ``AWS::EC2::NetworkInterfacePermission.NetworkInterfaceId``.
:param permission: ``AWS::EC2::NetworkInterfacePermission.Permission``.
"""
props = CfnNetworkInterfacePermissionProps(
aws_account_id=aws_account_id,
network_interface_id=network_interface_id,
permission=permission,
)
jsii.create(CfnNetworkInterfacePermission, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="awsAccountId")
def aws_account_id(self) -> builtins.str:
"""``AWS::EC2::NetworkInterfacePermission.AwsAccountId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinterfacepermission.html#cfn-ec2-networkinterfacepermission-awsaccountid
"""
return jsii.get(self, "awsAccountId")
@aws_account_id.setter # type: ignore
def aws_account_id(self, value: builtins.str) -> None:
jsii.set(self, "awsAccountId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="networkInterfaceId")
def network_interface_id(self) -> builtins.str:
"""``AWS::EC2::NetworkInterfacePermission.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinterfacepermission.html#cfn-ec2-networkinterfacepermission-networkinterfaceid
"""
return jsii.get(self, "networkInterfaceId")
@network_interface_id.setter # type: ignore
def network_interface_id(self, value: builtins.str) -> None:
jsii.set(self, "networkInterfaceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="permission")
def permission(self) -> builtins.str:
"""``AWS::EC2::NetworkInterfacePermission.Permission``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinterfacepermission.html#cfn-ec2-networkinterfacepermission-permission
"""
return jsii.get(self, "permission")
@permission.setter # type: ignore
def permission(self, value: builtins.str) -> None:
jsii.set(self, "permission", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInterfacePermissionProps",
jsii_struct_bases=[],
name_mapping={
"aws_account_id": "awsAccountId",
"network_interface_id": "networkInterfaceId",
"permission": "permission",
},
)
class CfnNetworkInterfacePermissionProps:
def __init__(
self,
*,
aws_account_id: builtins.str,
network_interface_id: builtins.str,
permission: builtins.str,
) -> None:
"""Properties for defining a ``AWS::EC2::NetworkInterfacePermission``.
:param aws_account_id: ``AWS::EC2::NetworkInterfacePermission.AwsAccountId``.
:param network_interface_id: ``AWS::EC2::NetworkInterfacePermission.NetworkInterfaceId``.
:param permission: ``AWS::EC2::NetworkInterfacePermission.Permission``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinterfacepermission.html
"""
self._values: typing.Dict[str, typing.Any] = {
"aws_account_id": aws_account_id,
"network_interface_id": network_interface_id,
"permission": permission,
}
@builtins.property
def aws_account_id(self) -> builtins.str:
"""``AWS::EC2::NetworkInterfacePermission.AwsAccountId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinterfacepermission.html#cfn-ec2-networkinterfacepermission-awsaccountid
"""
result = self._values.get("aws_account_id")
assert result is not None, "Required property 'aws_account_id' is missing"
return result
@builtins.property
def network_interface_id(self) -> builtins.str:
"""``AWS::EC2::NetworkInterfacePermission.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinterfacepermission.html#cfn-ec2-networkinterfacepermission-networkinterfaceid
"""
result = self._values.get("network_interface_id")
assert result is not None, "Required property 'network_interface_id' is missing"
return result
@builtins.property
def permission(self) -> builtins.str:
"""``AWS::EC2::NetworkInterfacePermission.Permission``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-networkinterfacepermission.html#cfn-ec2-networkinterfacepermission-permission
"""
result = self._values.get("permission")
assert result is not None, "Required property 'permission' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnNetworkInterfacePermissionProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnNetworkInterfaceProps",
jsii_struct_bases=[],
name_mapping={
"subnet_id": "subnetId",
"description": "description",
"group_set": "groupSet",
"interface_type": "interfaceType",
"ipv6_address_count": "ipv6AddressCount",
"ipv6_addresses": "ipv6Addresses",
"private_ip_address": "privateIpAddress",
"private_ip_addresses": "privateIpAddresses",
"secondary_private_ip_address_count": "secondaryPrivateIpAddressCount",
"source_dest_check": "sourceDestCheck",
"tags": "tags",
},
)
class CfnNetworkInterfaceProps:
def __init__(
self,
*,
subnet_id: builtins.str,
description: typing.Optional[builtins.str] = None,
group_set: typing.Optional[typing.List[builtins.str]] = None,
interface_type: typing.Optional[builtins.str] = None,
ipv6_address_count: typing.Optional[jsii.Number] = None,
ipv6_addresses: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnNetworkInterface.InstanceIpv6AddressProperty]]]] = None,
private_ip_address: typing.Optional[builtins.str] = None,
private_ip_addresses: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnNetworkInterface.PrivateIpAddressSpecificationProperty]]]] = None,
secondary_private_ip_address_count: typing.Optional[jsii.Number] = None,
source_dest_check: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::NetworkInterface``.
:param subnet_id: ``AWS::EC2::NetworkInterface.SubnetId``.
:param description: ``AWS::EC2::NetworkInterface.Description``.
:param group_set: ``AWS::EC2::NetworkInterface.GroupSet``.
:param interface_type: ``AWS::EC2::NetworkInterface.InterfaceType``.
:param ipv6_address_count: ``AWS::EC2::NetworkInterface.Ipv6AddressCount``.
:param ipv6_addresses: ``AWS::EC2::NetworkInterface.Ipv6Addresses``.
:param private_ip_address: ``AWS::EC2::NetworkInterface.PrivateIpAddress``.
:param private_ip_addresses: ``AWS::EC2::NetworkInterface.PrivateIpAddresses``.
:param secondary_private_ip_address_count: ``AWS::EC2::NetworkInterface.SecondaryPrivateIpAddressCount``.
:param source_dest_check: ``AWS::EC2::NetworkInterface.SourceDestCheck``.
:param tags: ``AWS::EC2::NetworkInterface.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html
"""
self._values: typing.Dict[str, typing.Any] = {
"subnet_id": subnet_id,
}
if description is not None:
self._values["description"] = description
if group_set is not None:
self._values["group_set"] = group_set
if interface_type is not None:
self._values["interface_type"] = interface_type
if ipv6_address_count is not None:
self._values["ipv6_address_count"] = ipv6_address_count
if ipv6_addresses is not None:
self._values["ipv6_addresses"] = ipv6_addresses
if private_ip_address is not None:
self._values["private_ip_address"] = private_ip_address
if private_ip_addresses is not None:
self._values["private_ip_addresses"] = private_ip_addresses
if secondary_private_ip_address_count is not None:
self._values["secondary_private_ip_address_count"] = secondary_private_ip_address_count
if source_dest_check is not None:
self._values["source_dest_check"] = source_dest_check
if tags is not None:
self._values["tags"] = tags
@builtins.property
def subnet_id(self) -> builtins.str:
"""``AWS::EC2::NetworkInterface.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-subnetid
"""
result = self._values.get("subnet_id")
assert result is not None, "Required property 'subnet_id' is missing"
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkInterface.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-description
"""
result = self._values.get("description")
return result
@builtins.property
def group_set(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::NetworkInterface.GroupSet``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-groupset
"""
result = self._values.get("group_set")
return result
@builtins.property
def interface_type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkInterface.InterfaceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-ec2-networkinterface-interfacetype
"""
result = self._values.get("interface_type")
return result
@builtins.property
def ipv6_address_count(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::NetworkInterface.Ipv6AddressCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-ec2-networkinterface-ipv6addresscount
"""
result = self._values.get("ipv6_address_count")
return result
@builtins.property
def ipv6_addresses(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnNetworkInterface.InstanceIpv6AddressProperty]]]]:
"""``AWS::EC2::NetworkInterface.Ipv6Addresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-ec2-networkinterface-ipv6addresses
"""
result = self._values.get("ipv6_addresses")
return result
@builtins.property
def private_ip_address(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::NetworkInterface.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-privateipaddress
"""
result = self._values.get("private_ip_address")
return result
@builtins.property
def private_ip_addresses(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnNetworkInterface.PrivateIpAddressSpecificationProperty]]]]:
"""``AWS::EC2::NetworkInterface.PrivateIpAddresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-privateipaddresses
"""
result = self._values.get("private_ip_addresses")
return result
@builtins.property
def secondary_private_ip_address_count(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::NetworkInterface.SecondaryPrivateIpAddressCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-secondaryprivateipcount
"""
result = self._values.get("secondary_private_ip_address_count")
return result
@builtins.property
def source_dest_check(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::NetworkInterface.SourceDestCheck``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-sourcedestcheck
"""
result = self._values.get("source_dest_check")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::NetworkInterface.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-network-interface.html#cfn-awsec2networkinterface-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnNetworkInterfaceProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnPlacementGroup(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnPlacementGroup",
):
"""A CloudFormation ``AWS::EC2::PlacementGroup``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-placementgroup.html
:cloudformationResource: AWS::EC2::PlacementGroup
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
strategy: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::PlacementGroup``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param strategy: ``AWS::EC2::PlacementGroup.Strategy``.
"""
props = CfnPlacementGroupProps(strategy=strategy)
jsii.create(CfnPlacementGroup, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="strategy")
def strategy(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::PlacementGroup.Strategy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-placementgroup.html#cfn-ec2-placementgroup-strategy
"""
return jsii.get(self, "strategy")
@strategy.setter # type: ignore
def strategy(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "strategy", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnPlacementGroupProps",
jsii_struct_bases=[],
name_mapping={"strategy": "strategy"},
)
class CfnPlacementGroupProps:
def __init__(self, *, strategy: typing.Optional[builtins.str] = None) -> None:
"""Properties for defining a ``AWS::EC2::PlacementGroup``.
:param strategy: ``AWS::EC2::PlacementGroup.Strategy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-placementgroup.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if strategy is not None:
self._values["strategy"] = strategy
@builtins.property
def strategy(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::PlacementGroup.Strategy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-placementgroup.html#cfn-ec2-placementgroup-strategy
"""
result = self._values.get("strategy")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnPlacementGroupProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnPrefixList(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnPrefixList",
):
"""A CloudFormation ``AWS::EC2::PrefixList``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-prefixlist.html
:cloudformationResource: AWS::EC2::PrefixList
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
address_family: builtins.str,
max_entries: jsii.Number,
prefix_list_name: builtins.str,
entries: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnPrefixList.EntryProperty"]]]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::PrefixList``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param address_family: ``AWS::EC2::PrefixList.AddressFamily``.
:param max_entries: ``AWS::EC2::PrefixList.MaxEntries``.
:param prefix_list_name: ``AWS::EC2::PrefixList.PrefixListName``.
:param entries: ``AWS::EC2::PrefixList.Entries``.
:param tags: ``AWS::EC2::PrefixList.Tags``.
"""
props = CfnPrefixListProps(
address_family=address_family,
max_entries=max_entries,
prefix_list_name=prefix_list_name,
entries=entries,
tags=tags,
)
jsii.create(CfnPrefixList, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrArn")
def attr_arn(self) -> builtins.str:
"""
:cloudformationAttribute: Arn
"""
return jsii.get(self, "attrArn")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrOwnerId")
def attr_owner_id(self) -> builtins.str:
"""
:cloudformationAttribute: OwnerId
"""
return jsii.get(self, "attrOwnerId")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrPrefixListId")
def attr_prefix_list_id(self) -> builtins.str:
"""
:cloudformationAttribute: PrefixListId
"""
return jsii.get(self, "attrPrefixListId")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrVersion")
def attr_version(self) -> jsii.Number:
"""
:cloudformationAttribute: Version
"""
return jsii.get(self, "attrVersion")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::PrefixList.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-prefixlist.html#cfn-ec2-prefixlist-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="addressFamily")
def address_family(self) -> builtins.str:
"""``AWS::EC2::PrefixList.AddressFamily``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-prefixlist.html#cfn-ec2-prefixlist-addressfamily
"""
return jsii.get(self, "addressFamily")
@address_family.setter # type: ignore
def address_family(self, value: builtins.str) -> None:
jsii.set(self, "addressFamily", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="maxEntries")
def max_entries(self) -> jsii.Number:
"""``AWS::EC2::PrefixList.MaxEntries``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-prefixlist.html#cfn-ec2-prefixlist-maxentries
"""
return jsii.get(self, "maxEntries")
@max_entries.setter # type: ignore
def max_entries(self, value: jsii.Number) -> None:
jsii.set(self, "maxEntries", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="prefixListName")
def prefix_list_name(self) -> builtins.str:
"""``AWS::EC2::PrefixList.PrefixListName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-prefixlist.html#cfn-ec2-prefixlist-prefixlistname
"""
return jsii.get(self, "prefixListName")
@prefix_list_name.setter # type: ignore
def prefix_list_name(self, value: builtins.str) -> None:
jsii.set(self, "prefixListName", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="entries")
def entries(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnPrefixList.EntryProperty"]]]]:
"""``AWS::EC2::PrefixList.Entries``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-prefixlist.html#cfn-ec2-prefixlist-entries
"""
return jsii.get(self, "entries")
@entries.setter # type: ignore
def entries(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnPrefixList.EntryProperty"]]]],
) -> None:
jsii.set(self, "entries", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnPrefixList.EntryProperty",
jsii_struct_bases=[],
name_mapping={"cidr": "cidr", "description": "description"},
)
class EntryProperty:
def __init__(
self,
*,
cidr: builtins.str,
description: typing.Optional[builtins.str] = None,
) -> None:
"""
:param cidr: ``CfnPrefixList.EntryProperty.Cidr``.
:param description: ``CfnPrefixList.EntryProperty.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-prefixlist-entry.html
"""
self._values: typing.Dict[str, typing.Any] = {
"cidr": cidr,
}
if description is not None:
self._values["description"] = description
@builtins.property
def cidr(self) -> builtins.str:
"""``CfnPrefixList.EntryProperty.Cidr``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-prefixlist-entry.html#cfn-ec2-prefixlist-entry-cidr
"""
result = self._values.get("cidr")
assert result is not None, "Required property 'cidr' is missing"
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``CfnPrefixList.EntryProperty.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-prefixlist-entry.html#cfn-ec2-prefixlist-entry-description
"""
result = self._values.get("description")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "EntryProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnPrefixListProps",
jsii_struct_bases=[],
name_mapping={
"address_family": "addressFamily",
"max_entries": "maxEntries",
"prefix_list_name": "prefixListName",
"entries": "entries",
"tags": "tags",
},
)
class CfnPrefixListProps:
def __init__(
self,
*,
address_family: builtins.str,
max_entries: jsii.Number,
prefix_list_name: builtins.str,
entries: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnPrefixList.EntryProperty]]]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::PrefixList``.
:param address_family: ``AWS::EC2::PrefixList.AddressFamily``.
:param max_entries: ``AWS::EC2::PrefixList.MaxEntries``.
:param prefix_list_name: ``AWS::EC2::PrefixList.PrefixListName``.
:param entries: ``AWS::EC2::PrefixList.Entries``.
:param tags: ``AWS::EC2::PrefixList.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-prefixlist.html
"""
self._values: typing.Dict[str, typing.Any] = {
"address_family": address_family,
"max_entries": max_entries,
"prefix_list_name": prefix_list_name,
}
if entries is not None:
self._values["entries"] = entries
if tags is not None:
self._values["tags"] = tags
@builtins.property
def address_family(self) -> builtins.str:
"""``AWS::EC2::PrefixList.AddressFamily``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-prefixlist.html#cfn-ec2-prefixlist-addressfamily
"""
result = self._values.get("address_family")
assert result is not None, "Required property 'address_family' is missing"
return result
@builtins.property
def max_entries(self) -> jsii.Number:
"""``AWS::EC2::PrefixList.MaxEntries``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-prefixlist.html#cfn-ec2-prefixlist-maxentries
"""
result = self._values.get("max_entries")
assert result is not None, "Required property 'max_entries' is missing"
return result
@builtins.property
def prefix_list_name(self) -> builtins.str:
"""``AWS::EC2::PrefixList.PrefixListName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-prefixlist.html#cfn-ec2-prefixlist-prefixlistname
"""
result = self._values.get("prefix_list_name")
assert result is not None, "Required property 'prefix_list_name' is missing"
return result
@builtins.property
def entries(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnPrefixList.EntryProperty]]]]:
"""``AWS::EC2::PrefixList.Entries``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-prefixlist.html#cfn-ec2-prefixlist-entries
"""
result = self._values.get("entries")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::PrefixList.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-prefixlist.html#cfn-ec2-prefixlist-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnPrefixListProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnRoute(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnRoute",
):
"""A CloudFormation ``AWS::EC2::Route``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html
:cloudformationResource: AWS::EC2::Route
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
route_table_id: builtins.str,
carrier_gateway_id: typing.Optional[builtins.str] = None,
destination_cidr_block: typing.Optional[builtins.str] = None,
destination_ipv6_cidr_block: typing.Optional[builtins.str] = None,
egress_only_internet_gateway_id: typing.Optional[builtins.str] = None,
gateway_id: typing.Optional[builtins.str] = None,
instance_id: typing.Optional[builtins.str] = None,
local_gateway_id: typing.Optional[builtins.str] = None,
nat_gateway_id: typing.Optional[builtins.str] = None,
network_interface_id: typing.Optional[builtins.str] = None,
transit_gateway_id: typing.Optional[builtins.str] = None,
vpc_endpoint_id: typing.Optional[builtins.str] = None,
vpc_peering_connection_id: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::Route``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param route_table_id: ``AWS::EC2::Route.RouteTableId``.
:param carrier_gateway_id: ``AWS::EC2::Route.CarrierGatewayId``.
:param destination_cidr_block: ``AWS::EC2::Route.DestinationCidrBlock``.
:param destination_ipv6_cidr_block: ``AWS::EC2::Route.DestinationIpv6CidrBlock``.
:param egress_only_internet_gateway_id: ``AWS::EC2::Route.EgressOnlyInternetGatewayId``.
:param gateway_id: ``AWS::EC2::Route.GatewayId``.
:param instance_id: ``AWS::EC2::Route.InstanceId``.
:param local_gateway_id: ``AWS::EC2::Route.LocalGatewayId``.
:param nat_gateway_id: ``AWS::EC2::Route.NatGatewayId``.
:param network_interface_id: ``AWS::EC2::Route.NetworkInterfaceId``.
:param transit_gateway_id: ``AWS::EC2::Route.TransitGatewayId``.
:param vpc_endpoint_id: ``AWS::EC2::Route.VpcEndpointId``.
:param vpc_peering_connection_id: ``AWS::EC2::Route.VpcPeeringConnectionId``.
"""
props = CfnRouteProps(
route_table_id=route_table_id,
carrier_gateway_id=carrier_gateway_id,
destination_cidr_block=destination_cidr_block,
destination_ipv6_cidr_block=destination_ipv6_cidr_block,
egress_only_internet_gateway_id=egress_only_internet_gateway_id,
gateway_id=gateway_id,
instance_id=instance_id,
local_gateway_id=local_gateway_id,
nat_gateway_id=nat_gateway_id,
network_interface_id=network_interface_id,
transit_gateway_id=transit_gateway_id,
vpc_endpoint_id=vpc_endpoint_id,
vpc_peering_connection_id=vpc_peering_connection_id,
)
jsii.create(CfnRoute, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="routeTableId")
def route_table_id(self) -> builtins.str:
"""``AWS::EC2::Route.RouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-routetableid
"""
return jsii.get(self, "routeTableId")
@route_table_id.setter # type: ignore
def route_table_id(self, value: builtins.str) -> None:
jsii.set(self, "routeTableId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="carrierGatewayId")
def carrier_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.CarrierGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-carriergatewayid
"""
return jsii.get(self, "carrierGatewayId")
@carrier_gateway_id.setter # type: ignore
def carrier_gateway_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "carrierGatewayId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="destinationCidrBlock")
def destination_cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.DestinationCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-destinationcidrblock
"""
return jsii.get(self, "destinationCidrBlock")
@destination_cidr_block.setter # type: ignore
def destination_cidr_block(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "destinationCidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="destinationIpv6CidrBlock")
def destination_ipv6_cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.DestinationIpv6CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-destinationipv6cidrblock
"""
return jsii.get(self, "destinationIpv6CidrBlock")
@destination_ipv6_cidr_block.setter # type: ignore
def destination_ipv6_cidr_block(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "destinationIpv6CidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="egressOnlyInternetGatewayId")
def egress_only_internet_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.EgressOnlyInternetGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-egressonlyinternetgatewayid
"""
return jsii.get(self, "egressOnlyInternetGatewayId")
@egress_only_internet_gateway_id.setter # type: ignore
def egress_only_internet_gateway_id(
self,
value: typing.Optional[builtins.str],
) -> None:
jsii.set(self, "egressOnlyInternetGatewayId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="gatewayId")
def gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.GatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-gatewayid
"""
return jsii.get(self, "gatewayId")
@gateway_id.setter # type: ignore
def gateway_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "gatewayId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceId")
def instance_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.InstanceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-instanceid
"""
return jsii.get(self, "instanceId")
@instance_id.setter # type: ignore
def instance_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "instanceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="localGatewayId")
def local_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.LocalGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-localgatewayid
"""
return jsii.get(self, "localGatewayId")
@local_gateway_id.setter # type: ignore
def local_gateway_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "localGatewayId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="natGatewayId")
def nat_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.NatGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-natgatewayid
"""
return jsii.get(self, "natGatewayId")
@nat_gateway_id.setter # type: ignore
def nat_gateway_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "natGatewayId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="networkInterfaceId")
def network_interface_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-networkinterfaceid
"""
return jsii.get(self, "networkInterfaceId")
@network_interface_id.setter # type: ignore
def network_interface_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "networkInterfaceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="transitGatewayId")
def transit_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.TransitGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-transitgatewayid
"""
return jsii.get(self, "transitGatewayId")
@transit_gateway_id.setter # type: ignore
def transit_gateway_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "transitGatewayId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointId")
def vpc_endpoint_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.VpcEndpointId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-vpcendpointid
"""
return jsii.get(self, "vpcEndpointId")
@vpc_endpoint_id.setter # type: ignore
def vpc_endpoint_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "vpcEndpointId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcPeeringConnectionId")
def vpc_peering_connection_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.VpcPeeringConnectionId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-vpcpeeringconnectionid
"""
return jsii.get(self, "vpcPeeringConnectionId")
@vpc_peering_connection_id.setter # type: ignore
def vpc_peering_connection_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "vpcPeeringConnectionId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnRouteProps",
jsii_struct_bases=[],
name_mapping={
"route_table_id": "routeTableId",
"carrier_gateway_id": "carrierGatewayId",
"destination_cidr_block": "destinationCidrBlock",
"destination_ipv6_cidr_block": "destinationIpv6CidrBlock",
"egress_only_internet_gateway_id": "egressOnlyInternetGatewayId",
"gateway_id": "gatewayId",
"instance_id": "instanceId",
"local_gateway_id": "localGatewayId",
"nat_gateway_id": "natGatewayId",
"network_interface_id": "networkInterfaceId",
"transit_gateway_id": "transitGatewayId",
"vpc_endpoint_id": "vpcEndpointId",
"vpc_peering_connection_id": "vpcPeeringConnectionId",
},
)
class CfnRouteProps:
def __init__(
self,
*,
route_table_id: builtins.str,
carrier_gateway_id: typing.Optional[builtins.str] = None,
destination_cidr_block: typing.Optional[builtins.str] = None,
destination_ipv6_cidr_block: typing.Optional[builtins.str] = None,
egress_only_internet_gateway_id: typing.Optional[builtins.str] = None,
gateway_id: typing.Optional[builtins.str] = None,
instance_id: typing.Optional[builtins.str] = None,
local_gateway_id: typing.Optional[builtins.str] = None,
nat_gateway_id: typing.Optional[builtins.str] = None,
network_interface_id: typing.Optional[builtins.str] = None,
transit_gateway_id: typing.Optional[builtins.str] = None,
vpc_endpoint_id: typing.Optional[builtins.str] = None,
vpc_peering_connection_id: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::Route``.
:param route_table_id: ``AWS::EC2::Route.RouteTableId``.
:param carrier_gateway_id: ``AWS::EC2::Route.CarrierGatewayId``.
:param destination_cidr_block: ``AWS::EC2::Route.DestinationCidrBlock``.
:param destination_ipv6_cidr_block: ``AWS::EC2::Route.DestinationIpv6CidrBlock``.
:param egress_only_internet_gateway_id: ``AWS::EC2::Route.EgressOnlyInternetGatewayId``.
:param gateway_id: ``AWS::EC2::Route.GatewayId``.
:param instance_id: ``AWS::EC2::Route.InstanceId``.
:param local_gateway_id: ``AWS::EC2::Route.LocalGatewayId``.
:param nat_gateway_id: ``AWS::EC2::Route.NatGatewayId``.
:param network_interface_id: ``AWS::EC2::Route.NetworkInterfaceId``.
:param transit_gateway_id: ``AWS::EC2::Route.TransitGatewayId``.
:param vpc_endpoint_id: ``AWS::EC2::Route.VpcEndpointId``.
:param vpc_peering_connection_id: ``AWS::EC2::Route.VpcPeeringConnectionId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html
"""
self._values: typing.Dict[str, typing.Any] = {
"route_table_id": route_table_id,
}
if carrier_gateway_id is not None:
self._values["carrier_gateway_id"] = carrier_gateway_id
if destination_cidr_block is not None:
self._values["destination_cidr_block"] = destination_cidr_block
if destination_ipv6_cidr_block is not None:
self._values["destination_ipv6_cidr_block"] = destination_ipv6_cidr_block
if egress_only_internet_gateway_id is not None:
self._values["egress_only_internet_gateway_id"] = egress_only_internet_gateway_id
if gateway_id is not None:
self._values["gateway_id"] = gateway_id
if instance_id is not None:
self._values["instance_id"] = instance_id
if local_gateway_id is not None:
self._values["local_gateway_id"] = local_gateway_id
if nat_gateway_id is not None:
self._values["nat_gateway_id"] = nat_gateway_id
if network_interface_id is not None:
self._values["network_interface_id"] = network_interface_id
if transit_gateway_id is not None:
self._values["transit_gateway_id"] = transit_gateway_id
if vpc_endpoint_id is not None:
self._values["vpc_endpoint_id"] = vpc_endpoint_id
if vpc_peering_connection_id is not None:
self._values["vpc_peering_connection_id"] = vpc_peering_connection_id
@builtins.property
def route_table_id(self) -> builtins.str:
"""``AWS::EC2::Route.RouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-routetableid
"""
result = self._values.get("route_table_id")
assert result is not None, "Required property 'route_table_id' is missing"
return result
@builtins.property
def carrier_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.CarrierGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-carriergatewayid
"""
result = self._values.get("carrier_gateway_id")
return result
@builtins.property
def destination_cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.DestinationCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-destinationcidrblock
"""
result = self._values.get("destination_cidr_block")
return result
@builtins.property
def destination_ipv6_cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.DestinationIpv6CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-destinationipv6cidrblock
"""
result = self._values.get("destination_ipv6_cidr_block")
return result
@builtins.property
def egress_only_internet_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.EgressOnlyInternetGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-egressonlyinternetgatewayid
"""
result = self._values.get("egress_only_internet_gateway_id")
return result
@builtins.property
def gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.GatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-gatewayid
"""
result = self._values.get("gateway_id")
return result
@builtins.property
def instance_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.InstanceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-instanceid
"""
result = self._values.get("instance_id")
return result
@builtins.property
def local_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.LocalGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-localgatewayid
"""
result = self._values.get("local_gateway_id")
return result
@builtins.property
def nat_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.NatGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-natgatewayid
"""
result = self._values.get("nat_gateway_id")
return result
@builtins.property
def network_interface_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-networkinterfaceid
"""
result = self._values.get("network_interface_id")
return result
@builtins.property
def transit_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.TransitGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-transitgatewayid
"""
result = self._values.get("transit_gateway_id")
return result
@builtins.property
def vpc_endpoint_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.VpcEndpointId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-vpcendpointid
"""
result = self._values.get("vpc_endpoint_id")
return result
@builtins.property
def vpc_peering_connection_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Route.VpcPeeringConnectionId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#cfn-ec2-route-vpcpeeringconnectionid
"""
result = self._values.get("vpc_peering_connection_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnRouteProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnRouteTable(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnRouteTable",
):
"""A CloudFormation ``AWS::EC2::RouteTable``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html
:cloudformationResource: AWS::EC2::RouteTable
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
vpc_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::RouteTable``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param vpc_id: ``AWS::EC2::RouteTable.VpcId``.
:param tags: ``AWS::EC2::RouteTable.Tags``.
"""
props = CfnRouteTableProps(vpc_id=vpc_id, tags=tags)
jsii.create(CfnRouteTable, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::RouteTable.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html#cfn-ec2-routetable-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::RouteTable.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html#cfn-ec2-routetable-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: builtins.str) -> None:
jsii.set(self, "vpcId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnRouteTableProps",
jsii_struct_bases=[],
name_mapping={"vpc_id": "vpcId", "tags": "tags"},
)
class CfnRouteTableProps:
def __init__(
self,
*,
vpc_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::RouteTable``.
:param vpc_id: ``AWS::EC2::RouteTable.VpcId``.
:param tags: ``AWS::EC2::RouteTable.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html
"""
self._values: typing.Dict[str, typing.Any] = {
"vpc_id": vpc_id,
}
if tags is not None:
self._values["tags"] = tags
@builtins.property
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::RouteTable.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html#cfn-ec2-routetable-vpcid
"""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::RouteTable.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route-table.html#cfn-ec2-routetable-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnRouteTableProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnSecurityGroup(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnSecurityGroup",
):
"""A CloudFormation ``AWS::EC2::SecurityGroup``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html
:cloudformationResource: AWS::EC2::SecurityGroup
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
group_description: builtins.str,
group_name: typing.Optional[builtins.str] = None,
security_group_egress: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSecurityGroup.EgressProperty"]]]] = None,
security_group_ingress: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSecurityGroup.IngressProperty"]]]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
vpc_id: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::SecurityGroup``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param group_description: ``AWS::EC2::SecurityGroup.GroupDescription``.
:param group_name: ``AWS::EC2::SecurityGroup.GroupName``.
:param security_group_egress: ``AWS::EC2::SecurityGroup.SecurityGroupEgress``.
:param security_group_ingress: ``AWS::EC2::SecurityGroup.SecurityGroupIngress``.
:param tags: ``AWS::EC2::SecurityGroup.Tags``.
:param vpc_id: ``AWS::EC2::SecurityGroup.VpcId``.
"""
props = CfnSecurityGroupProps(
group_description=group_description,
group_name=group_name,
security_group_egress=security_group_egress,
security_group_ingress=security_group_ingress,
tags=tags,
vpc_id=vpc_id,
)
jsii.create(CfnSecurityGroup, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrGroupId")
def attr_group_id(self) -> builtins.str:
"""
:cloudformationAttribute: GroupId
"""
return jsii.get(self, "attrGroupId")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrVpcId")
def attr_vpc_id(self) -> builtins.str:
"""
:cloudformationAttribute: VpcId
"""
return jsii.get(self, "attrVpcId")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::SecurityGroup.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="groupDescription")
def group_description(self) -> builtins.str:
"""``AWS::EC2::SecurityGroup.GroupDescription``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-groupdescription
"""
return jsii.get(self, "groupDescription")
@group_description.setter # type: ignore
def group_description(self, value: builtins.str) -> None:
jsii.set(self, "groupDescription", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="groupName")
def group_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroup.GroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-groupname
"""
return jsii.get(self, "groupName")
@group_name.setter # type: ignore
def group_name(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "groupName", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroupEgress")
def security_group_egress(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSecurityGroup.EgressProperty"]]]]:
"""``AWS::EC2::SecurityGroup.SecurityGroupEgress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-securitygroupegress
"""
return jsii.get(self, "securityGroupEgress")
@security_group_egress.setter # type: ignore
def security_group_egress(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSecurityGroup.EgressProperty"]]]],
) -> None:
jsii.set(self, "securityGroupEgress", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroupIngress")
def security_group_ingress(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSecurityGroup.IngressProperty"]]]]:
"""``AWS::EC2::SecurityGroup.SecurityGroupIngress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-securitygroupingress
"""
return jsii.get(self, "securityGroupIngress")
@security_group_ingress.setter # type: ignore
def security_group_ingress(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSecurityGroup.IngressProperty"]]]],
) -> None:
jsii.set(self, "securityGroupIngress", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroup.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "vpcId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSecurityGroup.EgressProperty",
jsii_struct_bases=[],
name_mapping={
"ip_protocol": "ipProtocol",
"cidr_ip": "cidrIp",
"cidr_ipv6": "cidrIpv6",
"description": "description",
"destination_prefix_list_id": "destinationPrefixListId",
"destination_security_group_id": "destinationSecurityGroupId",
"from_port": "fromPort",
"to_port": "toPort",
},
)
class EgressProperty:
def __init__(
self,
*,
ip_protocol: builtins.str,
cidr_ip: typing.Optional[builtins.str] = None,
cidr_ipv6: typing.Optional[builtins.str] = None,
description: typing.Optional[builtins.str] = None,
destination_prefix_list_id: typing.Optional[builtins.str] = None,
destination_security_group_id: typing.Optional[builtins.str] = None,
from_port: typing.Optional[jsii.Number] = None,
to_port: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param ip_protocol: ``CfnSecurityGroup.EgressProperty.IpProtocol``.
:param cidr_ip: ``CfnSecurityGroup.EgressProperty.CidrIp``.
:param cidr_ipv6: ``CfnSecurityGroup.EgressProperty.CidrIpv6``.
:param description: ``CfnSecurityGroup.EgressProperty.Description``.
:param destination_prefix_list_id: ``CfnSecurityGroup.EgressProperty.DestinationPrefixListId``.
:param destination_security_group_id: ``CfnSecurityGroup.EgressProperty.DestinationSecurityGroupId``.
:param from_port: ``CfnSecurityGroup.EgressProperty.FromPort``.
:param to_port: ``CfnSecurityGroup.EgressProperty.ToPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html
"""
self._values: typing.Dict[str, typing.Any] = {
"ip_protocol": ip_protocol,
}
if cidr_ip is not None:
self._values["cidr_ip"] = cidr_ip
if cidr_ipv6 is not None:
self._values["cidr_ipv6"] = cidr_ipv6
if description is not None:
self._values["description"] = description
if destination_prefix_list_id is not None:
self._values["destination_prefix_list_id"] = destination_prefix_list_id
if destination_security_group_id is not None:
self._values["destination_security_group_id"] = destination_security_group_id
if from_port is not None:
self._values["from_port"] = from_port
if to_port is not None:
self._values["to_port"] = to_port
@builtins.property
def ip_protocol(self) -> builtins.str:
"""``CfnSecurityGroup.EgressProperty.IpProtocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-ipprotocol
"""
result = self._values.get("ip_protocol")
assert result is not None, "Required property 'ip_protocol' is missing"
return result
@builtins.property
def cidr_ip(self) -> typing.Optional[builtins.str]:
"""``CfnSecurityGroup.EgressProperty.CidrIp``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-cidrip
"""
result = self._values.get("cidr_ip")
return result
@builtins.property
def cidr_ipv6(self) -> typing.Optional[builtins.str]:
"""``CfnSecurityGroup.EgressProperty.CidrIpv6``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-cidripv6
"""
result = self._values.get("cidr_ipv6")
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``CfnSecurityGroup.EgressProperty.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-description
"""
result = self._values.get("description")
return result
@builtins.property
def destination_prefix_list_id(self) -> typing.Optional[builtins.str]:
"""``CfnSecurityGroup.EgressProperty.DestinationPrefixListId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-destinationprefixlistid
"""
result = self._values.get("destination_prefix_list_id")
return result
@builtins.property
def destination_security_group_id(self) -> typing.Optional[builtins.str]:
"""``CfnSecurityGroup.EgressProperty.DestinationSecurityGroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-destsecgroupid
"""
result = self._values.get("destination_security_group_id")
return result
@builtins.property
def from_port(self) -> typing.Optional[jsii.Number]:
"""``CfnSecurityGroup.EgressProperty.FromPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-fromport
"""
result = self._values.get("from_port")
return result
@builtins.property
def to_port(self) -> typing.Optional[jsii.Number]:
"""``CfnSecurityGroup.EgressProperty.ToPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-toport
"""
result = self._values.get("to_port")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "EgressProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSecurityGroup.IngressProperty",
jsii_struct_bases=[],
name_mapping={
"ip_protocol": "ipProtocol",
"cidr_ip": "cidrIp",
"cidr_ipv6": "cidrIpv6",
"description": "description",
"from_port": "fromPort",
"source_prefix_list_id": "sourcePrefixListId",
"source_security_group_id": "sourceSecurityGroupId",
"source_security_group_name": "sourceSecurityGroupName",
"source_security_group_owner_id": "sourceSecurityGroupOwnerId",
"to_port": "toPort",
},
)
class IngressProperty:
def __init__(
self,
*,
ip_protocol: builtins.str,
cidr_ip: typing.Optional[builtins.str] = None,
cidr_ipv6: typing.Optional[builtins.str] = None,
description: typing.Optional[builtins.str] = None,
from_port: typing.Optional[jsii.Number] = None,
source_prefix_list_id: typing.Optional[builtins.str] = None,
source_security_group_id: typing.Optional[builtins.str] = None,
source_security_group_name: typing.Optional[builtins.str] = None,
source_security_group_owner_id: typing.Optional[builtins.str] = None,
to_port: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param ip_protocol: ``CfnSecurityGroup.IngressProperty.IpProtocol``.
:param cidr_ip: ``CfnSecurityGroup.IngressProperty.CidrIp``.
:param cidr_ipv6: ``CfnSecurityGroup.IngressProperty.CidrIpv6``.
:param description: ``CfnSecurityGroup.IngressProperty.Description``.
:param from_port: ``CfnSecurityGroup.IngressProperty.FromPort``.
:param source_prefix_list_id: ``CfnSecurityGroup.IngressProperty.SourcePrefixListId``.
:param source_security_group_id: ``CfnSecurityGroup.IngressProperty.SourceSecurityGroupId``.
:param source_security_group_name: ``CfnSecurityGroup.IngressProperty.SourceSecurityGroupName``.
:param source_security_group_owner_id: ``CfnSecurityGroup.IngressProperty.SourceSecurityGroupOwnerId``.
:param to_port: ``CfnSecurityGroup.IngressProperty.ToPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html
"""
self._values: typing.Dict[str, typing.Any] = {
"ip_protocol": ip_protocol,
}
if cidr_ip is not None:
self._values["cidr_ip"] = cidr_ip
if cidr_ipv6 is not None:
self._values["cidr_ipv6"] = cidr_ipv6
if description is not None:
self._values["description"] = description
if from_port is not None:
self._values["from_port"] = from_port
if source_prefix_list_id is not None:
self._values["source_prefix_list_id"] = source_prefix_list_id
if source_security_group_id is not None:
self._values["source_security_group_id"] = source_security_group_id
if source_security_group_name is not None:
self._values["source_security_group_name"] = source_security_group_name
if source_security_group_owner_id is not None:
self._values["source_security_group_owner_id"] = source_security_group_owner_id
if to_port is not None:
self._values["to_port"] = to_port
@builtins.property
def ip_protocol(self) -> builtins.str:
"""``CfnSecurityGroup.IngressProperty.IpProtocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-ipprotocol
"""
result = self._values.get("ip_protocol")
assert result is not None, "Required property 'ip_protocol' is missing"
return result
@builtins.property
def cidr_ip(self) -> typing.Optional[builtins.str]:
"""``CfnSecurityGroup.IngressProperty.CidrIp``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-cidrip
"""
result = self._values.get("cidr_ip")
return result
@builtins.property
def cidr_ipv6(self) -> typing.Optional[builtins.str]:
"""``CfnSecurityGroup.IngressProperty.CidrIpv6``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-cidripv6
"""
result = self._values.get("cidr_ipv6")
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``CfnSecurityGroup.IngressProperty.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-description
"""
result = self._values.get("description")
return result
@builtins.property
def from_port(self) -> typing.Optional[jsii.Number]:
"""``CfnSecurityGroup.IngressProperty.FromPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-fromport
"""
result = self._values.get("from_port")
return result
@builtins.property
def source_prefix_list_id(self) -> typing.Optional[builtins.str]:
"""``CfnSecurityGroup.IngressProperty.SourcePrefixListId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-securitygroup-ingress-sourceprefixlistid
"""
result = self._values.get("source_prefix_list_id")
return result
@builtins.property
def source_security_group_id(self) -> typing.Optional[builtins.str]:
"""``CfnSecurityGroup.IngressProperty.SourceSecurityGroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-sourcesecuritygroupid
"""
result = self._values.get("source_security_group_id")
return result
@builtins.property
def source_security_group_name(self) -> typing.Optional[builtins.str]:
"""``CfnSecurityGroup.IngressProperty.SourceSecurityGroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-sourcesecuritygroupname
"""
result = self._values.get("source_security_group_name")
return result
@builtins.property
def source_security_group_owner_id(self) -> typing.Optional[builtins.str]:
"""``CfnSecurityGroup.IngressProperty.SourceSecurityGroupOwnerId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-sourcesecuritygroupownerid
"""
result = self._values.get("source_security_group_owner_id")
return result
@builtins.property
def to_port(self) -> typing.Optional[jsii.Number]:
"""``CfnSecurityGroup.IngressProperty.ToPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-rule.html#cfn-ec2-security-group-rule-toport
"""
result = self._values.get("to_port")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "IngressProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnSecurityGroupEgress(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnSecurityGroupEgress",
):
"""A CloudFormation ``AWS::EC2::SecurityGroupEgress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html
:cloudformationResource: AWS::EC2::SecurityGroupEgress
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
group_id: builtins.str,
ip_protocol: builtins.str,
cidr_ip: typing.Optional[builtins.str] = None,
cidr_ipv6: typing.Optional[builtins.str] = None,
description: typing.Optional[builtins.str] = None,
destination_prefix_list_id: typing.Optional[builtins.str] = None,
destination_security_group_id: typing.Optional[builtins.str] = None,
from_port: typing.Optional[jsii.Number] = None,
to_port: typing.Optional[jsii.Number] = None,
) -> None:
"""Create a new ``AWS::EC2::SecurityGroupEgress``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param group_id: ``AWS::EC2::SecurityGroupEgress.GroupId``.
:param ip_protocol: ``AWS::EC2::SecurityGroupEgress.IpProtocol``.
:param cidr_ip: ``AWS::EC2::SecurityGroupEgress.CidrIp``.
:param cidr_ipv6: ``AWS::EC2::SecurityGroupEgress.CidrIpv6``.
:param description: ``AWS::EC2::SecurityGroupEgress.Description``.
:param destination_prefix_list_id: ``AWS::EC2::SecurityGroupEgress.DestinationPrefixListId``.
:param destination_security_group_id: ``AWS::EC2::SecurityGroupEgress.DestinationSecurityGroupId``.
:param from_port: ``AWS::EC2::SecurityGroupEgress.FromPort``.
:param to_port: ``AWS::EC2::SecurityGroupEgress.ToPort``.
"""
props = CfnSecurityGroupEgressProps(
group_id=group_id,
ip_protocol=ip_protocol,
cidr_ip=cidr_ip,
cidr_ipv6=cidr_ipv6,
description=description,
destination_prefix_list_id=destination_prefix_list_id,
destination_security_group_id=destination_security_group_id,
from_port=from_port,
to_port=to_port,
)
jsii.create(CfnSecurityGroupEgress, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="groupId")
def group_id(self) -> builtins.str:
"""``AWS::EC2::SecurityGroupEgress.GroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-groupid
"""
return jsii.get(self, "groupId")
@group_id.setter # type: ignore
def group_id(self, value: builtins.str) -> None:
jsii.set(self, "groupId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ipProtocol")
def ip_protocol(self) -> builtins.str:
"""``AWS::EC2::SecurityGroupEgress.IpProtocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-ipprotocol
"""
return jsii.get(self, "ipProtocol")
@ip_protocol.setter # type: ignore
def ip_protocol(self, value: builtins.str) -> None:
jsii.set(self, "ipProtocol", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="cidrIp")
def cidr_ip(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupEgress.CidrIp``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-cidrip
"""
return jsii.get(self, "cidrIp")
@cidr_ip.setter # type: ignore
def cidr_ip(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "cidrIp", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="cidrIpv6")
def cidr_ipv6(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupEgress.CidrIpv6``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-cidripv6
"""
return jsii.get(self, "cidrIpv6")
@cidr_ipv6.setter # type: ignore
def cidr_ipv6(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "cidrIpv6", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="description")
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupEgress.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-description
"""
return jsii.get(self, "description")
@description.setter # type: ignore
def description(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "description", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="destinationPrefixListId")
def destination_prefix_list_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupEgress.DestinationPrefixListId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-destinationprefixlistid
"""
return jsii.get(self, "destinationPrefixListId")
@destination_prefix_list_id.setter # type: ignore
def destination_prefix_list_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "destinationPrefixListId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="destinationSecurityGroupId")
def destination_security_group_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupEgress.DestinationSecurityGroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-destinationsecuritygroupid
"""
return jsii.get(self, "destinationSecurityGroupId")
@destination_security_group_id.setter # type: ignore
def destination_security_group_id(
self,
value: typing.Optional[builtins.str],
) -> None:
jsii.set(self, "destinationSecurityGroupId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="fromPort")
def from_port(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::SecurityGroupEgress.FromPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-fromport
"""
return jsii.get(self, "fromPort")
@from_port.setter # type: ignore
def from_port(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "fromPort", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="toPort")
def to_port(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::SecurityGroupEgress.ToPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-toport
"""
return jsii.get(self, "toPort")
@to_port.setter # type: ignore
def to_port(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "toPort", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSecurityGroupEgressProps",
jsii_struct_bases=[],
name_mapping={
"group_id": "groupId",
"ip_protocol": "ipProtocol",
"cidr_ip": "cidrIp",
"cidr_ipv6": "cidrIpv6",
"description": "description",
"destination_prefix_list_id": "destinationPrefixListId",
"destination_security_group_id": "destinationSecurityGroupId",
"from_port": "fromPort",
"to_port": "toPort",
},
)
class CfnSecurityGroupEgressProps:
def __init__(
self,
*,
group_id: builtins.str,
ip_protocol: builtins.str,
cidr_ip: typing.Optional[builtins.str] = None,
cidr_ipv6: typing.Optional[builtins.str] = None,
description: typing.Optional[builtins.str] = None,
destination_prefix_list_id: typing.Optional[builtins.str] = None,
destination_security_group_id: typing.Optional[builtins.str] = None,
from_port: typing.Optional[jsii.Number] = None,
to_port: typing.Optional[jsii.Number] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::SecurityGroupEgress``.
:param group_id: ``AWS::EC2::SecurityGroupEgress.GroupId``.
:param ip_protocol: ``AWS::EC2::SecurityGroupEgress.IpProtocol``.
:param cidr_ip: ``AWS::EC2::SecurityGroupEgress.CidrIp``.
:param cidr_ipv6: ``AWS::EC2::SecurityGroupEgress.CidrIpv6``.
:param description: ``AWS::EC2::SecurityGroupEgress.Description``.
:param destination_prefix_list_id: ``AWS::EC2::SecurityGroupEgress.DestinationPrefixListId``.
:param destination_security_group_id: ``AWS::EC2::SecurityGroupEgress.DestinationSecurityGroupId``.
:param from_port: ``AWS::EC2::SecurityGroupEgress.FromPort``.
:param to_port: ``AWS::EC2::SecurityGroupEgress.ToPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html
"""
self._values: typing.Dict[str, typing.Any] = {
"group_id": group_id,
"ip_protocol": ip_protocol,
}
if cidr_ip is not None:
self._values["cidr_ip"] = cidr_ip
if cidr_ipv6 is not None:
self._values["cidr_ipv6"] = cidr_ipv6
if description is not None:
self._values["description"] = description
if destination_prefix_list_id is not None:
self._values["destination_prefix_list_id"] = destination_prefix_list_id
if destination_security_group_id is not None:
self._values["destination_security_group_id"] = destination_security_group_id
if from_port is not None:
self._values["from_port"] = from_port
if to_port is not None:
self._values["to_port"] = to_port
@builtins.property
def group_id(self) -> builtins.str:
"""``AWS::EC2::SecurityGroupEgress.GroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-groupid
"""
result = self._values.get("group_id")
assert result is not None, "Required property 'group_id' is missing"
return result
@builtins.property
def ip_protocol(self) -> builtins.str:
"""``AWS::EC2::SecurityGroupEgress.IpProtocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-ipprotocol
"""
result = self._values.get("ip_protocol")
assert result is not None, "Required property 'ip_protocol' is missing"
return result
@builtins.property
def cidr_ip(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupEgress.CidrIp``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-cidrip
"""
result = self._values.get("cidr_ip")
return result
@builtins.property
def cidr_ipv6(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupEgress.CidrIpv6``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-cidripv6
"""
result = self._values.get("cidr_ipv6")
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupEgress.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-description
"""
result = self._values.get("description")
return result
@builtins.property
def destination_prefix_list_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupEgress.DestinationPrefixListId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-destinationprefixlistid
"""
result = self._values.get("destination_prefix_list_id")
return result
@builtins.property
def destination_security_group_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupEgress.DestinationSecurityGroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-destinationsecuritygroupid
"""
result = self._values.get("destination_security_group_id")
return result
@builtins.property
def from_port(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::SecurityGroupEgress.FromPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-fromport
"""
result = self._values.get("from_port")
return result
@builtins.property
def to_port(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::SecurityGroupEgress.ToPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-security-group-egress.html#cfn-ec2-securitygroupegress-toport
"""
result = self._values.get("to_port")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnSecurityGroupEgressProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnSecurityGroupIngress(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnSecurityGroupIngress",
):
"""A CloudFormation ``AWS::EC2::SecurityGroupIngress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html
:cloudformationResource: AWS::EC2::SecurityGroupIngress
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
ip_protocol: builtins.str,
cidr_ip: typing.Optional[builtins.str] = None,
cidr_ipv6: typing.Optional[builtins.str] = None,
description: typing.Optional[builtins.str] = None,
from_port: typing.Optional[jsii.Number] = None,
group_id: typing.Optional[builtins.str] = None,
group_name: typing.Optional[builtins.str] = None,
source_prefix_list_id: typing.Optional[builtins.str] = None,
source_security_group_id: typing.Optional[builtins.str] = None,
source_security_group_name: typing.Optional[builtins.str] = None,
source_security_group_owner_id: typing.Optional[builtins.str] = None,
to_port: typing.Optional[jsii.Number] = None,
) -> None:
"""Create a new ``AWS::EC2::SecurityGroupIngress``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param ip_protocol: ``AWS::EC2::SecurityGroupIngress.IpProtocol``.
:param cidr_ip: ``AWS::EC2::SecurityGroupIngress.CidrIp``.
:param cidr_ipv6: ``AWS::EC2::SecurityGroupIngress.CidrIpv6``.
:param description: ``AWS::EC2::SecurityGroupIngress.Description``.
:param from_port: ``AWS::EC2::SecurityGroupIngress.FromPort``.
:param group_id: ``AWS::EC2::SecurityGroupIngress.GroupId``.
:param group_name: ``AWS::EC2::SecurityGroupIngress.GroupName``.
:param source_prefix_list_id: ``AWS::EC2::SecurityGroupIngress.SourcePrefixListId``.
:param source_security_group_id: ``AWS::EC2::SecurityGroupIngress.SourceSecurityGroupId``.
:param source_security_group_name: ``AWS::EC2::SecurityGroupIngress.SourceSecurityGroupName``.
:param source_security_group_owner_id: ``AWS::EC2::SecurityGroupIngress.SourceSecurityGroupOwnerId``.
:param to_port: ``AWS::EC2::SecurityGroupIngress.ToPort``.
"""
props = CfnSecurityGroupIngressProps(
ip_protocol=ip_protocol,
cidr_ip=cidr_ip,
cidr_ipv6=cidr_ipv6,
description=description,
from_port=from_port,
group_id=group_id,
group_name=group_name,
source_prefix_list_id=source_prefix_list_id,
source_security_group_id=source_security_group_id,
source_security_group_name=source_security_group_name,
source_security_group_owner_id=source_security_group_owner_id,
to_port=to_port,
)
jsii.create(CfnSecurityGroupIngress, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="ipProtocol")
def ip_protocol(self) -> builtins.str:
"""``AWS::EC2::SecurityGroupIngress.IpProtocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-ipprotocol
"""
return jsii.get(self, "ipProtocol")
@ip_protocol.setter # type: ignore
def ip_protocol(self, value: builtins.str) -> None:
jsii.set(self, "ipProtocol", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="cidrIp")
def cidr_ip(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.CidrIp``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-cidrip
"""
return jsii.get(self, "cidrIp")
@cidr_ip.setter # type: ignore
def cidr_ip(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "cidrIp", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="cidrIpv6")
def cidr_ipv6(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.CidrIpv6``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-cidripv6
"""
return jsii.get(self, "cidrIpv6")
@cidr_ipv6.setter # type: ignore
def cidr_ipv6(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "cidrIpv6", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="description")
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-description
"""
return jsii.get(self, "description")
@description.setter # type: ignore
def description(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "description", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="fromPort")
def from_port(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::SecurityGroupIngress.FromPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-fromport
"""
return jsii.get(self, "fromPort")
@from_port.setter # type: ignore
def from_port(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "fromPort", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="groupId")
def group_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.GroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-groupid
"""
return jsii.get(self, "groupId")
@group_id.setter # type: ignore
def group_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "groupId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="groupName")
def group_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.GroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-groupname
"""
return jsii.get(self, "groupName")
@group_name.setter # type: ignore
def group_name(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "groupName", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="sourcePrefixListId")
def source_prefix_list_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.SourcePrefixListId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-securitygroupingress-sourceprefixlistid
"""
return jsii.get(self, "sourcePrefixListId")
@source_prefix_list_id.setter # type: ignore
def source_prefix_list_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "sourcePrefixListId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="sourceSecurityGroupId")
def source_security_group_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.SourceSecurityGroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-sourcesecuritygroupid
"""
return jsii.get(self, "sourceSecurityGroupId")
@source_security_group_id.setter # type: ignore
def source_security_group_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "sourceSecurityGroupId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="sourceSecurityGroupName")
def source_security_group_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.SourceSecurityGroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-sourcesecuritygroupname
"""
return jsii.get(self, "sourceSecurityGroupName")
@source_security_group_name.setter # type: ignore
def source_security_group_name(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "sourceSecurityGroupName", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="sourceSecurityGroupOwnerId")
def source_security_group_owner_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.SourceSecurityGroupOwnerId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-sourcesecuritygroupownerid
"""
return jsii.get(self, "sourceSecurityGroupOwnerId")
@source_security_group_owner_id.setter # type: ignore
def source_security_group_owner_id(
self,
value: typing.Optional[builtins.str],
) -> None:
jsii.set(self, "sourceSecurityGroupOwnerId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="toPort")
def to_port(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::SecurityGroupIngress.ToPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-toport
"""
return jsii.get(self, "toPort")
@to_port.setter # type: ignore
def to_port(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "toPort", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSecurityGroupIngressProps",
jsii_struct_bases=[],
name_mapping={
"ip_protocol": "ipProtocol",
"cidr_ip": "cidrIp",
"cidr_ipv6": "cidrIpv6",
"description": "description",
"from_port": "fromPort",
"group_id": "groupId",
"group_name": "groupName",
"source_prefix_list_id": "sourcePrefixListId",
"source_security_group_id": "sourceSecurityGroupId",
"source_security_group_name": "sourceSecurityGroupName",
"source_security_group_owner_id": "sourceSecurityGroupOwnerId",
"to_port": "toPort",
},
)
class CfnSecurityGroupIngressProps:
def __init__(
self,
*,
ip_protocol: builtins.str,
cidr_ip: typing.Optional[builtins.str] = None,
cidr_ipv6: typing.Optional[builtins.str] = None,
description: typing.Optional[builtins.str] = None,
from_port: typing.Optional[jsii.Number] = None,
group_id: typing.Optional[builtins.str] = None,
group_name: typing.Optional[builtins.str] = None,
source_prefix_list_id: typing.Optional[builtins.str] = None,
source_security_group_id: typing.Optional[builtins.str] = None,
source_security_group_name: typing.Optional[builtins.str] = None,
source_security_group_owner_id: typing.Optional[builtins.str] = None,
to_port: typing.Optional[jsii.Number] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::SecurityGroupIngress``.
:param ip_protocol: ``AWS::EC2::SecurityGroupIngress.IpProtocol``.
:param cidr_ip: ``AWS::EC2::SecurityGroupIngress.CidrIp``.
:param cidr_ipv6: ``AWS::EC2::SecurityGroupIngress.CidrIpv6``.
:param description: ``AWS::EC2::SecurityGroupIngress.Description``.
:param from_port: ``AWS::EC2::SecurityGroupIngress.FromPort``.
:param group_id: ``AWS::EC2::SecurityGroupIngress.GroupId``.
:param group_name: ``AWS::EC2::SecurityGroupIngress.GroupName``.
:param source_prefix_list_id: ``AWS::EC2::SecurityGroupIngress.SourcePrefixListId``.
:param source_security_group_id: ``AWS::EC2::SecurityGroupIngress.SourceSecurityGroupId``.
:param source_security_group_name: ``AWS::EC2::SecurityGroupIngress.SourceSecurityGroupName``.
:param source_security_group_owner_id: ``AWS::EC2::SecurityGroupIngress.SourceSecurityGroupOwnerId``.
:param to_port: ``AWS::EC2::SecurityGroupIngress.ToPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html
"""
self._values: typing.Dict[str, typing.Any] = {
"ip_protocol": ip_protocol,
}
if cidr_ip is not None:
self._values["cidr_ip"] = cidr_ip
if cidr_ipv6 is not None:
self._values["cidr_ipv6"] = cidr_ipv6
if description is not None:
self._values["description"] = description
if from_port is not None:
self._values["from_port"] = from_port
if group_id is not None:
self._values["group_id"] = group_id
if group_name is not None:
self._values["group_name"] = group_name
if source_prefix_list_id is not None:
self._values["source_prefix_list_id"] = source_prefix_list_id
if source_security_group_id is not None:
self._values["source_security_group_id"] = source_security_group_id
if source_security_group_name is not None:
self._values["source_security_group_name"] = source_security_group_name
if source_security_group_owner_id is not None:
self._values["source_security_group_owner_id"] = source_security_group_owner_id
if to_port is not None:
self._values["to_port"] = to_port
@builtins.property
def ip_protocol(self) -> builtins.str:
"""``AWS::EC2::SecurityGroupIngress.IpProtocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-ipprotocol
"""
result = self._values.get("ip_protocol")
assert result is not None, "Required property 'ip_protocol' is missing"
return result
@builtins.property
def cidr_ip(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.CidrIp``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-cidrip
"""
result = self._values.get("cidr_ip")
return result
@builtins.property
def cidr_ipv6(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.CidrIpv6``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-cidripv6
"""
result = self._values.get("cidr_ipv6")
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-description
"""
result = self._values.get("description")
return result
@builtins.property
def from_port(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::SecurityGroupIngress.FromPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-fromport
"""
result = self._values.get("from_port")
return result
@builtins.property
def group_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.GroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-groupid
"""
result = self._values.get("group_id")
return result
@builtins.property
def group_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.GroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-groupname
"""
result = self._values.get("group_name")
return result
@builtins.property
def source_prefix_list_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.SourcePrefixListId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-securitygroupingress-sourceprefixlistid
"""
result = self._values.get("source_prefix_list_id")
return result
@builtins.property
def source_security_group_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.SourceSecurityGroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-sourcesecuritygroupid
"""
result = self._values.get("source_security_group_id")
return result
@builtins.property
def source_security_group_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.SourceSecurityGroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-sourcesecuritygroupname
"""
result = self._values.get("source_security_group_name")
return result
@builtins.property
def source_security_group_owner_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroupIngress.SourceSecurityGroupOwnerId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-sourcesecuritygroupownerid
"""
result = self._values.get("source_security_group_owner_id")
return result
@builtins.property
def to_port(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::SecurityGroupIngress.ToPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group-ingress.html#cfn-ec2-security-group-ingress-toport
"""
result = self._values.get("to_port")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnSecurityGroupIngressProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSecurityGroupProps",
jsii_struct_bases=[],
name_mapping={
"group_description": "groupDescription",
"group_name": "groupName",
"security_group_egress": "securityGroupEgress",
"security_group_ingress": "securityGroupIngress",
"tags": "tags",
"vpc_id": "vpcId",
},
)
class CfnSecurityGroupProps:
def __init__(
self,
*,
group_description: builtins.str,
group_name: typing.Optional[builtins.str] = None,
security_group_egress: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnSecurityGroup.EgressProperty]]]] = None,
security_group_ingress: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnSecurityGroup.IngressProperty]]]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
vpc_id: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::SecurityGroup``.
:param group_description: ``AWS::EC2::SecurityGroup.GroupDescription``.
:param group_name: ``AWS::EC2::SecurityGroup.GroupName``.
:param security_group_egress: ``AWS::EC2::SecurityGroup.SecurityGroupEgress``.
:param security_group_ingress: ``AWS::EC2::SecurityGroup.SecurityGroupIngress``.
:param tags: ``AWS::EC2::SecurityGroup.Tags``.
:param vpc_id: ``AWS::EC2::SecurityGroup.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html
"""
self._values: typing.Dict[str, typing.Any] = {
"group_description": group_description,
}
if group_name is not None:
self._values["group_name"] = group_name
if security_group_egress is not None:
self._values["security_group_egress"] = security_group_egress
if security_group_ingress is not None:
self._values["security_group_ingress"] = security_group_ingress
if tags is not None:
self._values["tags"] = tags
if vpc_id is not None:
self._values["vpc_id"] = vpc_id
@builtins.property
def group_description(self) -> builtins.str:
"""``AWS::EC2::SecurityGroup.GroupDescription``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-groupdescription
"""
result = self._values.get("group_description")
assert result is not None, "Required property 'group_description' is missing"
return result
@builtins.property
def group_name(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroup.GroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-groupname
"""
result = self._values.get("group_name")
return result
@builtins.property
def security_group_egress(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnSecurityGroup.EgressProperty]]]]:
"""``AWS::EC2::SecurityGroup.SecurityGroupEgress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-securitygroupegress
"""
result = self._values.get("security_group_egress")
return result
@builtins.property
def security_group_ingress(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnSecurityGroup.IngressProperty]]]]:
"""``AWS::EC2::SecurityGroup.SecurityGroupIngress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-securitygroupingress
"""
result = self._values.get("security_group_ingress")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::SecurityGroup.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-tags
"""
result = self._values.get("tags")
return result
@builtins.property
def vpc_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::SecurityGroup.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html#cfn-ec2-securitygroup-vpcid
"""
result = self._values.get("vpc_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnSecurityGroupProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnSpotFleet(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet",
):
"""A CloudFormation ``AWS::EC2::SpotFleet``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-spotfleet.html
:cloudformationResource: AWS::EC2::SpotFleet
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
spot_fleet_request_config_data: typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotFleetRequestConfigDataProperty"],
) -> None:
"""Create a new ``AWS::EC2::SpotFleet``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param spot_fleet_request_config_data: ``AWS::EC2::SpotFleet.SpotFleetRequestConfigData``.
"""
props = CfnSpotFleetProps(
spot_fleet_request_config_data=spot_fleet_request_config_data
)
jsii.create(CfnSpotFleet, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="spotFleetRequestConfigData")
def spot_fleet_request_config_data(
self,
) -> typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotFleetRequestConfigDataProperty"]:
"""``AWS::EC2::SpotFleet.SpotFleetRequestConfigData``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-spotfleet.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata
"""
return jsii.get(self, "spotFleetRequestConfigData")
@spot_fleet_request_config_data.setter # type: ignore
def spot_fleet_request_config_data(
self,
value: typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotFleetRequestConfigDataProperty"],
) -> None:
jsii.set(self, "spotFleetRequestConfigData", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.BlockDeviceMappingProperty",
jsii_struct_bases=[],
name_mapping={
"device_name": "deviceName",
"ebs": "ebs",
"no_device": "noDevice",
"virtual_name": "virtualName",
},
)
class BlockDeviceMappingProperty:
def __init__(
self,
*,
device_name: builtins.str,
ebs: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.EbsBlockDeviceProperty"]] = None,
no_device: typing.Optional[builtins.str] = None,
virtual_name: typing.Optional[builtins.str] = None,
) -> None:
"""
:param device_name: ``CfnSpotFleet.BlockDeviceMappingProperty.DeviceName``.
:param ebs: ``CfnSpotFleet.BlockDeviceMappingProperty.Ebs``.
:param no_device: ``CfnSpotFleet.BlockDeviceMappingProperty.NoDevice``.
:param virtual_name: ``CfnSpotFleet.BlockDeviceMappingProperty.VirtualName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings.html
"""
self._values: typing.Dict[str, typing.Any] = {
"device_name": device_name,
}
if ebs is not None:
self._values["ebs"] = ebs
if no_device is not None:
self._values["no_device"] = no_device
if virtual_name is not None:
self._values["virtual_name"] = virtual_name
@builtins.property
def device_name(self) -> builtins.str:
"""``CfnSpotFleet.BlockDeviceMappingProperty.DeviceName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings.html#cfn-ec2-spotfleet-blockdevicemapping-devicename
"""
result = self._values.get("device_name")
assert result is not None, "Required property 'device_name' is missing"
return result
@builtins.property
def ebs(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.EbsBlockDeviceProperty"]]:
"""``CfnSpotFleet.BlockDeviceMappingProperty.Ebs``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings.html#cfn-ec2-spotfleet-blockdevicemapping-ebs
"""
result = self._values.get("ebs")
return result
@builtins.property
def no_device(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.BlockDeviceMappingProperty.NoDevice``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings.html#cfn-ec2-spotfleet-blockdevicemapping-nodevice
"""
result = self._values.get("no_device")
return result
@builtins.property
def virtual_name(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.BlockDeviceMappingProperty.VirtualName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings.html#cfn-ec2-spotfleet-blockdevicemapping-virtualname
"""
result = self._values.get("virtual_name")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "BlockDeviceMappingProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.ClassicLoadBalancerProperty",
jsii_struct_bases=[],
name_mapping={"name": "name"},
)
class ClassicLoadBalancerProperty:
def __init__(self, *, name: builtins.str) -> None:
"""
:param name: ``CfnSpotFleet.ClassicLoadBalancerProperty.Name``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-classicloadbalancer.html
"""
self._values: typing.Dict[str, typing.Any] = {
"name": name,
}
@builtins.property
def name(self) -> builtins.str:
"""``CfnSpotFleet.ClassicLoadBalancerProperty.Name``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-classicloadbalancer.html#cfn-ec2-spotfleet-classicloadbalancer-name
"""
result = self._values.get("name")
assert result is not None, "Required property 'name' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ClassicLoadBalancerProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.ClassicLoadBalancersConfigProperty",
jsii_struct_bases=[],
name_mapping={"classic_load_balancers": "classicLoadBalancers"},
)
class ClassicLoadBalancersConfigProperty:
def __init__(
self,
*,
classic_load_balancers: typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.ClassicLoadBalancerProperty"]]],
) -> None:
"""
:param classic_load_balancers: ``CfnSpotFleet.ClassicLoadBalancersConfigProperty.ClassicLoadBalancers``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-classicloadbalancersconfig.html
"""
self._values: typing.Dict[str, typing.Any] = {
"classic_load_balancers": classic_load_balancers,
}
@builtins.property
def classic_load_balancers(
self,
) -> typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.ClassicLoadBalancerProperty"]]]:
"""``CfnSpotFleet.ClassicLoadBalancersConfigProperty.ClassicLoadBalancers``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-classicloadbalancersconfig.html#cfn-ec2-spotfleet-classicloadbalancersconfig-classicloadbalancers
"""
result = self._values.get("classic_load_balancers")
assert result is not None, "Required property 'classic_load_balancers' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ClassicLoadBalancersConfigProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.EbsBlockDeviceProperty",
jsii_struct_bases=[],
name_mapping={
"delete_on_termination": "deleteOnTermination",
"encrypted": "encrypted",
"iops": "iops",
"snapshot_id": "snapshotId",
"volume_size": "volumeSize",
"volume_type": "volumeType",
},
)
class EbsBlockDeviceProperty:
def __init__(
self,
*,
delete_on_termination: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
encrypted: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
iops: typing.Optional[jsii.Number] = None,
snapshot_id: typing.Optional[builtins.str] = None,
volume_size: typing.Optional[jsii.Number] = None,
volume_type: typing.Optional[builtins.str] = None,
) -> None:
"""
:param delete_on_termination: ``CfnSpotFleet.EbsBlockDeviceProperty.DeleteOnTermination``.
:param encrypted: ``CfnSpotFleet.EbsBlockDeviceProperty.Encrypted``.
:param iops: ``CfnSpotFleet.EbsBlockDeviceProperty.Iops``.
:param snapshot_id: ``CfnSpotFleet.EbsBlockDeviceProperty.SnapshotId``.
:param volume_size: ``CfnSpotFleet.EbsBlockDeviceProperty.VolumeSize``.
:param volume_type: ``CfnSpotFleet.EbsBlockDeviceProperty.VolumeType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if delete_on_termination is not None:
self._values["delete_on_termination"] = delete_on_termination
if encrypted is not None:
self._values["encrypted"] = encrypted
if iops is not None:
self._values["iops"] = iops
if snapshot_id is not None:
self._values["snapshot_id"] = snapshot_id
if volume_size is not None:
self._values["volume_size"] = volume_size
if volume_type is not None:
self._values["volume_type"] = volume_type
@builtins.property
def delete_on_termination(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnSpotFleet.EbsBlockDeviceProperty.DeleteOnTermination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html#cfn-ec2-spotfleet-ebsblockdevice-deleteontermination
"""
result = self._values.get("delete_on_termination")
return result
@builtins.property
def encrypted(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnSpotFleet.EbsBlockDeviceProperty.Encrypted``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html#cfn-ec2-spotfleet-ebsblockdevice-encrypted
"""
result = self._values.get("encrypted")
return result
@builtins.property
def iops(self) -> typing.Optional[jsii.Number]:
"""``CfnSpotFleet.EbsBlockDeviceProperty.Iops``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html#cfn-ec2-spotfleet-ebsblockdevice-iops
"""
result = self._values.get("iops")
return result
@builtins.property
def snapshot_id(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.EbsBlockDeviceProperty.SnapshotId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html#cfn-ec2-spotfleet-ebsblockdevice-snapshotid
"""
result = self._values.get("snapshot_id")
return result
@builtins.property
def volume_size(self) -> typing.Optional[jsii.Number]:
"""``CfnSpotFleet.EbsBlockDeviceProperty.VolumeSize``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html#cfn-ec2-spotfleet-ebsblockdevice-volumesize
"""
result = self._values.get("volume_size")
return result
@builtins.property
def volume_type(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.EbsBlockDeviceProperty.VolumeType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-blockdevicemappings-ebs.html#cfn-ec2-spotfleet-ebsblockdevice-volumetype
"""
result = self._values.get("volume_type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "EbsBlockDeviceProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.FleetLaunchTemplateSpecificationProperty",
jsii_struct_bases=[],
name_mapping={
"version": "version",
"launch_template_id": "launchTemplateId",
"launch_template_name": "launchTemplateName",
},
)
class FleetLaunchTemplateSpecificationProperty:
def __init__(
self,
*,
version: builtins.str,
launch_template_id: typing.Optional[builtins.str] = None,
launch_template_name: typing.Optional[builtins.str] = None,
) -> None:
"""
:param version: ``CfnSpotFleet.FleetLaunchTemplateSpecificationProperty.Version``.
:param launch_template_id: ``CfnSpotFleet.FleetLaunchTemplateSpecificationProperty.LaunchTemplateId``.
:param launch_template_name: ``CfnSpotFleet.FleetLaunchTemplateSpecificationProperty.LaunchTemplateName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-fleetlaunchtemplatespecification.html
"""
self._values: typing.Dict[str, typing.Any] = {
"version": version,
}
if launch_template_id is not None:
self._values["launch_template_id"] = launch_template_id
if launch_template_name is not None:
self._values["launch_template_name"] = launch_template_name
@builtins.property
def version(self) -> builtins.str:
"""``CfnSpotFleet.FleetLaunchTemplateSpecificationProperty.Version``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-fleetlaunchtemplatespecification.html#cfn-ec2-spotfleet-fleetlaunchtemplatespecification-version
"""
result = self._values.get("version")
assert result is not None, "Required property 'version' is missing"
return result
@builtins.property
def launch_template_id(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.FleetLaunchTemplateSpecificationProperty.LaunchTemplateId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-fleetlaunchtemplatespecification.html#cfn-ec2-spotfleet-fleetlaunchtemplatespecification-launchtemplateid
"""
result = self._values.get("launch_template_id")
return result
@builtins.property
def launch_template_name(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.FleetLaunchTemplateSpecificationProperty.LaunchTemplateName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-fleetlaunchtemplatespecification.html#cfn-ec2-spotfleet-fleetlaunchtemplatespecification-launchtemplatename
"""
result = self._values.get("launch_template_name")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "FleetLaunchTemplateSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.GroupIdentifierProperty",
jsii_struct_bases=[],
name_mapping={"group_id": "groupId"},
)
class GroupIdentifierProperty:
def __init__(self, *, group_id: builtins.str) -> None:
"""
:param group_id: ``CfnSpotFleet.GroupIdentifierProperty.GroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-securitygroups.html
"""
self._values: typing.Dict[str, typing.Any] = {
"group_id": group_id,
}
@builtins.property
def group_id(self) -> builtins.str:
"""``CfnSpotFleet.GroupIdentifierProperty.GroupId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-securitygroups.html#cfn-ec2-spotfleet-groupidentifier-groupid
"""
result = self._values.get("group_id")
assert result is not None, "Required property 'group_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "GroupIdentifierProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.IamInstanceProfileSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"arn": "arn"},
)
class IamInstanceProfileSpecificationProperty:
def __init__(self, *, arn: typing.Optional[builtins.str] = None) -> None:
"""
:param arn: ``CfnSpotFleet.IamInstanceProfileSpecificationProperty.Arn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-iaminstanceprofile.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if arn is not None:
self._values["arn"] = arn
@builtins.property
def arn(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.IamInstanceProfileSpecificationProperty.Arn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-iaminstanceprofile.html#cfn-ec2-spotfleet-iaminstanceprofilespecification-arn
"""
result = self._values.get("arn")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "IamInstanceProfileSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.InstanceIpv6AddressProperty",
jsii_struct_bases=[],
name_mapping={"ipv6_address": "ipv6Address"},
)
class InstanceIpv6AddressProperty:
def __init__(self, *, ipv6_address: builtins.str) -> None:
"""
:param ipv6_address: ``CfnSpotFleet.InstanceIpv6AddressProperty.Ipv6Address``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-instanceipv6address.html
"""
self._values: typing.Dict[str, typing.Any] = {
"ipv6_address": ipv6_address,
}
@builtins.property
def ipv6_address(self) -> builtins.str:
"""``CfnSpotFleet.InstanceIpv6AddressProperty.Ipv6Address``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-instanceipv6address.html#cfn-ec2-spotfleet-instanceipv6address-ipv6address
"""
result = self._values.get("ipv6_address")
assert result is not None, "Required property 'ipv6_address' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InstanceIpv6AddressProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty",
jsii_struct_bases=[],
name_mapping={
"associate_public_ip_address": "associatePublicIpAddress",
"delete_on_termination": "deleteOnTermination",
"description": "description",
"device_index": "deviceIndex",
"groups": "groups",
"ipv6_address_count": "ipv6AddressCount",
"ipv6_addresses": "ipv6Addresses",
"network_interface_id": "networkInterfaceId",
"private_ip_addresses": "privateIpAddresses",
"secondary_private_ip_address_count": "secondaryPrivateIpAddressCount",
"subnet_id": "subnetId",
},
)
class InstanceNetworkInterfaceSpecificationProperty:
def __init__(
self,
*,
associate_public_ip_address: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
delete_on_termination: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
description: typing.Optional[builtins.str] = None,
device_index: typing.Optional[jsii.Number] = None,
groups: typing.Optional[typing.List[builtins.str]] = None,
ipv6_address_count: typing.Optional[jsii.Number] = None,
ipv6_addresses: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.InstanceIpv6AddressProperty"]]]] = None,
network_interface_id: typing.Optional[builtins.str] = None,
private_ip_addresses: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.PrivateIpAddressSpecificationProperty"]]]] = None,
secondary_private_ip_address_count: typing.Optional[jsii.Number] = None,
subnet_id: typing.Optional[builtins.str] = None,
) -> None:
"""
:param associate_public_ip_address: ``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.AssociatePublicIpAddress``.
:param delete_on_termination: ``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.DeleteOnTermination``.
:param description: ``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.Description``.
:param device_index: ``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.DeviceIndex``.
:param groups: ``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.Groups``.
:param ipv6_address_count: ``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.Ipv6AddressCount``.
:param ipv6_addresses: ``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.Ipv6Addresses``.
:param network_interface_id: ``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.NetworkInterfaceId``.
:param private_ip_addresses: ``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.PrivateIpAddresses``.
:param secondary_private_ip_address_count: ``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.SecondaryPrivateIpAddressCount``.
:param subnet_id: ``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if associate_public_ip_address is not None:
self._values["associate_public_ip_address"] = associate_public_ip_address
if delete_on_termination is not None:
self._values["delete_on_termination"] = delete_on_termination
if description is not None:
self._values["description"] = description
if device_index is not None:
self._values["device_index"] = device_index
if groups is not None:
self._values["groups"] = groups
if ipv6_address_count is not None:
self._values["ipv6_address_count"] = ipv6_address_count
if ipv6_addresses is not None:
self._values["ipv6_addresses"] = ipv6_addresses
if network_interface_id is not None:
self._values["network_interface_id"] = network_interface_id
if private_ip_addresses is not None:
self._values["private_ip_addresses"] = private_ip_addresses
if secondary_private_ip_address_count is not None:
self._values["secondary_private_ip_address_count"] = secondary_private_ip_address_count
if subnet_id is not None:
self._values["subnet_id"] = subnet_id
@builtins.property
def associate_public_ip_address(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.AssociatePublicIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-associatepublicipaddress
"""
result = self._values.get("associate_public_ip_address")
return result
@builtins.property
def delete_on_termination(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.DeleteOnTermination``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-deleteontermination
"""
result = self._values.get("delete_on_termination")
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-description
"""
result = self._values.get("description")
return result
@builtins.property
def device_index(self) -> typing.Optional[jsii.Number]:
"""``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.DeviceIndex``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-deviceindex
"""
result = self._values.get("device_index")
return result
@builtins.property
def groups(self) -> typing.Optional[typing.List[builtins.str]]:
"""``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.Groups``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-groups
"""
result = self._values.get("groups")
return result
@builtins.property
def ipv6_address_count(self) -> typing.Optional[jsii.Number]:
"""``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.Ipv6AddressCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-ipv6addresscount
"""
result = self._values.get("ipv6_address_count")
return result
@builtins.property
def ipv6_addresses(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.InstanceIpv6AddressProperty"]]]]:
"""``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.Ipv6Addresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-ipv6addresses
"""
result = self._values.get("ipv6_addresses")
return result
@builtins.property
def network_interface_id(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-networkinterfaceid
"""
result = self._values.get("network_interface_id")
return result
@builtins.property
def private_ip_addresses(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.PrivateIpAddressSpecificationProperty"]]]]:
"""``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.PrivateIpAddresses``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-privateipaddresses
"""
result = self._values.get("private_ip_addresses")
return result
@builtins.property
def secondary_private_ip_address_count(self) -> typing.Optional[jsii.Number]:
"""``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.SecondaryPrivateIpAddressCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-secondaryprivateipaddresscount
"""
result = self._values.get("secondary_private_ip_address_count")
return result
@builtins.property
def subnet_id(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces.html#cfn-ec2-spotfleet-instancenetworkinterfacespecification-subnetid
"""
result = self._values.get("subnet_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InstanceNetworkInterfaceSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.LaunchTemplateConfigProperty",
jsii_struct_bases=[],
name_mapping={
"launch_template_specification": "launchTemplateSpecification",
"overrides": "overrides",
},
)
class LaunchTemplateConfigProperty:
def __init__(
self,
*,
launch_template_specification: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.FleetLaunchTemplateSpecificationProperty"]] = None,
overrides: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.LaunchTemplateOverridesProperty"]]]] = None,
) -> None:
"""
:param launch_template_specification: ``CfnSpotFleet.LaunchTemplateConfigProperty.LaunchTemplateSpecification``.
:param overrides: ``CfnSpotFleet.LaunchTemplateConfigProperty.Overrides``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateconfig.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if launch_template_specification is not None:
self._values["launch_template_specification"] = launch_template_specification
if overrides is not None:
self._values["overrides"] = overrides
@builtins.property
def launch_template_specification(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.FleetLaunchTemplateSpecificationProperty"]]:
"""``CfnSpotFleet.LaunchTemplateConfigProperty.LaunchTemplateSpecification``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateconfig.html#cfn-ec2-spotfleet-launchtemplateconfig-launchtemplatespecification
"""
result = self._values.get("launch_template_specification")
return result
@builtins.property
def overrides(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.LaunchTemplateOverridesProperty"]]]]:
"""``CfnSpotFleet.LaunchTemplateConfigProperty.Overrides``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateconfig.html#cfn-ec2-spotfleet-launchtemplateconfig-overrides
"""
result = self._values.get("overrides")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LaunchTemplateConfigProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.LaunchTemplateOverridesProperty",
jsii_struct_bases=[],
name_mapping={
"availability_zone": "availabilityZone",
"instance_type": "instanceType",
"priority": "priority",
"spot_price": "spotPrice",
"subnet_id": "subnetId",
"weighted_capacity": "weightedCapacity",
},
)
class LaunchTemplateOverridesProperty:
def __init__(
self,
*,
availability_zone: typing.Optional[builtins.str] = None,
instance_type: typing.Optional[builtins.str] = None,
priority: typing.Optional[jsii.Number] = None,
spot_price: typing.Optional[builtins.str] = None,
subnet_id: typing.Optional[builtins.str] = None,
weighted_capacity: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param availability_zone: ``CfnSpotFleet.LaunchTemplateOverridesProperty.AvailabilityZone``.
:param instance_type: ``CfnSpotFleet.LaunchTemplateOverridesProperty.InstanceType``.
:param priority: ``CfnSpotFleet.LaunchTemplateOverridesProperty.Priority``.
:param spot_price: ``CfnSpotFleet.LaunchTemplateOverridesProperty.SpotPrice``.
:param subnet_id: ``CfnSpotFleet.LaunchTemplateOverridesProperty.SubnetId``.
:param weighted_capacity: ``CfnSpotFleet.LaunchTemplateOverridesProperty.WeightedCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateoverrides.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if availability_zone is not None:
self._values["availability_zone"] = availability_zone
if instance_type is not None:
self._values["instance_type"] = instance_type
if priority is not None:
self._values["priority"] = priority
if spot_price is not None:
self._values["spot_price"] = spot_price
if subnet_id is not None:
self._values["subnet_id"] = subnet_id
if weighted_capacity is not None:
self._values["weighted_capacity"] = weighted_capacity
@builtins.property
def availability_zone(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.LaunchTemplateOverridesProperty.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateoverrides.html#cfn-ec2-spotfleet-launchtemplateoverrides-availabilityzone
"""
result = self._values.get("availability_zone")
return result
@builtins.property
def instance_type(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.LaunchTemplateOverridesProperty.InstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateoverrides.html#cfn-ec2-spotfleet-launchtemplateoverrides-instancetype
"""
result = self._values.get("instance_type")
return result
@builtins.property
def priority(self) -> typing.Optional[jsii.Number]:
"""``CfnSpotFleet.LaunchTemplateOverridesProperty.Priority``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateoverrides.html#cfn-ec2-spotfleet-launchtemplateoverrides-priority
"""
result = self._values.get("priority")
return result
@builtins.property
def spot_price(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.LaunchTemplateOverridesProperty.SpotPrice``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateoverrides.html#cfn-ec2-spotfleet-launchtemplateoverrides-spotprice
"""
result = self._values.get("spot_price")
return result
@builtins.property
def subnet_id(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.LaunchTemplateOverridesProperty.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateoverrides.html#cfn-ec2-spotfleet-launchtemplateoverrides-subnetid
"""
result = self._values.get("subnet_id")
return result
@builtins.property
def weighted_capacity(self) -> typing.Optional[jsii.Number]:
"""``CfnSpotFleet.LaunchTemplateOverridesProperty.WeightedCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-launchtemplateoverrides.html#cfn-ec2-spotfleet-launchtemplateoverrides-weightedcapacity
"""
result = self._values.get("weighted_capacity")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LaunchTemplateOverridesProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.LoadBalancersConfigProperty",
jsii_struct_bases=[],
name_mapping={
"classic_load_balancers_config": "classicLoadBalancersConfig",
"target_groups_config": "targetGroupsConfig",
},
)
class LoadBalancersConfigProperty:
def __init__(
self,
*,
classic_load_balancers_config: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.ClassicLoadBalancersConfigProperty"]] = None,
target_groups_config: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.TargetGroupsConfigProperty"]] = None,
) -> None:
"""
:param classic_load_balancers_config: ``CfnSpotFleet.LoadBalancersConfigProperty.ClassicLoadBalancersConfig``.
:param target_groups_config: ``CfnSpotFleet.LoadBalancersConfigProperty.TargetGroupsConfig``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-loadbalancersconfig.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if classic_load_balancers_config is not None:
self._values["classic_load_balancers_config"] = classic_load_balancers_config
if target_groups_config is not None:
self._values["target_groups_config"] = target_groups_config
@builtins.property
def classic_load_balancers_config(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.ClassicLoadBalancersConfigProperty"]]:
"""``CfnSpotFleet.LoadBalancersConfigProperty.ClassicLoadBalancersConfig``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-loadbalancersconfig.html#cfn-ec2-spotfleet-loadbalancersconfig-classicloadbalancersconfig
"""
result = self._values.get("classic_load_balancers_config")
return result
@builtins.property
def target_groups_config(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.TargetGroupsConfigProperty"]]:
"""``CfnSpotFleet.LoadBalancersConfigProperty.TargetGroupsConfig``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-loadbalancersconfig.html#cfn-ec2-spotfleet-loadbalancersconfig-targetgroupsconfig
"""
result = self._values.get("target_groups_config")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LoadBalancersConfigProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.PrivateIpAddressSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"private_ip_address": "privateIpAddress", "primary": "primary"},
)
class PrivateIpAddressSpecificationProperty:
def __init__(
self,
*,
private_ip_address: builtins.str,
primary: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
) -> None:
"""
:param private_ip_address: ``CfnSpotFleet.PrivateIpAddressSpecificationProperty.PrivateIpAddress``.
:param primary: ``CfnSpotFleet.PrivateIpAddressSpecificationProperty.Primary``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces-privateipaddresses.html
"""
self._values: typing.Dict[str, typing.Any] = {
"private_ip_address": private_ip_address,
}
if primary is not None:
self._values["primary"] = primary
@builtins.property
def private_ip_address(self) -> builtins.str:
"""``CfnSpotFleet.PrivateIpAddressSpecificationProperty.PrivateIpAddress``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces-privateipaddresses.html#cfn-ec2-spotfleet-privateipaddressspecification-privateipaddress
"""
result = self._values.get("private_ip_address")
assert result is not None, "Required property 'private_ip_address' is missing"
return result
@builtins.property
def primary(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnSpotFleet.PrivateIpAddressSpecificationProperty.Primary``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-networkinterfaces-privateipaddresses.html#cfn-ec2-spotfleet-privateipaddressspecification-primary
"""
result = self._values.get("primary")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PrivateIpAddressSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.SpotCapacityRebalanceProperty",
jsii_struct_bases=[],
name_mapping={"replacement_strategy": "replacementStrategy"},
)
class SpotCapacityRebalanceProperty:
def __init__(
self,
*,
replacement_strategy: typing.Optional[builtins.str] = None,
) -> None:
"""
:param replacement_strategy: ``CfnSpotFleet.SpotCapacityRebalanceProperty.ReplacementStrategy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotcapacityrebalance.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if replacement_strategy is not None:
self._values["replacement_strategy"] = replacement_strategy
@builtins.property
def replacement_strategy(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotCapacityRebalanceProperty.ReplacementStrategy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotcapacityrebalance.html#cfn-ec2-spotfleet-spotcapacityrebalance-replacementstrategy
"""
result = self._values.get("replacement_strategy")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SpotCapacityRebalanceProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.SpotFleetLaunchSpecificationProperty",
jsii_struct_bases=[],
name_mapping={
"image_id": "imageId",
"instance_type": "instanceType",
"block_device_mappings": "blockDeviceMappings",
"ebs_optimized": "ebsOptimized",
"iam_instance_profile": "iamInstanceProfile",
"kernel_id": "kernelId",
"key_name": "keyName",
"monitoring": "monitoring",
"network_interfaces": "networkInterfaces",
"placement": "placement",
"ramdisk_id": "ramdiskId",
"security_groups": "securityGroups",
"spot_price": "spotPrice",
"subnet_id": "subnetId",
"tag_specifications": "tagSpecifications",
"user_data": "userData",
"weighted_capacity": "weightedCapacity",
},
)
class SpotFleetLaunchSpecificationProperty:
def __init__(
self,
*,
image_id: builtins.str,
instance_type: builtins.str,
block_device_mappings: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.BlockDeviceMappingProperty"]]]] = None,
ebs_optimized: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
iam_instance_profile: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.IamInstanceProfileSpecificationProperty"]] = None,
kernel_id: typing.Optional[builtins.str] = None,
key_name: typing.Optional[builtins.str] = None,
monitoring: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotFleetMonitoringProperty"]] = None,
network_interfaces: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty"]]]] = None,
placement: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotPlacementProperty"]] = None,
ramdisk_id: typing.Optional[builtins.str] = None,
security_groups: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.GroupIdentifierProperty"]]]] = None,
spot_price: typing.Optional[builtins.str] = None,
subnet_id: typing.Optional[builtins.str] = None,
tag_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotFleetTagSpecificationProperty"]]]] = None,
user_data: typing.Optional[builtins.str] = None,
weighted_capacity: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param image_id: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.ImageId``.
:param instance_type: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.InstanceType``.
:param block_device_mappings: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.BlockDeviceMappings``.
:param ebs_optimized: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.EbsOptimized``.
:param iam_instance_profile: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.IamInstanceProfile``.
:param kernel_id: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.KernelId``.
:param key_name: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.KeyName``.
:param monitoring: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.Monitoring``.
:param network_interfaces: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.NetworkInterfaces``.
:param placement: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.Placement``.
:param ramdisk_id: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.RamdiskId``.
:param security_groups: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.SecurityGroups``.
:param spot_price: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.SpotPrice``.
:param subnet_id: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.SubnetId``.
:param tag_specifications: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.TagSpecifications``.
:param user_data: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.UserData``.
:param weighted_capacity: ``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.WeightedCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html
"""
self._values: typing.Dict[str, typing.Any] = {
"image_id": image_id,
"instance_type": instance_type,
}
if block_device_mappings is not None:
self._values["block_device_mappings"] = block_device_mappings
if ebs_optimized is not None:
self._values["ebs_optimized"] = ebs_optimized
if iam_instance_profile is not None:
self._values["iam_instance_profile"] = iam_instance_profile
if kernel_id is not None:
self._values["kernel_id"] = kernel_id
if key_name is not None:
self._values["key_name"] = key_name
if monitoring is not None:
self._values["monitoring"] = monitoring
if network_interfaces is not None:
self._values["network_interfaces"] = network_interfaces
if placement is not None:
self._values["placement"] = placement
if ramdisk_id is not None:
self._values["ramdisk_id"] = ramdisk_id
if security_groups is not None:
self._values["security_groups"] = security_groups
if spot_price is not None:
self._values["spot_price"] = spot_price
if subnet_id is not None:
self._values["subnet_id"] = subnet_id
if tag_specifications is not None:
self._values["tag_specifications"] = tag_specifications
if user_data is not None:
self._values["user_data"] = user_data
if weighted_capacity is not None:
self._values["weighted_capacity"] = weighted_capacity
@builtins.property
def image_id(self) -> builtins.str:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.ImageId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-imageid
"""
result = self._values.get("image_id")
assert result is not None, "Required property 'image_id' is missing"
return result
@builtins.property
def instance_type(self) -> builtins.str:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.InstanceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-instancetype
"""
result = self._values.get("instance_type")
assert result is not None, "Required property 'instance_type' is missing"
return result
@builtins.property
def block_device_mappings(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.BlockDeviceMappingProperty"]]]]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.BlockDeviceMappings``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-blockdevicemappings
"""
result = self._values.get("block_device_mappings")
return result
@builtins.property
def ebs_optimized(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.EbsOptimized``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-ebsoptimized
"""
result = self._values.get("ebs_optimized")
return result
@builtins.property
def iam_instance_profile(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.IamInstanceProfileSpecificationProperty"]]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.IamInstanceProfile``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-iaminstanceprofile
"""
result = self._values.get("iam_instance_profile")
return result
@builtins.property
def kernel_id(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.KernelId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-kernelid
"""
result = self._values.get("kernel_id")
return result
@builtins.property
def key_name(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.KeyName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-keyname
"""
result = self._values.get("key_name")
return result
@builtins.property
def monitoring(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotFleetMonitoringProperty"]]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.Monitoring``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-monitoring
"""
result = self._values.get("monitoring")
return result
@builtins.property
def network_interfaces(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.InstanceNetworkInterfaceSpecificationProperty"]]]]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.NetworkInterfaces``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-networkinterfaces
"""
result = self._values.get("network_interfaces")
return result
@builtins.property
def placement(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotPlacementProperty"]]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.Placement``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-placement
"""
result = self._values.get("placement")
return result
@builtins.property
def ramdisk_id(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.RamdiskId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-ramdiskid
"""
result = self._values.get("ramdisk_id")
return result
@builtins.property
def security_groups(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.GroupIdentifierProperty"]]]]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.SecurityGroups``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-securitygroups
"""
result = self._values.get("security_groups")
return result
@builtins.property
def spot_price(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.SpotPrice``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-spotprice
"""
result = self._values.get("spot_price")
return result
@builtins.property
def subnet_id(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-subnetid
"""
result = self._values.get("subnet_id")
return result
@builtins.property
def tag_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotFleetTagSpecificationProperty"]]]]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.TagSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-tagspecifications
"""
result = self._values.get("tag_specifications")
return result
@builtins.property
def user_data(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.UserData``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-userdata
"""
result = self._values.get("user_data")
return result
@builtins.property
def weighted_capacity(self) -> typing.Optional[jsii.Number]:
"""``CfnSpotFleet.SpotFleetLaunchSpecificationProperty.WeightedCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications.html#cfn-ec2-spotfleet-spotfleetlaunchspecification-weightedcapacity
"""
result = self._values.get("weighted_capacity")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SpotFleetLaunchSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.SpotFleetMonitoringProperty",
jsii_struct_bases=[],
name_mapping={"enabled": "enabled"},
)
class SpotFleetMonitoringProperty:
def __init__(
self,
*,
enabled: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
) -> None:
"""
:param enabled: ``CfnSpotFleet.SpotFleetMonitoringProperty.Enabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-monitoring.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if enabled is not None:
self._values["enabled"] = enabled
@builtins.property
def enabled(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnSpotFleet.SpotFleetMonitoringProperty.Enabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-monitoring.html#cfn-ec2-spotfleet-spotfleetmonitoring-enabled
"""
result = self._values.get("enabled")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SpotFleetMonitoringProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.SpotFleetRequestConfigDataProperty",
jsii_struct_bases=[],
name_mapping={
"iam_fleet_role": "iamFleetRole",
"target_capacity": "targetCapacity",
"allocation_strategy": "allocationStrategy",
"excess_capacity_termination_policy": "excessCapacityTerminationPolicy",
"instance_interruption_behavior": "instanceInterruptionBehavior",
"instance_pools_to_use_count": "instancePoolsToUseCount",
"launch_specifications": "launchSpecifications",
"launch_template_configs": "launchTemplateConfigs",
"load_balancers_config": "loadBalancersConfig",
"on_demand_allocation_strategy": "onDemandAllocationStrategy",
"on_demand_max_total_price": "onDemandMaxTotalPrice",
"on_demand_target_capacity": "onDemandTargetCapacity",
"replace_unhealthy_instances": "replaceUnhealthyInstances",
"spot_maintenance_strategies": "spotMaintenanceStrategies",
"spot_max_total_price": "spotMaxTotalPrice",
"spot_price": "spotPrice",
"terminate_instances_with_expiration": "terminateInstancesWithExpiration",
"type": "type",
"valid_from": "validFrom",
"valid_until": "validUntil",
},
)
class SpotFleetRequestConfigDataProperty:
def __init__(
self,
*,
iam_fleet_role: builtins.str,
target_capacity: jsii.Number,
allocation_strategy: typing.Optional[builtins.str] = None,
excess_capacity_termination_policy: typing.Optional[builtins.str] = None,
instance_interruption_behavior: typing.Optional[builtins.str] = None,
instance_pools_to_use_count: typing.Optional[jsii.Number] = None,
launch_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotFleetLaunchSpecificationProperty"]]]] = None,
launch_template_configs: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.LaunchTemplateConfigProperty"]]]] = None,
load_balancers_config: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.LoadBalancersConfigProperty"]] = None,
on_demand_allocation_strategy: typing.Optional[builtins.str] = None,
on_demand_max_total_price: typing.Optional[builtins.str] = None,
on_demand_target_capacity: typing.Optional[jsii.Number] = None,
replace_unhealthy_instances: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
spot_maintenance_strategies: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotMaintenanceStrategiesProperty"]] = None,
spot_max_total_price: typing.Optional[builtins.str] = None,
spot_price: typing.Optional[builtins.str] = None,
terminate_instances_with_expiration: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
type: typing.Optional[builtins.str] = None,
valid_from: typing.Optional[builtins.str] = None,
valid_until: typing.Optional[builtins.str] = None,
) -> None:
"""
:param iam_fleet_role: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.IamFleetRole``.
:param target_capacity: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.TargetCapacity``.
:param allocation_strategy: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.AllocationStrategy``.
:param excess_capacity_termination_policy: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.ExcessCapacityTerminationPolicy``.
:param instance_interruption_behavior: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.InstanceInterruptionBehavior``.
:param instance_pools_to_use_count: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.InstancePoolsToUseCount``.
:param launch_specifications: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.LaunchSpecifications``.
:param launch_template_configs: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.LaunchTemplateConfigs``.
:param load_balancers_config: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.LoadBalancersConfig``.
:param on_demand_allocation_strategy: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.OnDemandAllocationStrategy``.
:param on_demand_max_total_price: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.OnDemandMaxTotalPrice``.
:param on_demand_target_capacity: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.OnDemandTargetCapacity``.
:param replace_unhealthy_instances: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.ReplaceUnhealthyInstances``.
:param spot_maintenance_strategies: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.SpotMaintenanceStrategies``.
:param spot_max_total_price: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.SpotMaxTotalPrice``.
:param spot_price: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.SpotPrice``.
:param terminate_instances_with_expiration: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.TerminateInstancesWithExpiration``.
:param type: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.Type``.
:param valid_from: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.ValidFrom``.
:param valid_until: ``CfnSpotFleet.SpotFleetRequestConfigDataProperty.ValidUntil``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html
"""
self._values: typing.Dict[str, typing.Any] = {
"iam_fleet_role": iam_fleet_role,
"target_capacity": target_capacity,
}
if allocation_strategy is not None:
self._values["allocation_strategy"] = allocation_strategy
if excess_capacity_termination_policy is not None:
self._values["excess_capacity_termination_policy"] = excess_capacity_termination_policy
if instance_interruption_behavior is not None:
self._values["instance_interruption_behavior"] = instance_interruption_behavior
if instance_pools_to_use_count is not None:
self._values["instance_pools_to_use_count"] = instance_pools_to_use_count
if launch_specifications is not None:
self._values["launch_specifications"] = launch_specifications
if launch_template_configs is not None:
self._values["launch_template_configs"] = launch_template_configs
if load_balancers_config is not None:
self._values["load_balancers_config"] = load_balancers_config
if on_demand_allocation_strategy is not None:
self._values["on_demand_allocation_strategy"] = on_demand_allocation_strategy
if on_demand_max_total_price is not None:
self._values["on_demand_max_total_price"] = on_demand_max_total_price
if on_demand_target_capacity is not None:
self._values["on_demand_target_capacity"] = on_demand_target_capacity
if replace_unhealthy_instances is not None:
self._values["replace_unhealthy_instances"] = replace_unhealthy_instances
if spot_maintenance_strategies is not None:
self._values["spot_maintenance_strategies"] = spot_maintenance_strategies
if spot_max_total_price is not None:
self._values["spot_max_total_price"] = spot_max_total_price
if spot_price is not None:
self._values["spot_price"] = spot_price
if terminate_instances_with_expiration is not None:
self._values["terminate_instances_with_expiration"] = terminate_instances_with_expiration
if type is not None:
self._values["type"] = type
if valid_from is not None:
self._values["valid_from"] = valid_from
if valid_until is not None:
self._values["valid_until"] = valid_until
@builtins.property
def iam_fleet_role(self) -> builtins.str:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.IamFleetRole``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-iamfleetrole
"""
result = self._values.get("iam_fleet_role")
assert result is not None, "Required property 'iam_fleet_role' is missing"
return result
@builtins.property
def target_capacity(self) -> jsii.Number:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.TargetCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-targetcapacity
"""
result = self._values.get("target_capacity")
assert result is not None, "Required property 'target_capacity' is missing"
return result
@builtins.property
def allocation_strategy(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.AllocationStrategy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-allocationstrategy
"""
result = self._values.get("allocation_strategy")
return result
@builtins.property
def excess_capacity_termination_policy(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.ExcessCapacityTerminationPolicy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-excesscapacityterminationpolicy
"""
result = self._values.get("excess_capacity_termination_policy")
return result
@builtins.property
def instance_interruption_behavior(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.InstanceInterruptionBehavior``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-instanceinterruptionbehavior
"""
result = self._values.get("instance_interruption_behavior")
return result
@builtins.property
def instance_pools_to_use_count(self) -> typing.Optional[jsii.Number]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.InstancePoolsToUseCount``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-instancepoolstousecount
"""
result = self._values.get("instance_pools_to_use_count")
return result
@builtins.property
def launch_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotFleetLaunchSpecificationProperty"]]]]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.LaunchSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications
"""
result = self._values.get("launch_specifications")
return result
@builtins.property
def launch_template_configs(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.LaunchTemplateConfigProperty"]]]]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.LaunchTemplateConfigs``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-launchtemplateconfigs
"""
result = self._values.get("launch_template_configs")
return result
@builtins.property
def load_balancers_config(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.LoadBalancersConfigProperty"]]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.LoadBalancersConfig``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-loadbalancersconfig
"""
result = self._values.get("load_balancers_config")
return result
@builtins.property
def on_demand_allocation_strategy(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.OnDemandAllocationStrategy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-ondemandallocationstrategy
"""
result = self._values.get("on_demand_allocation_strategy")
return result
@builtins.property
def on_demand_max_total_price(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.OnDemandMaxTotalPrice``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-ondemandmaxtotalprice
"""
result = self._values.get("on_demand_max_total_price")
return result
@builtins.property
def on_demand_target_capacity(self) -> typing.Optional[jsii.Number]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.OnDemandTargetCapacity``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-ondemandtargetcapacity
"""
result = self._values.get("on_demand_target_capacity")
return result
@builtins.property
def replace_unhealthy_instances(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.ReplaceUnhealthyInstances``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-replaceunhealthyinstances
"""
result = self._values.get("replace_unhealthy_instances")
return result
@builtins.property
def spot_maintenance_strategies(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotMaintenanceStrategiesProperty"]]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.SpotMaintenanceStrategies``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-spotmaintenancestrategies
"""
result = self._values.get("spot_maintenance_strategies")
return result
@builtins.property
def spot_max_total_price(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.SpotMaxTotalPrice``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-spotmaxtotalprice
"""
result = self._values.get("spot_max_total_price")
return result
@builtins.property
def spot_price(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.SpotPrice``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-spotprice
"""
result = self._values.get("spot_price")
return result
@builtins.property
def terminate_instances_with_expiration(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.TerminateInstancesWithExpiration``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-terminateinstanceswithexpiration
"""
result = self._values.get("terminate_instances_with_expiration")
return result
@builtins.property
def type(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-type
"""
result = self._values.get("type")
return result
@builtins.property
def valid_from(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.ValidFrom``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-validfrom
"""
result = self._values.get("valid_from")
return result
@builtins.property
def valid_until(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetRequestConfigDataProperty.ValidUntil``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata-validuntil
"""
result = self._values.get("valid_until")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SpotFleetRequestConfigDataProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.SpotFleetTagSpecificationProperty",
jsii_struct_bases=[],
name_mapping={"resource_type": "resourceType", "tags": "tags"},
)
class SpotFleetTagSpecificationProperty:
def __init__(
self,
*,
resource_type: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""
:param resource_type: ``CfnSpotFleet.SpotFleetTagSpecificationProperty.ResourceType``.
:param tags: ``CfnSpotFleet.SpotFleetTagSpecificationProperty.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-tagspecifications.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if resource_type is not None:
self._values["resource_type"] = resource_type
if tags is not None:
self._values["tags"] = tags
@builtins.property
def resource_type(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotFleetTagSpecificationProperty.ResourceType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-tagspecifications.html#cfn-ec2-spotfleet-spotfleettagspecification-resourcetype
"""
result = self._values.get("resource_type")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``CfnSpotFleet.SpotFleetTagSpecificationProperty.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-tagspecifications.html#cfn-ec2-spotfleet-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SpotFleetTagSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.SpotMaintenanceStrategiesProperty",
jsii_struct_bases=[],
name_mapping={"capacity_rebalance": "capacityRebalance"},
)
class SpotMaintenanceStrategiesProperty:
def __init__(
self,
*,
capacity_rebalance: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotCapacityRebalanceProperty"]] = None,
) -> None:
"""
:param capacity_rebalance: ``CfnSpotFleet.SpotMaintenanceStrategiesProperty.CapacityRebalance``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotmaintenancestrategies.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if capacity_rebalance is not None:
self._values["capacity_rebalance"] = capacity_rebalance
@builtins.property
def capacity_rebalance(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.SpotCapacityRebalanceProperty"]]:
"""``CfnSpotFleet.SpotMaintenanceStrategiesProperty.CapacityRebalance``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotmaintenancestrategies.html#cfn-ec2-spotfleet-spotmaintenancestrategies-capacityrebalance
"""
result = self._values.get("capacity_rebalance")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SpotMaintenanceStrategiesProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.SpotPlacementProperty",
jsii_struct_bases=[],
name_mapping={
"availability_zone": "availabilityZone",
"group_name": "groupName",
"tenancy": "tenancy",
},
)
class SpotPlacementProperty:
def __init__(
self,
*,
availability_zone: typing.Optional[builtins.str] = None,
group_name: typing.Optional[builtins.str] = None,
tenancy: typing.Optional[builtins.str] = None,
) -> None:
"""
:param availability_zone: ``CfnSpotFleet.SpotPlacementProperty.AvailabilityZone``.
:param group_name: ``CfnSpotFleet.SpotPlacementProperty.GroupName``.
:param tenancy: ``CfnSpotFleet.SpotPlacementProperty.Tenancy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-placement.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if availability_zone is not None:
self._values["availability_zone"] = availability_zone
if group_name is not None:
self._values["group_name"] = group_name
if tenancy is not None:
self._values["tenancy"] = tenancy
@builtins.property
def availability_zone(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotPlacementProperty.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-placement.html#cfn-ec2-spotfleet-spotplacement-availabilityzone
"""
result = self._values.get("availability_zone")
return result
@builtins.property
def group_name(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotPlacementProperty.GroupName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-placement.html#cfn-ec2-spotfleet-spotplacement-groupname
"""
result = self._values.get("group_name")
return result
@builtins.property
def tenancy(self) -> typing.Optional[builtins.str]:
"""``CfnSpotFleet.SpotPlacementProperty.Tenancy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-spotfleetrequestconfigdata-launchspecifications-placement.html#cfn-ec2-spotfleet-spotplacement-tenancy
"""
result = self._values.get("tenancy")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SpotPlacementProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.TargetGroupProperty",
jsii_struct_bases=[],
name_mapping={"arn": "arn"},
)
class TargetGroupProperty:
def __init__(self, *, arn: builtins.str) -> None:
"""
:param arn: ``CfnSpotFleet.TargetGroupProperty.Arn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-targetgroup.html
"""
self._values: typing.Dict[str, typing.Any] = {
"arn": arn,
}
@builtins.property
def arn(self) -> builtins.str:
"""``CfnSpotFleet.TargetGroupProperty.Arn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-targetgroup.html#cfn-ec2-spotfleet-targetgroup-arn
"""
result = self._values.get("arn")
assert result is not None, "Required property 'arn' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "TargetGroupProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleet.TargetGroupsConfigProperty",
jsii_struct_bases=[],
name_mapping={"target_groups": "targetGroups"},
)
class TargetGroupsConfigProperty:
def __init__(
self,
*,
target_groups: typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.TargetGroupProperty"]]],
) -> None:
"""
:param target_groups: ``CfnSpotFleet.TargetGroupsConfigProperty.TargetGroups``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-targetgroupsconfig.html
"""
self._values: typing.Dict[str, typing.Any] = {
"target_groups": target_groups,
}
@builtins.property
def target_groups(
self,
) -> typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnSpotFleet.TargetGroupProperty"]]]:
"""``CfnSpotFleet.TargetGroupsConfigProperty.TargetGroups``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-spotfleet-targetgroupsconfig.html#cfn-ec2-spotfleet-targetgroupsconfig-targetgroups
"""
result = self._values.get("target_groups")
assert result is not None, "Required property 'target_groups' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "TargetGroupsConfigProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSpotFleetProps",
jsii_struct_bases=[],
name_mapping={"spot_fleet_request_config_data": "spotFleetRequestConfigData"},
)
class CfnSpotFleetProps:
def __init__(
self,
*,
spot_fleet_request_config_data: typing.Union[aws_cdk.core.IResolvable, CfnSpotFleet.SpotFleetRequestConfigDataProperty],
) -> None:
"""Properties for defining a ``AWS::EC2::SpotFleet``.
:param spot_fleet_request_config_data: ``AWS::EC2::SpotFleet.SpotFleetRequestConfigData``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-spotfleet.html
"""
self._values: typing.Dict[str, typing.Any] = {
"spot_fleet_request_config_data": spot_fleet_request_config_data,
}
@builtins.property
def spot_fleet_request_config_data(
self,
) -> typing.Union[aws_cdk.core.IResolvable, CfnSpotFleet.SpotFleetRequestConfigDataProperty]:
"""``AWS::EC2::SpotFleet.SpotFleetRequestConfigData``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-spotfleet.html#cfn-ec2-spotfleet-spotfleetrequestconfigdata
"""
result = self._values.get("spot_fleet_request_config_data")
assert result is not None, "Required property 'spot_fleet_request_config_data' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnSpotFleetProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnSubnet(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnSubnet",
):
"""A CloudFormation ``AWS::EC2::Subnet``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html
:cloudformationResource: AWS::EC2::Subnet
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
cidr_block: builtins.str,
vpc_id: builtins.str,
assign_ipv6_address_on_creation: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
availability_zone: typing.Optional[builtins.str] = None,
ipv6_cidr_block: typing.Optional[builtins.str] = None,
map_public_ip_on_launch: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
outpost_arn: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::Subnet``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param cidr_block: ``AWS::EC2::Subnet.CidrBlock``.
:param vpc_id: ``AWS::EC2::Subnet.VpcId``.
:param assign_ipv6_address_on_creation: ``AWS::EC2::Subnet.AssignIpv6AddressOnCreation``.
:param availability_zone: ``AWS::EC2::Subnet.AvailabilityZone``.
:param ipv6_cidr_block: ``AWS::EC2::Subnet.Ipv6CidrBlock``.
:param map_public_ip_on_launch: ``AWS::EC2::Subnet.MapPublicIpOnLaunch``.
:param outpost_arn: ``AWS::EC2::Subnet.OutpostArn``.
:param tags: ``AWS::EC2::Subnet.Tags``.
"""
props = CfnSubnetProps(
cidr_block=cidr_block,
vpc_id=vpc_id,
assign_ipv6_address_on_creation=assign_ipv6_address_on_creation,
availability_zone=availability_zone,
ipv6_cidr_block=ipv6_cidr_block,
map_public_ip_on_launch=map_public_ip_on_launch,
outpost_arn=outpost_arn,
tags=tags,
)
jsii.create(CfnSubnet, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrAvailabilityZone")
def attr_availability_zone(self) -> builtins.str:
"""
:cloudformationAttribute: AvailabilityZone
"""
return jsii.get(self, "attrAvailabilityZone")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrIpv6CidrBlocks")
def attr_ipv6_cidr_blocks(self) -> typing.List[builtins.str]:
"""
:cloudformationAttribute: Ipv6CidrBlocks
"""
return jsii.get(self, "attrIpv6CidrBlocks")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrNetworkAclAssociationId")
def attr_network_acl_association_id(self) -> builtins.str:
"""
:cloudformationAttribute: NetworkAclAssociationId
"""
return jsii.get(self, "attrNetworkAclAssociationId")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrOutpostArn")
def attr_outpost_arn(self) -> builtins.str:
"""
:cloudformationAttribute: OutpostArn
"""
return jsii.get(self, "attrOutpostArn")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrVpcId")
def attr_vpc_id(self) -> builtins.str:
"""
:cloudformationAttribute: VpcId
"""
return jsii.get(self, "attrVpcId")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::Subnet.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="cidrBlock")
def cidr_block(self) -> builtins.str:
"""``AWS::EC2::Subnet.CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-cidrblock
"""
return jsii.get(self, "cidrBlock")
@cidr_block.setter # type: ignore
def cidr_block(self, value: builtins.str) -> None:
jsii.set(self, "cidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::Subnet.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-awsec2subnet-prop-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: builtins.str) -> None:
jsii.set(self, "vpcId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="assignIpv6AddressOnCreation")
def assign_ipv6_address_on_creation(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Subnet.AssignIpv6AddressOnCreation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-assignipv6addressoncreation
"""
return jsii.get(self, "assignIpv6AddressOnCreation")
@assign_ipv6_address_on_creation.setter # type: ignore
def assign_ipv6_address_on_creation(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "assignIpv6AddressOnCreation", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZone")
def availability_zone(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Subnet.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-availabilityzone
"""
return jsii.get(self, "availabilityZone")
@availability_zone.setter # type: ignore
def availability_zone(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "availabilityZone", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ipv6CidrBlock")
def ipv6_cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Subnet.Ipv6CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-ipv6cidrblock
"""
return jsii.get(self, "ipv6CidrBlock")
@ipv6_cidr_block.setter # type: ignore
def ipv6_cidr_block(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "ipv6CidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="mapPublicIpOnLaunch")
def map_public_ip_on_launch(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Subnet.MapPublicIpOnLaunch``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-mappubliciponlaunch
"""
return jsii.get(self, "mapPublicIpOnLaunch")
@map_public_ip_on_launch.setter # type: ignore
def map_public_ip_on_launch(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "mapPublicIpOnLaunch", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="outpostArn")
def outpost_arn(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Subnet.OutpostArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-outpostarn
"""
return jsii.get(self, "outpostArn")
@outpost_arn.setter # type: ignore
def outpost_arn(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "outpostArn", value)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnSubnetCidrBlock(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnSubnetCidrBlock",
):
"""A CloudFormation ``AWS::EC2::SubnetCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnetcidrblock.html
:cloudformationResource: AWS::EC2::SubnetCidrBlock
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
ipv6_cidr_block: builtins.str,
subnet_id: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::SubnetCidrBlock``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param ipv6_cidr_block: ``AWS::EC2::SubnetCidrBlock.Ipv6CidrBlock``.
:param subnet_id: ``AWS::EC2::SubnetCidrBlock.SubnetId``.
"""
props = CfnSubnetCidrBlockProps(
ipv6_cidr_block=ipv6_cidr_block, subnet_id=subnet_id
)
jsii.create(CfnSubnetCidrBlock, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="ipv6CidrBlock")
def ipv6_cidr_block(self) -> builtins.str:
"""``AWS::EC2::SubnetCidrBlock.Ipv6CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnetcidrblock.html#cfn-ec2-subnetcidrblock-ipv6cidrblock
"""
return jsii.get(self, "ipv6CidrBlock")
@ipv6_cidr_block.setter # type: ignore
def ipv6_cidr_block(self, value: builtins.str) -> None:
jsii.set(self, "ipv6CidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetId")
def subnet_id(self) -> builtins.str:
"""``AWS::EC2::SubnetCidrBlock.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnetcidrblock.html#cfn-ec2-subnetcidrblock-subnetid
"""
return jsii.get(self, "subnetId")
@subnet_id.setter # type: ignore
def subnet_id(self, value: builtins.str) -> None:
jsii.set(self, "subnetId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSubnetCidrBlockProps",
jsii_struct_bases=[],
name_mapping={"ipv6_cidr_block": "ipv6CidrBlock", "subnet_id": "subnetId"},
)
class CfnSubnetCidrBlockProps:
def __init__(
self,
*,
ipv6_cidr_block: builtins.str,
subnet_id: builtins.str,
) -> None:
"""Properties for defining a ``AWS::EC2::SubnetCidrBlock``.
:param ipv6_cidr_block: ``AWS::EC2::SubnetCidrBlock.Ipv6CidrBlock``.
:param subnet_id: ``AWS::EC2::SubnetCidrBlock.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnetcidrblock.html
"""
self._values: typing.Dict[str, typing.Any] = {
"ipv6_cidr_block": ipv6_cidr_block,
"subnet_id": subnet_id,
}
@builtins.property
def ipv6_cidr_block(self) -> builtins.str:
"""``AWS::EC2::SubnetCidrBlock.Ipv6CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnetcidrblock.html#cfn-ec2-subnetcidrblock-ipv6cidrblock
"""
result = self._values.get("ipv6_cidr_block")
assert result is not None, "Required property 'ipv6_cidr_block' is missing"
return result
@builtins.property
def subnet_id(self) -> builtins.str:
"""``AWS::EC2::SubnetCidrBlock.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnetcidrblock.html#cfn-ec2-subnetcidrblock-subnetid
"""
result = self._values.get("subnet_id")
assert result is not None, "Required property 'subnet_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnSubnetCidrBlockProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnSubnetNetworkAclAssociation(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnSubnetNetworkAclAssociation",
):
"""A CloudFormation ``AWS::EC2::SubnetNetworkAclAssociation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-network-acl-assoc.html
:cloudformationResource: AWS::EC2::SubnetNetworkAclAssociation
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
network_acl_id: builtins.str,
subnet_id: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::SubnetNetworkAclAssociation``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param network_acl_id: ``AWS::EC2::SubnetNetworkAclAssociation.NetworkAclId``.
:param subnet_id: ``AWS::EC2::SubnetNetworkAclAssociation.SubnetId``.
"""
props = CfnSubnetNetworkAclAssociationProps(
network_acl_id=network_acl_id, subnet_id=subnet_id
)
jsii.create(CfnSubnetNetworkAclAssociation, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrAssociationId")
def attr_association_id(self) -> builtins.str:
"""
:cloudformationAttribute: AssociationId
"""
return jsii.get(self, "attrAssociationId")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="networkAclId")
def network_acl_id(self) -> builtins.str:
"""``AWS::EC2::SubnetNetworkAclAssociation.NetworkAclId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-network-acl-assoc.html#cfn-ec2-subnetnetworkaclassociation-networkaclid
"""
return jsii.get(self, "networkAclId")
@network_acl_id.setter # type: ignore
def network_acl_id(self, value: builtins.str) -> None:
jsii.set(self, "networkAclId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetId")
def subnet_id(self) -> builtins.str:
"""``AWS::EC2::SubnetNetworkAclAssociation.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-network-acl-assoc.html#cfn-ec2-subnetnetworkaclassociation-associationid
"""
return jsii.get(self, "subnetId")
@subnet_id.setter # type: ignore
def subnet_id(self, value: builtins.str) -> None:
jsii.set(self, "subnetId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSubnetNetworkAclAssociationProps",
jsii_struct_bases=[],
name_mapping={"network_acl_id": "networkAclId", "subnet_id": "subnetId"},
)
class CfnSubnetNetworkAclAssociationProps:
def __init__(
self,
*,
network_acl_id: builtins.str,
subnet_id: builtins.str,
) -> None:
"""Properties for defining a ``AWS::EC2::SubnetNetworkAclAssociation``.
:param network_acl_id: ``AWS::EC2::SubnetNetworkAclAssociation.NetworkAclId``.
:param subnet_id: ``AWS::EC2::SubnetNetworkAclAssociation.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-network-acl-assoc.html
"""
self._values: typing.Dict[str, typing.Any] = {
"network_acl_id": network_acl_id,
"subnet_id": subnet_id,
}
@builtins.property
def network_acl_id(self) -> builtins.str:
"""``AWS::EC2::SubnetNetworkAclAssociation.NetworkAclId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-network-acl-assoc.html#cfn-ec2-subnetnetworkaclassociation-networkaclid
"""
result = self._values.get("network_acl_id")
assert result is not None, "Required property 'network_acl_id' is missing"
return result
@builtins.property
def subnet_id(self) -> builtins.str:
"""``AWS::EC2::SubnetNetworkAclAssociation.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-network-acl-assoc.html#cfn-ec2-subnetnetworkaclassociation-associationid
"""
result = self._values.get("subnet_id")
assert result is not None, "Required property 'subnet_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnSubnetNetworkAclAssociationProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSubnetProps",
jsii_struct_bases=[],
name_mapping={
"cidr_block": "cidrBlock",
"vpc_id": "vpcId",
"assign_ipv6_address_on_creation": "assignIpv6AddressOnCreation",
"availability_zone": "availabilityZone",
"ipv6_cidr_block": "ipv6CidrBlock",
"map_public_ip_on_launch": "mapPublicIpOnLaunch",
"outpost_arn": "outpostArn",
"tags": "tags",
},
)
class CfnSubnetProps:
def __init__(
self,
*,
cidr_block: builtins.str,
vpc_id: builtins.str,
assign_ipv6_address_on_creation: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
availability_zone: typing.Optional[builtins.str] = None,
ipv6_cidr_block: typing.Optional[builtins.str] = None,
map_public_ip_on_launch: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
outpost_arn: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::Subnet``.
:param cidr_block: ``AWS::EC2::Subnet.CidrBlock``.
:param vpc_id: ``AWS::EC2::Subnet.VpcId``.
:param assign_ipv6_address_on_creation: ``AWS::EC2::Subnet.AssignIpv6AddressOnCreation``.
:param availability_zone: ``AWS::EC2::Subnet.AvailabilityZone``.
:param ipv6_cidr_block: ``AWS::EC2::Subnet.Ipv6CidrBlock``.
:param map_public_ip_on_launch: ``AWS::EC2::Subnet.MapPublicIpOnLaunch``.
:param outpost_arn: ``AWS::EC2::Subnet.OutpostArn``.
:param tags: ``AWS::EC2::Subnet.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html
"""
self._values: typing.Dict[str, typing.Any] = {
"cidr_block": cidr_block,
"vpc_id": vpc_id,
}
if assign_ipv6_address_on_creation is not None:
self._values["assign_ipv6_address_on_creation"] = assign_ipv6_address_on_creation
if availability_zone is not None:
self._values["availability_zone"] = availability_zone
if ipv6_cidr_block is not None:
self._values["ipv6_cidr_block"] = ipv6_cidr_block
if map_public_ip_on_launch is not None:
self._values["map_public_ip_on_launch"] = map_public_ip_on_launch
if outpost_arn is not None:
self._values["outpost_arn"] = outpost_arn
if tags is not None:
self._values["tags"] = tags
@builtins.property
def cidr_block(self) -> builtins.str:
"""``AWS::EC2::Subnet.CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-cidrblock
"""
result = self._values.get("cidr_block")
assert result is not None, "Required property 'cidr_block' is missing"
return result
@builtins.property
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::Subnet.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-awsec2subnet-prop-vpcid
"""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def assign_ipv6_address_on_creation(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Subnet.AssignIpv6AddressOnCreation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-assignipv6addressoncreation
"""
result = self._values.get("assign_ipv6_address_on_creation")
return result
@builtins.property
def availability_zone(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Subnet.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-availabilityzone
"""
result = self._values.get("availability_zone")
return result
@builtins.property
def ipv6_cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Subnet.Ipv6CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-ipv6cidrblock
"""
result = self._values.get("ipv6_cidr_block")
return result
@builtins.property
def map_public_ip_on_launch(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Subnet.MapPublicIpOnLaunch``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-mappubliciponlaunch
"""
result = self._values.get("map_public_ip_on_launch")
return result
@builtins.property
def outpost_arn(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Subnet.OutpostArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-outpostarn
"""
result = self._values.get("outpost_arn")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::Subnet.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html#cfn-ec2-subnet-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnSubnetProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnSubnetRouteTableAssociation(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation",
):
"""A CloudFormation ``AWS::EC2::SubnetRouteTableAssociation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html
:cloudformationResource: AWS::EC2::SubnetRouteTableAssociation
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
route_table_id: builtins.str,
subnet_id: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::SubnetRouteTableAssociation``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param route_table_id: ``AWS::EC2::SubnetRouteTableAssociation.RouteTableId``.
:param subnet_id: ``AWS::EC2::SubnetRouteTableAssociation.SubnetId``.
"""
props = CfnSubnetRouteTableAssociationProps(
route_table_id=route_table_id, subnet_id=subnet_id
)
jsii.create(CfnSubnetRouteTableAssociation, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="routeTableId")
def route_table_id(self) -> builtins.str:
"""``AWS::EC2::SubnetRouteTableAssociation.RouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html#cfn-ec2-subnetroutetableassociation-routetableid
"""
return jsii.get(self, "routeTableId")
@route_table_id.setter # type: ignore
def route_table_id(self, value: builtins.str) -> None:
jsii.set(self, "routeTableId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetId")
def subnet_id(self) -> builtins.str:
"""``AWS::EC2::SubnetRouteTableAssociation.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html#cfn-ec2-subnetroutetableassociation-subnetid
"""
return jsii.get(self, "subnetId")
@subnet_id.setter # type: ignore
def subnet_id(self, value: builtins.str) -> None:
jsii.set(self, "subnetId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociationProps",
jsii_struct_bases=[],
name_mapping={"route_table_id": "routeTableId", "subnet_id": "subnetId"},
)
class CfnSubnetRouteTableAssociationProps:
def __init__(
self,
*,
route_table_id: builtins.str,
subnet_id: builtins.str,
) -> None:
"""Properties for defining a ``AWS::EC2::SubnetRouteTableAssociation``.
:param route_table_id: ``AWS::EC2::SubnetRouteTableAssociation.RouteTableId``.
:param subnet_id: ``AWS::EC2::SubnetRouteTableAssociation.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html
"""
self._values: typing.Dict[str, typing.Any] = {
"route_table_id": route_table_id,
"subnet_id": subnet_id,
}
@builtins.property
def route_table_id(self) -> builtins.str:
"""``AWS::EC2::SubnetRouteTableAssociation.RouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html#cfn-ec2-subnetroutetableassociation-routetableid
"""
result = self._values.get("route_table_id")
assert result is not None, "Required property 'route_table_id' is missing"
return result
@builtins.property
def subnet_id(self) -> builtins.str:
"""``AWS::EC2::SubnetRouteTableAssociation.SubnetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet-route-table-assoc.html#cfn-ec2-subnetroutetableassociation-subnetid
"""
result = self._values.get("subnet_id")
assert result is not None, "Required property 'subnet_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnSubnetRouteTableAssociationProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnTrafficMirrorFilter(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnTrafficMirrorFilter",
):
"""A CloudFormation ``AWS::EC2::TrafficMirrorFilter``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilter.html
:cloudformationResource: AWS::EC2::TrafficMirrorFilter
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
description: typing.Optional[builtins.str] = None,
network_services: typing.Optional[typing.List[builtins.str]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::TrafficMirrorFilter``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param description: ``AWS::EC2::TrafficMirrorFilter.Description``.
:param network_services: ``AWS::EC2::TrafficMirrorFilter.NetworkServices``.
:param tags: ``AWS::EC2::TrafficMirrorFilter.Tags``.
"""
props = CfnTrafficMirrorFilterProps(
description=description, network_services=network_services, tags=tags
)
jsii.create(CfnTrafficMirrorFilter, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::TrafficMirrorFilter.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilter.html#cfn-ec2-trafficmirrorfilter-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="description")
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TrafficMirrorFilter.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilter.html#cfn-ec2-trafficmirrorfilter-description
"""
return jsii.get(self, "description")
@description.setter # type: ignore
def description(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "description", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="networkServices")
def network_services(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::TrafficMirrorFilter.NetworkServices``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilter.html#cfn-ec2-trafficmirrorfilter-networkservices
"""
return jsii.get(self, "networkServices")
@network_services.setter # type: ignore
def network_services(
self,
value: typing.Optional[typing.List[builtins.str]],
) -> None:
jsii.set(self, "networkServices", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnTrafficMirrorFilterProps",
jsii_struct_bases=[],
name_mapping={
"description": "description",
"network_services": "networkServices",
"tags": "tags",
},
)
class CfnTrafficMirrorFilterProps:
def __init__(
self,
*,
description: typing.Optional[builtins.str] = None,
network_services: typing.Optional[typing.List[builtins.str]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::TrafficMirrorFilter``.
:param description: ``AWS::EC2::TrafficMirrorFilter.Description``.
:param network_services: ``AWS::EC2::TrafficMirrorFilter.NetworkServices``.
:param tags: ``AWS::EC2::TrafficMirrorFilter.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilter.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if description is not None:
self._values["description"] = description
if network_services is not None:
self._values["network_services"] = network_services
if tags is not None:
self._values["tags"] = tags
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TrafficMirrorFilter.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilter.html#cfn-ec2-trafficmirrorfilter-description
"""
result = self._values.get("description")
return result
@builtins.property
def network_services(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::TrafficMirrorFilter.NetworkServices``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilter.html#cfn-ec2-trafficmirrorfilter-networkservices
"""
result = self._values.get("network_services")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::TrafficMirrorFilter.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilter.html#cfn-ec2-trafficmirrorfilter-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnTrafficMirrorFilterProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnTrafficMirrorFilterRule(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnTrafficMirrorFilterRule",
):
"""A CloudFormation ``AWS::EC2::TrafficMirrorFilterRule``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html
:cloudformationResource: AWS::EC2::TrafficMirrorFilterRule
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
destination_cidr_block: builtins.str,
rule_action: builtins.str,
rule_number: jsii.Number,
source_cidr_block: builtins.str,
traffic_direction: builtins.str,
traffic_mirror_filter_id: builtins.str,
description: typing.Optional[builtins.str] = None,
destination_port_range: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty"]] = None,
protocol: typing.Optional[jsii.Number] = None,
source_port_range: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty"]] = None,
) -> None:
"""Create a new ``AWS::EC2::TrafficMirrorFilterRule``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param destination_cidr_block: ``AWS::EC2::TrafficMirrorFilterRule.DestinationCidrBlock``.
:param rule_action: ``AWS::EC2::TrafficMirrorFilterRule.RuleAction``.
:param rule_number: ``AWS::EC2::TrafficMirrorFilterRule.RuleNumber``.
:param source_cidr_block: ``AWS::EC2::TrafficMirrorFilterRule.SourceCidrBlock``.
:param traffic_direction: ``AWS::EC2::TrafficMirrorFilterRule.TrafficDirection``.
:param traffic_mirror_filter_id: ``AWS::EC2::TrafficMirrorFilterRule.TrafficMirrorFilterId``.
:param description: ``AWS::EC2::TrafficMirrorFilterRule.Description``.
:param destination_port_range: ``AWS::EC2::TrafficMirrorFilterRule.DestinationPortRange``.
:param protocol: ``AWS::EC2::TrafficMirrorFilterRule.Protocol``.
:param source_port_range: ``AWS::EC2::TrafficMirrorFilterRule.SourcePortRange``.
"""
props = CfnTrafficMirrorFilterRuleProps(
destination_cidr_block=destination_cidr_block,
rule_action=rule_action,
rule_number=rule_number,
source_cidr_block=source_cidr_block,
traffic_direction=traffic_direction,
traffic_mirror_filter_id=traffic_mirror_filter_id,
description=description,
destination_port_range=destination_port_range,
protocol=protocol,
source_port_range=source_port_range,
)
jsii.create(CfnTrafficMirrorFilterRule, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="destinationCidrBlock")
def destination_cidr_block(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorFilterRule.DestinationCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-destinationcidrblock
"""
return jsii.get(self, "destinationCidrBlock")
@destination_cidr_block.setter # type: ignore
def destination_cidr_block(self, value: builtins.str) -> None:
jsii.set(self, "destinationCidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ruleAction")
def rule_action(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorFilterRule.RuleAction``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-ruleaction
"""
return jsii.get(self, "ruleAction")
@rule_action.setter # type: ignore
def rule_action(self, value: builtins.str) -> None:
jsii.set(self, "ruleAction", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="ruleNumber")
def rule_number(self) -> jsii.Number:
"""``AWS::EC2::TrafficMirrorFilterRule.RuleNumber``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-rulenumber
"""
return jsii.get(self, "ruleNumber")
@rule_number.setter # type: ignore
def rule_number(self, value: jsii.Number) -> None:
jsii.set(self, "ruleNumber", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="sourceCidrBlock")
def source_cidr_block(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorFilterRule.SourceCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-sourcecidrblock
"""
return jsii.get(self, "sourceCidrBlock")
@source_cidr_block.setter # type: ignore
def source_cidr_block(self, value: builtins.str) -> None:
jsii.set(self, "sourceCidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="trafficDirection")
def traffic_direction(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorFilterRule.TrafficDirection``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-trafficdirection
"""
return jsii.get(self, "trafficDirection")
@traffic_direction.setter # type: ignore
def traffic_direction(self, value: builtins.str) -> None:
jsii.set(self, "trafficDirection", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="trafficMirrorFilterId")
def traffic_mirror_filter_id(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorFilterRule.TrafficMirrorFilterId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-trafficmirrorfilterid
"""
return jsii.get(self, "trafficMirrorFilterId")
@traffic_mirror_filter_id.setter # type: ignore
def traffic_mirror_filter_id(self, value: builtins.str) -> None:
jsii.set(self, "trafficMirrorFilterId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="description")
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TrafficMirrorFilterRule.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-description
"""
return jsii.get(self, "description")
@description.setter # type: ignore
def description(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "description", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="destinationPortRange")
def destination_port_range(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty"]]:
"""``AWS::EC2::TrafficMirrorFilterRule.DestinationPortRange``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-destinationportrange
"""
return jsii.get(self, "destinationPortRange")
@destination_port_range.setter # type: ignore
def destination_port_range(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty"]],
) -> None:
jsii.set(self, "destinationPortRange", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="protocol")
def protocol(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::TrafficMirrorFilterRule.Protocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-protocol
"""
return jsii.get(self, "protocol")
@protocol.setter # type: ignore
def protocol(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "protocol", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="sourcePortRange")
def source_port_range(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty"]]:
"""``AWS::EC2::TrafficMirrorFilterRule.SourcePortRange``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-sourceportrange
"""
return jsii.get(self, "sourcePortRange")
@source_port_range.setter # type: ignore
def source_port_range(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, "CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty"]],
) -> None:
jsii.set(self, "sourcePortRange", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty",
jsii_struct_bases=[],
name_mapping={"from_port": "fromPort", "to_port": "toPort"},
)
class TrafficMirrorPortRangeProperty:
def __init__(self, *, from_port: jsii.Number, to_port: jsii.Number) -> None:
"""
:param from_port: ``CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty.FromPort``.
:param to_port: ``CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty.ToPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-trafficmirrorfilterrule-trafficmirrorportrange.html
"""
self._values: typing.Dict[str, typing.Any] = {
"from_port": from_port,
"to_port": to_port,
}
@builtins.property
def from_port(self) -> jsii.Number:
"""``CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty.FromPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-trafficmirrorfilterrule-trafficmirrorportrange.html#cfn-ec2-trafficmirrorfilterrule-trafficmirrorportrange-fromport
"""
result = self._values.get("from_port")
assert result is not None, "Required property 'from_port' is missing"
return result
@builtins.property
def to_port(self) -> jsii.Number:
"""``CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty.ToPort``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-trafficmirrorfilterrule-trafficmirrorportrange.html#cfn-ec2-trafficmirrorfilterrule-trafficmirrorportrange-toport
"""
result = self._values.get("to_port")
assert result is not None, "Required property 'to_port' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "TrafficMirrorPortRangeProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnTrafficMirrorFilterRuleProps",
jsii_struct_bases=[],
name_mapping={
"destination_cidr_block": "destinationCidrBlock",
"rule_action": "ruleAction",
"rule_number": "ruleNumber",
"source_cidr_block": "sourceCidrBlock",
"traffic_direction": "trafficDirection",
"traffic_mirror_filter_id": "trafficMirrorFilterId",
"description": "description",
"destination_port_range": "destinationPortRange",
"protocol": "protocol",
"source_port_range": "sourcePortRange",
},
)
class CfnTrafficMirrorFilterRuleProps:
def __init__(
self,
*,
destination_cidr_block: builtins.str,
rule_action: builtins.str,
rule_number: jsii.Number,
source_cidr_block: builtins.str,
traffic_direction: builtins.str,
traffic_mirror_filter_id: builtins.str,
description: typing.Optional[builtins.str] = None,
destination_port_range: typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty]] = None,
protocol: typing.Optional[jsii.Number] = None,
source_port_range: typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::TrafficMirrorFilterRule``.
:param destination_cidr_block: ``AWS::EC2::TrafficMirrorFilterRule.DestinationCidrBlock``.
:param rule_action: ``AWS::EC2::TrafficMirrorFilterRule.RuleAction``.
:param rule_number: ``AWS::EC2::TrafficMirrorFilterRule.RuleNumber``.
:param source_cidr_block: ``AWS::EC2::TrafficMirrorFilterRule.SourceCidrBlock``.
:param traffic_direction: ``AWS::EC2::TrafficMirrorFilterRule.TrafficDirection``.
:param traffic_mirror_filter_id: ``AWS::EC2::TrafficMirrorFilterRule.TrafficMirrorFilterId``.
:param description: ``AWS::EC2::TrafficMirrorFilterRule.Description``.
:param destination_port_range: ``AWS::EC2::TrafficMirrorFilterRule.DestinationPortRange``.
:param protocol: ``AWS::EC2::TrafficMirrorFilterRule.Protocol``.
:param source_port_range: ``AWS::EC2::TrafficMirrorFilterRule.SourcePortRange``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html
"""
self._values: typing.Dict[str, typing.Any] = {
"destination_cidr_block": destination_cidr_block,
"rule_action": rule_action,
"rule_number": rule_number,
"source_cidr_block": source_cidr_block,
"traffic_direction": traffic_direction,
"traffic_mirror_filter_id": traffic_mirror_filter_id,
}
if description is not None:
self._values["description"] = description
if destination_port_range is not None:
self._values["destination_port_range"] = destination_port_range
if protocol is not None:
self._values["protocol"] = protocol
if source_port_range is not None:
self._values["source_port_range"] = source_port_range
@builtins.property
def destination_cidr_block(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorFilterRule.DestinationCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-destinationcidrblock
"""
result = self._values.get("destination_cidr_block")
assert result is not None, "Required property 'destination_cidr_block' is missing"
return result
@builtins.property
def rule_action(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorFilterRule.RuleAction``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-ruleaction
"""
result = self._values.get("rule_action")
assert result is not None, "Required property 'rule_action' is missing"
return result
@builtins.property
def rule_number(self) -> jsii.Number:
"""``AWS::EC2::TrafficMirrorFilterRule.RuleNumber``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-rulenumber
"""
result = self._values.get("rule_number")
assert result is not None, "Required property 'rule_number' is missing"
return result
@builtins.property
def source_cidr_block(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorFilterRule.SourceCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-sourcecidrblock
"""
result = self._values.get("source_cidr_block")
assert result is not None, "Required property 'source_cidr_block' is missing"
return result
@builtins.property
def traffic_direction(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorFilterRule.TrafficDirection``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-trafficdirection
"""
result = self._values.get("traffic_direction")
assert result is not None, "Required property 'traffic_direction' is missing"
return result
@builtins.property
def traffic_mirror_filter_id(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorFilterRule.TrafficMirrorFilterId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-trafficmirrorfilterid
"""
result = self._values.get("traffic_mirror_filter_id")
assert result is not None, "Required property 'traffic_mirror_filter_id' is missing"
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TrafficMirrorFilterRule.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-description
"""
result = self._values.get("description")
return result
@builtins.property
def destination_port_range(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty]]:
"""``AWS::EC2::TrafficMirrorFilterRule.DestinationPortRange``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-destinationportrange
"""
result = self._values.get("destination_port_range")
return result
@builtins.property
def protocol(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::TrafficMirrorFilterRule.Protocol``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-protocol
"""
result = self._values.get("protocol")
return result
@builtins.property
def source_port_range(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, CfnTrafficMirrorFilterRule.TrafficMirrorPortRangeProperty]]:
"""``AWS::EC2::TrafficMirrorFilterRule.SourcePortRange``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorfilterrule.html#cfn-ec2-trafficmirrorfilterrule-sourceportrange
"""
result = self._values.get("source_port_range")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnTrafficMirrorFilterRuleProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnTrafficMirrorSession(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnTrafficMirrorSession",
):
"""A CloudFormation ``AWS::EC2::TrafficMirrorSession``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html
:cloudformationResource: AWS::EC2::TrafficMirrorSession
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
network_interface_id: builtins.str,
session_number: jsii.Number,
traffic_mirror_filter_id: builtins.str,
traffic_mirror_target_id: builtins.str,
description: typing.Optional[builtins.str] = None,
packet_length: typing.Optional[jsii.Number] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
virtual_network_id: typing.Optional[jsii.Number] = None,
) -> None:
"""Create a new ``AWS::EC2::TrafficMirrorSession``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param network_interface_id: ``AWS::EC2::TrafficMirrorSession.NetworkInterfaceId``.
:param session_number: ``AWS::EC2::TrafficMirrorSession.SessionNumber``.
:param traffic_mirror_filter_id: ``AWS::EC2::TrafficMirrorSession.TrafficMirrorFilterId``.
:param traffic_mirror_target_id: ``AWS::EC2::TrafficMirrorSession.TrafficMirrorTargetId``.
:param description: ``AWS::EC2::TrafficMirrorSession.Description``.
:param packet_length: ``AWS::EC2::TrafficMirrorSession.PacketLength``.
:param tags: ``AWS::EC2::TrafficMirrorSession.Tags``.
:param virtual_network_id: ``AWS::EC2::TrafficMirrorSession.VirtualNetworkId``.
"""
props = CfnTrafficMirrorSessionProps(
network_interface_id=network_interface_id,
session_number=session_number,
traffic_mirror_filter_id=traffic_mirror_filter_id,
traffic_mirror_target_id=traffic_mirror_target_id,
description=description,
packet_length=packet_length,
tags=tags,
virtual_network_id=virtual_network_id,
)
jsii.create(CfnTrafficMirrorSession, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::TrafficMirrorSession.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="networkInterfaceId")
def network_interface_id(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorSession.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-networkinterfaceid
"""
return jsii.get(self, "networkInterfaceId")
@network_interface_id.setter # type: ignore
def network_interface_id(self, value: builtins.str) -> None:
jsii.set(self, "networkInterfaceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="sessionNumber")
def session_number(self) -> jsii.Number:
"""``AWS::EC2::TrafficMirrorSession.SessionNumber``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-sessionnumber
"""
return jsii.get(self, "sessionNumber")
@session_number.setter # type: ignore
def session_number(self, value: jsii.Number) -> None:
jsii.set(self, "sessionNumber", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="trafficMirrorFilterId")
def traffic_mirror_filter_id(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorSession.TrafficMirrorFilterId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-trafficmirrorfilterid
"""
return jsii.get(self, "trafficMirrorFilterId")
@traffic_mirror_filter_id.setter # type: ignore
def traffic_mirror_filter_id(self, value: builtins.str) -> None:
jsii.set(self, "trafficMirrorFilterId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="trafficMirrorTargetId")
def traffic_mirror_target_id(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorSession.TrafficMirrorTargetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-trafficmirrortargetid
"""
return jsii.get(self, "trafficMirrorTargetId")
@traffic_mirror_target_id.setter # type: ignore
def traffic_mirror_target_id(self, value: builtins.str) -> None:
jsii.set(self, "trafficMirrorTargetId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="description")
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TrafficMirrorSession.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-description
"""
return jsii.get(self, "description")
@description.setter # type: ignore
def description(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "description", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="packetLength")
def packet_length(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::TrafficMirrorSession.PacketLength``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-packetlength
"""
return jsii.get(self, "packetLength")
@packet_length.setter # type: ignore
def packet_length(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "packetLength", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="virtualNetworkId")
def virtual_network_id(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::TrafficMirrorSession.VirtualNetworkId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-virtualnetworkid
"""
return jsii.get(self, "virtualNetworkId")
@virtual_network_id.setter # type: ignore
def virtual_network_id(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "virtualNetworkId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnTrafficMirrorSessionProps",
jsii_struct_bases=[],
name_mapping={
"network_interface_id": "networkInterfaceId",
"session_number": "sessionNumber",
"traffic_mirror_filter_id": "trafficMirrorFilterId",
"traffic_mirror_target_id": "trafficMirrorTargetId",
"description": "description",
"packet_length": "packetLength",
"tags": "tags",
"virtual_network_id": "virtualNetworkId",
},
)
class CfnTrafficMirrorSessionProps:
def __init__(
self,
*,
network_interface_id: builtins.str,
session_number: jsii.Number,
traffic_mirror_filter_id: builtins.str,
traffic_mirror_target_id: builtins.str,
description: typing.Optional[builtins.str] = None,
packet_length: typing.Optional[jsii.Number] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
virtual_network_id: typing.Optional[jsii.Number] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::TrafficMirrorSession``.
:param network_interface_id: ``AWS::EC2::TrafficMirrorSession.NetworkInterfaceId``.
:param session_number: ``AWS::EC2::TrafficMirrorSession.SessionNumber``.
:param traffic_mirror_filter_id: ``AWS::EC2::TrafficMirrorSession.TrafficMirrorFilterId``.
:param traffic_mirror_target_id: ``AWS::EC2::TrafficMirrorSession.TrafficMirrorTargetId``.
:param description: ``AWS::EC2::TrafficMirrorSession.Description``.
:param packet_length: ``AWS::EC2::TrafficMirrorSession.PacketLength``.
:param tags: ``AWS::EC2::TrafficMirrorSession.Tags``.
:param virtual_network_id: ``AWS::EC2::TrafficMirrorSession.VirtualNetworkId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html
"""
self._values: typing.Dict[str, typing.Any] = {
"network_interface_id": network_interface_id,
"session_number": session_number,
"traffic_mirror_filter_id": traffic_mirror_filter_id,
"traffic_mirror_target_id": traffic_mirror_target_id,
}
if description is not None:
self._values["description"] = description
if packet_length is not None:
self._values["packet_length"] = packet_length
if tags is not None:
self._values["tags"] = tags
if virtual_network_id is not None:
self._values["virtual_network_id"] = virtual_network_id
@builtins.property
def network_interface_id(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorSession.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-networkinterfaceid
"""
result = self._values.get("network_interface_id")
assert result is not None, "Required property 'network_interface_id' is missing"
return result
@builtins.property
def session_number(self) -> jsii.Number:
"""``AWS::EC2::TrafficMirrorSession.SessionNumber``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-sessionnumber
"""
result = self._values.get("session_number")
assert result is not None, "Required property 'session_number' is missing"
return result
@builtins.property
def traffic_mirror_filter_id(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorSession.TrafficMirrorFilterId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-trafficmirrorfilterid
"""
result = self._values.get("traffic_mirror_filter_id")
assert result is not None, "Required property 'traffic_mirror_filter_id' is missing"
return result
@builtins.property
def traffic_mirror_target_id(self) -> builtins.str:
"""``AWS::EC2::TrafficMirrorSession.TrafficMirrorTargetId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-trafficmirrortargetid
"""
result = self._values.get("traffic_mirror_target_id")
assert result is not None, "Required property 'traffic_mirror_target_id' is missing"
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TrafficMirrorSession.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-description
"""
result = self._values.get("description")
return result
@builtins.property
def packet_length(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::TrafficMirrorSession.PacketLength``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-packetlength
"""
result = self._values.get("packet_length")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::TrafficMirrorSession.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-tags
"""
result = self._values.get("tags")
return result
@builtins.property
def virtual_network_id(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::TrafficMirrorSession.VirtualNetworkId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrorsession.html#cfn-ec2-trafficmirrorsession-virtualnetworkid
"""
result = self._values.get("virtual_network_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnTrafficMirrorSessionProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnTrafficMirrorTarget(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnTrafficMirrorTarget",
):
"""A CloudFormation ``AWS::EC2::TrafficMirrorTarget``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html
:cloudformationResource: AWS::EC2::TrafficMirrorTarget
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
description: typing.Optional[builtins.str] = None,
network_interface_id: typing.Optional[builtins.str] = None,
network_load_balancer_arn: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::TrafficMirrorTarget``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param description: ``AWS::EC2::TrafficMirrorTarget.Description``.
:param network_interface_id: ``AWS::EC2::TrafficMirrorTarget.NetworkInterfaceId``.
:param network_load_balancer_arn: ``AWS::EC2::TrafficMirrorTarget.NetworkLoadBalancerArn``.
:param tags: ``AWS::EC2::TrafficMirrorTarget.Tags``.
"""
props = CfnTrafficMirrorTargetProps(
description=description,
network_interface_id=network_interface_id,
network_load_balancer_arn=network_load_balancer_arn,
tags=tags,
)
jsii.create(CfnTrafficMirrorTarget, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::TrafficMirrorTarget.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html#cfn-ec2-trafficmirrortarget-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="description")
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TrafficMirrorTarget.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html#cfn-ec2-trafficmirrortarget-description
"""
return jsii.get(self, "description")
@description.setter # type: ignore
def description(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "description", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="networkInterfaceId")
def network_interface_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TrafficMirrorTarget.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html#cfn-ec2-trafficmirrortarget-networkinterfaceid
"""
return jsii.get(self, "networkInterfaceId")
@network_interface_id.setter # type: ignore
def network_interface_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "networkInterfaceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="networkLoadBalancerArn")
def network_load_balancer_arn(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TrafficMirrorTarget.NetworkLoadBalancerArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html#cfn-ec2-trafficmirrortarget-networkloadbalancerarn
"""
return jsii.get(self, "networkLoadBalancerArn")
@network_load_balancer_arn.setter # type: ignore
def network_load_balancer_arn(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "networkLoadBalancerArn", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnTrafficMirrorTargetProps",
jsii_struct_bases=[],
name_mapping={
"description": "description",
"network_interface_id": "networkInterfaceId",
"network_load_balancer_arn": "networkLoadBalancerArn",
"tags": "tags",
},
)
class CfnTrafficMirrorTargetProps:
def __init__(
self,
*,
description: typing.Optional[builtins.str] = None,
network_interface_id: typing.Optional[builtins.str] = None,
network_load_balancer_arn: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::TrafficMirrorTarget``.
:param description: ``AWS::EC2::TrafficMirrorTarget.Description``.
:param network_interface_id: ``AWS::EC2::TrafficMirrorTarget.NetworkInterfaceId``.
:param network_load_balancer_arn: ``AWS::EC2::TrafficMirrorTarget.NetworkLoadBalancerArn``.
:param tags: ``AWS::EC2::TrafficMirrorTarget.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if description is not None:
self._values["description"] = description
if network_interface_id is not None:
self._values["network_interface_id"] = network_interface_id
if network_load_balancer_arn is not None:
self._values["network_load_balancer_arn"] = network_load_balancer_arn
if tags is not None:
self._values["tags"] = tags
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TrafficMirrorTarget.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html#cfn-ec2-trafficmirrortarget-description
"""
result = self._values.get("description")
return result
@builtins.property
def network_interface_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TrafficMirrorTarget.NetworkInterfaceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html#cfn-ec2-trafficmirrortarget-networkinterfaceid
"""
result = self._values.get("network_interface_id")
return result
@builtins.property
def network_load_balancer_arn(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TrafficMirrorTarget.NetworkLoadBalancerArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html#cfn-ec2-trafficmirrortarget-networkloadbalancerarn
"""
result = self._values.get("network_load_balancer_arn")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::TrafficMirrorTarget.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-trafficmirrortarget.html#cfn-ec2-trafficmirrortarget-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnTrafficMirrorTargetProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnTransitGateway(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnTransitGateway",
):
"""A CloudFormation ``AWS::EC2::TransitGateway``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html
:cloudformationResource: AWS::EC2::TransitGateway
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
amazon_side_asn: typing.Optional[jsii.Number] = None,
auto_accept_shared_attachments: typing.Optional[builtins.str] = None,
default_route_table_association: typing.Optional[builtins.str] = None,
default_route_table_propagation: typing.Optional[builtins.str] = None,
description: typing.Optional[builtins.str] = None,
dns_support: typing.Optional[builtins.str] = None,
multicast_support: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
vpn_ecmp_support: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::TransitGateway``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param amazon_side_asn: ``AWS::EC2::TransitGateway.AmazonSideAsn``.
:param auto_accept_shared_attachments: ``AWS::EC2::TransitGateway.AutoAcceptSharedAttachments``.
:param default_route_table_association: ``AWS::EC2::TransitGateway.DefaultRouteTableAssociation``.
:param default_route_table_propagation: ``AWS::EC2::TransitGateway.DefaultRouteTablePropagation``.
:param description: ``AWS::EC2::TransitGateway.Description``.
:param dns_support: ``AWS::EC2::TransitGateway.DnsSupport``.
:param multicast_support: ``AWS::EC2::TransitGateway.MulticastSupport``.
:param tags: ``AWS::EC2::TransitGateway.Tags``.
:param vpn_ecmp_support: ``AWS::EC2::TransitGateway.VpnEcmpSupport``.
"""
props = CfnTransitGatewayProps(
amazon_side_asn=amazon_side_asn,
auto_accept_shared_attachments=auto_accept_shared_attachments,
default_route_table_association=default_route_table_association,
default_route_table_propagation=default_route_table_propagation,
description=description,
dns_support=dns_support,
multicast_support=multicast_support,
tags=tags,
vpn_ecmp_support=vpn_ecmp_support,
)
jsii.create(CfnTransitGateway, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::TransitGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="amazonSideAsn")
def amazon_side_asn(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::TransitGateway.AmazonSideAsn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-amazonsideasn
"""
return jsii.get(self, "amazonSideAsn")
@amazon_side_asn.setter # type: ignore
def amazon_side_asn(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "amazonSideAsn", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="autoAcceptSharedAttachments")
def auto_accept_shared_attachments(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.AutoAcceptSharedAttachments``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-autoacceptsharedattachments
"""
return jsii.get(self, "autoAcceptSharedAttachments")
@auto_accept_shared_attachments.setter # type: ignore
def auto_accept_shared_attachments(
self,
value: typing.Optional[builtins.str],
) -> None:
jsii.set(self, "autoAcceptSharedAttachments", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="defaultRouteTableAssociation")
def default_route_table_association(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.DefaultRouteTableAssociation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-defaultroutetableassociation
"""
return jsii.get(self, "defaultRouteTableAssociation")
@default_route_table_association.setter # type: ignore
def default_route_table_association(
self,
value: typing.Optional[builtins.str],
) -> None:
jsii.set(self, "defaultRouteTableAssociation", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="defaultRouteTablePropagation")
def default_route_table_propagation(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.DefaultRouteTablePropagation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-defaultroutetablepropagation
"""
return jsii.get(self, "defaultRouteTablePropagation")
@default_route_table_propagation.setter # type: ignore
def default_route_table_propagation(
self,
value: typing.Optional[builtins.str],
) -> None:
jsii.set(self, "defaultRouteTablePropagation", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="description")
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-description
"""
return jsii.get(self, "description")
@description.setter # type: ignore
def description(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "description", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="dnsSupport")
def dns_support(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.DnsSupport``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-dnssupport
"""
return jsii.get(self, "dnsSupport")
@dns_support.setter # type: ignore
def dns_support(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "dnsSupport", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="multicastSupport")
def multicast_support(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.MulticastSupport``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-multicastsupport
"""
return jsii.get(self, "multicastSupport")
@multicast_support.setter # type: ignore
def multicast_support(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "multicastSupport", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpnEcmpSupport")
def vpn_ecmp_support(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.VpnEcmpSupport``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-vpnecmpsupport
"""
return jsii.get(self, "vpnEcmpSupport")
@vpn_ecmp_support.setter # type: ignore
def vpn_ecmp_support(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "vpnEcmpSupport", value)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnTransitGatewayAttachment(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnTransitGatewayAttachment",
):
"""A CloudFormation ``AWS::EC2::TransitGatewayAttachment``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayattachment.html
:cloudformationResource: AWS::EC2::TransitGatewayAttachment
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
subnet_ids: typing.List[builtins.str],
transit_gateway_id: builtins.str,
vpc_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::TransitGatewayAttachment``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param subnet_ids: ``AWS::EC2::TransitGatewayAttachment.SubnetIds``.
:param transit_gateway_id: ``AWS::EC2::TransitGatewayAttachment.TransitGatewayId``.
:param vpc_id: ``AWS::EC2::TransitGatewayAttachment.VpcId``.
:param tags: ``AWS::EC2::TransitGatewayAttachment.Tags``.
"""
props = CfnTransitGatewayAttachmentProps(
subnet_ids=subnet_ids,
transit_gateway_id=transit_gateway_id,
vpc_id=vpc_id,
tags=tags,
)
jsii.create(CfnTransitGatewayAttachment, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::TransitGatewayAttachment.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayattachment.html#cfn-ec2-transitgatewayattachment-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetIds")
def subnet_ids(self) -> typing.List[builtins.str]:
"""``AWS::EC2::TransitGatewayAttachment.SubnetIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayattachment.html#cfn-ec2-transitgatewayattachment-subnetids
"""
return jsii.get(self, "subnetIds")
@subnet_ids.setter # type: ignore
def subnet_ids(self, value: typing.List[builtins.str]) -> None:
jsii.set(self, "subnetIds", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="transitGatewayId")
def transit_gateway_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayAttachment.TransitGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayattachment.html#cfn-ec2-transitgatewayattachment-transitgatewayid
"""
return jsii.get(self, "transitGatewayId")
@transit_gateway_id.setter # type: ignore
def transit_gateway_id(self, value: builtins.str) -> None:
jsii.set(self, "transitGatewayId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayAttachment.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayattachment.html#cfn-ec2-transitgatewayattachment-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: builtins.str) -> None:
jsii.set(self, "vpcId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnTransitGatewayAttachmentProps",
jsii_struct_bases=[],
name_mapping={
"subnet_ids": "subnetIds",
"transit_gateway_id": "transitGatewayId",
"vpc_id": "vpcId",
"tags": "tags",
},
)
class CfnTransitGatewayAttachmentProps:
def __init__(
self,
*,
subnet_ids: typing.List[builtins.str],
transit_gateway_id: builtins.str,
vpc_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::TransitGatewayAttachment``.
:param subnet_ids: ``AWS::EC2::TransitGatewayAttachment.SubnetIds``.
:param transit_gateway_id: ``AWS::EC2::TransitGatewayAttachment.TransitGatewayId``.
:param vpc_id: ``AWS::EC2::TransitGatewayAttachment.VpcId``.
:param tags: ``AWS::EC2::TransitGatewayAttachment.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayattachment.html
"""
self._values: typing.Dict[str, typing.Any] = {
"subnet_ids": subnet_ids,
"transit_gateway_id": transit_gateway_id,
"vpc_id": vpc_id,
}
if tags is not None:
self._values["tags"] = tags
@builtins.property
def subnet_ids(self) -> typing.List[builtins.str]:
"""``AWS::EC2::TransitGatewayAttachment.SubnetIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayattachment.html#cfn-ec2-transitgatewayattachment-subnetids
"""
result = self._values.get("subnet_ids")
assert result is not None, "Required property 'subnet_ids' is missing"
return result
@builtins.property
def transit_gateway_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayAttachment.TransitGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayattachment.html#cfn-ec2-transitgatewayattachment-transitgatewayid
"""
result = self._values.get("transit_gateway_id")
assert result is not None, "Required property 'transit_gateway_id' is missing"
return result
@builtins.property
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayAttachment.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayattachment.html#cfn-ec2-transitgatewayattachment-vpcid
"""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::TransitGatewayAttachment.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayattachment.html#cfn-ec2-transitgatewayattachment-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnTransitGatewayAttachmentProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnTransitGatewayProps",
jsii_struct_bases=[],
name_mapping={
"amazon_side_asn": "amazonSideAsn",
"auto_accept_shared_attachments": "autoAcceptSharedAttachments",
"default_route_table_association": "defaultRouteTableAssociation",
"default_route_table_propagation": "defaultRouteTablePropagation",
"description": "description",
"dns_support": "dnsSupport",
"multicast_support": "multicastSupport",
"tags": "tags",
"vpn_ecmp_support": "vpnEcmpSupport",
},
)
class CfnTransitGatewayProps:
def __init__(
self,
*,
amazon_side_asn: typing.Optional[jsii.Number] = None,
auto_accept_shared_attachments: typing.Optional[builtins.str] = None,
default_route_table_association: typing.Optional[builtins.str] = None,
default_route_table_propagation: typing.Optional[builtins.str] = None,
description: typing.Optional[builtins.str] = None,
dns_support: typing.Optional[builtins.str] = None,
multicast_support: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
vpn_ecmp_support: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::TransitGateway``.
:param amazon_side_asn: ``AWS::EC2::TransitGateway.AmazonSideAsn``.
:param auto_accept_shared_attachments: ``AWS::EC2::TransitGateway.AutoAcceptSharedAttachments``.
:param default_route_table_association: ``AWS::EC2::TransitGateway.DefaultRouteTableAssociation``.
:param default_route_table_propagation: ``AWS::EC2::TransitGateway.DefaultRouteTablePropagation``.
:param description: ``AWS::EC2::TransitGateway.Description``.
:param dns_support: ``AWS::EC2::TransitGateway.DnsSupport``.
:param multicast_support: ``AWS::EC2::TransitGateway.MulticastSupport``.
:param tags: ``AWS::EC2::TransitGateway.Tags``.
:param vpn_ecmp_support: ``AWS::EC2::TransitGateway.VpnEcmpSupport``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if amazon_side_asn is not None:
self._values["amazon_side_asn"] = amazon_side_asn
if auto_accept_shared_attachments is not None:
self._values["auto_accept_shared_attachments"] = auto_accept_shared_attachments
if default_route_table_association is not None:
self._values["default_route_table_association"] = default_route_table_association
if default_route_table_propagation is not None:
self._values["default_route_table_propagation"] = default_route_table_propagation
if description is not None:
self._values["description"] = description
if dns_support is not None:
self._values["dns_support"] = dns_support
if multicast_support is not None:
self._values["multicast_support"] = multicast_support
if tags is not None:
self._values["tags"] = tags
if vpn_ecmp_support is not None:
self._values["vpn_ecmp_support"] = vpn_ecmp_support
@builtins.property
def amazon_side_asn(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::TransitGateway.AmazonSideAsn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-amazonsideasn
"""
result = self._values.get("amazon_side_asn")
return result
@builtins.property
def auto_accept_shared_attachments(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.AutoAcceptSharedAttachments``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-autoacceptsharedattachments
"""
result = self._values.get("auto_accept_shared_attachments")
return result
@builtins.property
def default_route_table_association(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.DefaultRouteTableAssociation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-defaultroutetableassociation
"""
result = self._values.get("default_route_table_association")
return result
@builtins.property
def default_route_table_propagation(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.DefaultRouteTablePropagation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-defaultroutetablepropagation
"""
result = self._values.get("default_route_table_propagation")
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.Description``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-description
"""
result = self._values.get("description")
return result
@builtins.property
def dns_support(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.DnsSupport``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-dnssupport
"""
result = self._values.get("dns_support")
return result
@builtins.property
def multicast_support(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.MulticastSupport``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-multicastsupport
"""
result = self._values.get("multicast_support")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::TransitGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-tags
"""
result = self._values.get("tags")
return result
@builtins.property
def vpn_ecmp_support(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGateway.VpnEcmpSupport``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html#cfn-ec2-transitgateway-vpnecmpsupport
"""
result = self._values.get("vpn_ecmp_support")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnTransitGatewayProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnTransitGatewayRoute(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnTransitGatewayRoute",
):
"""A CloudFormation ``AWS::EC2::TransitGatewayRoute``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroute.html
:cloudformationResource: AWS::EC2::TransitGatewayRoute
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
transit_gateway_route_table_id: builtins.str,
blackhole: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
destination_cidr_block: typing.Optional[builtins.str] = None,
transit_gateway_attachment_id: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::TransitGatewayRoute``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param transit_gateway_route_table_id: ``AWS::EC2::TransitGatewayRoute.TransitGatewayRouteTableId``.
:param blackhole: ``AWS::EC2::TransitGatewayRoute.Blackhole``.
:param destination_cidr_block: ``AWS::EC2::TransitGatewayRoute.DestinationCidrBlock``.
:param transit_gateway_attachment_id: ``AWS::EC2::TransitGatewayRoute.TransitGatewayAttachmentId``.
"""
props = CfnTransitGatewayRouteProps(
transit_gateway_route_table_id=transit_gateway_route_table_id,
blackhole=blackhole,
destination_cidr_block=destination_cidr_block,
transit_gateway_attachment_id=transit_gateway_attachment_id,
)
jsii.create(CfnTransitGatewayRoute, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="transitGatewayRouteTableId")
def transit_gateway_route_table_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayRoute.TransitGatewayRouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroute.html#cfn-ec2-transitgatewayroute-transitgatewayroutetableid
"""
return jsii.get(self, "transitGatewayRouteTableId")
@transit_gateway_route_table_id.setter # type: ignore
def transit_gateway_route_table_id(self, value: builtins.str) -> None:
jsii.set(self, "transitGatewayRouteTableId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="blackhole")
def blackhole(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::TransitGatewayRoute.Blackhole``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroute.html#cfn-ec2-transitgatewayroute-blackhole
"""
return jsii.get(self, "blackhole")
@blackhole.setter # type: ignore
def blackhole(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "blackhole", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="destinationCidrBlock")
def destination_cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGatewayRoute.DestinationCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroute.html#cfn-ec2-transitgatewayroute-destinationcidrblock
"""
return jsii.get(self, "destinationCidrBlock")
@destination_cidr_block.setter # type: ignore
def destination_cidr_block(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "destinationCidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="transitGatewayAttachmentId")
def transit_gateway_attachment_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGatewayRoute.TransitGatewayAttachmentId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroute.html#cfn-ec2-transitgatewayroute-transitgatewayattachmentid
"""
return jsii.get(self, "transitGatewayAttachmentId")
@transit_gateway_attachment_id.setter # type: ignore
def transit_gateway_attachment_id(
self,
value: typing.Optional[builtins.str],
) -> None:
jsii.set(self, "transitGatewayAttachmentId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnTransitGatewayRouteProps",
jsii_struct_bases=[],
name_mapping={
"transit_gateway_route_table_id": "transitGatewayRouteTableId",
"blackhole": "blackhole",
"destination_cidr_block": "destinationCidrBlock",
"transit_gateway_attachment_id": "transitGatewayAttachmentId",
},
)
class CfnTransitGatewayRouteProps:
def __init__(
self,
*,
transit_gateway_route_table_id: builtins.str,
blackhole: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
destination_cidr_block: typing.Optional[builtins.str] = None,
transit_gateway_attachment_id: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::TransitGatewayRoute``.
:param transit_gateway_route_table_id: ``AWS::EC2::TransitGatewayRoute.TransitGatewayRouteTableId``.
:param blackhole: ``AWS::EC2::TransitGatewayRoute.Blackhole``.
:param destination_cidr_block: ``AWS::EC2::TransitGatewayRoute.DestinationCidrBlock``.
:param transit_gateway_attachment_id: ``AWS::EC2::TransitGatewayRoute.TransitGatewayAttachmentId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroute.html
"""
self._values: typing.Dict[str, typing.Any] = {
"transit_gateway_route_table_id": transit_gateway_route_table_id,
}
if blackhole is not None:
self._values["blackhole"] = blackhole
if destination_cidr_block is not None:
self._values["destination_cidr_block"] = destination_cidr_block
if transit_gateway_attachment_id is not None:
self._values["transit_gateway_attachment_id"] = transit_gateway_attachment_id
@builtins.property
def transit_gateway_route_table_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayRoute.TransitGatewayRouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroute.html#cfn-ec2-transitgatewayroute-transitgatewayroutetableid
"""
result = self._values.get("transit_gateway_route_table_id")
assert result is not None, "Required property 'transit_gateway_route_table_id' is missing"
return result
@builtins.property
def blackhole(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::TransitGatewayRoute.Blackhole``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroute.html#cfn-ec2-transitgatewayroute-blackhole
"""
result = self._values.get("blackhole")
return result
@builtins.property
def destination_cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGatewayRoute.DestinationCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroute.html#cfn-ec2-transitgatewayroute-destinationcidrblock
"""
result = self._values.get("destination_cidr_block")
return result
@builtins.property
def transit_gateway_attachment_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::TransitGatewayRoute.TransitGatewayAttachmentId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroute.html#cfn-ec2-transitgatewayroute-transitgatewayattachmentid
"""
result = self._values.get("transit_gateway_attachment_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnTransitGatewayRouteProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnTransitGatewayRouteTable(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnTransitGatewayRouteTable",
):
"""A CloudFormation ``AWS::EC2::TransitGatewayRouteTable``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetable.html
:cloudformationResource: AWS::EC2::TransitGatewayRouteTable
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
transit_gateway_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::TransitGatewayRouteTable``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param transit_gateway_id: ``AWS::EC2::TransitGatewayRouteTable.TransitGatewayId``.
:param tags: ``AWS::EC2::TransitGatewayRouteTable.Tags``.
"""
props = CfnTransitGatewayRouteTableProps(
transit_gateway_id=transit_gateway_id, tags=tags
)
jsii.create(CfnTransitGatewayRouteTable, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::TransitGatewayRouteTable.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetable.html#cfn-ec2-transitgatewayroutetable-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="transitGatewayId")
def transit_gateway_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayRouteTable.TransitGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetable.html#cfn-ec2-transitgatewayroutetable-transitgatewayid
"""
return jsii.get(self, "transitGatewayId")
@transit_gateway_id.setter # type: ignore
def transit_gateway_id(self, value: builtins.str) -> None:
jsii.set(self, "transitGatewayId", value)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnTransitGatewayRouteTableAssociation(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnTransitGatewayRouteTableAssociation",
):
"""A CloudFormation ``AWS::EC2::TransitGatewayRouteTableAssociation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html
:cloudformationResource: AWS::EC2::TransitGatewayRouteTableAssociation
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
transit_gateway_attachment_id: builtins.str,
transit_gateway_route_table_id: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::TransitGatewayRouteTableAssociation``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param transit_gateway_attachment_id: ``AWS::EC2::TransitGatewayRouteTableAssociation.TransitGatewayAttachmentId``.
:param transit_gateway_route_table_id: ``AWS::EC2::TransitGatewayRouteTableAssociation.TransitGatewayRouteTableId``.
"""
props = CfnTransitGatewayRouteTableAssociationProps(
transit_gateway_attachment_id=transit_gateway_attachment_id,
transit_gateway_route_table_id=transit_gateway_route_table_id,
)
jsii.create(CfnTransitGatewayRouteTableAssociation, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="transitGatewayAttachmentId")
def transit_gateway_attachment_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayRouteTableAssociation.TransitGatewayAttachmentId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html#cfn-ec2-transitgatewayroutetableassociation-transitgatewayattachmentid
"""
return jsii.get(self, "transitGatewayAttachmentId")
@transit_gateway_attachment_id.setter # type: ignore
def transit_gateway_attachment_id(self, value: builtins.str) -> None:
jsii.set(self, "transitGatewayAttachmentId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="transitGatewayRouteTableId")
def transit_gateway_route_table_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayRouteTableAssociation.TransitGatewayRouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html#cfn-ec2-transitgatewayroutetableassociation-transitgatewayroutetableid
"""
return jsii.get(self, "transitGatewayRouteTableId")
@transit_gateway_route_table_id.setter # type: ignore
def transit_gateway_route_table_id(self, value: builtins.str) -> None:
jsii.set(self, "transitGatewayRouteTableId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnTransitGatewayRouteTableAssociationProps",
jsii_struct_bases=[],
name_mapping={
"transit_gateway_attachment_id": "transitGatewayAttachmentId",
"transit_gateway_route_table_id": "transitGatewayRouteTableId",
},
)
class CfnTransitGatewayRouteTableAssociationProps:
def __init__(
self,
*,
transit_gateway_attachment_id: builtins.str,
transit_gateway_route_table_id: builtins.str,
) -> None:
"""Properties for defining a ``AWS::EC2::TransitGatewayRouteTableAssociation``.
:param transit_gateway_attachment_id: ``AWS::EC2::TransitGatewayRouteTableAssociation.TransitGatewayAttachmentId``.
:param transit_gateway_route_table_id: ``AWS::EC2::TransitGatewayRouteTableAssociation.TransitGatewayRouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html
"""
self._values: typing.Dict[str, typing.Any] = {
"transit_gateway_attachment_id": transit_gateway_attachment_id,
"transit_gateway_route_table_id": transit_gateway_route_table_id,
}
@builtins.property
def transit_gateway_attachment_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayRouteTableAssociation.TransitGatewayAttachmentId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html#cfn-ec2-transitgatewayroutetableassociation-transitgatewayattachmentid
"""
result = self._values.get("transit_gateway_attachment_id")
assert result is not None, "Required property 'transit_gateway_attachment_id' is missing"
return result
@builtins.property
def transit_gateway_route_table_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayRouteTableAssociation.TransitGatewayRouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetableassociation.html#cfn-ec2-transitgatewayroutetableassociation-transitgatewayroutetableid
"""
result = self._values.get("transit_gateway_route_table_id")
assert result is not None, "Required property 'transit_gateway_route_table_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnTransitGatewayRouteTableAssociationProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnTransitGatewayRouteTablePropagation(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnTransitGatewayRouteTablePropagation",
):
"""A CloudFormation ``AWS::EC2::TransitGatewayRouteTablePropagation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetablepropagation.html
:cloudformationResource: AWS::EC2::TransitGatewayRouteTablePropagation
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
transit_gateway_attachment_id: builtins.str,
transit_gateway_route_table_id: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::TransitGatewayRouteTablePropagation``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param transit_gateway_attachment_id: ``AWS::EC2::TransitGatewayRouteTablePropagation.TransitGatewayAttachmentId``.
:param transit_gateway_route_table_id: ``AWS::EC2::TransitGatewayRouteTablePropagation.TransitGatewayRouteTableId``.
"""
props = CfnTransitGatewayRouteTablePropagationProps(
transit_gateway_attachment_id=transit_gateway_attachment_id,
transit_gateway_route_table_id=transit_gateway_route_table_id,
)
jsii.create(CfnTransitGatewayRouteTablePropagation, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="transitGatewayAttachmentId")
def transit_gateway_attachment_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayRouteTablePropagation.TransitGatewayAttachmentId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetablepropagation.html#cfn-ec2-transitgatewayroutetablepropagation-transitgatewayattachmentid
"""
return jsii.get(self, "transitGatewayAttachmentId")
@transit_gateway_attachment_id.setter # type: ignore
def transit_gateway_attachment_id(self, value: builtins.str) -> None:
jsii.set(self, "transitGatewayAttachmentId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="transitGatewayRouteTableId")
def transit_gateway_route_table_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayRouteTablePropagation.TransitGatewayRouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetablepropagation.html#cfn-ec2-transitgatewayroutetablepropagation-transitgatewayroutetableid
"""
return jsii.get(self, "transitGatewayRouteTableId")
@transit_gateway_route_table_id.setter # type: ignore
def transit_gateway_route_table_id(self, value: builtins.str) -> None:
jsii.set(self, "transitGatewayRouteTableId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnTransitGatewayRouteTablePropagationProps",
jsii_struct_bases=[],
name_mapping={
"transit_gateway_attachment_id": "transitGatewayAttachmentId",
"transit_gateway_route_table_id": "transitGatewayRouteTableId",
},
)
class CfnTransitGatewayRouteTablePropagationProps:
def __init__(
self,
*,
transit_gateway_attachment_id: builtins.str,
transit_gateway_route_table_id: builtins.str,
) -> None:
"""Properties for defining a ``AWS::EC2::TransitGatewayRouteTablePropagation``.
:param transit_gateway_attachment_id: ``AWS::EC2::TransitGatewayRouteTablePropagation.TransitGatewayAttachmentId``.
:param transit_gateway_route_table_id: ``AWS::EC2::TransitGatewayRouteTablePropagation.TransitGatewayRouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetablepropagation.html
"""
self._values: typing.Dict[str, typing.Any] = {
"transit_gateway_attachment_id": transit_gateway_attachment_id,
"transit_gateway_route_table_id": transit_gateway_route_table_id,
}
@builtins.property
def transit_gateway_attachment_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayRouteTablePropagation.TransitGatewayAttachmentId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetablepropagation.html#cfn-ec2-transitgatewayroutetablepropagation-transitgatewayattachmentid
"""
result = self._values.get("transit_gateway_attachment_id")
assert result is not None, "Required property 'transit_gateway_attachment_id' is missing"
return result
@builtins.property
def transit_gateway_route_table_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayRouteTablePropagation.TransitGatewayRouteTableId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetablepropagation.html#cfn-ec2-transitgatewayroutetablepropagation-transitgatewayroutetableid
"""
result = self._values.get("transit_gateway_route_table_id")
assert result is not None, "Required property 'transit_gateway_route_table_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnTransitGatewayRouteTablePropagationProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnTransitGatewayRouteTableProps",
jsii_struct_bases=[],
name_mapping={"transit_gateway_id": "transitGatewayId", "tags": "tags"},
)
class CfnTransitGatewayRouteTableProps:
def __init__(
self,
*,
transit_gateway_id: builtins.str,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::TransitGatewayRouteTable``.
:param transit_gateway_id: ``AWS::EC2::TransitGatewayRouteTable.TransitGatewayId``.
:param tags: ``AWS::EC2::TransitGatewayRouteTable.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetable.html
"""
self._values: typing.Dict[str, typing.Any] = {
"transit_gateway_id": transit_gateway_id,
}
if tags is not None:
self._values["tags"] = tags
@builtins.property
def transit_gateway_id(self) -> builtins.str:
"""``AWS::EC2::TransitGatewayRouteTable.TransitGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetable.html#cfn-ec2-transitgatewayroutetable-transitgatewayid
"""
result = self._values.get("transit_gateway_id")
assert result is not None, "Required property 'transit_gateway_id' is missing"
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::TransitGatewayRouteTable.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetable.html#cfn-ec2-transitgatewayroutetable-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnTransitGatewayRouteTableProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVPC(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVPC",
):
"""A CloudFormation ``AWS::EC2::VPC``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html
:cloudformationResource: AWS::EC2::VPC
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
cidr_block: builtins.str,
enable_dns_hostnames: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
enable_dns_support: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
instance_tenancy: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::VPC``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param cidr_block: ``AWS::EC2::VPC.CidrBlock``.
:param enable_dns_hostnames: ``AWS::EC2::VPC.EnableDnsHostnames``.
:param enable_dns_support: ``AWS::EC2::VPC.EnableDnsSupport``.
:param instance_tenancy: ``AWS::EC2::VPC.InstanceTenancy``.
:param tags: ``AWS::EC2::VPC.Tags``.
"""
props = CfnVPCProps(
cidr_block=cidr_block,
enable_dns_hostnames=enable_dns_hostnames,
enable_dns_support=enable_dns_support,
instance_tenancy=instance_tenancy,
tags=tags,
)
jsii.create(CfnVPC, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrCidrBlock")
def attr_cidr_block(self) -> builtins.str:
"""
:cloudformationAttribute: CidrBlock
"""
return jsii.get(self, "attrCidrBlock")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrCidrBlockAssociations")
def attr_cidr_block_associations(self) -> typing.List[builtins.str]:
"""
:cloudformationAttribute: CidrBlockAssociations
"""
return jsii.get(self, "attrCidrBlockAssociations")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrDefaultNetworkAcl")
def attr_default_network_acl(self) -> builtins.str:
"""
:cloudformationAttribute: DefaultNetworkAcl
"""
return jsii.get(self, "attrDefaultNetworkAcl")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrDefaultSecurityGroup")
def attr_default_security_group(self) -> builtins.str:
"""
:cloudformationAttribute: DefaultSecurityGroup
"""
return jsii.get(self, "attrDefaultSecurityGroup")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrIpv6CidrBlocks")
def attr_ipv6_cidr_blocks(self) -> typing.List[builtins.str]:
"""
:cloudformationAttribute: Ipv6CidrBlocks
"""
return jsii.get(self, "attrIpv6CidrBlocks")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::VPC.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="cidrBlock")
def cidr_block(self) -> builtins.str:
"""``AWS::EC2::VPC.CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-cidrblock
"""
return jsii.get(self, "cidrBlock")
@cidr_block.setter # type: ignore
def cidr_block(self, value: builtins.str) -> None:
jsii.set(self, "cidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="enableDnsHostnames")
def enable_dns_hostnames(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::VPC.EnableDnsHostnames``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-EnableDnsHostnames
"""
return jsii.get(self, "enableDnsHostnames")
@enable_dns_hostnames.setter # type: ignore
def enable_dns_hostnames(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "enableDnsHostnames", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="enableDnsSupport")
def enable_dns_support(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::VPC.EnableDnsSupport``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-EnableDnsSupport
"""
return jsii.get(self, "enableDnsSupport")
@enable_dns_support.setter # type: ignore
def enable_dns_support(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "enableDnsSupport", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceTenancy")
def instance_tenancy(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPC.InstanceTenancy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-instancetenancy
"""
return jsii.get(self, "instanceTenancy")
@instance_tenancy.setter # type: ignore
def instance_tenancy(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "instanceTenancy", value)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVPCCidrBlock(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVPCCidrBlock",
):
"""A CloudFormation ``AWS::EC2::VPCCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html
:cloudformationResource: AWS::EC2::VPCCidrBlock
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
vpc_id: builtins.str,
amazon_provided_ipv6_cidr_block: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
cidr_block: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::VPCCidrBlock``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param vpc_id: ``AWS::EC2::VPCCidrBlock.VpcId``.
:param amazon_provided_ipv6_cidr_block: ``AWS::EC2::VPCCidrBlock.AmazonProvidedIpv6CidrBlock``.
:param cidr_block: ``AWS::EC2::VPCCidrBlock.CidrBlock``.
"""
props = CfnVPCCidrBlockProps(
vpc_id=vpc_id,
amazon_provided_ipv6_cidr_block=amazon_provided_ipv6_cidr_block,
cidr_block=cidr_block,
)
jsii.create(CfnVPCCidrBlock, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::VPCCidrBlock.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html#cfn-ec2-vpccidrblock-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: builtins.str) -> None:
jsii.set(self, "vpcId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="amazonProvidedIpv6CidrBlock")
def amazon_provided_ipv6_cidr_block(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::VPCCidrBlock.AmazonProvidedIpv6CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html#cfn-ec2-vpccidrblock-amazonprovidedipv6cidrblock
"""
return jsii.get(self, "amazonProvidedIpv6CidrBlock")
@amazon_provided_ipv6_cidr_block.setter # type: ignore
def amazon_provided_ipv6_cidr_block(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "amazonProvidedIpv6CidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="cidrBlock")
def cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCCidrBlock.CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html#cfn-ec2-vpccidrblock-cidrblock
"""
return jsii.get(self, "cidrBlock")
@cidr_block.setter # type: ignore
def cidr_block(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "cidrBlock", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPCCidrBlockProps",
jsii_struct_bases=[],
name_mapping={
"vpc_id": "vpcId",
"amazon_provided_ipv6_cidr_block": "amazonProvidedIpv6CidrBlock",
"cidr_block": "cidrBlock",
},
)
class CfnVPCCidrBlockProps:
def __init__(
self,
*,
vpc_id: builtins.str,
amazon_provided_ipv6_cidr_block: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
cidr_block: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::VPCCidrBlock``.
:param vpc_id: ``AWS::EC2::VPCCidrBlock.VpcId``.
:param amazon_provided_ipv6_cidr_block: ``AWS::EC2::VPCCidrBlock.AmazonProvidedIpv6CidrBlock``.
:param cidr_block: ``AWS::EC2::VPCCidrBlock.CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html
"""
self._values: typing.Dict[str, typing.Any] = {
"vpc_id": vpc_id,
}
if amazon_provided_ipv6_cidr_block is not None:
self._values["amazon_provided_ipv6_cidr_block"] = amazon_provided_ipv6_cidr_block
if cidr_block is not None:
self._values["cidr_block"] = cidr_block
@builtins.property
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::VPCCidrBlock.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html#cfn-ec2-vpccidrblock-vpcid
"""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def amazon_provided_ipv6_cidr_block(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::VPCCidrBlock.AmazonProvidedIpv6CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html#cfn-ec2-vpccidrblock-amazonprovidedipv6cidrblock
"""
result = self._values.get("amazon_provided_ipv6_cidr_block")
return result
@builtins.property
def cidr_block(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCCidrBlock.CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpccidrblock.html#cfn-ec2-vpccidrblock-cidrblock
"""
result = self._values.get("cidr_block")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVPCCidrBlockProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVPCDHCPOptionsAssociation(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVPCDHCPOptionsAssociation",
):
"""A CloudFormation ``AWS::EC2::VPCDHCPOptionsAssociation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-dhcp-options-assoc.html
:cloudformationResource: AWS::EC2::VPCDHCPOptionsAssociation
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
dhcp_options_id: builtins.str,
vpc_id: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::VPCDHCPOptionsAssociation``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param dhcp_options_id: ``AWS::EC2::VPCDHCPOptionsAssociation.DhcpOptionsId``.
:param vpc_id: ``AWS::EC2::VPCDHCPOptionsAssociation.VpcId``.
"""
props = CfnVPCDHCPOptionsAssociationProps(
dhcp_options_id=dhcp_options_id, vpc_id=vpc_id
)
jsii.create(CfnVPCDHCPOptionsAssociation, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="dhcpOptionsId")
def dhcp_options_id(self) -> builtins.str:
"""``AWS::EC2::VPCDHCPOptionsAssociation.DhcpOptionsId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-dhcp-options-assoc.html#cfn-ec2-vpcdhcpoptionsassociation-dhcpoptionsid
"""
return jsii.get(self, "dhcpOptionsId")
@dhcp_options_id.setter # type: ignore
def dhcp_options_id(self, value: builtins.str) -> None:
jsii.set(self, "dhcpOptionsId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::VPCDHCPOptionsAssociation.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-dhcp-options-assoc.html#cfn-ec2-vpcdhcpoptionsassociation-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: builtins.str) -> None:
jsii.set(self, "vpcId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPCDHCPOptionsAssociationProps",
jsii_struct_bases=[],
name_mapping={"dhcp_options_id": "dhcpOptionsId", "vpc_id": "vpcId"},
)
class CfnVPCDHCPOptionsAssociationProps:
def __init__(self, *, dhcp_options_id: builtins.str, vpc_id: builtins.str) -> None:
"""Properties for defining a ``AWS::EC2::VPCDHCPOptionsAssociation``.
:param dhcp_options_id: ``AWS::EC2::VPCDHCPOptionsAssociation.DhcpOptionsId``.
:param vpc_id: ``AWS::EC2::VPCDHCPOptionsAssociation.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-dhcp-options-assoc.html
"""
self._values: typing.Dict[str, typing.Any] = {
"dhcp_options_id": dhcp_options_id,
"vpc_id": vpc_id,
}
@builtins.property
def dhcp_options_id(self) -> builtins.str:
"""``AWS::EC2::VPCDHCPOptionsAssociation.DhcpOptionsId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-dhcp-options-assoc.html#cfn-ec2-vpcdhcpoptionsassociation-dhcpoptionsid
"""
result = self._values.get("dhcp_options_id")
assert result is not None, "Required property 'dhcp_options_id' is missing"
return result
@builtins.property
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::VPCDHCPOptionsAssociation.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-dhcp-options-assoc.html#cfn-ec2-vpcdhcpoptionsassociation-vpcid
"""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVPCDHCPOptionsAssociationProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVPCEndpoint(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVPCEndpoint",
):
"""A CloudFormation ``AWS::EC2::VPCEndpoint``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html
:cloudformationResource: AWS::EC2::VPCEndpoint
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
service_name: builtins.str,
vpc_id: builtins.str,
policy_document: typing.Any = None,
private_dns_enabled: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
route_table_ids: typing.Optional[typing.List[builtins.str]] = None,
security_group_ids: typing.Optional[typing.List[builtins.str]] = None,
subnet_ids: typing.Optional[typing.List[builtins.str]] = None,
vpc_endpoint_type: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::VPCEndpoint``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param service_name: ``AWS::EC2::VPCEndpoint.ServiceName``.
:param vpc_id: ``AWS::EC2::VPCEndpoint.VpcId``.
:param policy_document: ``AWS::EC2::VPCEndpoint.PolicyDocument``.
:param private_dns_enabled: ``AWS::EC2::VPCEndpoint.PrivateDnsEnabled``.
:param route_table_ids: ``AWS::EC2::VPCEndpoint.RouteTableIds``.
:param security_group_ids: ``AWS::EC2::VPCEndpoint.SecurityGroupIds``.
:param subnet_ids: ``AWS::EC2::VPCEndpoint.SubnetIds``.
:param vpc_endpoint_type: ``AWS::EC2::VPCEndpoint.VpcEndpointType``.
"""
props = CfnVPCEndpointProps(
service_name=service_name,
vpc_id=vpc_id,
policy_document=policy_document,
private_dns_enabled=private_dns_enabled,
route_table_ids=route_table_ids,
security_group_ids=security_group_ids,
subnet_ids=subnet_ids,
vpc_endpoint_type=vpc_endpoint_type,
)
jsii.create(CfnVPCEndpoint, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrCreationTimestamp")
def attr_creation_timestamp(self) -> builtins.str:
"""
:cloudformationAttribute: CreationTimestamp
"""
return jsii.get(self, "attrCreationTimestamp")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrDnsEntries")
def attr_dns_entries(self) -> typing.List[builtins.str]:
"""
:cloudformationAttribute: DnsEntries
"""
return jsii.get(self, "attrDnsEntries")
@builtins.property # type: ignore
@jsii.member(jsii_name="attrNetworkInterfaceIds")
def attr_network_interface_ids(self) -> typing.List[builtins.str]:
"""
:cloudformationAttribute: NetworkInterfaceIds
"""
return jsii.get(self, "attrNetworkInterfaceIds")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="policyDocument")
def policy_document(self) -> typing.Any:
"""``AWS::EC2::VPCEndpoint.PolicyDocument``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-policydocument
"""
return jsii.get(self, "policyDocument")
@policy_document.setter # type: ignore
def policy_document(self, value: typing.Any) -> None:
jsii.set(self, "policyDocument", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="serviceName")
def service_name(self) -> builtins.str:
"""``AWS::EC2::VPCEndpoint.ServiceName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-servicename
"""
return jsii.get(self, "serviceName")
@service_name.setter # type: ignore
def service_name(self, value: builtins.str) -> None:
jsii.set(self, "serviceName", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::VPCEndpoint.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: builtins.str) -> None:
jsii.set(self, "vpcId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="privateDnsEnabled")
def private_dns_enabled(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::VPCEndpoint.PrivateDnsEnabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-privatednsenabled
"""
return jsii.get(self, "privateDnsEnabled")
@private_dns_enabled.setter # type: ignore
def private_dns_enabled(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "privateDnsEnabled", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="routeTableIds")
def route_table_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::VPCEndpoint.RouteTableIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-routetableids
"""
return jsii.get(self, "routeTableIds")
@route_table_ids.setter # type: ignore
def route_table_ids(
self,
value: typing.Optional[typing.List[builtins.str]],
) -> None:
jsii.set(self, "routeTableIds", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroupIds")
def security_group_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::VPCEndpoint.SecurityGroupIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-securitygroupids
"""
return jsii.get(self, "securityGroupIds")
@security_group_ids.setter # type: ignore
def security_group_ids(
self,
value: typing.Optional[typing.List[builtins.str]],
) -> None:
jsii.set(self, "securityGroupIds", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetIds")
def subnet_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::VPCEndpoint.SubnetIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-subnetids
"""
return jsii.get(self, "subnetIds")
@subnet_ids.setter # type: ignore
def subnet_ids(self, value: typing.Optional[typing.List[builtins.str]]) -> None:
jsii.set(self, "subnetIds", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointType")
def vpc_endpoint_type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCEndpoint.VpcEndpointType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-vpcendpointtype
"""
return jsii.get(self, "vpcEndpointType")
@vpc_endpoint_type.setter # type: ignore
def vpc_endpoint_type(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "vpcEndpointType", value)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVPCEndpointConnectionNotification(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVPCEndpointConnectionNotification",
):
"""A CloudFormation ``AWS::EC2::VPCEndpointConnectionNotification``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html
:cloudformationResource: AWS::EC2::VPCEndpointConnectionNotification
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
connection_events: typing.List[builtins.str],
connection_notification_arn: builtins.str,
service_id: typing.Optional[builtins.str] = None,
vpc_endpoint_id: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::VPCEndpointConnectionNotification``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param connection_events: ``AWS::EC2::VPCEndpointConnectionNotification.ConnectionEvents``.
:param connection_notification_arn: ``AWS::EC2::VPCEndpointConnectionNotification.ConnectionNotificationArn``.
:param service_id: ``AWS::EC2::VPCEndpointConnectionNotification.ServiceId``.
:param vpc_endpoint_id: ``AWS::EC2::VPCEndpointConnectionNotification.VPCEndpointId``.
"""
props = CfnVPCEndpointConnectionNotificationProps(
connection_events=connection_events,
connection_notification_arn=connection_notification_arn,
service_id=service_id,
vpc_endpoint_id=vpc_endpoint_id,
)
jsii.create(CfnVPCEndpointConnectionNotification, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="connectionEvents")
def connection_events(self) -> typing.List[builtins.str]:
"""``AWS::EC2::VPCEndpointConnectionNotification.ConnectionEvents``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html#cfn-ec2-vpcendpointconnectionnotification-connectionevents
"""
return jsii.get(self, "connectionEvents")
@connection_events.setter # type: ignore
def connection_events(self, value: typing.List[builtins.str]) -> None:
jsii.set(self, "connectionEvents", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="connectionNotificationArn")
def connection_notification_arn(self) -> builtins.str:
"""``AWS::EC2::VPCEndpointConnectionNotification.ConnectionNotificationArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html#cfn-ec2-vpcendpointconnectionnotification-connectionnotificationarn
"""
return jsii.get(self, "connectionNotificationArn")
@connection_notification_arn.setter # type: ignore
def connection_notification_arn(self, value: builtins.str) -> None:
jsii.set(self, "connectionNotificationArn", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="serviceId")
def service_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCEndpointConnectionNotification.ServiceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html#cfn-ec2-vpcendpointconnectionnotification-serviceid
"""
return jsii.get(self, "serviceId")
@service_id.setter # type: ignore
def service_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "serviceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointId")
def vpc_endpoint_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCEndpointConnectionNotification.VPCEndpointId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html#cfn-ec2-vpcendpointconnectionnotification-vpcendpointid
"""
return jsii.get(self, "vpcEndpointId")
@vpc_endpoint_id.setter # type: ignore
def vpc_endpoint_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "vpcEndpointId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPCEndpointConnectionNotificationProps",
jsii_struct_bases=[],
name_mapping={
"connection_events": "connectionEvents",
"connection_notification_arn": "connectionNotificationArn",
"service_id": "serviceId",
"vpc_endpoint_id": "vpcEndpointId",
},
)
class CfnVPCEndpointConnectionNotificationProps:
def __init__(
self,
*,
connection_events: typing.List[builtins.str],
connection_notification_arn: builtins.str,
service_id: typing.Optional[builtins.str] = None,
vpc_endpoint_id: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::VPCEndpointConnectionNotification``.
:param connection_events: ``AWS::EC2::VPCEndpointConnectionNotification.ConnectionEvents``.
:param connection_notification_arn: ``AWS::EC2::VPCEndpointConnectionNotification.ConnectionNotificationArn``.
:param service_id: ``AWS::EC2::VPCEndpointConnectionNotification.ServiceId``.
:param vpc_endpoint_id: ``AWS::EC2::VPCEndpointConnectionNotification.VPCEndpointId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html
"""
self._values: typing.Dict[str, typing.Any] = {
"connection_events": connection_events,
"connection_notification_arn": connection_notification_arn,
}
if service_id is not None:
self._values["service_id"] = service_id
if vpc_endpoint_id is not None:
self._values["vpc_endpoint_id"] = vpc_endpoint_id
@builtins.property
def connection_events(self) -> typing.List[builtins.str]:
"""``AWS::EC2::VPCEndpointConnectionNotification.ConnectionEvents``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html#cfn-ec2-vpcendpointconnectionnotification-connectionevents
"""
result = self._values.get("connection_events")
assert result is not None, "Required property 'connection_events' is missing"
return result
@builtins.property
def connection_notification_arn(self) -> builtins.str:
"""``AWS::EC2::VPCEndpointConnectionNotification.ConnectionNotificationArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html#cfn-ec2-vpcendpointconnectionnotification-connectionnotificationarn
"""
result = self._values.get("connection_notification_arn")
assert result is not None, "Required property 'connection_notification_arn' is missing"
return result
@builtins.property
def service_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCEndpointConnectionNotification.ServiceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html#cfn-ec2-vpcendpointconnectionnotification-serviceid
"""
result = self._values.get("service_id")
return result
@builtins.property
def vpc_endpoint_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCEndpointConnectionNotification.VPCEndpointId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointconnectionnotification.html#cfn-ec2-vpcendpointconnectionnotification-vpcendpointid
"""
result = self._values.get("vpc_endpoint_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVPCEndpointConnectionNotificationProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPCEndpointProps",
jsii_struct_bases=[],
name_mapping={
"service_name": "serviceName",
"vpc_id": "vpcId",
"policy_document": "policyDocument",
"private_dns_enabled": "privateDnsEnabled",
"route_table_ids": "routeTableIds",
"security_group_ids": "securityGroupIds",
"subnet_ids": "subnetIds",
"vpc_endpoint_type": "vpcEndpointType",
},
)
class CfnVPCEndpointProps:
def __init__(
self,
*,
service_name: builtins.str,
vpc_id: builtins.str,
policy_document: typing.Any = None,
private_dns_enabled: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
route_table_ids: typing.Optional[typing.List[builtins.str]] = None,
security_group_ids: typing.Optional[typing.List[builtins.str]] = None,
subnet_ids: typing.Optional[typing.List[builtins.str]] = None,
vpc_endpoint_type: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::VPCEndpoint``.
:param service_name: ``AWS::EC2::VPCEndpoint.ServiceName``.
:param vpc_id: ``AWS::EC2::VPCEndpoint.VpcId``.
:param policy_document: ``AWS::EC2::VPCEndpoint.PolicyDocument``.
:param private_dns_enabled: ``AWS::EC2::VPCEndpoint.PrivateDnsEnabled``.
:param route_table_ids: ``AWS::EC2::VPCEndpoint.RouteTableIds``.
:param security_group_ids: ``AWS::EC2::VPCEndpoint.SecurityGroupIds``.
:param subnet_ids: ``AWS::EC2::VPCEndpoint.SubnetIds``.
:param vpc_endpoint_type: ``AWS::EC2::VPCEndpoint.VpcEndpointType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html
"""
self._values: typing.Dict[str, typing.Any] = {
"service_name": service_name,
"vpc_id": vpc_id,
}
if policy_document is not None:
self._values["policy_document"] = policy_document
if private_dns_enabled is not None:
self._values["private_dns_enabled"] = private_dns_enabled
if route_table_ids is not None:
self._values["route_table_ids"] = route_table_ids
if security_group_ids is not None:
self._values["security_group_ids"] = security_group_ids
if subnet_ids is not None:
self._values["subnet_ids"] = subnet_ids
if vpc_endpoint_type is not None:
self._values["vpc_endpoint_type"] = vpc_endpoint_type
@builtins.property
def service_name(self) -> builtins.str:
"""``AWS::EC2::VPCEndpoint.ServiceName``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-servicename
"""
result = self._values.get("service_name")
assert result is not None, "Required property 'service_name' is missing"
return result
@builtins.property
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::VPCEndpoint.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-vpcid
"""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def policy_document(self) -> typing.Any:
"""``AWS::EC2::VPCEndpoint.PolicyDocument``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-policydocument
"""
result = self._values.get("policy_document")
return result
@builtins.property
def private_dns_enabled(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::VPCEndpoint.PrivateDnsEnabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-privatednsenabled
"""
result = self._values.get("private_dns_enabled")
return result
@builtins.property
def route_table_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::VPCEndpoint.RouteTableIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-routetableids
"""
result = self._values.get("route_table_ids")
return result
@builtins.property
def security_group_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::VPCEndpoint.SecurityGroupIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-securitygroupids
"""
result = self._values.get("security_group_ids")
return result
@builtins.property
def subnet_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::VPCEndpoint.SubnetIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-subnetids
"""
result = self._values.get("subnet_ids")
return result
@builtins.property
def vpc_endpoint_type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCEndpoint.VpcEndpointType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpoint.html#cfn-ec2-vpcendpoint-vpcendpointtype
"""
result = self._values.get("vpc_endpoint_type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVPCEndpointProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVPCEndpointService(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVPCEndpointService",
):
"""A CloudFormation ``AWS::EC2::VPCEndpointService``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservice.html
:cloudformationResource: AWS::EC2::VPCEndpointService
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
acceptance_required: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
gateway_load_balancer_arns: typing.Optional[typing.List[builtins.str]] = None,
network_load_balancer_arns: typing.Optional[typing.List[builtins.str]] = None,
) -> None:
"""Create a new ``AWS::EC2::VPCEndpointService``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param acceptance_required: ``AWS::EC2::VPCEndpointService.AcceptanceRequired``.
:param gateway_load_balancer_arns: ``AWS::EC2::VPCEndpointService.GatewayLoadBalancerArns``.
:param network_load_balancer_arns: ``AWS::EC2::VPCEndpointService.NetworkLoadBalancerArns``.
"""
props = CfnVPCEndpointServiceProps(
acceptance_required=acceptance_required,
gateway_load_balancer_arns=gateway_load_balancer_arns,
network_load_balancer_arns=network_load_balancer_arns,
)
jsii.create(CfnVPCEndpointService, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="acceptanceRequired")
def acceptance_required(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::VPCEndpointService.AcceptanceRequired``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservice.html#cfn-ec2-vpcendpointservice-acceptancerequired
"""
return jsii.get(self, "acceptanceRequired")
@acceptance_required.setter # type: ignore
def acceptance_required(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "acceptanceRequired", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="gatewayLoadBalancerArns")
def gateway_load_balancer_arns(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::VPCEndpointService.GatewayLoadBalancerArns``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservice.html#cfn-ec2-vpcendpointservice-gatewayloadbalancerarns
"""
return jsii.get(self, "gatewayLoadBalancerArns")
@gateway_load_balancer_arns.setter # type: ignore
def gateway_load_balancer_arns(
self,
value: typing.Optional[typing.List[builtins.str]],
) -> None:
jsii.set(self, "gatewayLoadBalancerArns", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="networkLoadBalancerArns")
def network_load_balancer_arns(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::VPCEndpointService.NetworkLoadBalancerArns``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservice.html#cfn-ec2-vpcendpointservice-networkloadbalancerarns
"""
return jsii.get(self, "networkLoadBalancerArns")
@network_load_balancer_arns.setter # type: ignore
def network_load_balancer_arns(
self,
value: typing.Optional[typing.List[builtins.str]],
) -> None:
jsii.set(self, "networkLoadBalancerArns", value)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVPCEndpointServicePermissions(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVPCEndpointServicePermissions",
):
"""A CloudFormation ``AWS::EC2::VPCEndpointServicePermissions``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservicepermissions.html
:cloudformationResource: AWS::EC2::VPCEndpointServicePermissions
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
service_id: builtins.str,
allowed_principals: typing.Optional[typing.List[builtins.str]] = None,
) -> None:
"""Create a new ``AWS::EC2::VPCEndpointServicePermissions``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param service_id: ``AWS::EC2::VPCEndpointServicePermissions.ServiceId``.
:param allowed_principals: ``AWS::EC2::VPCEndpointServicePermissions.AllowedPrincipals``.
"""
props = CfnVPCEndpointServicePermissionsProps(
service_id=service_id, allowed_principals=allowed_principals
)
jsii.create(CfnVPCEndpointServicePermissions, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="serviceId")
def service_id(self) -> builtins.str:
"""``AWS::EC2::VPCEndpointServicePermissions.ServiceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservicepermissions.html#cfn-ec2-vpcendpointservicepermissions-serviceid
"""
return jsii.get(self, "serviceId")
@service_id.setter # type: ignore
def service_id(self, value: builtins.str) -> None:
jsii.set(self, "serviceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="allowedPrincipals")
def allowed_principals(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::VPCEndpointServicePermissions.AllowedPrincipals``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservicepermissions.html#cfn-ec2-vpcendpointservicepermissions-allowedprincipals
"""
return jsii.get(self, "allowedPrincipals")
@allowed_principals.setter # type: ignore
def allowed_principals(
self,
value: typing.Optional[typing.List[builtins.str]],
) -> None:
jsii.set(self, "allowedPrincipals", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPCEndpointServicePermissionsProps",
jsii_struct_bases=[],
name_mapping={
"service_id": "serviceId",
"allowed_principals": "allowedPrincipals",
},
)
class CfnVPCEndpointServicePermissionsProps:
def __init__(
self,
*,
service_id: builtins.str,
allowed_principals: typing.Optional[typing.List[builtins.str]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::VPCEndpointServicePermissions``.
:param service_id: ``AWS::EC2::VPCEndpointServicePermissions.ServiceId``.
:param allowed_principals: ``AWS::EC2::VPCEndpointServicePermissions.AllowedPrincipals``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservicepermissions.html
"""
self._values: typing.Dict[str, typing.Any] = {
"service_id": service_id,
}
if allowed_principals is not None:
self._values["allowed_principals"] = allowed_principals
@builtins.property
def service_id(self) -> builtins.str:
"""``AWS::EC2::VPCEndpointServicePermissions.ServiceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservicepermissions.html#cfn-ec2-vpcendpointservicepermissions-serviceid
"""
result = self._values.get("service_id")
assert result is not None, "Required property 'service_id' is missing"
return result
@builtins.property
def allowed_principals(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::VPCEndpointServicePermissions.AllowedPrincipals``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservicepermissions.html#cfn-ec2-vpcendpointservicepermissions-allowedprincipals
"""
result = self._values.get("allowed_principals")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVPCEndpointServicePermissionsProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPCEndpointServiceProps",
jsii_struct_bases=[],
name_mapping={
"acceptance_required": "acceptanceRequired",
"gateway_load_balancer_arns": "gatewayLoadBalancerArns",
"network_load_balancer_arns": "networkLoadBalancerArns",
},
)
class CfnVPCEndpointServiceProps:
def __init__(
self,
*,
acceptance_required: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
gateway_load_balancer_arns: typing.Optional[typing.List[builtins.str]] = None,
network_load_balancer_arns: typing.Optional[typing.List[builtins.str]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::VPCEndpointService``.
:param acceptance_required: ``AWS::EC2::VPCEndpointService.AcceptanceRequired``.
:param gateway_load_balancer_arns: ``AWS::EC2::VPCEndpointService.GatewayLoadBalancerArns``.
:param network_load_balancer_arns: ``AWS::EC2::VPCEndpointService.NetworkLoadBalancerArns``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservice.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if acceptance_required is not None:
self._values["acceptance_required"] = acceptance_required
if gateway_load_balancer_arns is not None:
self._values["gateway_load_balancer_arns"] = gateway_load_balancer_arns
if network_load_balancer_arns is not None:
self._values["network_load_balancer_arns"] = network_load_balancer_arns
@builtins.property
def acceptance_required(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::VPCEndpointService.AcceptanceRequired``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservice.html#cfn-ec2-vpcendpointservice-acceptancerequired
"""
result = self._values.get("acceptance_required")
return result
@builtins.property
def gateway_load_balancer_arns(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::VPCEndpointService.GatewayLoadBalancerArns``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservice.html#cfn-ec2-vpcendpointservice-gatewayloadbalancerarns
"""
result = self._values.get("gateway_load_balancer_arns")
return result
@builtins.property
def network_load_balancer_arns(self) -> typing.Optional[typing.List[builtins.str]]:
"""``AWS::EC2::VPCEndpointService.NetworkLoadBalancerArns``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcendpointservice.html#cfn-ec2-vpcendpointservice-networkloadbalancerarns
"""
result = self._values.get("network_load_balancer_arns")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVPCEndpointServiceProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVPCGatewayAttachment(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVPCGatewayAttachment",
):
"""A CloudFormation ``AWS::EC2::VPCGatewayAttachment``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html
:cloudformationResource: AWS::EC2::VPCGatewayAttachment
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
vpc_id: builtins.str,
internet_gateway_id: typing.Optional[builtins.str] = None,
vpn_gateway_id: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::VPCGatewayAttachment``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param vpc_id: ``AWS::EC2::VPCGatewayAttachment.VpcId``.
:param internet_gateway_id: ``AWS::EC2::VPCGatewayAttachment.InternetGatewayId``.
:param vpn_gateway_id: ``AWS::EC2::VPCGatewayAttachment.VpnGatewayId``.
"""
props = CfnVPCGatewayAttachmentProps(
vpc_id=vpc_id,
internet_gateway_id=internet_gateway_id,
vpn_gateway_id=vpn_gateway_id,
)
jsii.create(CfnVPCGatewayAttachment, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::VPCGatewayAttachment.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html#cfn-ec2-vpcgatewayattachment-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: builtins.str) -> None:
jsii.set(self, "vpcId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="internetGatewayId")
def internet_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCGatewayAttachment.InternetGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html#cfn-ec2-vpcgatewayattachment-internetgatewayid
"""
return jsii.get(self, "internetGatewayId")
@internet_gateway_id.setter # type: ignore
def internet_gateway_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "internetGatewayId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpnGatewayId")
def vpn_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCGatewayAttachment.VpnGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html#cfn-ec2-vpcgatewayattachment-vpngatewayid
"""
return jsii.get(self, "vpnGatewayId")
@vpn_gateway_id.setter # type: ignore
def vpn_gateway_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "vpnGatewayId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPCGatewayAttachmentProps",
jsii_struct_bases=[],
name_mapping={
"vpc_id": "vpcId",
"internet_gateway_id": "internetGatewayId",
"vpn_gateway_id": "vpnGatewayId",
},
)
class CfnVPCGatewayAttachmentProps:
def __init__(
self,
*,
vpc_id: builtins.str,
internet_gateway_id: typing.Optional[builtins.str] = None,
vpn_gateway_id: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::VPCGatewayAttachment``.
:param vpc_id: ``AWS::EC2::VPCGatewayAttachment.VpcId``.
:param internet_gateway_id: ``AWS::EC2::VPCGatewayAttachment.InternetGatewayId``.
:param vpn_gateway_id: ``AWS::EC2::VPCGatewayAttachment.VpnGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html
"""
self._values: typing.Dict[str, typing.Any] = {
"vpc_id": vpc_id,
}
if internet_gateway_id is not None:
self._values["internet_gateway_id"] = internet_gateway_id
if vpn_gateway_id is not None:
self._values["vpn_gateway_id"] = vpn_gateway_id
@builtins.property
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::VPCGatewayAttachment.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html#cfn-ec2-vpcgatewayattachment-vpcid
"""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def internet_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCGatewayAttachment.InternetGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html#cfn-ec2-vpcgatewayattachment-internetgatewayid
"""
result = self._values.get("internet_gateway_id")
return result
@builtins.property
def vpn_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCGatewayAttachment.VpnGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html#cfn-ec2-vpcgatewayattachment-vpngatewayid
"""
result = self._values.get("vpn_gateway_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVPCGatewayAttachmentProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVPCPeeringConnection(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVPCPeeringConnection",
):
"""A CloudFormation ``AWS::EC2::VPCPeeringConnection``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html
:cloudformationResource: AWS::EC2::VPCPeeringConnection
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
peer_vpc_id: builtins.str,
vpc_id: builtins.str,
peer_owner_id: typing.Optional[builtins.str] = None,
peer_region: typing.Optional[builtins.str] = None,
peer_role_arn: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::VPCPeeringConnection``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param peer_vpc_id: ``AWS::EC2::VPCPeeringConnection.PeerVpcId``.
:param vpc_id: ``AWS::EC2::VPCPeeringConnection.VpcId``.
:param peer_owner_id: ``AWS::EC2::VPCPeeringConnection.PeerOwnerId``.
:param peer_region: ``AWS::EC2::VPCPeeringConnection.PeerRegion``.
:param peer_role_arn: ``AWS::EC2::VPCPeeringConnection.PeerRoleArn``.
:param tags: ``AWS::EC2::VPCPeeringConnection.Tags``.
"""
props = CfnVPCPeeringConnectionProps(
peer_vpc_id=peer_vpc_id,
vpc_id=vpc_id,
peer_owner_id=peer_owner_id,
peer_region=peer_region,
peer_role_arn=peer_role_arn,
tags=tags,
)
jsii.create(CfnVPCPeeringConnection, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::VPCPeeringConnection.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="peerVpcId")
def peer_vpc_id(self) -> builtins.str:
"""``AWS::EC2::VPCPeeringConnection.PeerVpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-peervpcid
"""
return jsii.get(self, "peerVpcId")
@peer_vpc_id.setter # type: ignore
def peer_vpc_id(self, value: builtins.str) -> None:
jsii.set(self, "peerVpcId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::VPCPeeringConnection.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-vpcid
"""
return jsii.get(self, "vpcId")
@vpc_id.setter # type: ignore
def vpc_id(self, value: builtins.str) -> None:
jsii.set(self, "vpcId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="peerOwnerId")
def peer_owner_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCPeeringConnection.PeerOwnerId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-peerownerid
"""
return jsii.get(self, "peerOwnerId")
@peer_owner_id.setter # type: ignore
def peer_owner_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "peerOwnerId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="peerRegion")
def peer_region(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCPeeringConnection.PeerRegion``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-peerregion
"""
return jsii.get(self, "peerRegion")
@peer_region.setter # type: ignore
def peer_region(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "peerRegion", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="peerRoleArn")
def peer_role_arn(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCPeeringConnection.PeerRoleArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-peerrolearn
"""
return jsii.get(self, "peerRoleArn")
@peer_role_arn.setter # type: ignore
def peer_role_arn(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "peerRoleArn", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPCPeeringConnectionProps",
jsii_struct_bases=[],
name_mapping={
"peer_vpc_id": "peerVpcId",
"vpc_id": "vpcId",
"peer_owner_id": "peerOwnerId",
"peer_region": "peerRegion",
"peer_role_arn": "peerRoleArn",
"tags": "tags",
},
)
class CfnVPCPeeringConnectionProps:
def __init__(
self,
*,
peer_vpc_id: builtins.str,
vpc_id: builtins.str,
peer_owner_id: typing.Optional[builtins.str] = None,
peer_region: typing.Optional[builtins.str] = None,
peer_role_arn: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::VPCPeeringConnection``.
:param peer_vpc_id: ``AWS::EC2::VPCPeeringConnection.PeerVpcId``.
:param vpc_id: ``AWS::EC2::VPCPeeringConnection.VpcId``.
:param peer_owner_id: ``AWS::EC2::VPCPeeringConnection.PeerOwnerId``.
:param peer_region: ``AWS::EC2::VPCPeeringConnection.PeerRegion``.
:param peer_role_arn: ``AWS::EC2::VPCPeeringConnection.PeerRoleArn``.
:param tags: ``AWS::EC2::VPCPeeringConnection.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html
"""
self._values: typing.Dict[str, typing.Any] = {
"peer_vpc_id": peer_vpc_id,
"vpc_id": vpc_id,
}
if peer_owner_id is not None:
self._values["peer_owner_id"] = peer_owner_id
if peer_region is not None:
self._values["peer_region"] = peer_region
if peer_role_arn is not None:
self._values["peer_role_arn"] = peer_role_arn
if tags is not None:
self._values["tags"] = tags
@builtins.property
def peer_vpc_id(self) -> builtins.str:
"""``AWS::EC2::VPCPeeringConnection.PeerVpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-peervpcid
"""
result = self._values.get("peer_vpc_id")
assert result is not None, "Required property 'peer_vpc_id' is missing"
return result
@builtins.property
def vpc_id(self) -> builtins.str:
"""``AWS::EC2::VPCPeeringConnection.VpcId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-vpcid
"""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def peer_owner_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCPeeringConnection.PeerOwnerId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-peerownerid
"""
result = self._values.get("peer_owner_id")
return result
@builtins.property
def peer_region(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCPeeringConnection.PeerRegion``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-peerregion
"""
result = self._values.get("peer_region")
return result
@builtins.property
def peer_role_arn(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPCPeeringConnection.PeerRoleArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-peerrolearn
"""
result = self._values.get("peer_role_arn")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::VPCPeeringConnection.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpcpeeringconnection.html#cfn-ec2-vpcpeeringconnection-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVPCPeeringConnectionProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPCProps",
jsii_struct_bases=[],
name_mapping={
"cidr_block": "cidrBlock",
"enable_dns_hostnames": "enableDnsHostnames",
"enable_dns_support": "enableDnsSupport",
"instance_tenancy": "instanceTenancy",
"tags": "tags",
},
)
class CfnVPCProps:
def __init__(
self,
*,
cidr_block: builtins.str,
enable_dns_hostnames: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
enable_dns_support: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
instance_tenancy: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::VPC``.
:param cidr_block: ``AWS::EC2::VPC.CidrBlock``.
:param enable_dns_hostnames: ``AWS::EC2::VPC.EnableDnsHostnames``.
:param enable_dns_support: ``AWS::EC2::VPC.EnableDnsSupport``.
:param instance_tenancy: ``AWS::EC2::VPC.InstanceTenancy``.
:param tags: ``AWS::EC2::VPC.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html
"""
self._values: typing.Dict[str, typing.Any] = {
"cidr_block": cidr_block,
}
if enable_dns_hostnames is not None:
self._values["enable_dns_hostnames"] = enable_dns_hostnames
if enable_dns_support is not None:
self._values["enable_dns_support"] = enable_dns_support
if instance_tenancy is not None:
self._values["instance_tenancy"] = instance_tenancy
if tags is not None:
self._values["tags"] = tags
@builtins.property
def cidr_block(self) -> builtins.str:
"""``AWS::EC2::VPC.CidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-cidrblock
"""
result = self._values.get("cidr_block")
assert result is not None, "Required property 'cidr_block' is missing"
return result
@builtins.property
def enable_dns_hostnames(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::VPC.EnableDnsHostnames``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-EnableDnsHostnames
"""
result = self._values.get("enable_dns_hostnames")
return result
@builtins.property
def enable_dns_support(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::VPC.EnableDnsSupport``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-EnableDnsSupport
"""
result = self._values.get("enable_dns_support")
return result
@builtins.property
def instance_tenancy(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPC.InstanceTenancy``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-instancetenancy
"""
result = self._values.get("instance_tenancy")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::VPC.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html#cfn-aws-ec2-vpc-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVPCProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVPNConnection(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVPNConnection",
):
"""A CloudFormation ``AWS::EC2::VPNConnection``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html
:cloudformationResource: AWS::EC2::VPNConnection
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
customer_gateway_id: builtins.str,
type: builtins.str,
static_routes_only: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
transit_gateway_id: typing.Optional[builtins.str] = None,
vpn_gateway_id: typing.Optional[builtins.str] = None,
vpn_tunnel_options_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnVPNConnection.VpnTunnelOptionsSpecificationProperty"]]]] = None,
) -> None:
"""Create a new ``AWS::EC2::VPNConnection``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param customer_gateway_id: ``AWS::EC2::VPNConnection.CustomerGatewayId``.
:param type: ``AWS::EC2::VPNConnection.Type``.
:param static_routes_only: ``AWS::EC2::VPNConnection.StaticRoutesOnly``.
:param tags: ``AWS::EC2::VPNConnection.Tags``.
:param transit_gateway_id: ``AWS::EC2::VPNConnection.TransitGatewayId``.
:param vpn_gateway_id: ``AWS::EC2::VPNConnection.VpnGatewayId``.
:param vpn_tunnel_options_specifications: ``AWS::EC2::VPNConnection.VpnTunnelOptionsSpecifications``.
"""
props = CfnVPNConnectionProps(
customer_gateway_id=customer_gateway_id,
type=type,
static_routes_only=static_routes_only,
tags=tags,
transit_gateway_id=transit_gateway_id,
vpn_gateway_id=vpn_gateway_id,
vpn_tunnel_options_specifications=vpn_tunnel_options_specifications,
)
jsii.create(CfnVPNConnection, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::VPNConnection.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="customerGatewayId")
def customer_gateway_id(self) -> builtins.str:
"""``AWS::EC2::VPNConnection.CustomerGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-customergatewayid
"""
return jsii.get(self, "customerGatewayId")
@customer_gateway_id.setter # type: ignore
def customer_gateway_id(self, value: builtins.str) -> None:
jsii.set(self, "customerGatewayId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="type")
def type(self) -> builtins.str:
"""``AWS::EC2::VPNConnection.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-type
"""
return jsii.get(self, "type")
@type.setter # type: ignore
def type(self, value: builtins.str) -> None:
jsii.set(self, "type", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="staticRoutesOnly")
def static_routes_only(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::VPNConnection.StaticRoutesOnly``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-StaticRoutesOnly
"""
return jsii.get(self, "staticRoutesOnly")
@static_routes_only.setter # type: ignore
def static_routes_only(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "staticRoutesOnly", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="transitGatewayId")
def transit_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPNConnection.TransitGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-transitgatewayid
"""
return jsii.get(self, "transitGatewayId")
@transit_gateway_id.setter # type: ignore
def transit_gateway_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "transitGatewayId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpnGatewayId")
def vpn_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPNConnection.VpnGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-vpngatewayid
"""
return jsii.get(self, "vpnGatewayId")
@vpn_gateway_id.setter # type: ignore
def vpn_gateway_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "vpnGatewayId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpnTunnelOptionsSpecifications")
def vpn_tunnel_options_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnVPNConnection.VpnTunnelOptionsSpecificationProperty"]]]]:
"""``AWS::EC2::VPNConnection.VpnTunnelOptionsSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-vpntunneloptionsspecifications
"""
return jsii.get(self, "vpnTunnelOptionsSpecifications")
@vpn_tunnel_options_specifications.setter # type: ignore
def vpn_tunnel_options_specifications(
self,
value: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, "CfnVPNConnection.VpnTunnelOptionsSpecificationProperty"]]]],
) -> None:
jsii.set(self, "vpnTunnelOptionsSpecifications", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPNConnection.VpnTunnelOptionsSpecificationProperty",
jsii_struct_bases=[],
name_mapping={
"pre_shared_key": "preSharedKey",
"tunnel_inside_cidr": "tunnelInsideCidr",
},
)
class VpnTunnelOptionsSpecificationProperty:
def __init__(
self,
*,
pre_shared_key: typing.Optional[builtins.str] = None,
tunnel_inside_cidr: typing.Optional[builtins.str] = None,
) -> None:
"""
:param pre_shared_key: ``CfnVPNConnection.VpnTunnelOptionsSpecificationProperty.PreSharedKey``.
:param tunnel_inside_cidr: ``CfnVPNConnection.VpnTunnelOptionsSpecificationProperty.TunnelInsideCidr``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-vpnconnection-vpntunneloptionsspecification.html
"""
self._values: typing.Dict[str, typing.Any] = {}
if pre_shared_key is not None:
self._values["pre_shared_key"] = pre_shared_key
if tunnel_inside_cidr is not None:
self._values["tunnel_inside_cidr"] = tunnel_inside_cidr
@builtins.property
def pre_shared_key(self) -> typing.Optional[builtins.str]:
"""``CfnVPNConnection.VpnTunnelOptionsSpecificationProperty.PreSharedKey``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-vpnconnection-vpntunneloptionsspecification.html#cfn-ec2-vpnconnection-vpntunneloptionsspecification-presharedkey
"""
result = self._values.get("pre_shared_key")
return result
@builtins.property
def tunnel_inside_cidr(self) -> typing.Optional[builtins.str]:
"""``CfnVPNConnection.VpnTunnelOptionsSpecificationProperty.TunnelInsideCidr``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-vpnconnection-vpntunneloptionsspecification.html#cfn-ec2-vpnconnection-vpntunneloptionsspecification-tunnelinsidecidr
"""
result = self._values.get("tunnel_inside_cidr")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "VpnTunnelOptionsSpecificationProperty(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPNConnectionProps",
jsii_struct_bases=[],
name_mapping={
"customer_gateway_id": "customerGatewayId",
"type": "type",
"static_routes_only": "staticRoutesOnly",
"tags": "tags",
"transit_gateway_id": "transitGatewayId",
"vpn_gateway_id": "vpnGatewayId",
"vpn_tunnel_options_specifications": "vpnTunnelOptionsSpecifications",
},
)
class CfnVPNConnectionProps:
def __init__(
self,
*,
customer_gateway_id: builtins.str,
type: builtins.str,
static_routes_only: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
transit_gateway_id: typing.Optional[builtins.str] = None,
vpn_gateway_id: typing.Optional[builtins.str] = None,
vpn_tunnel_options_specifications: typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnVPNConnection.VpnTunnelOptionsSpecificationProperty]]]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::VPNConnection``.
:param customer_gateway_id: ``AWS::EC2::VPNConnection.CustomerGatewayId``.
:param type: ``AWS::EC2::VPNConnection.Type``.
:param static_routes_only: ``AWS::EC2::VPNConnection.StaticRoutesOnly``.
:param tags: ``AWS::EC2::VPNConnection.Tags``.
:param transit_gateway_id: ``AWS::EC2::VPNConnection.TransitGatewayId``.
:param vpn_gateway_id: ``AWS::EC2::VPNConnection.VpnGatewayId``.
:param vpn_tunnel_options_specifications: ``AWS::EC2::VPNConnection.VpnTunnelOptionsSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html
"""
self._values: typing.Dict[str, typing.Any] = {
"customer_gateway_id": customer_gateway_id,
"type": type,
}
if static_routes_only is not None:
self._values["static_routes_only"] = static_routes_only
if tags is not None:
self._values["tags"] = tags
if transit_gateway_id is not None:
self._values["transit_gateway_id"] = transit_gateway_id
if vpn_gateway_id is not None:
self._values["vpn_gateway_id"] = vpn_gateway_id
if vpn_tunnel_options_specifications is not None:
self._values["vpn_tunnel_options_specifications"] = vpn_tunnel_options_specifications
@builtins.property
def customer_gateway_id(self) -> builtins.str:
"""``AWS::EC2::VPNConnection.CustomerGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-customergatewayid
"""
result = self._values.get("customer_gateway_id")
assert result is not None, "Required property 'customer_gateway_id' is missing"
return result
@builtins.property
def type(self) -> builtins.str:
"""``AWS::EC2::VPNConnection.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-type
"""
result = self._values.get("type")
assert result is not None, "Required property 'type' is missing"
return result
@builtins.property
def static_routes_only(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::VPNConnection.StaticRoutesOnly``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-StaticRoutesOnly
"""
result = self._values.get("static_routes_only")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::VPNConnection.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-tags
"""
result = self._values.get("tags")
return result
@builtins.property
def transit_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPNConnection.TransitGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-transitgatewayid
"""
result = self._values.get("transit_gateway_id")
return result
@builtins.property
def vpn_gateway_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::VPNConnection.VpnGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-vpngatewayid
"""
result = self._values.get("vpn_gateway_id")
return result
@builtins.property
def vpn_tunnel_options_specifications(
self,
) -> typing.Optional[typing.Union[aws_cdk.core.IResolvable, typing.List[typing.Union[aws_cdk.core.IResolvable, CfnVPNConnection.VpnTunnelOptionsSpecificationProperty]]]]:
"""``AWS::EC2::VPNConnection.VpnTunnelOptionsSpecifications``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection.html#cfn-ec2-vpnconnection-vpntunneloptionsspecifications
"""
result = self._values.get("vpn_tunnel_options_specifications")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVPNConnectionProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVPNConnectionRoute(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVPNConnectionRoute",
):
"""A CloudFormation ``AWS::EC2::VPNConnectionRoute``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection-route.html
:cloudformationResource: AWS::EC2::VPNConnectionRoute
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
destination_cidr_block: builtins.str,
vpn_connection_id: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::VPNConnectionRoute``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param destination_cidr_block: ``AWS::EC2::VPNConnectionRoute.DestinationCidrBlock``.
:param vpn_connection_id: ``AWS::EC2::VPNConnectionRoute.VpnConnectionId``.
"""
props = CfnVPNConnectionRouteProps(
destination_cidr_block=destination_cidr_block,
vpn_connection_id=vpn_connection_id,
)
jsii.create(CfnVPNConnectionRoute, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="destinationCidrBlock")
def destination_cidr_block(self) -> builtins.str:
"""``AWS::EC2::VPNConnectionRoute.DestinationCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection-route.html#cfn-ec2-vpnconnectionroute-cidrblock
"""
return jsii.get(self, "destinationCidrBlock")
@destination_cidr_block.setter # type: ignore
def destination_cidr_block(self, value: builtins.str) -> None:
jsii.set(self, "destinationCidrBlock", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpnConnectionId")
def vpn_connection_id(self) -> builtins.str:
"""``AWS::EC2::VPNConnectionRoute.VpnConnectionId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection-route.html#cfn-ec2-vpnconnectionroute-connectionid
"""
return jsii.get(self, "vpnConnectionId")
@vpn_connection_id.setter # type: ignore
def vpn_connection_id(self, value: builtins.str) -> None:
jsii.set(self, "vpnConnectionId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPNConnectionRouteProps",
jsii_struct_bases=[],
name_mapping={
"destination_cidr_block": "destinationCidrBlock",
"vpn_connection_id": "vpnConnectionId",
},
)
class CfnVPNConnectionRouteProps:
def __init__(
self,
*,
destination_cidr_block: builtins.str,
vpn_connection_id: builtins.str,
) -> None:
"""Properties for defining a ``AWS::EC2::VPNConnectionRoute``.
:param destination_cidr_block: ``AWS::EC2::VPNConnectionRoute.DestinationCidrBlock``.
:param vpn_connection_id: ``AWS::EC2::VPNConnectionRoute.VpnConnectionId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection-route.html
"""
self._values: typing.Dict[str, typing.Any] = {
"destination_cidr_block": destination_cidr_block,
"vpn_connection_id": vpn_connection_id,
}
@builtins.property
def destination_cidr_block(self) -> builtins.str:
"""``AWS::EC2::VPNConnectionRoute.DestinationCidrBlock``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection-route.html#cfn-ec2-vpnconnectionroute-cidrblock
"""
result = self._values.get("destination_cidr_block")
assert result is not None, "Required property 'destination_cidr_block' is missing"
return result
@builtins.property
def vpn_connection_id(self) -> builtins.str:
"""``AWS::EC2::VPNConnectionRoute.VpnConnectionId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-connection-route.html#cfn-ec2-vpnconnectionroute-connectionid
"""
result = self._values.get("vpn_connection_id")
assert result is not None, "Required property 'vpn_connection_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVPNConnectionRouteProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVPNGateway(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVPNGateway",
):
"""A CloudFormation ``AWS::EC2::VPNGateway``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html
:cloudformationResource: AWS::EC2::VPNGateway
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
type: builtins.str,
amazon_side_asn: typing.Optional[jsii.Number] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Create a new ``AWS::EC2::VPNGateway``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param type: ``AWS::EC2::VPNGateway.Type``.
:param amazon_side_asn: ``AWS::EC2::VPNGateway.AmazonSideAsn``.
:param tags: ``AWS::EC2::VPNGateway.Tags``.
"""
props = CfnVPNGatewayProps(
type=type, amazon_side_asn=amazon_side_asn, tags=tags
)
jsii.create(CfnVPNGateway, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::VPNGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html#cfn-ec2-vpngateway-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="type")
def type(self) -> builtins.str:
"""``AWS::EC2::VPNGateway.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html#cfn-ec2-vpngateway-type
"""
return jsii.get(self, "type")
@type.setter # type: ignore
def type(self, value: builtins.str) -> None:
jsii.set(self, "type", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="amazonSideAsn")
def amazon_side_asn(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::VPNGateway.AmazonSideAsn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html#cfn-ec2-vpngateway-amazonsideasn
"""
return jsii.get(self, "amazonSideAsn")
@amazon_side_asn.setter # type: ignore
def amazon_side_asn(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "amazonSideAsn", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPNGatewayProps",
jsii_struct_bases=[],
name_mapping={"type": "type", "amazon_side_asn": "amazonSideAsn", "tags": "tags"},
)
class CfnVPNGatewayProps:
def __init__(
self,
*,
type: builtins.str,
amazon_side_asn: typing.Optional[jsii.Number] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::VPNGateway``.
:param type: ``AWS::EC2::VPNGateway.Type``.
:param amazon_side_asn: ``AWS::EC2::VPNGateway.AmazonSideAsn``.
:param tags: ``AWS::EC2::VPNGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html
"""
self._values: typing.Dict[str, typing.Any] = {
"type": type,
}
if amazon_side_asn is not None:
self._values["amazon_side_asn"] = amazon_side_asn
if tags is not None:
self._values["tags"] = tags
@builtins.property
def type(self) -> builtins.str:
"""``AWS::EC2::VPNGateway.Type``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html#cfn-ec2-vpngateway-type
"""
result = self._values.get("type")
assert result is not None, "Required property 'type' is missing"
return result
@builtins.property
def amazon_side_asn(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::VPNGateway.AmazonSideAsn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html#cfn-ec2-vpngateway-amazonsideasn
"""
result = self._values.get("amazon_side_asn")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::VPNGateway.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gateway.html#cfn-ec2-vpngateway-tags
"""
result = self._values.get("tags")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVPNGatewayProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVPNGatewayRoutePropagation(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVPNGatewayRoutePropagation",
):
"""A CloudFormation ``AWS::EC2::VPNGatewayRoutePropagation``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gatewayrouteprop.html
:cloudformationResource: AWS::EC2::VPNGatewayRoutePropagation
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
route_table_ids: typing.List[builtins.str],
vpn_gateway_id: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::VPNGatewayRoutePropagation``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param route_table_ids: ``AWS::EC2::VPNGatewayRoutePropagation.RouteTableIds``.
:param vpn_gateway_id: ``AWS::EC2::VPNGatewayRoutePropagation.VpnGatewayId``.
"""
props = CfnVPNGatewayRoutePropagationProps(
route_table_ids=route_table_ids, vpn_gateway_id=vpn_gateway_id
)
jsii.create(CfnVPNGatewayRoutePropagation, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="routeTableIds")
def route_table_ids(self) -> typing.List[builtins.str]:
"""``AWS::EC2::VPNGatewayRoutePropagation.RouteTableIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gatewayrouteprop.html#cfn-ec2-vpngatewayrouteprop-routetableids
"""
return jsii.get(self, "routeTableIds")
@route_table_ids.setter # type: ignore
def route_table_ids(self, value: typing.List[builtins.str]) -> None:
jsii.set(self, "routeTableIds", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="vpnGatewayId")
def vpn_gateway_id(self) -> builtins.str:
"""``AWS::EC2::VPNGatewayRoutePropagation.VpnGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gatewayrouteprop.html#cfn-ec2-vpngatewayrouteprop-vpngatewayid
"""
return jsii.get(self, "vpnGatewayId")
@vpn_gateway_id.setter # type: ignore
def vpn_gateway_id(self, value: builtins.str) -> None:
jsii.set(self, "vpnGatewayId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVPNGatewayRoutePropagationProps",
jsii_struct_bases=[],
name_mapping={
"route_table_ids": "routeTableIds",
"vpn_gateway_id": "vpnGatewayId",
},
)
class CfnVPNGatewayRoutePropagationProps:
def __init__(
self,
*,
route_table_ids: typing.List[builtins.str],
vpn_gateway_id: builtins.str,
) -> None:
"""Properties for defining a ``AWS::EC2::VPNGatewayRoutePropagation``.
:param route_table_ids: ``AWS::EC2::VPNGatewayRoutePropagation.RouteTableIds``.
:param vpn_gateway_id: ``AWS::EC2::VPNGatewayRoutePropagation.VpnGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gatewayrouteprop.html
"""
self._values: typing.Dict[str, typing.Any] = {
"route_table_ids": route_table_ids,
"vpn_gateway_id": vpn_gateway_id,
}
@builtins.property
def route_table_ids(self) -> typing.List[builtins.str]:
"""``AWS::EC2::VPNGatewayRoutePropagation.RouteTableIds``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gatewayrouteprop.html#cfn-ec2-vpngatewayrouteprop-routetableids
"""
result = self._values.get("route_table_ids")
assert result is not None, "Required property 'route_table_ids' is missing"
return result
@builtins.property
def vpn_gateway_id(self) -> builtins.str:
"""``AWS::EC2::VPNGatewayRoutePropagation.VpnGatewayId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpn-gatewayrouteprop.html#cfn-ec2-vpngatewayrouteprop-vpngatewayid
"""
result = self._values.get("vpn_gateway_id")
assert result is not None, "Required property 'vpn_gateway_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVPNGatewayRoutePropagationProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVolume(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVolume",
):
"""A CloudFormation ``AWS::EC2::Volume``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html
:cloudformationResource: AWS::EC2::Volume
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
availability_zone: builtins.str,
auto_enable_io: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
encrypted: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
iops: typing.Optional[jsii.Number] = None,
kms_key_id: typing.Optional[builtins.str] = None,
multi_attach_enabled: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
outpost_arn: typing.Optional[builtins.str] = None,
size: typing.Optional[jsii.Number] = None,
snapshot_id: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
throughput: typing.Optional[jsii.Number] = None,
volume_type: typing.Optional[builtins.str] = None,
) -> None:
"""Create a new ``AWS::EC2::Volume``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param availability_zone: ``AWS::EC2::Volume.AvailabilityZone``.
:param auto_enable_io: ``AWS::EC2::Volume.AutoEnableIO``.
:param encrypted: ``AWS::EC2::Volume.Encrypted``.
:param iops: ``AWS::EC2::Volume.Iops``.
:param kms_key_id: ``AWS::EC2::Volume.KmsKeyId``.
:param multi_attach_enabled: ``AWS::EC2::Volume.MultiAttachEnabled``.
:param outpost_arn: ``AWS::EC2::Volume.OutpostArn``.
:param size: ``AWS::EC2::Volume.Size``.
:param snapshot_id: ``AWS::EC2::Volume.SnapshotId``.
:param tags: ``AWS::EC2::Volume.Tags``.
:param throughput: ``AWS::EC2::Volume.Throughput``.
:param volume_type: ``AWS::EC2::Volume.VolumeType``.
"""
props = CfnVolumeProps(
availability_zone=availability_zone,
auto_enable_io=auto_enable_io,
encrypted=encrypted,
iops=iops,
kms_key_id=kms_key_id,
multi_attach_enabled=multi_attach_enabled,
outpost_arn=outpost_arn,
size=size,
snapshot_id=snapshot_id,
tags=tags,
throughput=throughput,
volume_type=volume_type,
)
jsii.create(CfnVolume, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def tags(self) -> aws_cdk.core.TagManager:
"""``AWS::EC2::Volume.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-tags
"""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZone")
def availability_zone(self) -> builtins.str:
"""``AWS::EC2::Volume.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-availabilityzone
"""
return jsii.get(self, "availabilityZone")
@availability_zone.setter # type: ignore
def availability_zone(self, value: builtins.str) -> None:
jsii.set(self, "availabilityZone", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="autoEnableIo")
def auto_enable_io(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Volume.AutoEnableIO``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-autoenableio
"""
return jsii.get(self, "autoEnableIo")
@auto_enable_io.setter # type: ignore
def auto_enable_io(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "autoEnableIo", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="encrypted")
def encrypted(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Volume.Encrypted``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-encrypted
"""
return jsii.get(self, "encrypted")
@encrypted.setter # type: ignore
def encrypted(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "encrypted", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="iops")
def iops(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::Volume.Iops``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-iops
"""
return jsii.get(self, "iops")
@iops.setter # type: ignore
def iops(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "iops", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="kmsKeyId")
def kms_key_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Volume.KmsKeyId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-kmskeyid
"""
return jsii.get(self, "kmsKeyId")
@kms_key_id.setter # type: ignore
def kms_key_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "kmsKeyId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="multiAttachEnabled")
def multi_attach_enabled(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Volume.MultiAttachEnabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-multiattachenabled
"""
return jsii.get(self, "multiAttachEnabled")
@multi_attach_enabled.setter # type: ignore
def multi_attach_enabled(
self,
value: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]],
) -> None:
jsii.set(self, "multiAttachEnabled", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="outpostArn")
def outpost_arn(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Volume.OutpostArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-outpostarn
"""
return jsii.get(self, "outpostArn")
@outpost_arn.setter # type: ignore
def outpost_arn(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "outpostArn", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="size")
def size(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::Volume.Size``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-size
"""
return jsii.get(self, "size")
@size.setter # type: ignore
def size(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "size", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="snapshotId")
def snapshot_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Volume.SnapshotId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-snapshotid
"""
return jsii.get(self, "snapshotId")
@snapshot_id.setter # type: ignore
def snapshot_id(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "snapshotId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="throughput")
def throughput(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::Volume.Throughput``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-throughput
"""
return jsii.get(self, "throughput")
@throughput.setter # type: ignore
def throughput(self, value: typing.Optional[jsii.Number]) -> None:
jsii.set(self, "throughput", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="volumeType")
def volume_type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Volume.VolumeType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-volumetype
"""
return jsii.get(self, "volumeType")
@volume_type.setter # type: ignore
def volume_type(self, value: typing.Optional[builtins.str]) -> None:
jsii.set(self, "volumeType", value)
@jsii.implements(aws_cdk.core.IInspectable)
class CfnVolumeAttachment(
aws_cdk.core.CfnResource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CfnVolumeAttachment",
):
"""A CloudFormation ``AWS::EC2::VolumeAttachment``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html
:cloudformationResource: AWS::EC2::VolumeAttachment
"""
def __init__(
self,
scope: aws_cdk.core.Construct,
id: builtins.str,
*,
device: builtins.str,
instance_id: builtins.str,
volume_id: builtins.str,
) -> None:
"""Create a new ``AWS::EC2::VolumeAttachment``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param device: ``AWS::EC2::VolumeAttachment.Device``.
:param instance_id: ``AWS::EC2::VolumeAttachment.InstanceId``.
:param volume_id: ``AWS::EC2::VolumeAttachment.VolumeId``.
"""
props = CfnVolumeAttachmentProps(
device=device, instance_id=instance_id, volume_id=volume_id
)
jsii.create(CfnVolumeAttachment, self, [scope, id, props])
@jsii.member(jsii_name="inspect")
def inspect(self, inspector: aws_cdk.core.TreeInspector) -> None:
"""(experimental) Examines the CloudFormation resource and discloses attributes.
:param inspector: - tree inspector to collect and process attributes.
:stability: experimental
"""
return jsii.invoke(self, "inspect", [inspector])
@jsii.member(jsii_name="renderProperties")
def _render_properties(
self,
props: typing.Mapping[builtins.str, typing.Any],
) -> typing.Mapping[builtins.str, typing.Any]:
"""
:param props: -
"""
return jsii.invoke(self, "renderProperties", [props])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CFN_RESOURCE_TYPE_NAME")
def CFN_RESOURCE_TYPE_NAME(cls) -> builtins.str:
"""The CloudFormation resource type name for this resource class."""
return jsii.sget(cls, "CFN_RESOURCE_TYPE_NAME")
@builtins.property # type: ignore
@jsii.member(jsii_name="cfnProperties")
def _cfn_properties(self) -> typing.Mapping[builtins.str, typing.Any]:
return jsii.get(self, "cfnProperties")
@builtins.property # type: ignore
@jsii.member(jsii_name="device")
def device(self) -> builtins.str:
"""``AWS::EC2::VolumeAttachment.Device``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html#cfn-ec2-ebs-volumeattachment-device
"""
return jsii.get(self, "device")
@device.setter # type: ignore
def device(self, value: builtins.str) -> None:
jsii.set(self, "device", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceId")
def instance_id(self) -> builtins.str:
"""``AWS::EC2::VolumeAttachment.InstanceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html#cfn-ec2-ebs-volumeattachment-instanceid
"""
return jsii.get(self, "instanceId")
@instance_id.setter # type: ignore
def instance_id(self, value: builtins.str) -> None:
jsii.set(self, "instanceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="volumeId")
def volume_id(self) -> builtins.str:
"""``AWS::EC2::VolumeAttachment.VolumeId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html#cfn-ec2-ebs-volumeattachment-volumeid
"""
return jsii.get(self, "volumeId")
@volume_id.setter # type: ignore
def volume_id(self, value: builtins.str) -> None:
jsii.set(self, "volumeId", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVolumeAttachmentProps",
jsii_struct_bases=[],
name_mapping={
"device": "device",
"instance_id": "instanceId",
"volume_id": "volumeId",
},
)
class CfnVolumeAttachmentProps:
def __init__(
self,
*,
device: builtins.str,
instance_id: builtins.str,
volume_id: builtins.str,
) -> None:
"""Properties for defining a ``AWS::EC2::VolumeAttachment``.
:param device: ``AWS::EC2::VolumeAttachment.Device``.
:param instance_id: ``AWS::EC2::VolumeAttachment.InstanceId``.
:param volume_id: ``AWS::EC2::VolumeAttachment.VolumeId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html
"""
self._values: typing.Dict[str, typing.Any] = {
"device": device,
"instance_id": instance_id,
"volume_id": volume_id,
}
@builtins.property
def device(self) -> builtins.str:
"""``AWS::EC2::VolumeAttachment.Device``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html#cfn-ec2-ebs-volumeattachment-device
"""
result = self._values.get("device")
assert result is not None, "Required property 'device' is missing"
return result
@builtins.property
def instance_id(self) -> builtins.str:
"""``AWS::EC2::VolumeAttachment.InstanceId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html#cfn-ec2-ebs-volumeattachment-instanceid
"""
result = self._values.get("instance_id")
assert result is not None, "Required property 'instance_id' is missing"
return result
@builtins.property
def volume_id(self) -> builtins.str:
"""``AWS::EC2::VolumeAttachment.VolumeId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volumeattachment.html#cfn-ec2-ebs-volumeattachment-volumeid
"""
result = self._values.get("volume_id")
assert result is not None, "Required property 'volume_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVolumeAttachmentProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CfnVolumeProps",
jsii_struct_bases=[],
name_mapping={
"availability_zone": "availabilityZone",
"auto_enable_io": "autoEnableIo",
"encrypted": "encrypted",
"iops": "iops",
"kms_key_id": "kmsKeyId",
"multi_attach_enabled": "multiAttachEnabled",
"outpost_arn": "outpostArn",
"size": "size",
"snapshot_id": "snapshotId",
"tags": "tags",
"throughput": "throughput",
"volume_type": "volumeType",
},
)
class CfnVolumeProps:
def __init__(
self,
*,
availability_zone: builtins.str,
auto_enable_io: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
encrypted: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
iops: typing.Optional[jsii.Number] = None,
kms_key_id: typing.Optional[builtins.str] = None,
multi_attach_enabled: typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]] = None,
outpost_arn: typing.Optional[builtins.str] = None,
size: typing.Optional[jsii.Number] = None,
snapshot_id: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.List[aws_cdk.core.CfnTag]] = None,
throughput: typing.Optional[jsii.Number] = None,
volume_type: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for defining a ``AWS::EC2::Volume``.
:param availability_zone: ``AWS::EC2::Volume.AvailabilityZone``.
:param auto_enable_io: ``AWS::EC2::Volume.AutoEnableIO``.
:param encrypted: ``AWS::EC2::Volume.Encrypted``.
:param iops: ``AWS::EC2::Volume.Iops``.
:param kms_key_id: ``AWS::EC2::Volume.KmsKeyId``.
:param multi_attach_enabled: ``AWS::EC2::Volume.MultiAttachEnabled``.
:param outpost_arn: ``AWS::EC2::Volume.OutpostArn``.
:param size: ``AWS::EC2::Volume.Size``.
:param snapshot_id: ``AWS::EC2::Volume.SnapshotId``.
:param tags: ``AWS::EC2::Volume.Tags``.
:param throughput: ``AWS::EC2::Volume.Throughput``.
:param volume_type: ``AWS::EC2::Volume.VolumeType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html
"""
self._values: typing.Dict[str, typing.Any] = {
"availability_zone": availability_zone,
}
if auto_enable_io is not None:
self._values["auto_enable_io"] = auto_enable_io
if encrypted is not None:
self._values["encrypted"] = encrypted
if iops is not None:
self._values["iops"] = iops
if kms_key_id is not None:
self._values["kms_key_id"] = kms_key_id
if multi_attach_enabled is not None:
self._values["multi_attach_enabled"] = multi_attach_enabled
if outpost_arn is not None:
self._values["outpost_arn"] = outpost_arn
if size is not None:
self._values["size"] = size
if snapshot_id is not None:
self._values["snapshot_id"] = snapshot_id
if tags is not None:
self._values["tags"] = tags
if throughput is not None:
self._values["throughput"] = throughput
if volume_type is not None:
self._values["volume_type"] = volume_type
@builtins.property
def availability_zone(self) -> builtins.str:
"""``AWS::EC2::Volume.AvailabilityZone``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-availabilityzone
"""
result = self._values.get("availability_zone")
assert result is not None, "Required property 'availability_zone' is missing"
return result
@builtins.property
def auto_enable_io(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Volume.AutoEnableIO``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-autoenableio
"""
result = self._values.get("auto_enable_io")
return result
@builtins.property
def encrypted(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Volume.Encrypted``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-encrypted
"""
result = self._values.get("encrypted")
return result
@builtins.property
def iops(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::Volume.Iops``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-iops
"""
result = self._values.get("iops")
return result
@builtins.property
def kms_key_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Volume.KmsKeyId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-kmskeyid
"""
result = self._values.get("kms_key_id")
return result
@builtins.property
def multi_attach_enabled(
self,
) -> typing.Optional[typing.Union[builtins.bool, aws_cdk.core.IResolvable]]:
"""``AWS::EC2::Volume.MultiAttachEnabled``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-multiattachenabled
"""
result = self._values.get("multi_attach_enabled")
return result
@builtins.property
def outpost_arn(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Volume.OutpostArn``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-outpostarn
"""
result = self._values.get("outpost_arn")
return result
@builtins.property
def size(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::Volume.Size``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-size
"""
result = self._values.get("size")
return result
@builtins.property
def snapshot_id(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Volume.SnapshotId``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-snapshotid
"""
result = self._values.get("snapshot_id")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.List[aws_cdk.core.CfnTag]]:
"""``AWS::EC2::Volume.Tags``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-tags
"""
result = self._values.get("tags")
return result
@builtins.property
def throughput(self) -> typing.Optional[jsii.Number]:
"""``AWS::EC2::Volume.Throughput``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-throughput
"""
result = self._values.get("throughput")
return result
@builtins.property
def volume_type(self) -> typing.Optional[builtins.str]:
"""``AWS::EC2::Volume.VolumeType``.
:see: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-volumetype
"""
result = self._values.get("volume_type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CfnVolumeProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class CloudFormationInit(
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.CloudFormationInit",
):
"""A CloudFormation-init configuration."""
@jsii.member(jsii_name="fromConfig")
@builtins.classmethod
def from_config(cls, config: "InitConfig") -> "CloudFormationInit":
"""Use an existing InitConfig object as the default and only config.
:param config: -
"""
return jsii.sinvoke(cls, "fromConfig", [config])
@jsii.member(jsii_name="fromConfigSets")
@builtins.classmethod
def from_config_sets(
cls,
*,
configs: typing.Mapping[builtins.str, "InitConfig"],
config_sets: typing.Mapping[builtins.str, typing.List[builtins.str]],
) -> "CloudFormationInit":
"""Build a CloudFormationInit from config sets.
:param configs: The sets of configs to pick from.
:param config_sets: The definitions of each config set.
"""
props = ConfigSetProps(configs=configs, config_sets=config_sets)
return jsii.sinvoke(cls, "fromConfigSets", [props])
@jsii.member(jsii_name="fromElements")
@builtins.classmethod
def from_elements(cls, *elements: "InitElement") -> "CloudFormationInit":
"""Build a new config from a set of Init Elements.
:param elements: -
"""
return jsii.sinvoke(cls, "fromElements", [*elements])
@jsii.member(jsii_name="addConfig")
def add_config(self, config_name: builtins.str, config: "InitConfig") -> None:
"""Add a config with the given name to this CloudFormationInit object.
:param config_name: -
:param config: -
"""
return jsii.invoke(self, "addConfig", [config_name, config])
@jsii.member(jsii_name="addConfigSet")
def add_config_set(
self,
config_set_name: builtins.str,
config_names: typing.Optional[typing.List[builtins.str]] = None,
) -> None:
"""Add a config set with the given name to this CloudFormationInit object.
The new configset will reference the given configs in the given order.
:param config_set_name: -
:param config_names: -
"""
return jsii.invoke(self, "addConfigSet", [config_set_name, config_names])
@jsii.member(jsii_name="attach")
def attach(
self,
attached_resource: aws_cdk.core.CfnResource,
*,
instance_role: aws_cdk.aws_iam.IRole,
platform: "OperatingSystemType",
user_data: "UserData",
config_sets: typing.Optional[typing.List[builtins.str]] = None,
embed_fingerprint: typing.Optional[builtins.bool] = None,
ignore_failures: typing.Optional[builtins.bool] = None,
print_log: typing.Optional[builtins.bool] = None,
) -> None:
"""Attach the CloudFormation Init config to the given resource.
As an app builder, use ``instance.applyCloudFormationInit()`` or
``autoScalingGroup.applyCloudFormationInit()`` to trigger this method.
This method does the following:
- Renders the ``AWS::CloudFormation::Init`` object to the given resource's
metadata, potentially adding a ``AWS::CloudFormation::Authentication`` object
next to it if required.
- Updates the instance role policy to be able to call the APIs required for
``cfn-init`` and ``cfn-signal`` to work, and potentially add permissions to download
referenced asset and bucket resources.
- Updates the given UserData with commands to execute the ``cfn-init`` script.
:param attached_resource: -
:param instance_role: Instance role of the consuming instance or fleet.
:param platform: OS Platform the init config will be used for.
:param user_data: UserData to add commands to.
:param config_sets: ConfigSet to activate. Default: ['default']
:param embed_fingerprint: Whether to embed a hash into the userData. If ``true`` (the default), a hash of the config will be embedded into the UserData, so that if the config changes, the UserData changes and the instance will be replaced. If ``false``, no such hash will be embedded, and if the CloudFormation Init config changes nothing will happen to the running instance. Default: true
:param ignore_failures: Don't fail the instance creation when cfn-init fails. You can use this to prevent CloudFormation from rolling back when instances fail to start up, to help in debugging. Default: false
:param print_log: Print the results of running cfn-init to the Instance System Log. By default, the output of running cfn-init is written to a log file on the instance. Set this to ``true`` to print it to the System Log (visible from the EC2 Console), ``false`` to not print it. (Be aware that the system log is refreshed at certain points in time of the instance life cycle, and successful execution may not always show up). Default: true
"""
attach_options = AttachInitOptions(
instance_role=instance_role,
platform=platform,
user_data=user_data,
config_sets=config_sets,
embed_fingerprint=embed_fingerprint,
ignore_failures=ignore_failures,
print_log=print_log,
)
return jsii.invoke(self, "attach", [attached_resource, attach_options])
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.CommonNetworkAclEntryOptions",
jsii_struct_bases=[],
name_mapping={
"cidr": "cidr",
"rule_number": "ruleNumber",
"traffic": "traffic",
"direction": "direction",
"network_acl_entry_name": "networkAclEntryName",
"rule_action": "ruleAction",
},
)
class CommonNetworkAclEntryOptions:
def __init__(
self,
*,
cidr: AclCidr,
rule_number: jsii.Number,
traffic: AclTraffic,
direction: typing.Optional["TrafficDirection"] = None,
network_acl_entry_name: typing.Optional[builtins.str] = None,
rule_action: typing.Optional[Action] = None,
) -> None:
"""(experimental) Basic NetworkACL entry props.
:param cidr: (experimental) The CIDR range to allow or deny.
:param rule_number: (experimental) Rule number to assign to the entry, such as 100. ACL entries are processed in ascending order by rule number. Entries can't use the same rule number unless one is an egress rule and the other is an ingress rule.
:param traffic: (experimental) What kind of traffic this ACL rule applies to.
:param direction: (experimental) Traffic direction, with respect to the subnet, this rule applies to. Default: TrafficDirection.INGRESS
:param network_acl_entry_name: (experimental) The name of the NetworkAclEntry. It is not recommended to use an explicit group name. Default: If you don't specify a NetworkAclName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
:param rule_action: (experimental) Whether to allow or deny traffic that matches the rule; valid values are "allow" or "deny". Any traffic that is not explicitly allowed is automatically denied in a custom ACL, all traffic is automatically allowed in a default ACL. Default: ALLOW
:stability: experimental
"""
self._values: typing.Dict[str, typing.Any] = {
"cidr": cidr,
"rule_number": rule_number,
"traffic": traffic,
}
if direction is not None:
self._values["direction"] = direction
if network_acl_entry_name is not None:
self._values["network_acl_entry_name"] = network_acl_entry_name
if rule_action is not None:
self._values["rule_action"] = rule_action
@builtins.property
def cidr(self) -> AclCidr:
"""(experimental) The CIDR range to allow or deny.
:stability: experimental
"""
result = self._values.get("cidr")
assert result is not None, "Required property 'cidr' is missing"
return result
@builtins.property
def rule_number(self) -> jsii.Number:
"""(experimental) Rule number to assign to the entry, such as 100.
ACL entries are processed in ascending order by rule number.
Entries can't use the same rule number unless one is an egress rule and the other is an ingress rule.
:stability: experimental
"""
result = self._values.get("rule_number")
assert result is not None, "Required property 'rule_number' is missing"
return result
@builtins.property
def traffic(self) -> AclTraffic:
"""(experimental) What kind of traffic this ACL rule applies to.
:stability: experimental
"""
result = self._values.get("traffic")
assert result is not None, "Required property 'traffic' is missing"
return result
@builtins.property
def direction(self) -> typing.Optional["TrafficDirection"]:
"""(experimental) Traffic direction, with respect to the subnet, this rule applies to.
:default: TrafficDirection.INGRESS
:stability: experimental
"""
result = self._values.get("direction")
return result
@builtins.property
def network_acl_entry_name(self) -> typing.Optional[builtins.str]:
"""(experimental) The name of the NetworkAclEntry.
It is not recommended to use an explicit group name.
:default:
If you don't specify a NetworkAclName, AWS CloudFormation generates a
unique physical ID and uses that ID for the group name.
:stability: experimental
"""
result = self._values.get("network_acl_entry_name")
return result
@builtins.property
def rule_action(self) -> typing.Optional[Action]:
"""(experimental) Whether to allow or deny traffic that matches the rule; valid values are "allow" or "deny".
Any traffic that is not explicitly allowed is automatically denied in a custom
ACL, all traffic is automatically allowed in a default ACL.
:default: ALLOW
:stability: experimental
"""
result = self._values.get("rule_action")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "CommonNetworkAclEntryOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.ConfigSetProps",
jsii_struct_bases=[],
name_mapping={"configs": "configs", "config_sets": "configSets"},
)
class ConfigSetProps:
def __init__(
self,
*,
configs: typing.Mapping[builtins.str, "InitConfig"],
config_sets: typing.Mapping[builtins.str, typing.List[builtins.str]],
) -> None:
"""Options for CloudFormationInit.withConfigSets.
:param configs: The sets of configs to pick from.
:param config_sets: The definitions of each config set.
"""
self._values: typing.Dict[str, typing.Any] = {
"configs": configs,
"config_sets": config_sets,
}
@builtins.property
def configs(self) -> typing.Mapping[builtins.str, "InitConfig"]:
"""The sets of configs to pick from."""
result = self._values.get("configs")
assert result is not None, "Required property 'configs' is missing"
return result
@builtins.property
def config_sets(self) -> typing.Mapping[builtins.str, typing.List[builtins.str]]:
"""The definitions of each config set."""
result = self._values.get("config_sets")
assert result is not None, "Required property 'config_sets' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ConfigSetProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.ConfigureNatOptions",
jsii_struct_bases=[],
name_mapping={
"nat_subnets": "natSubnets",
"private_subnets": "privateSubnets",
"vpc": "vpc",
},
)
class ConfigureNatOptions:
def __init__(
self,
*,
nat_subnets: typing.List["PublicSubnet"],
private_subnets: typing.List["PrivateSubnet"],
vpc: "Vpc",
) -> None:
"""(experimental) Options passed by the VPC when NAT needs to be configured.
:param nat_subnets: (experimental) The public subnets where the NAT providers need to be placed.
:param private_subnets: (experimental) The private subnets that need to route through the NAT providers. There may be more private subnets than public subnets with NAT providers.
:param vpc: (experimental) The VPC we're configuring NAT for.
:stability: experimental
"""
self._values: typing.Dict[str, typing.Any] = {
"nat_subnets": nat_subnets,
"private_subnets": private_subnets,
"vpc": vpc,
}
@builtins.property
def nat_subnets(self) -> typing.List["PublicSubnet"]:
"""(experimental) The public subnets where the NAT providers need to be placed.
:stability: experimental
"""
result = self._values.get("nat_subnets")
assert result is not None, "Required property 'nat_subnets' is missing"
return result
@builtins.property
def private_subnets(self) -> typing.List["PrivateSubnet"]:
"""(experimental) The private subnets that need to route through the NAT providers.
There may be more private subnets than public subnets with NAT providers.
:stability: experimental
"""
result = self._values.get("private_subnets")
assert result is not None, "Required property 'private_subnets' is missing"
return result
@builtins.property
def vpc(self) -> "Vpc":
"""(experimental) The VPC we're configuring NAT for.
:stability: experimental
"""
result = self._values.get("vpc")
assert result is not None, "Required property 'vpc' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ConfigureNatOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.ConnectionRule",
jsii_struct_bases=[],
name_mapping={
"from_port": "fromPort",
"description": "description",
"protocol": "protocol",
"to_port": "toPort",
},
)
class ConnectionRule:
def __init__(
self,
*,
from_port: jsii.Number,
description: typing.Optional[builtins.str] = None,
protocol: typing.Optional[builtins.str] = None,
to_port: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param from_port: Start of port range for the TCP and UDP protocols, or an ICMP type number. If you specify icmp for the IpProtocol property, you can specify -1 as a wildcard (i.e., any ICMP type number).
:param description: Description of this connection. It is applied to both the ingress rule and the egress rule. Default: No description
:param protocol: The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). Use -1 to specify all protocols. If you specify -1, or a protocol number other than tcp, udp, icmp, or 58 (ICMPv6), traffic on all ports is allowed, regardless of any ports you specify. For tcp, udp, and icmp, you must specify a port range. For protocol 58 (ICMPv6), you can optionally specify a port range; if you don't, traffic for all types and codes is allowed. Default: tcp
:param to_port: End of port range for the TCP and UDP protocols, or an ICMP code. If you specify icmp for the IpProtocol property, you can specify -1 as a wildcard (i.e., any ICMP code). Default: If toPort is not specified, it will be the same as fromPort.
"""
self._values: typing.Dict[str, typing.Any] = {
"from_port": from_port,
}
if description is not None:
self._values["description"] = description
if protocol is not None:
self._values["protocol"] = protocol
if to_port is not None:
self._values["to_port"] = to_port
@builtins.property
def from_port(self) -> jsii.Number:
"""Start of port range for the TCP and UDP protocols, or an ICMP type number.
If you specify icmp for the IpProtocol property, you can specify
-1 as a wildcard (i.e., any ICMP type number).
"""
result = self._values.get("from_port")
assert result is not None, "Required property 'from_port' is missing"
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""Description of this connection.
It is applied to both the ingress rule
and the egress rule.
:default: No description
"""
result = self._values.get("description")
return result
@builtins.property
def protocol(self) -> typing.Optional[builtins.str]:
"""The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers).
Use -1 to specify all protocols. If you specify -1, or a protocol number
other than tcp, udp, icmp, or 58 (ICMPv6), traffic on all ports is
allowed, regardless of any ports you specify. For tcp, udp, and icmp, you
must specify a port range. For protocol 58 (ICMPv6), you can optionally
specify a port range; if you don't, traffic for all types and codes is
allowed.
:default: tcp
"""
result = self._values.get("protocol")
return result
@builtins.property
def to_port(self) -> typing.Optional[jsii.Number]:
"""End of port range for the TCP and UDP protocols, or an ICMP code.
If you specify icmp for the IpProtocol property, you can specify -1 as a
wildcard (i.e., any ICMP code).
:default: If toPort is not specified, it will be the same as fromPort.
"""
result = self._values.get("to_port")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ConnectionRule(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.ConnectionsProps",
jsii_struct_bases=[],
name_mapping={
"default_port": "defaultPort",
"peer": "peer",
"security_groups": "securityGroups",
},
)
class ConnectionsProps:
def __init__(
self,
*,
default_port: typing.Optional["Port"] = None,
peer: typing.Optional["IPeer"] = None,
security_groups: typing.Optional[typing.List["ISecurityGroup"]] = None,
) -> None:
"""Properties to intialize a new Connections object.
:param default_port: Default port range for initiating connections to and from this object. Default: - No default port
:param peer: Class that represents the rule by which others can connect to this connectable. This object is required, but will be derived from securityGroup if that is passed. Default: Derived from securityGroup if set.
:param security_groups: What securityGroup(s) this object is managing connections for. Default: No security groups
"""
self._values: typing.Dict[str, typing.Any] = {}
if default_port is not None:
self._values["default_port"] = default_port
if peer is not None:
self._values["peer"] = peer
if security_groups is not None:
self._values["security_groups"] = security_groups
@builtins.property
def default_port(self) -> typing.Optional["Port"]:
"""Default port range for initiating connections to and from this object.
:default: - No default port
"""
result = self._values.get("default_port")
return result
@builtins.property
def peer(self) -> typing.Optional["IPeer"]:
"""Class that represents the rule by which others can connect to this connectable.
This object is required, but will be derived from securityGroup if that is passed.
:default: Derived from securityGroup if set.
"""
result = self._values.get("peer")
return result
@builtins.property
def security_groups(self) -> typing.Optional[typing.List["ISecurityGroup"]]:
"""What securityGroup(s) this object is managing connections for.
:default: No security groups
"""
result = self._values.get("security_groups")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ConnectionsProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.CpuCredits")
class CpuCredits(enum.Enum):
"""Provides the options for specifying the CPU credit type for burstable EC2 instance types (T2, T3, T3a, etc).
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances-how-to.html
"""
STANDARD = "STANDARD"
"""Standard bursting mode.
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances-standard-mode.html
"""
UNLIMITED = "UNLIMITED"
"""Unlimited bursting mode.
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances-unlimited-mode.html
"""
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.DefaultInstanceTenancy")
class DefaultInstanceTenancy(enum.Enum):
"""The default tenancy of instances launched into the VPC."""
DEFAULT = "DEFAULT"
"""Instances can be launched with any tenancy."""
DEDICATED = "DEDICATED"
"""Any instance launched into the VPC automatically has dedicated tenancy, unless you launch it with the default tenancy."""
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.EbsDeviceOptionsBase",
jsii_struct_bases=[],
name_mapping={
"delete_on_termination": "deleteOnTermination",
"iops": "iops",
"volume_type": "volumeType",
},
)
class EbsDeviceOptionsBase:
def __init__(
self,
*,
delete_on_termination: typing.Optional[builtins.bool] = None,
iops: typing.Optional[jsii.Number] = None,
volume_type: typing.Optional["EbsDeviceVolumeType"] = None,
) -> None:
"""Base block device options for an EBS volume.
:param delete_on_termination: Indicates whether to delete the volume when the instance is terminated. Default: - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)
:param iops: The number of I/O operations per second (IOPS) to provision for the volume. Must only be set for {@link volumeType}: {@link EbsDeviceVolumeType.IO1} The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS, you need at least 100 GiB storage on the volume. Default: - none, required for {@link EbsDeviceVolumeType.IO1}
:param volume_type: The EBS volume type. Default: {@link EbsDeviceVolumeType.GP2}
"""
self._values: typing.Dict[str, typing.Any] = {}
if delete_on_termination is not None:
self._values["delete_on_termination"] = delete_on_termination
if iops is not None:
self._values["iops"] = iops
if volume_type is not None:
self._values["volume_type"] = volume_type
@builtins.property
def delete_on_termination(self) -> typing.Optional[builtins.bool]:
"""Indicates whether to delete the volume when the instance is terminated.
:default: - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)
"""
result = self._values.get("delete_on_termination")
return result
@builtins.property
def iops(self) -> typing.Optional[jsii.Number]:
"""The number of I/O operations per second (IOPS) to provision for the volume.
Must only be set for {@link volumeType}: {@link EbsDeviceVolumeType.IO1}
The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS,
you need at least 100 GiB storage on the volume.
:default: - none, required for {@link EbsDeviceVolumeType.IO1}
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
"""
result = self._values.get("iops")
return result
@builtins.property
def volume_type(self) -> typing.Optional["EbsDeviceVolumeType"]:
"""The EBS volume type.
:default: {@link EbsDeviceVolumeType.GP2}
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
"""
result = self._values.get("volume_type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "EbsDeviceOptionsBase(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.EbsDeviceSnapshotOptions",
jsii_struct_bases=[EbsDeviceOptionsBase],
name_mapping={
"delete_on_termination": "deleteOnTermination",
"iops": "iops",
"volume_type": "volumeType",
"volume_size": "volumeSize",
},
)
class EbsDeviceSnapshotOptions(EbsDeviceOptionsBase):
def __init__(
self,
*,
delete_on_termination: typing.Optional[builtins.bool] = None,
iops: typing.Optional[jsii.Number] = None,
volume_type: typing.Optional["EbsDeviceVolumeType"] = None,
volume_size: typing.Optional[jsii.Number] = None,
) -> None:
"""Block device options for an EBS volume created from a snapshot.
:param delete_on_termination: Indicates whether to delete the volume when the instance is terminated. Default: - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)
:param iops: The number of I/O operations per second (IOPS) to provision for the volume. Must only be set for {@link volumeType}: {@link EbsDeviceVolumeType.IO1} The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS, you need at least 100 GiB storage on the volume. Default: - none, required for {@link EbsDeviceVolumeType.IO1}
:param volume_type: The EBS volume type. Default: {@link EbsDeviceVolumeType.GP2}
:param volume_size: The volume size, in Gibibytes (GiB). If you specify volumeSize, it must be equal or greater than the size of the snapshot. Default: - The snapshot size
"""
self._values: typing.Dict[str, typing.Any] = {}
if delete_on_termination is not None:
self._values["delete_on_termination"] = delete_on_termination
if iops is not None:
self._values["iops"] = iops
if volume_type is not None:
self._values["volume_type"] = volume_type
if volume_size is not None:
self._values["volume_size"] = volume_size
@builtins.property
def delete_on_termination(self) -> typing.Optional[builtins.bool]:
"""Indicates whether to delete the volume when the instance is terminated.
:default: - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)
"""
result = self._values.get("delete_on_termination")
return result
@builtins.property
def iops(self) -> typing.Optional[jsii.Number]:
"""The number of I/O operations per second (IOPS) to provision for the volume.
Must only be set for {@link volumeType}: {@link EbsDeviceVolumeType.IO1}
The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS,
you need at least 100 GiB storage on the volume.
:default: - none, required for {@link EbsDeviceVolumeType.IO1}
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
"""
result = self._values.get("iops")
return result
@builtins.property
def volume_type(self) -> typing.Optional["EbsDeviceVolumeType"]:
"""The EBS volume type.
:default: {@link EbsDeviceVolumeType.GP2}
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
"""
result = self._values.get("volume_type")
return result
@builtins.property
def volume_size(self) -> typing.Optional[jsii.Number]:
"""The volume size, in Gibibytes (GiB).
If you specify volumeSize, it must be equal or greater than the size of the snapshot.
:default: - The snapshot size
"""
result = self._values.get("volume_size")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "EbsDeviceSnapshotOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.EbsDeviceVolumeType")
class EbsDeviceVolumeType(enum.Enum):
"""Supported EBS volume types for blockDevices."""
STANDARD = "STANDARD"
"""Magnetic."""
IO1 = "IO1"
"""Provisioned IOPS SSD - IO1."""
IO2 = "IO2"
"""Provisioned IOPS SSD - IO2."""
GP2 = "GP2"
"""General Purpose SSD - GP2."""
GP3 = "GP3"
"""General Purpose SSD - GP3."""
ST1 = "ST1"
"""Throughput Optimized HDD."""
SC1 = "SC1"
"""Cold HDD."""
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.ExecuteFileOptions",
jsii_struct_bases=[],
name_mapping={"file_path": "filePath", "arguments": "arguments"},
)
class ExecuteFileOptions:
def __init__(
self,
*,
file_path: builtins.str,
arguments: typing.Optional[builtins.str] = None,
) -> None:
"""Options when executing a file.
:param file_path: The path to the file.
:param arguments: The arguments to be passed to the file. Default: No arguments are passed to the file.
"""
self._values: typing.Dict[str, typing.Any] = {
"file_path": file_path,
}
if arguments is not None:
self._values["arguments"] = arguments
@builtins.property
def file_path(self) -> builtins.str:
"""The path to the file."""
result = self._values.get("file_path")
assert result is not None, "Required property 'file_path' is missing"
return result
@builtins.property
def arguments(self) -> typing.Optional[builtins.str]:
"""The arguments to be passed to the file.
:default: No arguments are passed to the file.
"""
result = self._values.get("arguments")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "ExecuteFileOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class FlowLogDestination(
metaclass=jsii.JSIIAbstractClass,
jsii_type="@aws-cdk/aws-ec2.FlowLogDestination",
):
"""(experimental) The destination type for the flow log.
:stability: experimental
"""
@builtins.staticmethod
def __jsii_proxy_class__():
return _FlowLogDestinationProxy
def __init__(self) -> None:
jsii.create(FlowLogDestination, self, [])
@jsii.member(jsii_name="toCloudWatchLogs")
@builtins.classmethod
def to_cloud_watch_logs(
cls,
log_group: typing.Optional[aws_cdk.aws_logs.ILogGroup] = None,
iam_role: typing.Optional[aws_cdk.aws_iam.IRole] = None,
) -> "FlowLogDestination":
"""(experimental) Use CloudWatch logs as the destination.
:param log_group: -
:param iam_role: -
:stability: experimental
"""
return jsii.sinvoke(cls, "toCloudWatchLogs", [log_group, iam_role])
@jsii.member(jsii_name="toS3")
@builtins.classmethod
def to_s3(
cls,
bucket: typing.Optional[aws_cdk.aws_s3.IBucket] = None,
key_prefix: typing.Optional[builtins.str] = None,
) -> "FlowLogDestination":
"""(experimental) Use S3 as the destination.
:param bucket: -
:param key_prefix: -
:stability: experimental
"""
return jsii.sinvoke(cls, "toS3", [bucket, key_prefix])
@jsii.member(jsii_name="bind")
@abc.abstractmethod
def bind(
self,
scope: aws_cdk.core.Construct,
flow_log: "FlowLog",
) -> "FlowLogDestinationConfig":
"""(experimental) Generates a flow log destination configuration.
:param scope: -
:param flow_log: -
:stability: experimental
"""
...
class _FlowLogDestinationProxy(FlowLogDestination):
@jsii.member(jsii_name="bind")
def bind(
self,
scope: aws_cdk.core.Construct,
flow_log: "FlowLog",
) -> "FlowLogDestinationConfig":
"""(experimental) Generates a flow log destination configuration.
:param scope: -
:param flow_log: -
:stability: experimental
"""
return jsii.invoke(self, "bind", [scope, flow_log])
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.FlowLogDestinationConfig",
jsii_struct_bases=[],
name_mapping={
"log_destination_type": "logDestinationType",
"iam_role": "iamRole",
"key_prefix": "keyPrefix",
"log_group": "logGroup",
"s3_bucket": "s3Bucket",
},
)
class FlowLogDestinationConfig:
def __init__(
self,
*,
log_destination_type: "FlowLogDestinationType",
iam_role: typing.Optional[aws_cdk.aws_iam.IRole] = None,
key_prefix: typing.Optional[builtins.str] = None,
log_group: typing.Optional[aws_cdk.aws_logs.ILogGroup] = None,
s3_bucket: typing.Optional[aws_cdk.aws_s3.IBucket] = None,
) -> None:
"""(experimental) Flow Log Destination configuration.
:param log_destination_type: (experimental) The type of destination to publish the flow logs to. Default: - CLOUD_WATCH_LOGS
:param iam_role: (experimental) The IAM Role that has access to publish to CloudWatch logs. Default: - default IAM role is created for you
:param key_prefix: (experimental) S3 bucket key prefix to publish the flow logs to. Default: - undefined
:param log_group: (experimental) The CloudWatch Logs Log Group to publish the flow logs to. Default: - default log group is created for you
:param s3_bucket: (experimental) S3 bucket to publish the flow logs to. Default: - undefined
:stability: experimental
"""
self._values: typing.Dict[str, typing.Any] = {
"log_destination_type": log_destination_type,
}
if iam_role is not None:
self._values["iam_role"] = iam_role
if key_prefix is not None:
self._values["key_prefix"] = key_prefix
if log_group is not None:
self._values["log_group"] = log_group
if s3_bucket is not None:
self._values["s3_bucket"] = s3_bucket
@builtins.property
def log_destination_type(self) -> "FlowLogDestinationType":
"""(experimental) The type of destination to publish the flow logs to.
:default: - CLOUD_WATCH_LOGS
:stability: experimental
"""
result = self._values.get("log_destination_type")
assert result is not None, "Required property 'log_destination_type' is missing"
return result
@builtins.property
def iam_role(self) -> typing.Optional[aws_cdk.aws_iam.IRole]:
"""(experimental) The IAM Role that has access to publish to CloudWatch logs.
:default: - default IAM role is created for you
:stability: experimental
"""
result = self._values.get("iam_role")
return result
@builtins.property
def key_prefix(self) -> typing.Optional[builtins.str]:
"""(experimental) S3 bucket key prefix to publish the flow logs to.
:default: - undefined
:stability: experimental
"""
result = self._values.get("key_prefix")
return result
@builtins.property
def log_group(self) -> typing.Optional[aws_cdk.aws_logs.ILogGroup]:
"""(experimental) The CloudWatch Logs Log Group to publish the flow logs to.
:default: - default log group is created for you
:stability: experimental
"""
result = self._values.get("log_group")
return result
@builtins.property
def s3_bucket(self) -> typing.Optional[aws_cdk.aws_s3.IBucket]:
"""(experimental) S3 bucket to publish the flow logs to.
:default: - undefined
:stability: experimental
"""
result = self._values.get("s3_bucket")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "FlowLogDestinationConfig(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.FlowLogDestinationType")
class FlowLogDestinationType(enum.Enum):
"""(experimental) The available destination types for Flow Logs.
:stability: experimental
"""
CLOUD_WATCH_LOGS = "CLOUD_WATCH_LOGS"
"""(experimental) Send flow logs to CloudWatch Logs Group.
:stability: experimental
"""
S3 = "S3"
"""(experimental) Send flow logs to S3 Bucket.
:stability: experimental
"""
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.FlowLogOptions",
jsii_struct_bases=[],
name_mapping={"destination": "destination", "traffic_type": "trafficType"},
)
class FlowLogOptions:
def __init__(
self,
*,
destination: typing.Optional[FlowLogDestination] = None,
traffic_type: typing.Optional["FlowLogTrafficType"] = None,
) -> None:
"""(experimental) Options to add a flow log to a VPC.
:param destination: (experimental) Specifies the type of destination to which the flow log data is to be published. Flow log data can be published to CloudWatch Logs or Amazon S3 Default: FlowLogDestinationType.toCloudWatchLogs()
:param traffic_type: (experimental) The type of traffic to log. You can log traffic that the resource accepts or rejects, or all traffic. Default: ALL
:stability: experimental
"""
self._values: typing.Dict[str, typing.Any] = {}
if destination is not None:
self._values["destination"] = destination
if traffic_type is not None:
self._values["traffic_type"] = traffic_type
@builtins.property
def destination(self) -> typing.Optional[FlowLogDestination]:
"""(experimental) Specifies the type of destination to which the flow log data is to be published.
Flow log data can be published to CloudWatch Logs or Amazon S3
:default: FlowLogDestinationType.toCloudWatchLogs()
:stability: experimental
"""
result = self._values.get("destination")
return result
@builtins.property
def traffic_type(self) -> typing.Optional["FlowLogTrafficType"]:
"""(experimental) The type of traffic to log.
You can log traffic that the resource accepts or rejects, or all traffic.
:default: ALL
:stability: experimental
"""
result = self._values.get("traffic_type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "FlowLogOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.FlowLogProps",
jsii_struct_bases=[FlowLogOptions],
name_mapping={
"destination": "destination",
"traffic_type": "trafficType",
"resource_type": "resourceType",
"flow_log_name": "flowLogName",
},
)
class FlowLogProps(FlowLogOptions):
def __init__(
self,
*,
destination: typing.Optional[FlowLogDestination] = None,
traffic_type: typing.Optional["FlowLogTrafficType"] = None,
resource_type: "FlowLogResourceType",
flow_log_name: typing.Optional[builtins.str] = None,
) -> None:
"""(experimental) Properties of a VPC Flow Log.
:param destination: (experimental) Specifies the type of destination to which the flow log data is to be published. Flow log data can be published to CloudWatch Logs or Amazon S3 Default: FlowLogDestinationType.toCloudWatchLogs()
:param traffic_type: (experimental) The type of traffic to log. You can log traffic that the resource accepts or rejects, or all traffic. Default: ALL
:param resource_type: (experimental) The type of resource for which to create the flow log.
:param flow_log_name: (experimental) The name of the FlowLog. It is not recommended to use an explicit name. Default: If you don't specify a flowLogName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
:stability: experimental
"""
self._values: typing.Dict[str, typing.Any] = {
"resource_type": resource_type,
}
if destination is not None:
self._values["destination"] = destination
if traffic_type is not None:
self._values["traffic_type"] = traffic_type
if flow_log_name is not None:
self._values["flow_log_name"] = flow_log_name
@builtins.property
def destination(self) -> typing.Optional[FlowLogDestination]:
"""(experimental) Specifies the type of destination to which the flow log data is to be published.
Flow log data can be published to CloudWatch Logs or Amazon S3
:default: FlowLogDestinationType.toCloudWatchLogs()
:stability: experimental
"""
result = self._values.get("destination")
return result
@builtins.property
def traffic_type(self) -> typing.Optional["FlowLogTrafficType"]:
"""(experimental) The type of traffic to log.
You can log traffic that the resource accepts or rejects, or all traffic.
:default: ALL
:stability: experimental
"""
result = self._values.get("traffic_type")
return result
@builtins.property
def resource_type(self) -> "FlowLogResourceType":
"""(experimental) The type of resource for which to create the flow log.
:stability: experimental
"""
result = self._values.get("resource_type")
assert result is not None, "Required property 'resource_type' is missing"
return result
@builtins.property
def flow_log_name(self) -> typing.Optional[builtins.str]:
"""(experimental) The name of the FlowLog.
It is not recommended to use an explicit name.
:default:
If you don't specify a flowLogName, AWS CloudFormation generates a
unique physical ID and uses that ID for the group name.
:stability: experimental
"""
result = self._values.get("flow_log_name")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "FlowLogProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class FlowLogResourceType(
metaclass=jsii.JSIIAbstractClass,
jsii_type="@aws-cdk/aws-ec2.FlowLogResourceType",
):
"""(experimental) The type of resource to create the flow log for.
:stability: experimental
"""
@builtins.staticmethod
def __jsii_proxy_class__():
return _FlowLogResourceTypeProxy
def __init__(self) -> None:
jsii.create(FlowLogResourceType, self, [])
@jsii.member(jsii_name="fromNetworkInterfaceId")
@builtins.classmethod
def from_network_interface_id(cls, id: builtins.str) -> "FlowLogResourceType":
"""(experimental) The Network Interface to attach the Flow Log to.
:param id: -
:stability: experimental
"""
return jsii.sinvoke(cls, "fromNetworkInterfaceId", [id])
@jsii.member(jsii_name="fromSubnet")
@builtins.classmethod
def from_subnet(cls, subnet: "ISubnet") -> "FlowLogResourceType":
"""(experimental) The subnet to attach the Flow Log to.
:param subnet: -
:stability: experimental
"""
return jsii.sinvoke(cls, "fromSubnet", [subnet])
@jsii.member(jsii_name="fromVpc")
@builtins.classmethod
def from_vpc(cls, vpc: "IVpc") -> "FlowLogResourceType":
"""(experimental) The VPC to attach the Flow Log to.
:param vpc: -
:stability: experimental
"""
return jsii.sinvoke(cls, "fromVpc", [vpc])
@builtins.property # type: ignore
@jsii.member(jsii_name="resourceId")
@abc.abstractmethod
def resource_id(self) -> builtins.str:
"""(experimental) The Id of the resource that the flow log should be attached to.
:stability: experimental
"""
...
@resource_id.setter # type: ignore
@abc.abstractmethod
def resource_id(self, value: builtins.str) -> None:
...
@builtins.property # type: ignore
@jsii.member(jsii_name="resourceType")
@abc.abstractmethod
def resource_type(self) -> builtins.str:
"""(experimental) The type of resource to attach a flow log to.
:stability: experimental
"""
...
@resource_type.setter # type: ignore
@abc.abstractmethod
def resource_type(self, value: builtins.str) -> None:
...
class _FlowLogResourceTypeProxy(FlowLogResourceType):
@builtins.property # type: ignore
@jsii.member(jsii_name="resourceId")
def resource_id(self) -> builtins.str:
"""(experimental) The Id of the resource that the flow log should be attached to.
:stability: experimental
"""
return jsii.get(self, "resourceId")
@resource_id.setter # type: ignore
def resource_id(self, value: builtins.str) -> None:
jsii.set(self, "resourceId", value)
@builtins.property # type: ignore
@jsii.member(jsii_name="resourceType")
def resource_type(self) -> builtins.str:
"""(experimental) The type of resource to attach a flow log to.
:stability: experimental
"""
return jsii.get(self, "resourceType")
@resource_type.setter # type: ignore
def resource_type(self, value: builtins.str) -> None:
jsii.set(self, "resourceType", value)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.FlowLogTrafficType")
class FlowLogTrafficType(enum.Enum):
"""(experimental) The type of VPC traffic to log.
:stability: experimental
"""
ACCEPT = "ACCEPT"
"""(experimental) Only log accepts.
:stability: experimental
"""
ALL = "ALL"
"""(experimental) Log all requests.
:stability: experimental
"""
REJECT = "REJECT"
"""(experimental) Only log rejects.
:stability: experimental
"""
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.GatewayConfig",
jsii_struct_bases=[],
name_mapping={"az": "az", "gateway_id": "gatewayId"},
)
class GatewayConfig:
def __init__(self, *, az: builtins.str, gateway_id: builtins.str) -> None:
"""Pair represents a gateway created by NAT Provider.
:param az: Availability Zone.
:param gateway_id: Identity of gateway spawned by the provider.
"""
self._values: typing.Dict[str, typing.Any] = {
"az": az,
"gateway_id": gateway_id,
}
@builtins.property
def az(self) -> builtins.str:
"""Availability Zone."""
result = self._values.get("az")
assert result is not None, "Required property 'az' is missing"
return result
@builtins.property
def gateway_id(self) -> builtins.str:
"""Identity of gateway spawned by the provider."""
result = self._values.get("gateway_id")
assert result is not None, "Required property 'gateway_id' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "GatewayConfig(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.GatewayVpcEndpointOptions",
jsii_struct_bases=[],
name_mapping={"service": "service", "subnets": "subnets"},
)
class GatewayVpcEndpointOptions:
def __init__(
self,
*,
service: "IGatewayVpcEndpointService",
subnets: typing.Optional[typing.List["SubnetSelection"]] = None,
) -> None:
"""Options to add a gateway endpoint to a VPC.
:param service: The service to use for this gateway VPC endpoint.
:param subnets: Where to add endpoint routing. By default, this endpoint will be routable from all subnets in the VPC. Specify a list of subnet selection objects here to be more specific. Default: - All subnets in the VPC
"""
self._values: typing.Dict[str, typing.Any] = {
"service": service,
}
if subnets is not None:
self._values["subnets"] = subnets
@builtins.property
def service(self) -> "IGatewayVpcEndpointService":
"""The service to use for this gateway VPC endpoint."""
result = self._values.get("service")
assert result is not None, "Required property 'service' is missing"
return result
@builtins.property
def subnets(self) -> typing.Optional[typing.List["SubnetSelection"]]:
"""Where to add endpoint routing.
By default, this endpoint will be routable from all subnets in the VPC.
Specify a list of subnet selection objects here to be more specific.
:default: - All subnets in the VPC
Example::
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
vpc.add_gateway_endpoint("DynamoDbEndpoint",
service=ec2.GatewayVpcEndpointAwsService.DYNAMODB,
# Add only to ISOLATED subnets
subnets=[{"subnet_type": ec2.SubnetType.ISOLATED}
]
)
"""
result = self._values.get("subnets")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "GatewayVpcEndpointOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.GatewayVpcEndpointProps",
jsii_struct_bases=[GatewayVpcEndpointOptions],
name_mapping={"service": "service", "subnets": "subnets", "vpc": "vpc"},
)
class GatewayVpcEndpointProps(GatewayVpcEndpointOptions):
def __init__(
self,
*,
service: "IGatewayVpcEndpointService",
subnets: typing.Optional[typing.List["SubnetSelection"]] = None,
vpc: "IVpc",
) -> None:
"""Construction properties for a GatewayVpcEndpoint.
:param service: The service to use for this gateway VPC endpoint.
:param subnets: Where to add endpoint routing. By default, this endpoint will be routable from all subnets in the VPC. Specify a list of subnet selection objects here to be more specific. Default: - All subnets in the VPC
:param vpc: The VPC network in which the gateway endpoint will be used.
"""
self._values: typing.Dict[str, typing.Any] = {
"service": service,
"vpc": vpc,
}
if subnets is not None:
self._values["subnets"] = subnets
@builtins.property
def service(self) -> "IGatewayVpcEndpointService":
"""The service to use for this gateway VPC endpoint."""
result = self._values.get("service")
assert result is not None, "Required property 'service' is missing"
return result
@builtins.property
def subnets(self) -> typing.Optional[typing.List["SubnetSelection"]]:
"""Where to add endpoint routing.
By default, this endpoint will be routable from all subnets in the VPC.
Specify a list of subnet selection objects here to be more specific.
:default: - All subnets in the VPC
Example::
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
vpc.add_gateway_endpoint("DynamoDbEndpoint",
service=ec2.GatewayVpcEndpointAwsService.DYNAMODB,
# Add only to ISOLATED subnets
subnets=[{"subnet_type": ec2.SubnetType.ISOLATED}
]
)
"""
result = self._values.get("subnets")
return result
@builtins.property
def vpc(self) -> "IVpc":
"""The VPC network in which the gateway endpoint will be used."""
result = self._values.get("vpc")
assert result is not None, "Required property 'vpc' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "GatewayVpcEndpointProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.GenericLinuxImageProps",
jsii_struct_bases=[],
name_mapping={"user_data": "userData"},
)
class GenericLinuxImageProps:
def __init__(self, *, user_data: typing.Optional["UserData"] = None) -> None:
"""Configuration options for GenericLinuxImage.
:param user_data: Initial user data. Default: - Empty UserData for Linux machines
"""
self._values: typing.Dict[str, typing.Any] = {}
if user_data is not None:
self._values["user_data"] = user_data
@builtins.property
def user_data(self) -> typing.Optional["UserData"]:
"""Initial user data.
:default: - Empty UserData for Linux machines
"""
result = self._values.get("user_data")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "GenericLinuxImageProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.GenericWindowsImageProps",
jsii_struct_bases=[],
name_mapping={"user_data": "userData"},
)
class GenericWindowsImageProps:
def __init__(self, *, user_data: typing.Optional["UserData"] = None) -> None:
"""Configuration options for GenericWindowsImage.
:param user_data: Initial user data. Default: - Empty UserData for Windows machines
"""
self._values: typing.Dict[str, typing.Any] = {}
if user_data is not None:
self._values["user_data"] = user_data
@builtins.property
def user_data(self) -> typing.Optional["UserData"]:
"""Initial user data.
:default: - Empty UserData for Windows machines
"""
result = self._values.get("user_data")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "GenericWindowsImageProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IConnectable")
class IConnectable(typing_extensions.Protocol):
"""An object that has a Connections object."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IConnectableProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="connections")
def connections(self) -> "Connections":
...
class _IConnectableProxy:
"""An object that has a Connections object."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IConnectable"
@builtins.property # type: ignore
@jsii.member(jsii_name="connections")
def connections(self) -> "Connections":
return jsii.get(self, "connections")
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IFlowLog")
class IFlowLog(aws_cdk.core.IResource, typing_extensions.Protocol):
"""(experimental) A FlowLog.
:stability: experimental
"""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IFlowLogProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="flowLogId")
def flow_log_id(self) -> builtins.str:
"""(experimental) The Id of the VPC Flow Log.
:stability: experimental
:attribute: true
"""
...
class _IFlowLogProxy(
jsii.proxy_for(aws_cdk.core.IResource) # type: ignore
):
"""(experimental) A FlowLog.
:stability: experimental
"""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IFlowLog"
@builtins.property # type: ignore
@jsii.member(jsii_name="flowLogId")
def flow_log_id(self) -> builtins.str:
"""(experimental) The Id of the VPC Flow Log.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "flowLogId")
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IGatewayVpcEndpointService")
class IGatewayVpcEndpointService(typing_extensions.Protocol):
"""A service for a gateway VPC endpoint."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IGatewayVpcEndpointServiceProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="name")
def name(self) -> builtins.str:
"""The name of the service."""
...
class _IGatewayVpcEndpointServiceProxy:
"""A service for a gateway VPC endpoint."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IGatewayVpcEndpointService"
@builtins.property # type: ignore
@jsii.member(jsii_name="name")
def name(self) -> builtins.str:
"""The name of the service."""
return jsii.get(self, "name")
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IInstance")
class IInstance(
aws_cdk.core.IResource,
IConnectable,
aws_cdk.aws_iam.IGrantable,
typing_extensions.Protocol,
):
@builtins.staticmethod
def __jsii_proxy_class__():
return _IInstanceProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceAvailabilityZone")
def instance_availability_zone(self) -> builtins.str:
"""The availability zone the instance was launched in.
:attribute: true
"""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceId")
def instance_id(self) -> builtins.str:
"""The instance's ID.
:attribute: true
"""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePrivateDnsName")
def instance_private_dns_name(self) -> builtins.str:
"""Private DNS name for this instance.
:attribute: true
"""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePrivateIp")
def instance_private_ip(self) -> builtins.str:
"""Private IP for this instance.
:attribute: true
"""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePublicDnsName")
def instance_public_dns_name(self) -> builtins.str:
"""Publicly-routable DNS name for this instance.
(May be an empty string if the instance does not have a public name).
:attribute: true
"""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePublicIp")
def instance_public_ip(self) -> builtins.str:
"""Publicly-routable IP address for this instance.
(May be an empty string if the instance does not have a public IP).
:attribute: true
"""
...
class _IInstanceProxy(
jsii.proxy_for(aws_cdk.core.IResource), # type: ignore
jsii.proxy_for(IConnectable), # type: ignore
jsii.proxy_for(aws_cdk.aws_iam.IGrantable), # type: ignore
):
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IInstance"
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceAvailabilityZone")
def instance_availability_zone(self) -> builtins.str:
"""The availability zone the instance was launched in.
:attribute: true
"""
return jsii.get(self, "instanceAvailabilityZone")
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceId")
def instance_id(self) -> builtins.str:
"""The instance's ID.
:attribute: true
"""
return jsii.get(self, "instanceId")
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePrivateDnsName")
def instance_private_dns_name(self) -> builtins.str:
"""Private DNS name for this instance.
:attribute: true
"""
return jsii.get(self, "instancePrivateDnsName")
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePrivateIp")
def instance_private_ip(self) -> builtins.str:
"""Private IP for this instance.
:attribute: true
"""
return jsii.get(self, "instancePrivateIp")
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePublicDnsName")
def instance_public_dns_name(self) -> builtins.str:
"""Publicly-routable DNS name for this instance.
(May be an empty string if the instance does not have a public name).
:attribute: true
"""
return jsii.get(self, "instancePublicDnsName")
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePublicIp")
def instance_public_ip(self) -> builtins.str:
"""Publicly-routable IP address for this instance.
(May be an empty string if the instance does not have a public IP).
:attribute: true
"""
return jsii.get(self, "instancePublicIp")
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IInterfaceVpcEndpointService")
class IInterfaceVpcEndpointService(typing_extensions.Protocol):
"""A service for an interface VPC endpoint."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IInterfaceVpcEndpointServiceProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="name")
def name(self) -> builtins.str:
"""The name of the service."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="port")
def port(self) -> jsii.Number:
"""The port of the service."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="privateDnsDefault")
def private_dns_default(self) -> typing.Optional[builtins.bool]:
"""Whether Private DNS is supported by default."""
...
class _IInterfaceVpcEndpointServiceProxy:
"""A service for an interface VPC endpoint."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IInterfaceVpcEndpointService"
@builtins.property # type: ignore
@jsii.member(jsii_name="name")
def name(self) -> builtins.str:
"""The name of the service."""
return jsii.get(self, "name")
@builtins.property # type: ignore
@jsii.member(jsii_name="port")
def port(self) -> jsii.Number:
"""The port of the service."""
return jsii.get(self, "port")
@builtins.property # type: ignore
@jsii.member(jsii_name="privateDnsDefault")
def private_dns_default(self) -> typing.Optional[builtins.bool]:
"""Whether Private DNS is supported by default."""
return jsii.get(self, "privateDnsDefault")
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.ILaunchTemplate")
class ILaunchTemplate(aws_cdk.core.IResource, typing_extensions.Protocol):
"""Interface for LaunchTemplate-like objects."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _ILaunchTemplateProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="versionNumber")
def version_number(self) -> builtins.str:
"""The version number of this launch template to use.
:attribute: true
"""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="launchTemplateId")
def launch_template_id(self) -> typing.Optional[builtins.str]:
"""The identifier of the Launch Template.
Exactly one of ``launchTemplateId`` and ``launchTemplateName`` will be set.
:attribute: true
"""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="launchTemplateName")
def launch_template_name(self) -> typing.Optional[builtins.str]:
"""The name of the Launch Template.
Exactly one of ``launchTemplateId`` and ``launchTemplateName`` will be set.
:attribute: true
"""
...
class _ILaunchTemplateProxy(
jsii.proxy_for(aws_cdk.core.IResource) # type: ignore
):
"""Interface for LaunchTemplate-like objects."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.ILaunchTemplate"
@builtins.property # type: ignore
@jsii.member(jsii_name="versionNumber")
def version_number(self) -> builtins.str:
"""The version number of this launch template to use.
:attribute: true
"""
return jsii.get(self, "versionNumber")
@builtins.property # type: ignore
@jsii.member(jsii_name="launchTemplateId")
def launch_template_id(self) -> typing.Optional[builtins.str]:
"""The identifier of the Launch Template.
Exactly one of ``launchTemplateId`` and ``launchTemplateName`` will be set.
:attribute: true
"""
return jsii.get(self, "launchTemplateId")
@builtins.property # type: ignore
@jsii.member(jsii_name="launchTemplateName")
def launch_template_name(self) -> typing.Optional[builtins.str]:
"""The name of the Launch Template.
Exactly one of ``launchTemplateId`` and ``launchTemplateName`` will be set.
:attribute: true
"""
return jsii.get(self, "launchTemplateName")
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IMachineImage")
class IMachineImage(typing_extensions.Protocol):
"""Interface for classes that can select an appropriate machine image to use."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IMachineImageProxy
@jsii.member(jsii_name="getImage")
def get_image(self, scope: aws_cdk.core.Construct) -> "MachineImageConfig":
"""Return the image to use in the given context.
:param scope: -
"""
...
class _IMachineImageProxy:
"""Interface for classes that can select an appropriate machine image to use."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IMachineImage"
@jsii.member(jsii_name="getImage")
def get_image(self, scope: aws_cdk.core.Construct) -> "MachineImageConfig":
"""Return the image to use in the given context.
:param scope: -
"""
return jsii.invoke(self, "getImage", [scope])
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.INetworkAcl")
class INetworkAcl(aws_cdk.core.IResource, typing_extensions.Protocol):
"""(experimental) A NetworkAcl.
:stability: experimental
"""
@builtins.staticmethod
def __jsii_proxy_class__():
return _INetworkAclProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="networkAclId")
def network_acl_id(self) -> builtins.str:
"""(experimental) ID for the current Network ACL.
:stability: experimental
:attribute: true
"""
...
@jsii.member(jsii_name="addEntry")
def add_entry(
self,
id: builtins.str,
*,
cidr: AclCidr,
rule_number: jsii.Number,
traffic: AclTraffic,
direction: typing.Optional["TrafficDirection"] = None,
network_acl_entry_name: typing.Optional[builtins.str] = None,
rule_action: typing.Optional[Action] = None,
) -> "NetworkAclEntry":
"""(experimental) Add a new entry to the ACL.
:param id: -
:param cidr: (experimental) The CIDR range to allow or deny.
:param rule_number: (experimental) Rule number to assign to the entry, such as 100. ACL entries are processed in ascending order by rule number. Entries can't use the same rule number unless one is an egress rule and the other is an ingress rule.
:param traffic: (experimental) What kind of traffic this ACL rule applies to.
:param direction: (experimental) Traffic direction, with respect to the subnet, this rule applies to. Default: TrafficDirection.INGRESS
:param network_acl_entry_name: (experimental) The name of the NetworkAclEntry. It is not recommended to use an explicit group name. Default: If you don't specify a NetworkAclName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
:param rule_action: (experimental) Whether to allow or deny traffic that matches the rule; valid values are "allow" or "deny". Any traffic that is not explicitly allowed is automatically denied in a custom ACL, all traffic is automatically allowed in a default ACL. Default: ALLOW
:stability: experimental
"""
...
class _INetworkAclProxy(
jsii.proxy_for(aws_cdk.core.IResource) # type: ignore
):
"""(experimental) A NetworkAcl.
:stability: experimental
"""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.INetworkAcl"
@builtins.property # type: ignore
@jsii.member(jsii_name="networkAclId")
def network_acl_id(self) -> builtins.str:
"""(experimental) ID for the current Network ACL.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "networkAclId")
@jsii.member(jsii_name="addEntry")
def add_entry(
self,
id: builtins.str,
*,
cidr: AclCidr,
rule_number: jsii.Number,
traffic: AclTraffic,
direction: typing.Optional["TrafficDirection"] = None,
network_acl_entry_name: typing.Optional[builtins.str] = None,
rule_action: typing.Optional[Action] = None,
) -> "NetworkAclEntry":
"""(experimental) Add a new entry to the ACL.
:param id: -
:param cidr: (experimental) The CIDR range to allow or deny.
:param rule_number: (experimental) Rule number to assign to the entry, such as 100. ACL entries are processed in ascending order by rule number. Entries can't use the same rule number unless one is an egress rule and the other is an ingress rule.
:param traffic: (experimental) What kind of traffic this ACL rule applies to.
:param direction: (experimental) Traffic direction, with respect to the subnet, this rule applies to. Default: TrafficDirection.INGRESS
:param network_acl_entry_name: (experimental) The name of the NetworkAclEntry. It is not recommended to use an explicit group name. Default: If you don't specify a NetworkAclName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
:param rule_action: (experimental) Whether to allow or deny traffic that matches the rule; valid values are "allow" or "deny". Any traffic that is not explicitly allowed is automatically denied in a custom ACL, all traffic is automatically allowed in a default ACL. Default: ALLOW
:stability: experimental
"""
options = CommonNetworkAclEntryOptions(
cidr=cidr,
rule_number=rule_number,
traffic=traffic,
direction=direction,
network_acl_entry_name=network_acl_entry_name,
rule_action=rule_action,
)
return jsii.invoke(self, "addEntry", [id, options])
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.INetworkAclEntry")
class INetworkAclEntry(aws_cdk.core.IResource, typing_extensions.Protocol):
"""(experimental) A NetworkAclEntry.
:stability: experimental
"""
@builtins.staticmethod
def __jsii_proxy_class__():
return _INetworkAclEntryProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="networkAcl")
def network_acl(self) -> INetworkAcl:
"""(experimental) The network ACL.
:stability: experimental
"""
...
class _INetworkAclEntryProxy(
jsii.proxy_for(aws_cdk.core.IResource) # type: ignore
):
"""(experimental) A NetworkAclEntry.
:stability: experimental
"""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.INetworkAclEntry"
@builtins.property # type: ignore
@jsii.member(jsii_name="networkAcl")
def network_acl(self) -> INetworkAcl:
"""(experimental) The network ACL.
:stability: experimental
"""
return jsii.get(self, "networkAcl")
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IPeer")
class IPeer(IConnectable, typing_extensions.Protocol):
"""Interface for classes that provide the peer-specification parts of a security group rule."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IPeerProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="canInlineRule")
def can_inline_rule(self) -> builtins.bool:
"""Whether the rule can be inlined into a SecurityGroup or not."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="uniqueId")
def unique_id(self) -> builtins.str:
"""A unique identifier for this connection peer."""
...
@jsii.member(jsii_name="toEgressRuleConfig")
def to_egress_rule_config(self) -> typing.Any:
"""Produce the egress rule JSON for the given connection."""
...
@jsii.member(jsii_name="toIngressRuleConfig")
def to_ingress_rule_config(self) -> typing.Any:
"""Produce the ingress rule JSON for the given connection."""
...
class _IPeerProxy(
jsii.proxy_for(IConnectable) # type: ignore
):
"""Interface for classes that provide the peer-specification parts of a security group rule."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IPeer"
@builtins.property # type: ignore
@jsii.member(jsii_name="canInlineRule")
def can_inline_rule(self) -> builtins.bool:
"""Whether the rule can be inlined into a SecurityGroup or not."""
return jsii.get(self, "canInlineRule")
@builtins.property # type: ignore
@jsii.member(jsii_name="uniqueId")
def unique_id(self) -> builtins.str:
"""A unique identifier for this connection peer."""
return jsii.get(self, "uniqueId")
@jsii.member(jsii_name="toEgressRuleConfig")
def to_egress_rule_config(self) -> typing.Any:
"""Produce the egress rule JSON for the given connection."""
return jsii.invoke(self, "toEgressRuleConfig", [])
@jsii.member(jsii_name="toIngressRuleConfig")
def to_ingress_rule_config(self) -> typing.Any:
"""Produce the ingress rule JSON for the given connection."""
return jsii.invoke(self, "toIngressRuleConfig", [])
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IRouteTable")
class IRouteTable(typing_extensions.Protocol):
"""An abstract route table."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IRouteTableProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="routeTableId")
def route_table_id(self) -> builtins.str:
"""Route table ID."""
...
class _IRouteTableProxy:
"""An abstract route table."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IRouteTable"
@builtins.property # type: ignore
@jsii.member(jsii_name="routeTableId")
def route_table_id(self) -> builtins.str:
"""Route table ID."""
return jsii.get(self, "routeTableId")
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.ISecurityGroup")
class ISecurityGroup(aws_cdk.core.IResource, IPeer, typing_extensions.Protocol):
"""Interface for security group-like objects."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _ISecurityGroupProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="allowAllOutbound")
def allow_all_outbound(self) -> builtins.bool:
"""Whether the SecurityGroup has been configured to allow all outbound traffic."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroupId")
def security_group_id(self) -> builtins.str:
"""ID for the current security group.
:attribute: true
"""
...
@jsii.member(jsii_name="addEgressRule")
def add_egress_rule(
self,
peer: IPeer,
connection: "Port",
description: typing.Optional[builtins.str] = None,
remote_rule: typing.Optional[builtins.bool] = None,
) -> None:
"""Add an egress rule for the current security group.
``remoteRule`` controls where the Rule object is created if the peer is also a
securityGroup and they are in different stack. If false (default) the
rule object is created under the current SecurityGroup object. If true and the
peer is also a SecurityGroup, the rule object is created under the remote
SecurityGroup object.
:param peer: -
:param connection: -
:param description: -
:param remote_rule: -
"""
...
@jsii.member(jsii_name="addIngressRule")
def add_ingress_rule(
self,
peer: IPeer,
connection: "Port",
description: typing.Optional[builtins.str] = None,
remote_rule: typing.Optional[builtins.bool] = None,
) -> None:
"""Add an ingress rule for the current security group.
``remoteRule`` controls where the Rule object is created if the peer is also a
securityGroup and they are in different stack. If false (default) the
rule object is created under the current SecurityGroup object. If true and the
peer is also a SecurityGroup, the rule object is created under the remote
SecurityGroup object.
:param peer: -
:param connection: -
:param description: -
:param remote_rule: -
"""
...
class _ISecurityGroupProxy(
jsii.proxy_for(aws_cdk.core.IResource), # type: ignore
jsii.proxy_for(IPeer), # type: ignore
):
"""Interface for security group-like objects."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.ISecurityGroup"
@builtins.property # type: ignore
@jsii.member(jsii_name="allowAllOutbound")
def allow_all_outbound(self) -> builtins.bool:
"""Whether the SecurityGroup has been configured to allow all outbound traffic."""
return jsii.get(self, "allowAllOutbound")
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroupId")
def security_group_id(self) -> builtins.str:
"""ID for the current security group.
:attribute: true
"""
return jsii.get(self, "securityGroupId")
@jsii.member(jsii_name="addEgressRule")
def add_egress_rule(
self,
peer: IPeer,
connection: "Port",
description: typing.Optional[builtins.str] = None,
remote_rule: typing.Optional[builtins.bool] = None,
) -> None:
"""Add an egress rule for the current security group.
``remoteRule`` controls where the Rule object is created if the peer is also a
securityGroup and they are in different stack. If false (default) the
rule object is created under the current SecurityGroup object. If true and the
peer is also a SecurityGroup, the rule object is created under the remote
SecurityGroup object.
:param peer: -
:param connection: -
:param description: -
:param remote_rule: -
"""
return jsii.invoke(self, "addEgressRule", [peer, connection, description, remote_rule])
@jsii.member(jsii_name="addIngressRule")
def add_ingress_rule(
self,
peer: IPeer,
connection: "Port",
description: typing.Optional[builtins.str] = None,
remote_rule: typing.Optional[builtins.bool] = None,
) -> None:
"""Add an ingress rule for the current security group.
``remoteRule`` controls where the Rule object is created if the peer is also a
securityGroup and they are in different stack. If false (default) the
rule object is created under the current SecurityGroup object. If true and the
peer is also a SecurityGroup, the rule object is created under the remote
SecurityGroup object.
:param peer: -
:param connection: -
:param description: -
:param remote_rule: -
"""
return jsii.invoke(self, "addIngressRule", [peer, connection, description, remote_rule])
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.ISubnet")
class ISubnet(aws_cdk.core.IResource, typing_extensions.Protocol):
@builtins.staticmethod
def __jsii_proxy_class__():
return _ISubnetProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZone")
def availability_zone(self) -> builtins.str:
"""The Availability Zone the subnet is located in."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="internetConnectivityEstablished")
def internet_connectivity_established(self) -> aws_cdk.core.IDependable:
"""Dependable that can be depended upon to force internet connectivity established on the VPC."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="ipv4CidrBlock")
def ipv4_cidr_block(self) -> builtins.str:
"""The IPv4 CIDR block for this subnet."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="routeTable")
def route_table(self) -> IRouteTable:
"""The route table for this subnet."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetId")
def subnet_id(self) -> builtins.str:
"""The subnetId for this particular subnet.
:attribute: true
"""
...
@jsii.member(jsii_name="associateNetworkAcl")
def associate_network_acl(self, id: builtins.str, acl: INetworkAcl) -> None:
"""Associate a Network ACL with this subnet.
:param id: -
:param acl: The Network ACL to associate.
"""
...
class _ISubnetProxy(
jsii.proxy_for(aws_cdk.core.IResource) # type: ignore
):
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.ISubnet"
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZone")
def availability_zone(self) -> builtins.str:
"""The Availability Zone the subnet is located in."""
return jsii.get(self, "availabilityZone")
@builtins.property # type: ignore
@jsii.member(jsii_name="internetConnectivityEstablished")
def internet_connectivity_established(self) -> aws_cdk.core.IDependable:
"""Dependable that can be depended upon to force internet connectivity established on the VPC."""
return jsii.get(self, "internetConnectivityEstablished")
@builtins.property # type: ignore
@jsii.member(jsii_name="ipv4CidrBlock")
def ipv4_cidr_block(self) -> builtins.str:
"""The IPv4 CIDR block for this subnet."""
return jsii.get(self, "ipv4CidrBlock")
@builtins.property # type: ignore
@jsii.member(jsii_name="routeTable")
def route_table(self) -> IRouteTable:
"""The route table for this subnet."""
return jsii.get(self, "routeTable")
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetId")
def subnet_id(self) -> builtins.str:
"""The subnetId for this particular subnet.
:attribute: true
"""
return jsii.get(self, "subnetId")
@jsii.member(jsii_name="associateNetworkAcl")
def associate_network_acl(self, id: builtins.str, acl: INetworkAcl) -> None:
"""Associate a Network ACL with this subnet.
:param id: -
:param acl: The Network ACL to associate.
"""
return jsii.invoke(self, "associateNetworkAcl", [id, acl])
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.ISubnetNetworkAclAssociation")
class ISubnetNetworkAclAssociation(aws_cdk.core.IResource, typing_extensions.Protocol):
"""(experimental) A SubnetNetworkAclAssociation.
:stability: experimental
"""
@builtins.staticmethod
def __jsii_proxy_class__():
return _ISubnetNetworkAclAssociationProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetNetworkAclAssociationAssociationId")
def subnet_network_acl_association_association_id(self) -> builtins.str:
"""(experimental) ID for the current SubnetNetworkAclAssociation.
:stability: experimental
:attribute: true
"""
...
class _ISubnetNetworkAclAssociationProxy(
jsii.proxy_for(aws_cdk.core.IResource) # type: ignore
):
"""(experimental) A SubnetNetworkAclAssociation.
:stability: experimental
"""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.ISubnetNetworkAclAssociation"
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetNetworkAclAssociationAssociationId")
def subnet_network_acl_association_association_id(self) -> builtins.str:
"""(experimental) ID for the current SubnetNetworkAclAssociation.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "subnetNetworkAclAssociationAssociationId")
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IVolume")
class IVolume(aws_cdk.core.IResource, typing_extensions.Protocol):
"""An EBS Volume in AWS EC2."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IVolumeProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZone")
def availability_zone(self) -> builtins.str:
"""The availability zone that the EBS Volume is contained within (ex: us-west-2a)."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="volumeId")
def volume_id(self) -> builtins.str:
"""The EBS Volume's ID.
:attribute: true
"""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="encryptionKey")
def encryption_key(self) -> typing.Optional[aws_cdk.aws_kms.IKey]:
"""The customer-managed encryption key that is used to encrypt the Volume.
:attribute: true
"""
...
@jsii.member(jsii_name="grantAttachVolume")
def grant_attach_volume(
self,
grantee: aws_cdk.aws_iam.IGrantable,
instances: typing.Optional[typing.List[IInstance]] = None,
) -> aws_cdk.aws_iam.Grant:
"""Grants permission to attach this Volume to an instance.
CAUTION: Granting an instance permission to attach to itself using this method will lead to
an unresolvable circular reference between the instance role and the instance.
Use {@link IVolume.grantAttachVolumeToSelf} to grant an instance permission to attach this
volume to itself.
:param grantee: the principal being granted permission.
:param instances: the instances to which permission is being granted to attach this volume to. If not specified, then permission is granted to attach to all instances in this account.
"""
...
@jsii.member(jsii_name="grantAttachVolumeByResourceTag")
def grant_attach_volume_by_resource_tag(
self,
grantee: aws_cdk.aws_iam.IGrantable,
constructs: typing.List[constructs.Construct],
tag_key_suffix: typing.Optional[builtins.str] = None,
) -> aws_cdk.aws_iam.Grant:
"""Grants permission to attach the Volume by a ResourceTag condition.
If you are looking to
grant an Instance, AutoScalingGroup, EC2-Fleet, SpotFleet, ECS host, etc the ability to attach
this volume to **itself** then this is the method you want to use.
This is implemented by adding a Tag with key ``VolumeGrantAttach-<suffix>`` to the given
constructs and this Volume, and then conditioning the Grant such that the grantee is only
given the ability to AttachVolume if both the Volume and the destination Instance have that
tag applied to them.
:param grantee: the principal being granted permission.
:param constructs: The list of constructs that will have the generated resource tag applied to them.
:param tag_key_suffix: A suffix to use on the generated Tag key in place of the generated hash value. Defaults to a hash calculated from this volume and list of constructs. (DEPRECATED)
"""
...
@jsii.member(jsii_name="grantDetachVolume")
def grant_detach_volume(
self,
grantee: aws_cdk.aws_iam.IGrantable,
instances: typing.Optional[typing.List[IInstance]] = None,
) -> aws_cdk.aws_iam.Grant:
"""Grants permission to detach this Volume from an instance CAUTION: Granting an instance permission to detach from itself using this method will lead to an unresolvable circular reference between the instance role and the instance.
Use {@link IVolume.grantDetachVolumeFromSelf} to grant an instance permission to detach this
volume from itself.
:param grantee: the principal being granted permission.
:param instances: the instances to which permission is being granted to detach this volume from. If not specified, then permission is granted to detach from all instances in this account.
"""
...
@jsii.member(jsii_name="grantDetachVolumeByResourceTag")
def grant_detach_volume_by_resource_tag(
self,
grantee: aws_cdk.aws_iam.IGrantable,
constructs: typing.List[constructs.Construct],
tag_key_suffix: typing.Optional[builtins.str] = None,
) -> aws_cdk.aws_iam.Grant:
"""Grants permission to detach the Volume by a ResourceTag condition.
This is implemented via the same mechanism as {@link IVolume.grantAttachVolumeByResourceTag},
and is subject to the same conditions.
:param grantee: the principal being granted permission.
:param constructs: The list of constructs that will have the generated resource tag applied to them.
:param tag_key_suffix: A suffix to use on the generated Tag key in place of the generated hash value. Defaults to a hash calculated from this volume and list of constructs. (DEPRECATED)
"""
...
class _IVolumeProxy(
jsii.proxy_for(aws_cdk.core.IResource) # type: ignore
):
"""An EBS Volume in AWS EC2."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IVolume"
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZone")
def availability_zone(self) -> builtins.str:
"""The availability zone that the EBS Volume is contained within (ex: us-west-2a)."""
return jsii.get(self, "availabilityZone")
@builtins.property # type: ignore
@jsii.member(jsii_name="volumeId")
def volume_id(self) -> builtins.str:
"""The EBS Volume's ID.
:attribute: true
"""
return jsii.get(self, "volumeId")
@builtins.property # type: ignore
@jsii.member(jsii_name="encryptionKey")
def encryption_key(self) -> typing.Optional[aws_cdk.aws_kms.IKey]:
"""The customer-managed encryption key that is used to encrypt the Volume.
:attribute: true
"""
return jsii.get(self, "encryptionKey")
@jsii.member(jsii_name="grantAttachVolume")
def grant_attach_volume(
self,
grantee: aws_cdk.aws_iam.IGrantable,
instances: typing.Optional[typing.List[IInstance]] = None,
) -> aws_cdk.aws_iam.Grant:
"""Grants permission to attach this Volume to an instance.
CAUTION: Granting an instance permission to attach to itself using this method will lead to
an unresolvable circular reference between the instance role and the instance.
Use {@link IVolume.grantAttachVolumeToSelf} to grant an instance permission to attach this
volume to itself.
:param grantee: the principal being granted permission.
:param instances: the instances to which permission is being granted to attach this volume to. If not specified, then permission is granted to attach to all instances in this account.
"""
return jsii.invoke(self, "grantAttachVolume", [grantee, instances])
@jsii.member(jsii_name="grantAttachVolumeByResourceTag")
def grant_attach_volume_by_resource_tag(
self,
grantee: aws_cdk.aws_iam.IGrantable,
constructs: typing.List[constructs.Construct],
tag_key_suffix: typing.Optional[builtins.str] = None,
) -> aws_cdk.aws_iam.Grant:
"""Grants permission to attach the Volume by a ResourceTag condition.
If you are looking to
grant an Instance, AutoScalingGroup, EC2-Fleet, SpotFleet, ECS host, etc the ability to attach
this volume to **itself** then this is the method you want to use.
This is implemented by adding a Tag with key ``VolumeGrantAttach-<suffix>`` to the given
constructs and this Volume, and then conditioning the Grant such that the grantee is only
given the ability to AttachVolume if both the Volume and the destination Instance have that
tag applied to them.
:param grantee: the principal being granted permission.
:param constructs: The list of constructs that will have the generated resource tag applied to them.
:param tag_key_suffix: A suffix to use on the generated Tag key in place of the generated hash value. Defaults to a hash calculated from this volume and list of constructs. (DEPRECATED)
"""
return jsii.invoke(self, "grantAttachVolumeByResourceTag", [grantee, constructs, tag_key_suffix])
@jsii.member(jsii_name="grantDetachVolume")
def grant_detach_volume(
self,
grantee: aws_cdk.aws_iam.IGrantable,
instances: typing.Optional[typing.List[IInstance]] = None,
) -> aws_cdk.aws_iam.Grant:
"""Grants permission to detach this Volume from an instance CAUTION: Granting an instance permission to detach from itself using this method will lead to an unresolvable circular reference between the instance role and the instance.
Use {@link IVolume.grantDetachVolumeFromSelf} to grant an instance permission to detach this
volume from itself.
:param grantee: the principal being granted permission.
:param instances: the instances to which permission is being granted to detach this volume from. If not specified, then permission is granted to detach from all instances in this account.
"""
return jsii.invoke(self, "grantDetachVolume", [grantee, instances])
@jsii.member(jsii_name="grantDetachVolumeByResourceTag")
def grant_detach_volume_by_resource_tag(
self,
grantee: aws_cdk.aws_iam.IGrantable,
constructs: typing.List[constructs.Construct],
tag_key_suffix: typing.Optional[builtins.str] = None,
) -> aws_cdk.aws_iam.Grant:
"""Grants permission to detach the Volume by a ResourceTag condition.
This is implemented via the same mechanism as {@link IVolume.grantAttachVolumeByResourceTag},
and is subject to the same conditions.
:param grantee: the principal being granted permission.
:param constructs: The list of constructs that will have the generated resource tag applied to them.
:param tag_key_suffix: A suffix to use on the generated Tag key in place of the generated hash value. Defaults to a hash calculated from this volume and list of constructs. (DEPRECATED)
"""
return jsii.invoke(self, "grantDetachVolumeByResourceTag", [grantee, constructs, tag_key_suffix])
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IVpc")
class IVpc(aws_cdk.core.IResource, typing_extensions.Protocol):
@builtins.staticmethod
def __jsii_proxy_class__():
return _IVpcProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZones")
def availability_zones(self) -> typing.List[builtins.str]:
"""AZs for this VPC."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="internetConnectivityEstablished")
def internet_connectivity_established(self) -> aws_cdk.core.IDependable:
"""Dependable that can be depended upon to force internet connectivity established on the VPC."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="isolatedSubnets")
def isolated_subnets(self) -> typing.List[ISubnet]:
"""List of isolated subnets in this VPC."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="privateSubnets")
def private_subnets(self) -> typing.List[ISubnet]:
"""List of private subnets in this VPC."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="publicSubnets")
def public_subnets(self) -> typing.List[ISubnet]:
"""List of public subnets in this VPC."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcCidrBlock")
def vpc_cidr_block(self) -> builtins.str:
"""CIDR range for this VPC.
:attribute: true
"""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""Identifier for this VPC.
:attribute: true
"""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="vpnGatewayId")
def vpn_gateway_id(self) -> typing.Optional[builtins.str]:
"""Identifier for the VPN gateway."""
...
@jsii.member(jsii_name="addFlowLog")
def add_flow_log(
self,
id: builtins.str,
*,
destination: typing.Optional[FlowLogDestination] = None,
traffic_type: typing.Optional[FlowLogTrafficType] = None,
) -> "FlowLog":
"""Adds a new Flow Log to this VPC.
:param id: -
:param destination: (experimental) Specifies the type of destination to which the flow log data is to be published. Flow log data can be published to CloudWatch Logs or Amazon S3 Default: FlowLogDestinationType.toCloudWatchLogs()
:param traffic_type: (experimental) The type of traffic to log. You can log traffic that the resource accepts or rejects, or all traffic. Default: ALL
"""
...
@jsii.member(jsii_name="addGatewayEndpoint")
def add_gateway_endpoint(
self,
id: builtins.str,
*,
service: IGatewayVpcEndpointService,
subnets: typing.Optional[typing.List["SubnetSelection"]] = None,
) -> "GatewayVpcEndpoint":
"""Adds a new gateway endpoint to this VPC.
:param id: -
:param service: The service to use for this gateway VPC endpoint.
:param subnets: Where to add endpoint routing. By default, this endpoint will be routable from all subnets in the VPC. Specify a list of subnet selection objects here to be more specific. Default: - All subnets in the VPC
"""
...
@jsii.member(jsii_name="addInterfaceEndpoint")
def add_interface_endpoint(
self,
id: builtins.str,
*,
service: IInterfaceVpcEndpointService,
lookup_supported_azs: typing.Optional[builtins.bool] = None,
open: typing.Optional[builtins.bool] = None,
private_dns_enabled: typing.Optional[builtins.bool] = None,
security_groups: typing.Optional[typing.List[ISecurityGroup]] = None,
subnets: typing.Optional["SubnetSelection"] = None,
) -> "InterfaceVpcEndpoint":
"""Adds a new interface endpoint to this VPC.
:param id: -
:param service: The service to use for this interface VPC endpoint.
:param lookup_supported_azs: Limit to only those availability zones where the endpoint service can be created. Setting this to 'true' requires a lookup to be performed at synthesis time. Account and region must be set on the containing stack for this to work. Default: false
:param open: Whether to automatically allow VPC traffic to the endpoint. If enabled, all traffic to the endpoint from within the VPC will be automatically allowed. This is done based on the VPC's CIDR range. Default: true
:param private_dns_enabled: Whether to associate a private hosted zone with the specified VPC. This allows you to make requests to the service using its default DNS hostname. Default: set by the instance of IInterfaceVpcEndpointService, or true if not defined by the instance of IInterfaceVpcEndpointService
:param security_groups: The security groups to associate with this interface VPC endpoint. Default: - a new security group is created
:param subnets: The subnets in which to create an endpoint network interface. At most one per availability zone. Default: - private subnets
"""
...
@jsii.member(jsii_name="addVpnConnection")
def add_vpn_connection(
self,
id: builtins.str,
*,
ip: builtins.str,
asn: typing.Optional[jsii.Number] = None,
static_routes: typing.Optional[typing.List[builtins.str]] = None,
tunnel_options: typing.Optional[typing.List["VpnTunnelOption"]] = None,
) -> "VpnConnection":
"""Adds a new VPN connection to this VPC.
:param id: -
:param ip: The ip address of the customer gateway.
:param asn: The ASN of the customer gateway. Default: 65000
:param static_routes: The static routes to be routed from the VPN gateway to the customer gateway. Default: Dynamic routing (BGP)
:param tunnel_options: The tunnel options for the VPN connection. At most two elements (one per tunnel). Duplicates not allowed. Default: Amazon generated tunnel options
"""
...
@jsii.member(jsii_name="enableVpnGateway")
def enable_vpn_gateway(
self,
*,
vpn_route_propagation: typing.Optional[typing.List["SubnetSelection"]] = None,
type: builtins.str,
amazon_side_asn: typing.Optional[jsii.Number] = None,
) -> None:
"""Adds a VPN Gateway to this VPC.
:param vpn_route_propagation: Provide an array of subnets where the route propagation should be added. Default: noPropagation
:param type: Default type ipsec.1.
:param amazon_side_asn: Explicitly specify an Asn or let aws pick an Asn for you. Default: 65000
"""
...
@jsii.member(jsii_name="selectSubnets")
def select_subnets(
self,
*,
availability_zones: typing.Optional[typing.List[builtins.str]] = None,
one_per_az: typing.Optional[builtins.bool] = None,
subnet_filters: typing.Optional[typing.List["SubnetFilter"]] = None,
subnet_group_name: typing.Optional[builtins.str] = None,
subnet_name: typing.Optional[builtins.str] = None,
subnets: typing.Optional[typing.List[ISubnet]] = None,
subnet_type: typing.Optional["SubnetType"] = None,
) -> "SelectedSubnets":
"""Return information on the subnets appropriate for the given selection strategy.
Requires that at least one subnet is matched, throws a descriptive
error message otherwise.
:param availability_zones: Select subnets only in the given AZs. Default: no filtering on AZs is done
:param one_per_az: If true, return at most one subnet per AZ. Default: false
:param subnet_filters: List of provided subnet filters. Default: - none
:param subnet_group_name: Select the subnet group with the given name. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them. Otherwise, prefer ``subnetType``. This field does not select individual subnets, it selects all subnets that share the given subnet group name. This is the name supplied in ``subnetConfiguration``. At most one of ``subnetType`` and ``subnetGroupName`` can be supplied. Default: - Selection by type instead of by name
:param subnet_name: (deprecated) Alias for ``subnetGroupName``. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them.
:param subnets: Explicitly select individual subnets. Use this if you don't want to automatically use all subnets in a group, but have a need to control selection down to individual subnets. Cannot be specified together with ``subnetType`` or ``subnetGroupName``. Default: - Use all subnets in a selected group (all private subnets by default)
:param subnet_type: Select all subnets of the given type. At most one of ``subnetType`` and ``subnetGroupName`` can be supplied. Default: SubnetType.PRIVATE (or ISOLATED or PUBLIC if there are no PRIVATE subnets)
"""
...
class _IVpcProxy(
jsii.proxy_for(aws_cdk.core.IResource) # type: ignore
):
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IVpc"
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZones")
def availability_zones(self) -> typing.List[builtins.str]:
"""AZs for this VPC."""
return jsii.get(self, "availabilityZones")
@builtins.property # type: ignore
@jsii.member(jsii_name="internetConnectivityEstablished")
def internet_connectivity_established(self) -> aws_cdk.core.IDependable:
"""Dependable that can be depended upon to force internet connectivity established on the VPC."""
return jsii.get(self, "internetConnectivityEstablished")
@builtins.property # type: ignore
@jsii.member(jsii_name="isolatedSubnets")
def isolated_subnets(self) -> typing.List[ISubnet]:
"""List of isolated subnets in this VPC."""
return jsii.get(self, "isolatedSubnets")
@builtins.property # type: ignore
@jsii.member(jsii_name="privateSubnets")
def private_subnets(self) -> typing.List[ISubnet]:
"""List of private subnets in this VPC."""
return jsii.get(self, "privateSubnets")
@builtins.property # type: ignore
@jsii.member(jsii_name="publicSubnets")
def public_subnets(self) -> typing.List[ISubnet]:
"""List of public subnets in this VPC."""
return jsii.get(self, "publicSubnets")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcCidrBlock")
def vpc_cidr_block(self) -> builtins.str:
"""CIDR range for this VPC.
:attribute: true
"""
return jsii.get(self, "vpcCidrBlock")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""Identifier for this VPC.
:attribute: true
"""
return jsii.get(self, "vpcId")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpnGatewayId")
def vpn_gateway_id(self) -> typing.Optional[builtins.str]:
"""Identifier for the VPN gateway."""
return jsii.get(self, "vpnGatewayId")
@jsii.member(jsii_name="addFlowLog")
def add_flow_log(
self,
id: builtins.str,
*,
destination: typing.Optional[FlowLogDestination] = None,
traffic_type: typing.Optional[FlowLogTrafficType] = None,
) -> "FlowLog":
"""Adds a new Flow Log to this VPC.
:param id: -
:param destination: (experimental) Specifies the type of destination to which the flow log data is to be published. Flow log data can be published to CloudWatch Logs or Amazon S3 Default: FlowLogDestinationType.toCloudWatchLogs()
:param traffic_type: (experimental) The type of traffic to log. You can log traffic that the resource accepts or rejects, or all traffic. Default: ALL
"""
options = FlowLogOptions(destination=destination, traffic_type=traffic_type)
return jsii.invoke(self, "addFlowLog", [id, options])
@jsii.member(jsii_name="addGatewayEndpoint")
def add_gateway_endpoint(
self,
id: builtins.str,
*,
service: IGatewayVpcEndpointService,
subnets: typing.Optional[typing.List["SubnetSelection"]] = None,
) -> "GatewayVpcEndpoint":
"""Adds a new gateway endpoint to this VPC.
:param id: -
:param service: The service to use for this gateway VPC endpoint.
:param subnets: Where to add endpoint routing. By default, this endpoint will be routable from all subnets in the VPC. Specify a list of subnet selection objects here to be more specific. Default: - All subnets in the VPC
"""
options = GatewayVpcEndpointOptions(service=service, subnets=subnets)
return jsii.invoke(self, "addGatewayEndpoint", [id, options])
@jsii.member(jsii_name="addInterfaceEndpoint")
def add_interface_endpoint(
self,
id: builtins.str,
*,
service: IInterfaceVpcEndpointService,
lookup_supported_azs: typing.Optional[builtins.bool] = None,
open: typing.Optional[builtins.bool] = None,
private_dns_enabled: typing.Optional[builtins.bool] = None,
security_groups: typing.Optional[typing.List[ISecurityGroup]] = None,
subnets: typing.Optional["SubnetSelection"] = None,
) -> "InterfaceVpcEndpoint":
"""Adds a new interface endpoint to this VPC.
:param id: -
:param service: The service to use for this interface VPC endpoint.
:param lookup_supported_azs: Limit to only those availability zones where the endpoint service can be created. Setting this to 'true' requires a lookup to be performed at synthesis time. Account and region must be set on the containing stack for this to work. Default: false
:param open: Whether to automatically allow VPC traffic to the endpoint. If enabled, all traffic to the endpoint from within the VPC will be automatically allowed. This is done based on the VPC's CIDR range. Default: true
:param private_dns_enabled: Whether to associate a private hosted zone with the specified VPC. This allows you to make requests to the service using its default DNS hostname. Default: set by the instance of IInterfaceVpcEndpointService, or true if not defined by the instance of IInterfaceVpcEndpointService
:param security_groups: The security groups to associate with this interface VPC endpoint. Default: - a new security group is created
:param subnets: The subnets in which to create an endpoint network interface. At most one per availability zone. Default: - private subnets
"""
options = InterfaceVpcEndpointOptions(
service=service,
lookup_supported_azs=lookup_supported_azs,
open=open,
private_dns_enabled=private_dns_enabled,
security_groups=security_groups,
subnets=subnets,
)
return jsii.invoke(self, "addInterfaceEndpoint", [id, options])
@jsii.member(jsii_name="addVpnConnection")
def add_vpn_connection(
self,
id: builtins.str,
*,
ip: builtins.str,
asn: typing.Optional[jsii.Number] = None,
static_routes: typing.Optional[typing.List[builtins.str]] = None,
tunnel_options: typing.Optional[typing.List["VpnTunnelOption"]] = None,
) -> "VpnConnection":
"""Adds a new VPN connection to this VPC.
:param id: -
:param ip: The ip address of the customer gateway.
:param asn: The ASN of the customer gateway. Default: 65000
:param static_routes: The static routes to be routed from the VPN gateway to the customer gateway. Default: Dynamic routing (BGP)
:param tunnel_options: The tunnel options for the VPN connection. At most two elements (one per tunnel). Duplicates not allowed. Default: Amazon generated tunnel options
"""
options = VpnConnectionOptions(
ip=ip, asn=asn, static_routes=static_routes, tunnel_options=tunnel_options
)
return jsii.invoke(self, "addVpnConnection", [id, options])
@jsii.member(jsii_name="enableVpnGateway")
def enable_vpn_gateway(
self,
*,
vpn_route_propagation: typing.Optional[typing.List["SubnetSelection"]] = None,
type: builtins.str,
amazon_side_asn: typing.Optional[jsii.Number] = None,
) -> None:
"""Adds a VPN Gateway to this VPC.
:param vpn_route_propagation: Provide an array of subnets where the route propagation should be added. Default: noPropagation
:param type: Default type ipsec.1.
:param amazon_side_asn: Explicitly specify an Asn or let aws pick an Asn for you. Default: 65000
"""
options = EnableVpnGatewayOptions(
vpn_route_propagation=vpn_route_propagation,
type=type,
amazon_side_asn=amazon_side_asn,
)
return jsii.invoke(self, "enableVpnGateway", [options])
@jsii.member(jsii_name="selectSubnets")
def select_subnets(
self,
*,
availability_zones: typing.Optional[typing.List[builtins.str]] = None,
one_per_az: typing.Optional[builtins.bool] = None,
subnet_filters: typing.Optional[typing.List["SubnetFilter"]] = None,
subnet_group_name: typing.Optional[builtins.str] = None,
subnet_name: typing.Optional[builtins.str] = None,
subnets: typing.Optional[typing.List[ISubnet]] = None,
subnet_type: typing.Optional["SubnetType"] = None,
) -> "SelectedSubnets":
"""Return information on the subnets appropriate for the given selection strategy.
Requires that at least one subnet is matched, throws a descriptive
error message otherwise.
:param availability_zones: Select subnets only in the given AZs. Default: no filtering on AZs is done
:param one_per_az: If true, return at most one subnet per AZ. Default: false
:param subnet_filters: List of provided subnet filters. Default: - none
:param subnet_group_name: Select the subnet group with the given name. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them. Otherwise, prefer ``subnetType``. This field does not select individual subnets, it selects all subnets that share the given subnet group name. This is the name supplied in ``subnetConfiguration``. At most one of ``subnetType`` and ``subnetGroupName`` can be supplied. Default: - Selection by type instead of by name
:param subnet_name: (deprecated) Alias for ``subnetGroupName``. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them.
:param subnets: Explicitly select individual subnets. Use this if you don't want to automatically use all subnets in a group, but have a need to control selection down to individual subnets. Cannot be specified together with ``subnetType`` or ``subnetGroupName``. Default: - Use all subnets in a selected group (all private subnets by default)
:param subnet_type: Select all subnets of the given type. At most one of ``subnetType`` and ``subnetGroupName`` can be supplied. Default: SubnetType.PRIVATE (or ISOLATED or PUBLIC if there are no PRIVATE subnets)
"""
selection = SubnetSelection(
availability_zones=availability_zones,
one_per_az=one_per_az,
subnet_filters=subnet_filters,
subnet_group_name=subnet_group_name,
subnet_name=subnet_name,
subnets=subnets,
subnet_type=subnet_type,
)
return jsii.invoke(self, "selectSubnets", [selection])
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IVpcEndpoint")
class IVpcEndpoint(aws_cdk.core.IResource, typing_extensions.Protocol):
"""A VPC endpoint."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IVpcEndpointProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointId")
def vpc_endpoint_id(self) -> builtins.str:
"""The VPC endpoint identifier.
:attribute: true
"""
...
class _IVpcEndpointProxy(
jsii.proxy_for(aws_cdk.core.IResource) # type: ignore
):
"""A VPC endpoint."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IVpcEndpoint"
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointId")
def vpc_endpoint_id(self) -> builtins.str:
"""The VPC endpoint identifier.
:attribute: true
"""
return jsii.get(self, "vpcEndpointId")
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IVpcEndpointService")
class IVpcEndpointService(aws_cdk.core.IResource, typing_extensions.Protocol):
"""(experimental) A VPC endpoint service.
:stability: experimental
"""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IVpcEndpointServiceProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointServiceId")
def vpc_endpoint_service_id(self) -> builtins.str:
"""(experimental) The id of the VPC Endpoint Service that clients use to connect to, like vpce-svc-xxxxxxxxxxxxxxxx.
:stability: experimental
:attribute: true
"""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointServiceName")
def vpc_endpoint_service_name(self) -> builtins.str:
"""(experimental) The service name of the VPC Endpoint Service that clients use to connect to, like com.amazonaws.vpce..vpce-svc-xxxxxxxxxxxxxxxx.
:stability: experimental
:attribute: true
"""
...
class _IVpcEndpointServiceProxy(
jsii.proxy_for(aws_cdk.core.IResource) # type: ignore
):
"""(experimental) A VPC endpoint service.
:stability: experimental
"""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IVpcEndpointService"
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointServiceId")
def vpc_endpoint_service_id(self) -> builtins.str:
"""(experimental) The id of the VPC Endpoint Service that clients use to connect to, like vpce-svc-xxxxxxxxxxxxxxxx.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "vpcEndpointServiceId")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointServiceName")
def vpc_endpoint_service_name(self) -> builtins.str:
"""(experimental) The service name of the VPC Endpoint Service that clients use to connect to, like com.amazonaws.vpce..vpce-svc-xxxxxxxxxxxxxxxx.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "vpcEndpointServiceName")
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IVpcEndpointServiceLoadBalancer")
class IVpcEndpointServiceLoadBalancer(typing_extensions.Protocol):
"""A load balancer that can host a VPC Endpoint Service."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IVpcEndpointServiceLoadBalancerProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="loadBalancerArn")
def load_balancer_arn(self) -> builtins.str:
"""The ARN of the load balancer that hosts the VPC Endpoint Service."""
...
class _IVpcEndpointServiceLoadBalancerProxy:
"""A load balancer that can host a VPC Endpoint Service."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IVpcEndpointServiceLoadBalancer"
@builtins.property # type: ignore
@jsii.member(jsii_name="loadBalancerArn")
def load_balancer_arn(self) -> builtins.str:
"""The ARN of the load balancer that hosts the VPC Endpoint Service."""
return jsii.get(self, "loadBalancerArn")
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IVpnConnection")
class IVpnConnection(aws_cdk.core.IResource, typing_extensions.Protocol):
@builtins.staticmethod
def __jsii_proxy_class__():
return _IVpnConnectionProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="customerGatewayAsn")
def customer_gateway_asn(self) -> jsii.Number:
"""The ASN of the customer gateway."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="customerGatewayId")
def customer_gateway_id(self) -> builtins.str:
"""The id of the customer gateway."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="customerGatewayIp")
def customer_gateway_ip(self) -> builtins.str:
"""The ip address of the customer gateway."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="vpnId")
def vpn_id(self) -> builtins.str:
"""The id of the VPN connection."""
...
@jsii.member(jsii_name="metric")
def metric(
self,
metric_name: builtins.str,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""Return the given named metric for this VPNConnection.
:param metric_name: -
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
"""
...
@jsii.member(jsii_name="metricTunnelDataIn")
def metric_tunnel_data_in(
self,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""The bytes received through the VPN tunnel.
Sum over 5 minutes
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
"""
...
@jsii.member(jsii_name="metricTunnelDataOut")
def metric_tunnel_data_out(
self,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""The bytes sent through the VPN tunnel.
Sum over 5 minutes
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
"""
...
@jsii.member(jsii_name="metricTunnelState")
def metric_tunnel_state(
self,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""The state of the tunnel. 0 indicates DOWN and 1 indicates UP.
Average over 5 minutes
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
"""
...
class _IVpnConnectionProxy(
jsii.proxy_for(aws_cdk.core.IResource) # type: ignore
):
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IVpnConnection"
@builtins.property # type: ignore
@jsii.member(jsii_name="customerGatewayAsn")
def customer_gateway_asn(self) -> jsii.Number:
"""The ASN of the customer gateway."""
return jsii.get(self, "customerGatewayAsn")
@builtins.property # type: ignore
@jsii.member(jsii_name="customerGatewayId")
def customer_gateway_id(self) -> builtins.str:
"""The id of the customer gateway."""
return jsii.get(self, "customerGatewayId")
@builtins.property # type: ignore
@jsii.member(jsii_name="customerGatewayIp")
def customer_gateway_ip(self) -> builtins.str:
"""The ip address of the customer gateway."""
return jsii.get(self, "customerGatewayIp")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpnId")
def vpn_id(self) -> builtins.str:
"""The id of the VPN connection."""
return jsii.get(self, "vpnId")
@jsii.member(jsii_name="metric")
def metric(
self,
metric_name: builtins.str,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""Return the given named metric for this VPNConnection.
:param metric_name: -
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
"""
props = aws_cdk.aws_cloudwatch.MetricOptions(
account=account,
color=color,
dimensions=dimensions,
label=label,
period=period,
region=region,
statistic=statistic,
unit=unit,
)
return jsii.invoke(self, "metric", [metric_name, props])
@jsii.member(jsii_name="metricTunnelDataIn")
def metric_tunnel_data_in(
self,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""The bytes received through the VPN tunnel.
Sum over 5 minutes
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
"""
props = aws_cdk.aws_cloudwatch.MetricOptions(
account=account,
color=color,
dimensions=dimensions,
label=label,
period=period,
region=region,
statistic=statistic,
unit=unit,
)
return jsii.invoke(self, "metricTunnelDataIn", [props])
@jsii.member(jsii_name="metricTunnelDataOut")
def metric_tunnel_data_out(
self,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""The bytes sent through the VPN tunnel.
Sum over 5 minutes
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
"""
props = aws_cdk.aws_cloudwatch.MetricOptions(
account=account,
color=color,
dimensions=dimensions,
label=label,
period=period,
region=region,
statistic=statistic,
unit=unit,
)
return jsii.invoke(self, "metricTunnelDataOut", [props])
@jsii.member(jsii_name="metricTunnelState")
def metric_tunnel_state(
self,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""The state of the tunnel. 0 indicates DOWN and 1 indicates UP.
Average over 5 minutes
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
"""
props = aws_cdk.aws_cloudwatch.MetricOptions(
account=account,
color=color,
dimensions=dimensions,
label=label,
period=period,
region=region,
statistic=statistic,
unit=unit,
)
return jsii.invoke(self, "metricTunnelState", [props])
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IVpnGateway")
class IVpnGateway(aws_cdk.core.IResource, typing_extensions.Protocol):
"""The virtual private gateway interface."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IVpnGatewayProxy
@builtins.property # type: ignore
@jsii.member(jsii_name="gatewayId")
def gateway_id(self) -> builtins.str:
"""The virtual private gateway Id."""
...
class _IVpnGatewayProxy(
jsii.proxy_for(aws_cdk.core.IResource) # type: ignore
):
"""The virtual private gateway interface."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IVpnGateway"
@builtins.property # type: ignore
@jsii.member(jsii_name="gatewayId")
def gateway_id(self) -> builtins.str:
"""The virtual private gateway Id."""
return jsii.get(self, "gatewayId")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.InitCommandOptions",
jsii_struct_bases=[],
name_mapping={
"cwd": "cwd",
"env": "env",
"ignore_errors": "ignoreErrors",
"key": "key",
"service_restart_handles": "serviceRestartHandles",
"test_cmd": "testCmd",
"wait_after_completion": "waitAfterCompletion",
},
)
class InitCommandOptions:
def __init__(
self,
*,
cwd: typing.Optional[builtins.str] = None,
env: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
ignore_errors: typing.Optional[builtins.bool] = None,
key: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
test_cmd: typing.Optional[builtins.str] = None,
wait_after_completion: typing.Optional["InitCommandWaitDuration"] = None,
) -> None:
"""Options for InitCommand.
:param cwd: The working directory. Default: - Use default working directory
:param env: Sets environment variables for the command. This property overwrites, rather than appends, the existing environment. Default: - Use current environment
:param ignore_errors: Continue running if this command fails. Default: false
:param key: Identifier key for this command. Commands are executed in lexicographical order of their key names. Default: - Automatically generated based on index
:param service_restart_handles: Restart the given service(s) after this command has run. Default: - Do not restart any service
:param test_cmd: Command to determine whether this command should be run. If the test passes (exits with error code of 0), the command is run. Default: - Always run the command
:param wait_after_completion: The duration to wait after a command has finished in case the command causes a reboot. Set this value to ``InitCommandWaitDuration.none()`` if you do not want to wait for every command; ``InitCommandWaitDuration.forever()`` directs cfn-init to exit and resume only after the reboot is complete. For Windows systems only. Default: - 60 seconds
"""
self._values: typing.Dict[str, typing.Any] = {}
if cwd is not None:
self._values["cwd"] = cwd
if env is not None:
self._values["env"] = env
if ignore_errors is not None:
self._values["ignore_errors"] = ignore_errors
if key is not None:
self._values["key"] = key
if service_restart_handles is not None:
self._values["service_restart_handles"] = service_restart_handles
if test_cmd is not None:
self._values["test_cmd"] = test_cmd
if wait_after_completion is not None:
self._values["wait_after_completion"] = wait_after_completion
@builtins.property
def cwd(self) -> typing.Optional[builtins.str]:
"""The working directory.
:default: - Use default working directory
"""
result = self._values.get("cwd")
return result
@builtins.property
def env(self) -> typing.Optional[typing.Mapping[builtins.str, builtins.str]]:
"""Sets environment variables for the command.
This property overwrites, rather than appends, the existing environment.
:default: - Use current environment
"""
result = self._values.get("env")
return result
@builtins.property
def ignore_errors(self) -> typing.Optional[builtins.bool]:
"""Continue running if this command fails.
:default: false
"""
result = self._values.get("ignore_errors")
return result
@builtins.property
def key(self) -> typing.Optional[builtins.str]:
"""Identifier key for this command.
Commands are executed in lexicographical order of their key names.
:default: - Automatically generated based on index
"""
result = self._values.get("key")
return result
@builtins.property
def service_restart_handles(
self,
) -> typing.Optional[typing.List["InitServiceRestartHandle"]]:
"""Restart the given service(s) after this command has run.
:default: - Do not restart any service
"""
result = self._values.get("service_restart_handles")
return result
@builtins.property
def test_cmd(self) -> typing.Optional[builtins.str]:
"""Command to determine whether this command should be run.
If the test passes (exits with error code of 0), the command is run.
:default: - Always run the command
"""
result = self._values.get("test_cmd")
return result
@builtins.property
def wait_after_completion(self) -> typing.Optional["InitCommandWaitDuration"]:
"""The duration to wait after a command has finished in case the command causes a reboot.
Set this value to ``InitCommandWaitDuration.none()`` if you do not want to wait for every command;
``InitCommandWaitDuration.forever()`` directs cfn-init to exit and resume only after the reboot is complete.
For Windows systems only.
:default: - 60 seconds
"""
result = self._values.get("wait_after_completion")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InitCommandOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class InitCommandWaitDuration(
metaclass=jsii.JSIIAbstractClass,
jsii_type="@aws-cdk/aws-ec2.InitCommandWaitDuration",
):
"""Represents a duration to wait after a command has finished, in case of a reboot (Windows only)."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _InitCommandWaitDurationProxy
def __init__(self) -> None:
jsii.create(InitCommandWaitDuration, self, [])
@jsii.member(jsii_name="forever")
@builtins.classmethod
def forever(cls) -> "InitCommandWaitDuration":
"""cfn-init will exit and resume only after a reboot."""
return jsii.sinvoke(cls, "forever", [])
@jsii.member(jsii_name="none")
@builtins.classmethod
def none(cls) -> "InitCommandWaitDuration":
"""Do not wait for this command."""
return jsii.sinvoke(cls, "none", [])
@jsii.member(jsii_name="of")
@builtins.classmethod
def of(cls, duration: aws_cdk.core.Duration) -> "InitCommandWaitDuration":
"""Wait for a specified duration after a command.
:param duration: -
"""
return jsii.sinvoke(cls, "of", [duration])
class _InitCommandWaitDurationProxy(InitCommandWaitDuration):
pass
class InitConfig(metaclass=jsii.JSIIMeta, jsii_type="@aws-cdk/aws-ec2.InitConfig"):
"""A collection of configuration elements."""
def __init__(self, elements: typing.List["InitElement"]) -> None:
"""
:param elements: -
"""
jsii.create(InitConfig, self, [elements])
@jsii.member(jsii_name="add")
def add(self, *elements: "InitElement") -> None:
"""Add one or more elements to the config.
:param elements: -
"""
return jsii.invoke(self, "add", [*elements])
@jsii.member(jsii_name="isEmpty")
def is_empty(self) -> builtins.bool:
"""Whether this configset has elements or not."""
return jsii.invoke(self, "isEmpty", [])
class InitElement(
metaclass=jsii.JSIIAbstractClass,
jsii_type="@aws-cdk/aws-ec2.InitElement",
):
"""Base class for all CloudFormation Init elements."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _InitElementProxy
def __init__(self) -> None:
jsii.create(InitElement, self, [])
@builtins.property # type: ignore
@jsii.member(jsii_name="elementType")
@abc.abstractmethod
def element_type(self) -> builtins.str:
"""Returns the init element type for this element."""
...
class _InitElementProxy(InitElement):
@builtins.property # type: ignore
@jsii.member(jsii_name="elementType")
def element_type(self) -> builtins.str:
"""Returns the init element type for this element."""
return jsii.get(self, "elementType")
class InitFile(
InitElement,
metaclass=jsii.JSIIAbstractClass,
jsii_type="@aws-cdk/aws-ec2.InitFile",
):
"""Create files on the EC2 instance."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _InitFileProxy
def __init__(
self,
file_name: builtins.str,
*,
base64_encoded: typing.Optional[builtins.bool] = None,
group: typing.Optional[builtins.str] = None,
mode: typing.Optional[builtins.str] = None,
owner: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
) -> None:
"""
:param file_name: -
:param base64_encoded: True if the inlined content (from a string or file) should be treated as base64 encoded. Only applicable for inlined string and file content. Default: false
:param group: The name of the owning group for this file. Not supported for Windows systems. Default: 'root'
:param mode: A six-digit octal value representing the mode for this file. Use the first three digits for symlinks and the last three digits for setting permissions. To create a symlink, specify 120xxx, where xxx defines the permissions of the target file. To specify permissions for a file, use the last three digits, such as 000644. Not supported for Windows systems. Default: '000644'
:param owner: The name of the owning user for this file. Not supported for Windows systems. Default: 'root'
:param service_restart_handles: Restart the given service after this file has been written. Default: - Do not restart any service
"""
options = InitFileOptions(
base64_encoded=base64_encoded,
group=group,
mode=mode,
owner=owner,
service_restart_handles=service_restart_handles,
)
jsii.create(InitFile, self, [file_name, options])
@jsii.member(jsii_name="fromAsset")
@builtins.classmethod
def from_asset(
cls,
target_file_name: builtins.str,
path: builtins.str,
*,
base64_encoded: typing.Optional[builtins.bool] = None,
group: typing.Optional[builtins.str] = None,
mode: typing.Optional[builtins.str] = None,
owner: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
readers: typing.Optional[typing.List[aws_cdk.aws_iam.IGrantable]] = None,
source_hash: typing.Optional[builtins.str] = None,
exclude: typing.Optional[typing.List[builtins.str]] = None,
follow: typing.Optional[aws_cdk.assets.FollowMode] = None,
ignore_mode: typing.Optional[aws_cdk.core.IgnoreMode] = None,
asset_hash: typing.Optional[builtins.str] = None,
asset_hash_type: typing.Optional[aws_cdk.core.AssetHashType] = None,
bundling: typing.Optional[aws_cdk.core.BundlingOptions] = None,
) -> "InitFile":
"""Create an asset from the given file.
This is appropriate for files that are too large to embed into the template.
:param target_file_name: -
:param path: -
:param base64_encoded: True if the inlined content (from a string or file) should be treated as base64 encoded. Only applicable for inlined string and file content. Default: false
:param group: The name of the owning group for this file. Not supported for Windows systems. Default: 'root'
:param mode: A six-digit octal value representing the mode for this file. Use the first three digits for symlinks and the last three digits for setting permissions. To create a symlink, specify 120xxx, where xxx defines the permissions of the target file. To specify permissions for a file, use the last three digits, such as 000644. Not supported for Windows systems. Default: '000644'
:param owner: The name of the owning user for this file. Not supported for Windows systems. Default: 'root'
:param service_restart_handles: Restart the given service after this file has been written. Default: - Do not restart any service
:param readers: (experimental) A list of principals that should be able to read this asset from S3. You can use ``asset.grantRead(principal)`` to grant read permissions later. Default: - No principals that can read file asset.
:param source_hash: (deprecated) Custom hash to use when identifying the specific version of the asset. For consistency, this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be the asset hash. NOTE: the source hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to Amazon S3, etc. If you chose to customize the source hash, you will need to make sure it is updated every time the source changes, or otherwise it is possible that some deployments will not be invalidated. Default: - automatically calculate source hash based on the contents of the source file or directory.
:param exclude: (deprecated) Glob patterns to exclude from the copy. Default: nothing is excluded
:param follow: (deprecated) A strategy for how to handle symlinks. Default: Never
:param ignore_mode: (deprecated) The ignore behavior to use for exclude patterns. Default: - GLOB for file assets, DOCKER or GLOB for docker assets depending on whether the '
:param asset_hash: Specify a custom hash for this asset. If ``assetHashType`` is set it must be set to ``AssetHashType.CUSTOM``. For consistency, this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be the asset hash. NOTE: the hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will need to make sure it is updated every time the asset changes, or otherwise it is possible that some deployments will not be invalidated. Default: - based on ``assetHashType``
:param asset_hash_type: Specifies the type of hash to calculate for this asset. If ``assetHash`` is configured, this option must be ``undefined`` or ``AssetHashType.CUSTOM``. Default: - the default is ``AssetHashType.SOURCE``, but if ``assetHash`` is explicitly specified this value defaults to ``AssetHashType.CUSTOM``.
:param bundling: (experimental) Bundle the asset by executing a command in a Docker container. The asset path will be mounted at ``/asset-input``. The Docker container is responsible for putting content at ``/asset-output``. The content at ``/asset-output`` will be zipped and used as the final asset. Default: - uploaded as-is to S3 if the asset is a regular file or a .zip file, archived into a .zip file and uploaded to S3 otherwise
"""
options = InitFileAssetOptions(
base64_encoded=base64_encoded,
group=group,
mode=mode,
owner=owner,
service_restart_handles=service_restart_handles,
readers=readers,
source_hash=source_hash,
exclude=exclude,
follow=follow,
ignore_mode=ignore_mode,
asset_hash=asset_hash,
asset_hash_type=asset_hash_type,
bundling=bundling,
)
return jsii.sinvoke(cls, "fromAsset", [target_file_name, path, options])
@jsii.member(jsii_name="fromExistingAsset")
@builtins.classmethod
def from_existing_asset(
cls,
target_file_name: builtins.str,
asset: aws_cdk.aws_s3_assets.Asset,
*,
base64_encoded: typing.Optional[builtins.bool] = None,
group: typing.Optional[builtins.str] = None,
mode: typing.Optional[builtins.str] = None,
owner: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
) -> "InitFile":
"""Use a file from an asset at instance startup time.
:param target_file_name: -
:param asset: -
:param base64_encoded: True if the inlined content (from a string or file) should be treated as base64 encoded. Only applicable for inlined string and file content. Default: false
:param group: The name of the owning group for this file. Not supported for Windows systems. Default: 'root'
:param mode: A six-digit octal value representing the mode for this file. Use the first three digits for symlinks and the last three digits for setting permissions. To create a symlink, specify 120xxx, where xxx defines the permissions of the target file. To specify permissions for a file, use the last three digits, such as 000644. Not supported for Windows systems. Default: '000644'
:param owner: The name of the owning user for this file. Not supported for Windows systems. Default: 'root'
:param service_restart_handles: Restart the given service after this file has been written. Default: - Do not restart any service
"""
options = InitFileOptions(
base64_encoded=base64_encoded,
group=group,
mode=mode,
owner=owner,
service_restart_handles=service_restart_handles,
)
return jsii.sinvoke(cls, "fromExistingAsset", [target_file_name, asset, options])
@jsii.member(jsii_name="fromFileInline")
@builtins.classmethod
def from_file_inline(
cls,
target_file_name: builtins.str,
source_file_name: builtins.str,
*,
base64_encoded: typing.Optional[builtins.bool] = None,
group: typing.Optional[builtins.str] = None,
mode: typing.Optional[builtins.str] = None,
owner: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
) -> "InitFile":
"""Read a file from disk and use its contents.
The file will be embedded in the template, so care should be taken to not
exceed the template size.
If options.base64encoded is set to true, this will base64-encode the file's contents.
:param target_file_name: -
:param source_file_name: -
:param base64_encoded: True if the inlined content (from a string or file) should be treated as base64 encoded. Only applicable for inlined string and file content. Default: false
:param group: The name of the owning group for this file. Not supported for Windows systems. Default: 'root'
:param mode: A six-digit octal value representing the mode for this file. Use the first three digits for symlinks and the last three digits for setting permissions. To create a symlink, specify 120xxx, where xxx defines the permissions of the target file. To specify permissions for a file, use the last three digits, such as 000644. Not supported for Windows systems. Default: '000644'
:param owner: The name of the owning user for this file. Not supported for Windows systems. Default: 'root'
:param service_restart_handles: Restart the given service after this file has been written. Default: - Do not restart any service
"""
options = InitFileOptions(
base64_encoded=base64_encoded,
group=group,
mode=mode,
owner=owner,
service_restart_handles=service_restart_handles,
)
return jsii.sinvoke(cls, "fromFileInline", [target_file_name, source_file_name, options])
@jsii.member(jsii_name="fromObject")
@builtins.classmethod
def from_object(
cls,
file_name: builtins.str,
obj: typing.Mapping[builtins.str, typing.Any],
*,
base64_encoded: typing.Optional[builtins.bool] = None,
group: typing.Optional[builtins.str] = None,
mode: typing.Optional[builtins.str] = None,
owner: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
) -> "InitFile":
"""Use a JSON-compatible object as the file content, write it to a JSON file.
May contain tokens.
:param file_name: -
:param obj: -
:param base64_encoded: True if the inlined content (from a string or file) should be treated as base64 encoded. Only applicable for inlined string and file content. Default: false
:param group: The name of the owning group for this file. Not supported for Windows systems. Default: 'root'
:param mode: A six-digit octal value representing the mode for this file. Use the first three digits for symlinks and the last three digits for setting permissions. To create a symlink, specify 120xxx, where xxx defines the permissions of the target file. To specify permissions for a file, use the last three digits, such as 000644. Not supported for Windows systems. Default: '000644'
:param owner: The name of the owning user for this file. Not supported for Windows systems. Default: 'root'
:param service_restart_handles: Restart the given service after this file has been written. Default: - Do not restart any service
"""
options = InitFileOptions(
base64_encoded=base64_encoded,
group=group,
mode=mode,
owner=owner,
service_restart_handles=service_restart_handles,
)
return jsii.sinvoke(cls, "fromObject", [file_name, obj, options])
@jsii.member(jsii_name="fromS3Object")
@builtins.classmethod
def from_s3_object(
cls,
file_name: builtins.str,
bucket: aws_cdk.aws_s3.IBucket,
key: builtins.str,
*,
base64_encoded: typing.Optional[builtins.bool] = None,
group: typing.Optional[builtins.str] = None,
mode: typing.Optional[builtins.str] = None,
owner: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
) -> "InitFile":
"""Download a file from an S3 bucket at instance startup time.
:param file_name: -
:param bucket: -
:param key: -
:param base64_encoded: True if the inlined content (from a string or file) should be treated as base64 encoded. Only applicable for inlined string and file content. Default: false
:param group: The name of the owning group for this file. Not supported for Windows systems. Default: 'root'
:param mode: A six-digit octal value representing the mode for this file. Use the first three digits for symlinks and the last three digits for setting permissions. To create a symlink, specify 120xxx, where xxx defines the permissions of the target file. To specify permissions for a file, use the last three digits, such as 000644. Not supported for Windows systems. Default: '000644'
:param owner: The name of the owning user for this file. Not supported for Windows systems. Default: 'root'
:param service_restart_handles: Restart the given service after this file has been written. Default: - Do not restart any service
"""
options = InitFileOptions(
base64_encoded=base64_encoded,
group=group,
mode=mode,
owner=owner,
service_restart_handles=service_restart_handles,
)
return jsii.sinvoke(cls, "fromS3Object", [file_name, bucket, key, options])
@jsii.member(jsii_name="fromString")
@builtins.classmethod
def from_string(
cls,
file_name: builtins.str,
content: builtins.str,
*,
base64_encoded: typing.Optional[builtins.bool] = None,
group: typing.Optional[builtins.str] = None,
mode: typing.Optional[builtins.str] = None,
owner: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
) -> "InitFile":
"""Use a literal string as the file content.
:param file_name: -
:param content: -
:param base64_encoded: True if the inlined content (from a string or file) should be treated as base64 encoded. Only applicable for inlined string and file content. Default: false
:param group: The name of the owning group for this file. Not supported for Windows systems. Default: 'root'
:param mode: A six-digit octal value representing the mode for this file. Use the first three digits for symlinks and the last three digits for setting permissions. To create a symlink, specify 120xxx, where xxx defines the permissions of the target file. To specify permissions for a file, use the last three digits, such as 000644. Not supported for Windows systems. Default: '000644'
:param owner: The name of the owning user for this file. Not supported for Windows systems. Default: 'root'
:param service_restart_handles: Restart the given service after this file has been written. Default: - Do not restart any service
"""
options = InitFileOptions(
base64_encoded=base64_encoded,
group=group,
mode=mode,
owner=owner,
service_restart_handles=service_restart_handles,
)
return jsii.sinvoke(cls, "fromString", [file_name, content, options])
@jsii.member(jsii_name="fromUrl")
@builtins.classmethod
def from_url(
cls,
file_name: builtins.str,
url: builtins.str,
*,
base64_encoded: typing.Optional[builtins.bool] = None,
group: typing.Optional[builtins.str] = None,
mode: typing.Optional[builtins.str] = None,
owner: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
) -> "InitFile":
"""Download from a URL at instance startup time.
:param file_name: -
:param url: -
:param base64_encoded: True if the inlined content (from a string or file) should be treated as base64 encoded. Only applicable for inlined string and file content. Default: false
:param group: The name of the owning group for this file. Not supported for Windows systems. Default: 'root'
:param mode: A six-digit octal value representing the mode for this file. Use the first three digits for symlinks and the last three digits for setting permissions. To create a symlink, specify 120xxx, where xxx defines the permissions of the target file. To specify permissions for a file, use the last three digits, such as 000644. Not supported for Windows systems. Default: '000644'
:param owner: The name of the owning user for this file. Not supported for Windows systems. Default: 'root'
:param service_restart_handles: Restart the given service after this file has been written. Default: - Do not restart any service
"""
options = InitFileOptions(
base64_encoded=base64_encoded,
group=group,
mode=mode,
owner=owner,
service_restart_handles=service_restart_handles,
)
return jsii.sinvoke(cls, "fromUrl", [file_name, url, options])
@jsii.member(jsii_name="symlink")
@builtins.classmethod
def symlink(
cls,
file_name: builtins.str,
target: builtins.str,
*,
base64_encoded: typing.Optional[builtins.bool] = None,
group: typing.Optional[builtins.str] = None,
mode: typing.Optional[builtins.str] = None,
owner: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
) -> "InitFile":
"""Write a symlink with the given symlink target.
:param file_name: -
:param target: -
:param base64_encoded: True if the inlined content (from a string or file) should be treated as base64 encoded. Only applicable for inlined string and file content. Default: false
:param group: The name of the owning group for this file. Not supported for Windows systems. Default: 'root'
:param mode: A six-digit octal value representing the mode for this file. Use the first three digits for symlinks and the last three digits for setting permissions. To create a symlink, specify 120xxx, where xxx defines the permissions of the target file. To specify permissions for a file, use the last three digits, such as 000644. Not supported for Windows systems. Default: '000644'
:param owner: The name of the owning user for this file. Not supported for Windows systems. Default: 'root'
:param service_restart_handles: Restart the given service after this file has been written. Default: - Do not restart any service
"""
options = InitFileOptions(
base64_encoded=base64_encoded,
group=group,
mode=mode,
owner=owner,
service_restart_handles=service_restart_handles,
)
return jsii.sinvoke(cls, "symlink", [file_name, target, options])
@builtins.property # type: ignore
@jsii.member(jsii_name="elementType")
def element_type(self) -> builtins.str:
"""Returns the init element type for this element."""
return jsii.get(self, "elementType")
class _InitFileProxy(
InitFile, jsii.proxy_for(InitElement) # type: ignore
):
pass
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.InitFileOptions",
jsii_struct_bases=[],
name_mapping={
"base64_encoded": "base64Encoded",
"group": "group",
"mode": "mode",
"owner": "owner",
"service_restart_handles": "serviceRestartHandles",
},
)
class InitFileOptions:
def __init__(
self,
*,
base64_encoded: typing.Optional[builtins.bool] = None,
group: typing.Optional[builtins.str] = None,
mode: typing.Optional[builtins.str] = None,
owner: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
) -> None:
"""Options for InitFile.
:param base64_encoded: True if the inlined content (from a string or file) should be treated as base64 encoded. Only applicable for inlined string and file content. Default: false
:param group: The name of the owning group for this file. Not supported for Windows systems. Default: 'root'
:param mode: A six-digit octal value representing the mode for this file. Use the first three digits for symlinks and the last three digits for setting permissions. To create a symlink, specify 120xxx, where xxx defines the permissions of the target file. To specify permissions for a file, use the last three digits, such as 000644. Not supported for Windows systems. Default: '000644'
:param owner: The name of the owning user for this file. Not supported for Windows systems. Default: 'root'
:param service_restart_handles: Restart the given service after this file has been written. Default: - Do not restart any service
"""
self._values: typing.Dict[str, typing.Any] = {}
if base64_encoded is not None:
self._values["base64_encoded"] = base64_encoded
if group is not None:
self._values["group"] = group
if mode is not None:
self._values["mode"] = mode
if owner is not None:
self._values["owner"] = owner
if service_restart_handles is not None:
self._values["service_restart_handles"] = service_restart_handles
@builtins.property
def base64_encoded(self) -> typing.Optional[builtins.bool]:
"""True if the inlined content (from a string or file) should be treated as base64 encoded.
Only applicable for inlined string and file content.
:default: false
"""
result = self._values.get("base64_encoded")
return result
@builtins.property
def group(self) -> typing.Optional[builtins.str]:
"""The name of the owning group for this file.
Not supported for Windows systems.
:default: 'root'
"""
result = self._values.get("group")
return result
@builtins.property
def mode(self) -> typing.Optional[builtins.str]:
"""A six-digit octal value representing the mode for this file.
Use the first three digits for symlinks and the last three digits for
setting permissions. To create a symlink, specify 120xxx, where xxx
defines the permissions of the target file. To specify permissions for a
file, use the last three digits, such as 000644.
Not supported for Windows systems.
:default: '000644'
"""
result = self._values.get("mode")
return result
@builtins.property
def owner(self) -> typing.Optional[builtins.str]:
"""The name of the owning user for this file.
Not supported for Windows systems.
:default: 'root'
"""
result = self._values.get("owner")
return result
@builtins.property
def service_restart_handles(
self,
) -> typing.Optional[typing.List["InitServiceRestartHandle"]]:
"""Restart the given service after this file has been written.
:default: - Do not restart any service
"""
result = self._values.get("service_restart_handles")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InitFileOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class InitGroup(
InitElement,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.InitGroup",
):
"""Create Linux/UNIX groups and assign group IDs.
Not supported for Windows systems.
"""
def __init__(
self,
group_name: builtins.str,
group_id: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param group_name: -
:param group_id: -
"""
jsii.create(InitGroup, self, [group_name, group_id])
@jsii.member(jsii_name="fromName")
@builtins.classmethod
def from_name(
cls,
group_name: builtins.str,
group_id: typing.Optional[jsii.Number] = None,
) -> "InitGroup":
"""Create a group from its name, and optionally, group id.
:param group_name: -
:param group_id: -
"""
return jsii.sinvoke(cls, "fromName", [group_name, group_id])
@builtins.property # type: ignore
@jsii.member(jsii_name="elementType")
def element_type(self) -> builtins.str:
"""Returns the init element type for this element."""
return jsii.get(self, "elementType")
class InitPackage(
InitElement,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.InitPackage",
):
"""A package to be installed during cfn-init time."""
def __init__(
self,
type: builtins.str,
versions: typing.List[builtins.str],
package_name: typing.Optional[builtins.str] = None,
service_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
) -> None:
"""
:param type: -
:param versions: -
:param package_name: -
:param service_handles: -
"""
jsii.create(InitPackage, self, [type, versions, package_name, service_handles])
@jsii.member(jsii_name="apt")
@builtins.classmethod
def apt(
cls,
package_name: builtins.str,
*,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
version: typing.Optional[typing.List[builtins.str]] = None,
) -> "InitPackage":
"""Install a package using APT.
:param package_name: -
:param service_restart_handles: Restart the given services after this command has run. Default: - Do not restart any service
:param version: Specify the versions to install. Default: - Install the latest version
"""
options = NamedPackageOptions(
service_restart_handles=service_restart_handles, version=version
)
return jsii.sinvoke(cls, "apt", [package_name, options])
@jsii.member(jsii_name="msi")
@builtins.classmethod
def msi(
cls,
location: builtins.str,
*,
key: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
) -> "InitPackage":
"""Install an MSI package from an HTTP URL or a location on disk.
:param location: -
:param key: Identifier key for this package. You can use this to order package installs. Default: - Automatically generated
:param service_restart_handles: Restart the given service after this command has run. Default: - Do not restart any service
"""
options = LocationPackageOptions(
key=key, service_restart_handles=service_restart_handles
)
return jsii.sinvoke(cls, "msi", [location, options])
@jsii.member(jsii_name="python")
@builtins.classmethod
def python(
cls,
package_name: builtins.str,
*,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
version: typing.Optional[typing.List[builtins.str]] = None,
) -> "InitPackage":
"""Install a package from PyPI.
:param package_name: -
:param service_restart_handles: Restart the given services after this command has run. Default: - Do not restart any service
:param version: Specify the versions to install. Default: - Install the latest version
"""
options = NamedPackageOptions(
service_restart_handles=service_restart_handles, version=version
)
return jsii.sinvoke(cls, "python", [package_name, options])
@jsii.member(jsii_name="rpm")
@builtins.classmethod
def rpm(
cls,
location: builtins.str,
*,
key: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
) -> "InitPackage":
"""Install an RPM from an HTTP URL or a location on disk.
:param location: -
:param key: Identifier key for this package. You can use this to order package installs. Default: - Automatically generated
:param service_restart_handles: Restart the given service after this command has run. Default: - Do not restart any service
"""
options = LocationPackageOptions(
key=key, service_restart_handles=service_restart_handles
)
return jsii.sinvoke(cls, "rpm", [location, options])
@jsii.member(jsii_name="rubyGem")
@builtins.classmethod
def ruby_gem(
cls,
gem_name: builtins.str,
*,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
version: typing.Optional[typing.List[builtins.str]] = None,
) -> "InitPackage":
"""Install a package from RubyGems.
:param gem_name: -
:param service_restart_handles: Restart the given services after this command has run. Default: - Do not restart any service
:param version: Specify the versions to install. Default: - Install the latest version
"""
options = NamedPackageOptions(
service_restart_handles=service_restart_handles, version=version
)
return jsii.sinvoke(cls, "rubyGem", [gem_name, options])
@jsii.member(jsii_name="yum")
@builtins.classmethod
def yum(
cls,
package_name: builtins.str,
*,
service_restart_handles: typing.Optional[typing.List["InitServiceRestartHandle"]] = None,
version: typing.Optional[typing.List[builtins.str]] = None,
) -> "InitPackage":
"""Install a package using Yum.
:param package_name: -
:param service_restart_handles: Restart the given services after this command has run. Default: - Do not restart any service
:param version: Specify the versions to install. Default: - Install the latest version
"""
options = NamedPackageOptions(
service_restart_handles=service_restart_handles, version=version
)
return jsii.sinvoke(cls, "yum", [package_name, options])
@jsii.member(jsii_name="renderPackageVersions")
def _render_package_versions(self) -> typing.Any:
return jsii.invoke(self, "renderPackageVersions", [])
@builtins.property # type: ignore
@jsii.member(jsii_name="elementType")
def element_type(self) -> builtins.str:
"""Returns the init element type for this element."""
return jsii.get(self, "elementType")
class InitService(
InitElement,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.InitService",
):
"""A services that be enabled, disabled or restarted when the instance is launched."""
@jsii.member(jsii_name="disable")
@builtins.classmethod
def disable(cls, service_name: builtins.str) -> "InitService":
"""Disable and stop the given service.
:param service_name: -
"""
return jsii.sinvoke(cls, "disable", [service_name])
@jsii.member(jsii_name="enable")
@builtins.classmethod
def enable(
cls,
service_name: builtins.str,
*,
enabled: typing.Optional[builtins.bool] = None,
ensure_running: typing.Optional[builtins.bool] = None,
service_restart_handle: typing.Optional["InitServiceRestartHandle"] = None,
) -> "InitService":
"""Enable and start the given service, optionally restarting it.
:param service_name: -
:param enabled: Enable or disable this service. Set to true to ensure that the service will be started automatically upon boot. Set to false to ensure that the service will not be started automatically upon boot. Default: - true if used in ``InitService.enable()``, no change to service state if used in ``InitService.fromOptions()``.
:param ensure_running: Make sure this service is running or not running after cfn-init finishes. Set to true to ensure that the service is running after cfn-init finishes. Set to false to ensure that the service is not running after cfn-init finishes. Default: - same value as ``enabled``.
:param service_restart_handle: Restart service when the actions registered into the restartHandle have been performed. Register actions into the restartHandle by passing it to ``InitFile``, ``InitCommand``, ``InitPackage`` and ``InitSource`` objects. Default: - No files trigger restart
"""
options = InitServiceOptions(
enabled=enabled,
ensure_running=ensure_running,
service_restart_handle=service_restart_handle,
)
return jsii.sinvoke(cls, "enable", [service_name, options])
@builtins.property # type: ignore
@jsii.member(jsii_name="elementType")
def element_type(self) -> builtins.str:
"""Returns the init element type for this element."""
return jsii.get(self, "elementType")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.InitServiceOptions",
jsii_struct_bases=[],
name_mapping={
"enabled": "enabled",
"ensure_running": "ensureRunning",
"service_restart_handle": "serviceRestartHandle",
},
)
class InitServiceOptions:
def __init__(
self,
*,
enabled: typing.Optional[builtins.bool] = None,
ensure_running: typing.Optional[builtins.bool] = None,
service_restart_handle: typing.Optional["InitServiceRestartHandle"] = None,
) -> None:
"""Options for an InitService.
:param enabled: Enable or disable this service. Set to true to ensure that the service will be started automatically upon boot. Set to false to ensure that the service will not be started automatically upon boot. Default: - true if used in ``InitService.enable()``, no change to service state if used in ``InitService.fromOptions()``.
:param ensure_running: Make sure this service is running or not running after cfn-init finishes. Set to true to ensure that the service is running after cfn-init finishes. Set to false to ensure that the service is not running after cfn-init finishes. Default: - same value as ``enabled``.
:param service_restart_handle: Restart service when the actions registered into the restartHandle have been performed. Register actions into the restartHandle by passing it to ``InitFile``, ``InitCommand``, ``InitPackage`` and ``InitSource`` objects. Default: - No files trigger restart
"""
self._values: typing.Dict[str, typing.Any] = {}
if enabled is not None:
self._values["enabled"] = enabled
if ensure_running is not None:
self._values["ensure_running"] = ensure_running
if service_restart_handle is not None:
self._values["service_restart_handle"] = service_restart_handle
@builtins.property
def enabled(self) -> typing.Optional[builtins.bool]:
"""Enable or disable this service.
Set to true to ensure that the service will be started automatically upon boot.
Set to false to ensure that the service will not be started automatically upon boot.
:default:
- true if used in ``InitService.enable()``, no change to service
state if used in ``InitService.fromOptions()``.
"""
result = self._values.get("enabled")
return result
@builtins.property
def ensure_running(self) -> typing.Optional[builtins.bool]:
"""Make sure this service is running or not running after cfn-init finishes.
Set to true to ensure that the service is running after cfn-init finishes.
Set to false to ensure that the service is not running after cfn-init finishes.
:default: - same value as ``enabled``.
"""
result = self._values.get("ensure_running")
return result
@builtins.property
def service_restart_handle(self) -> typing.Optional["InitServiceRestartHandle"]:
"""Restart service when the actions registered into the restartHandle have been performed.
Register actions into the restartHandle by passing it to ``InitFile``, ``InitCommand``,
``InitPackage`` and ``InitSource`` objects.
:default: - No files trigger restart
"""
result = self._values.get("service_restart_handle")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InitServiceOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class InitServiceRestartHandle(
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.InitServiceRestartHandle",
):
"""An object that represents reasons to restart an InitService.
Pass an instance of this object to the ``InitFile``, ``InitCommand``,
``InitSource`` and ``InitPackage`` objects, and finally to an ``InitService``
itself to cause the actions (files, commands, sources, and packages)
to trigger a restart of the service.
For example, the following will run a custom command to install Nginx,
and trigger the nginx service to be restarted after the command has run::
# Example automatically generated. See https://github.com/aws/jsii/issues/826
handle = ec2.InitServiceRestartHandle()
ec2.CloudFormationInit.from_elements(
ec2.InitCommand.shell_command("/usr/bin/custom-nginx-install.sh", service_restart_handles=[handle]),
ec2.InitService.enable("nginx", service_restart_handle=handle))
"""
def __init__(self) -> None:
jsii.create(InitServiceRestartHandle, self, [])
class InitSource(
InitElement,
metaclass=jsii.JSIIAbstractClass,
jsii_type="@aws-cdk/aws-ec2.InitSource",
):
"""Extract an archive into a directory."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _InitSourceProxy
def __init__(
self,
target_directory: builtins.str,
service_handles: typing.Optional[typing.List[InitServiceRestartHandle]] = None,
) -> None:
"""
:param target_directory: -
:param service_handles: -
"""
jsii.create(InitSource, self, [target_directory, service_handles])
@jsii.member(jsii_name="fromAsset")
@builtins.classmethod
def from_asset(
cls,
target_directory: builtins.str,
path: builtins.str,
*,
service_restart_handles: typing.Optional[typing.List[InitServiceRestartHandle]] = None,
readers: typing.Optional[typing.List[aws_cdk.aws_iam.IGrantable]] = None,
source_hash: typing.Optional[builtins.str] = None,
exclude: typing.Optional[typing.List[builtins.str]] = None,
follow: typing.Optional[aws_cdk.assets.FollowMode] = None,
ignore_mode: typing.Optional[aws_cdk.core.IgnoreMode] = None,
asset_hash: typing.Optional[builtins.str] = None,
asset_hash_type: typing.Optional[aws_cdk.core.AssetHashType] = None,
bundling: typing.Optional[aws_cdk.core.BundlingOptions] = None,
) -> "InitSource":
"""Create an InitSource from an asset created from the given path.
:param target_directory: -
:param path: -
:param service_restart_handles: Restart the given services after this archive has been extracted. Default: - Do not restart any service
:param readers: (experimental) A list of principals that should be able to read this asset from S3. You can use ``asset.grantRead(principal)`` to grant read permissions later. Default: - No principals that can read file asset.
:param source_hash: (deprecated) Custom hash to use when identifying the specific version of the asset. For consistency, this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be the asset hash. NOTE: the source hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to Amazon S3, etc. If you chose to customize the source hash, you will need to make sure it is updated every time the source changes, or otherwise it is possible that some deployments will not be invalidated. Default: - automatically calculate source hash based on the contents of the source file or directory.
:param exclude: (deprecated) Glob patterns to exclude from the copy. Default: nothing is excluded
:param follow: (deprecated) A strategy for how to handle symlinks. Default: Never
:param ignore_mode: (deprecated) The ignore behavior to use for exclude patterns. Default: - GLOB for file assets, DOCKER or GLOB for docker assets depending on whether the '
:param asset_hash: Specify a custom hash for this asset. If ``assetHashType`` is set it must be set to ``AssetHashType.CUSTOM``. For consistency, this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be the asset hash. NOTE: the hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will need to make sure it is updated every time the asset changes, or otherwise it is possible that some deployments will not be invalidated. Default: - based on ``assetHashType``
:param asset_hash_type: Specifies the type of hash to calculate for this asset. If ``assetHash`` is configured, this option must be ``undefined`` or ``AssetHashType.CUSTOM``. Default: - the default is ``AssetHashType.SOURCE``, but if ``assetHash`` is explicitly specified this value defaults to ``AssetHashType.CUSTOM``.
:param bundling: (experimental) Bundle the asset by executing a command in a Docker container. The asset path will be mounted at ``/asset-input``. The Docker container is responsible for putting content at ``/asset-output``. The content at ``/asset-output`` will be zipped and used as the final asset. Default: - uploaded as-is to S3 if the asset is a regular file or a .zip file, archived into a .zip file and uploaded to S3 otherwise
"""
options = InitSourceAssetOptions(
service_restart_handles=service_restart_handles,
readers=readers,
source_hash=source_hash,
exclude=exclude,
follow=follow,
ignore_mode=ignore_mode,
asset_hash=asset_hash,
asset_hash_type=asset_hash_type,
bundling=bundling,
)
return jsii.sinvoke(cls, "fromAsset", [target_directory, path, options])
@jsii.member(jsii_name="fromExistingAsset")
@builtins.classmethod
def from_existing_asset(
cls,
target_directory: builtins.str,
asset: aws_cdk.aws_s3_assets.Asset,
*,
service_restart_handles: typing.Optional[typing.List[InitServiceRestartHandle]] = None,
) -> "InitSource":
"""Extract a directory from an existing directory asset.
:param target_directory: -
:param asset: -
:param service_restart_handles: Restart the given services after this archive has been extracted. Default: - Do not restart any service
"""
options = InitSourceOptions(service_restart_handles=service_restart_handles)
return jsii.sinvoke(cls, "fromExistingAsset", [target_directory, asset, options])
@jsii.member(jsii_name="fromGitHub")
@builtins.classmethod
def from_git_hub(
cls,
target_directory: builtins.str,
owner: builtins.str,
repo: builtins.str,
ref_spec: typing.Optional[builtins.str] = None,
*,
service_restart_handles: typing.Optional[typing.List[InitServiceRestartHandle]] = None,
) -> "InitSource":
"""Extract a GitHub branch into a given directory.
:param target_directory: -
:param owner: -
:param repo: -
:param ref_spec: -
:param service_restart_handles: Restart the given services after this archive has been extracted. Default: - Do not restart any service
"""
options = InitSourceOptions(service_restart_handles=service_restart_handles)
return jsii.sinvoke(cls, "fromGitHub", [target_directory, owner, repo, ref_spec, options])
@jsii.member(jsii_name="fromS3Object")
@builtins.classmethod
def from_s3_object(
cls,
target_directory: builtins.str,
bucket: aws_cdk.aws_s3.IBucket,
key: builtins.str,
*,
service_restart_handles: typing.Optional[typing.List[InitServiceRestartHandle]] = None,
) -> "InitSource":
"""Extract an archive stored in an S3 bucket into the given directory.
:param target_directory: -
:param bucket: -
:param key: -
:param service_restart_handles: Restart the given services after this archive has been extracted. Default: - Do not restart any service
"""
options = InitSourceOptions(service_restart_handles=service_restart_handles)
return jsii.sinvoke(cls, "fromS3Object", [target_directory, bucket, key, options])
@jsii.member(jsii_name="fromUrl")
@builtins.classmethod
def from_url(
cls,
target_directory: builtins.str,
url: builtins.str,
*,
service_restart_handles: typing.Optional[typing.List[InitServiceRestartHandle]] = None,
) -> "InitSource":
"""Retrieve a URL and extract it into the given directory.
:param target_directory: -
:param url: -
:param service_restart_handles: Restart the given services after this archive has been extracted. Default: - Do not restart any service
"""
options = InitSourceOptions(service_restart_handles=service_restart_handles)
return jsii.sinvoke(cls, "fromUrl", [target_directory, url, options])
@builtins.property # type: ignore
@jsii.member(jsii_name="elementType")
def element_type(self) -> builtins.str:
"""Returns the init element type for this element."""
return jsii.get(self, "elementType")
class _InitSourceProxy(
InitSource, jsii.proxy_for(InitElement) # type: ignore
):
pass
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.InitSourceOptions",
jsii_struct_bases=[],
name_mapping={"service_restart_handles": "serviceRestartHandles"},
)
class InitSourceOptions:
def __init__(
self,
*,
service_restart_handles: typing.Optional[typing.List[InitServiceRestartHandle]] = None,
) -> None:
"""Additional options for an InitSource.
:param service_restart_handles: Restart the given services after this archive has been extracted. Default: - Do not restart any service
"""
self._values: typing.Dict[str, typing.Any] = {}
if service_restart_handles is not None:
self._values["service_restart_handles"] = service_restart_handles
@builtins.property
def service_restart_handles(
self,
) -> typing.Optional[typing.List[InitServiceRestartHandle]]:
"""Restart the given services after this archive has been extracted.
:default: - Do not restart any service
"""
result = self._values.get("service_restart_handles")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InitSourceOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class InitUser(
InitElement,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.InitUser",
):
"""Create Linux/UNIX users and to assign user IDs.
Users are created as non-interactive system users with a shell of
/sbin/nologin. This is by design and cannot be modified.
Not supported for Windows systems.
"""
def __init__(
self,
user_name: builtins.str,
*,
groups: typing.Optional[typing.List[builtins.str]] = None,
home_dir: typing.Optional[builtins.str] = None,
user_id: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param user_name: -
:param groups: A list of group names. The user will be added to each group in the list. Default: the user is not associated with any groups.
:param home_dir: The user's home directory. Default: assigned by the OS
:param user_id: A user ID. The creation process fails if the user name exists with a different user ID. If the user ID is already assigned to an existing user the operating system may reject the creation request. Default: assigned by the OS
"""
user_options = InitUserOptions(
groups=groups, home_dir=home_dir, user_id=user_id
)
jsii.create(InitUser, self, [user_name, user_options])
@jsii.member(jsii_name="fromName")
@builtins.classmethod
def from_name(
cls,
user_name: builtins.str,
*,
groups: typing.Optional[typing.List[builtins.str]] = None,
home_dir: typing.Optional[builtins.str] = None,
user_id: typing.Optional[jsii.Number] = None,
) -> "InitUser":
"""Create a user from user name.
:param user_name: -
:param groups: A list of group names. The user will be added to each group in the list. Default: the user is not associated with any groups.
:param home_dir: The user's home directory. Default: assigned by the OS
:param user_id: A user ID. The creation process fails if the user name exists with a different user ID. If the user ID is already assigned to an existing user the operating system may reject the creation request. Default: assigned by the OS
"""
options = InitUserOptions(groups=groups, home_dir=home_dir, user_id=user_id)
return jsii.sinvoke(cls, "fromName", [user_name, options])
@builtins.property # type: ignore
@jsii.member(jsii_name="elementType")
def element_type(self) -> builtins.str:
"""Returns the init element type for this element."""
return jsii.get(self, "elementType")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.InitUserOptions",
jsii_struct_bases=[],
name_mapping={"groups": "groups", "home_dir": "homeDir", "user_id": "userId"},
)
class InitUserOptions:
def __init__(
self,
*,
groups: typing.Optional[typing.List[builtins.str]] = None,
home_dir: typing.Optional[builtins.str] = None,
user_id: typing.Optional[jsii.Number] = None,
) -> None:
"""Optional parameters used when creating a user.
:param groups: A list of group names. The user will be added to each group in the list. Default: the user is not associated with any groups.
:param home_dir: The user's home directory. Default: assigned by the OS
:param user_id: A user ID. The creation process fails if the user name exists with a different user ID. If the user ID is already assigned to an existing user the operating system may reject the creation request. Default: assigned by the OS
"""
self._values: typing.Dict[str, typing.Any] = {}
if groups is not None:
self._values["groups"] = groups
if home_dir is not None:
self._values["home_dir"] = home_dir
if user_id is not None:
self._values["user_id"] = user_id
@builtins.property
def groups(self) -> typing.Optional[typing.List[builtins.str]]:
"""A list of group names.
The user will be added to each group in the list.
:default: the user is not associated with any groups.
"""
result = self._values.get("groups")
return result
@builtins.property
def home_dir(self) -> typing.Optional[builtins.str]:
"""The user's home directory.
:default: assigned by the OS
"""
result = self._values.get("home_dir")
return result
@builtins.property
def user_id(self) -> typing.Optional[jsii.Number]:
"""A user ID.
The creation process fails if the user name exists with a different user ID.
If the user ID is already assigned to an existing user the operating system may
reject the creation request.
:default: assigned by the OS
"""
result = self._values.get("user_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InitUserOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(IInstance)
class Instance(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.Instance",
):
"""This represents a single EC2 instance."""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
instance_type: "InstanceType",
machine_image: IMachineImage,
vpc: IVpc,
allow_all_outbound: typing.Optional[builtins.bool] = None,
availability_zone: typing.Optional[builtins.str] = None,
block_devices: typing.Optional[typing.List[BlockDevice]] = None,
init: typing.Optional[CloudFormationInit] = None,
init_options: typing.Optional[ApplyCloudFormationInitOptions] = None,
instance_name: typing.Optional[builtins.str] = None,
key_name: typing.Optional[builtins.str] = None,
private_ip_address: typing.Optional[builtins.str] = None,
resource_signal_timeout: typing.Optional[aws_cdk.core.Duration] = None,
role: typing.Optional[aws_cdk.aws_iam.IRole] = None,
security_group: typing.Optional[ISecurityGroup] = None,
source_dest_check: typing.Optional[builtins.bool] = None,
user_data: typing.Optional["UserData"] = None,
user_data_causes_replacement: typing.Optional[builtins.bool] = None,
vpc_subnets: typing.Optional["SubnetSelection"] = None,
) -> None:
"""
:param scope: -
:param id: -
:param instance_type: Type of instance to launch.
:param machine_image: AMI to launch.
:param vpc: VPC to launch the instance in.
:param allow_all_outbound: Whether the instance could initiate connections to anywhere by default. This property is only used when you do not provide a security group. Default: true
:param availability_zone: In which AZ to place the instance within the VPC. Default: - Random zone.
:param block_devices: Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched. Default: - Uses the block device mapping of the AMI
:param init: Apply the given CloudFormation Init configuration to the instance at startup. Default: - no CloudFormation init
:param init_options: Use the given options for applying CloudFormation Init. Describes the configsets to use and the timeout to wait Default: - default options
:param instance_name: The name of the instance. Default: - CDK generated name
:param key_name: Name of SSH keypair to grant access to instance. Default: - No SSH access will be possible.
:param private_ip_address: Defines a private IP address to associate with an instance. Private IP should be available within the VPC that the instance is build within. Default: - no association
:param resource_signal_timeout: The length of time to wait for the resourceSignalCount. The maximum value is 43200 (12 hours). Default: Duration.minutes(5)
:param role: An IAM role to associate with the instance profile assigned to this Auto Scaling Group. The role must be assumable by the service principal ``ec2.amazonaws.com``: Default: - A role will automatically be created, it can be accessed via the ``role`` property
:param security_group: Security Group to assign to this instance. Default: - create new security group
:param source_dest_check: Specifies whether to enable an instance launched in a VPC to perform NAT. This controls whether source/destination checking is enabled on the instance. A value of true means that checking is enabled, and false means that checking is disabled. The value must be false for the instance to perform NAT. Default: true
:param user_data: Specific UserData to use. The UserData may still be mutated after creation. Default: - A UserData object appropriate for the MachineImage's Operating System is created.
:param user_data_causes_replacement: Changes to the UserData force replacement. Depending the EC2 instance type, changing UserData either restarts the instance or replaces the instance. - Instance store-backed instances are replaced. - EBS-backed instances are restarted. By default, restarting does not execute the new UserData so you will need a different mechanism to ensure the instance is restarted. Setting this to ``true`` will make the instance's Logical ID depend on the UserData, which will cause CloudFormation to replace it if the UserData changes. Default: - true iff ``initOptions`` is specified, false otherwise.
:param vpc_subnets: Where to place the instance within the VPC. Default: - Private subnets.
"""
props = InstanceProps(
instance_type=instance_type,
machine_image=machine_image,
vpc=vpc,
allow_all_outbound=allow_all_outbound,
availability_zone=availability_zone,
block_devices=block_devices,
init=init,
init_options=init_options,
instance_name=instance_name,
key_name=key_name,
private_ip_address=private_ip_address,
resource_signal_timeout=resource_signal_timeout,
role=role,
security_group=security_group,
source_dest_check=source_dest_check,
user_data=user_data,
user_data_causes_replacement=user_data_causes_replacement,
vpc_subnets=vpc_subnets,
)
jsii.create(Instance, self, [scope, id, props])
@jsii.member(jsii_name="addSecurityGroup")
def add_security_group(self, security_group: ISecurityGroup) -> None:
"""Add the security group to the instance.
:param security_group: : The security group to add.
"""
return jsii.invoke(self, "addSecurityGroup", [security_group])
@jsii.member(jsii_name="addToRolePolicy")
def add_to_role_policy(self, statement: aws_cdk.aws_iam.PolicyStatement) -> None:
"""Adds a statement to the IAM role assumed by the instance.
:param statement: -
"""
return jsii.invoke(self, "addToRolePolicy", [statement])
@jsii.member(jsii_name="addUserData")
def add_user_data(self, *commands: builtins.str) -> None:
"""Add command to the startup script of the instance.
The command must be in the scripting language supported by the instance's OS (i.e. Linux/Windows).
:param commands: -
"""
return jsii.invoke(self, "addUserData", [*commands])
@builtins.property # type: ignore
@jsii.member(jsii_name="connections")
def connections(self) -> "Connections":
"""Allows specify security group connections for the instance."""
return jsii.get(self, "connections")
@builtins.property # type: ignore
@jsii.member(jsii_name="grantPrincipal")
def grant_principal(self) -> aws_cdk.aws_iam.IPrincipal:
"""The principal to grant permissions to."""
return jsii.get(self, "grantPrincipal")
@builtins.property # type: ignore
@jsii.member(jsii_name="instance")
def instance(self) -> CfnInstance:
"""the underlying instance resource."""
return jsii.get(self, "instance")
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceAvailabilityZone")
def instance_availability_zone(self) -> builtins.str:
"""The availability zone the instance was launched in.
:attribute: true
"""
return jsii.get(self, "instanceAvailabilityZone")
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceId")
def instance_id(self) -> builtins.str:
"""The instance's ID.
:attribute: true
"""
return jsii.get(self, "instanceId")
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePrivateDnsName")
def instance_private_dns_name(self) -> builtins.str:
"""Private DNS name for this instance.
:attribute: true
"""
return jsii.get(self, "instancePrivateDnsName")
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePrivateIp")
def instance_private_ip(self) -> builtins.str:
"""Private IP for this instance.
:attribute: true
"""
return jsii.get(self, "instancePrivateIp")
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePublicDnsName")
def instance_public_dns_name(self) -> builtins.str:
"""Publicly-routable DNS name for this instance.
(May be an empty string if the instance does not have a public name).
:attribute: true
"""
return jsii.get(self, "instancePublicDnsName")
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePublicIp")
def instance_public_ip(self) -> builtins.str:
"""Publicly-routable IP address for this instance.
(May be an empty string if the instance does not have a public IP).
:attribute: true
"""
return jsii.get(self, "instancePublicIp")
@builtins.property # type: ignore
@jsii.member(jsii_name="osType")
def os_type(self) -> "OperatingSystemType":
"""The type of OS the instance is running."""
return jsii.get(self, "osType")
@builtins.property # type: ignore
@jsii.member(jsii_name="role")
def role(self) -> aws_cdk.aws_iam.IRole:
"""The IAM role assumed by the instance."""
return jsii.get(self, "role")
@builtins.property # type: ignore
@jsii.member(jsii_name="userData")
def user_data(self) -> "UserData":
"""UserData for the instance."""
return jsii.get(self, "userData")
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.InstanceArchitecture")
class InstanceArchitecture(enum.Enum):
"""Identifies an instance's CPU architecture."""
ARM_64 = "ARM_64"
"""ARM64 architecture."""
X86_64 = "X86_64"
"""x86-64 architecture."""
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.InstanceClass")
class InstanceClass(enum.Enum):
"""What class and generation of instance to use.
We have both symbolic and concrete enums for every type.
The first are for people that want to specify by purpose,
the second one are for people who already know exactly what
'R4' means.
"""
STANDARD3 = "STANDARD3"
"""Standard instances, 3rd generation."""
STANDARD4 = "STANDARD4"
"""Standard instances, 4th generation."""
STANDARD5 = "STANDARD5"
"""Standard instances, 5th generation."""
STANDARD5_NVME_DRIVE = "STANDARD5_NVME_DRIVE"
"""Standard instances with local NVME drive, 5th generation."""
STANDARD5_AMD = "STANDARD5_AMD"
"""Standard instances based on AMD EPYC, 5th generation."""
STANDARD5_AMD_NVME_DRIVE = "STANDARD5_AMD_NVME_DRIVE"
"""Standard instances based on AMD EPYC with local NVME drive, 5th generation."""
MEMORY3 = "MEMORY3"
"""Memory optimized instances, 3rd generation."""
MEMORY4 = "MEMORY4"
"""Memory optimized instances, 4th generation."""
MEMORY5 = "MEMORY5"
"""Memory optimized instances, 5th generation."""
MEMORY5_HIGH_PERFORMANCE = "MEMORY5_HIGH_PERFORMANCE"
"""Memory optimized instances for high performance computing, 5th generation."""
MEMORY5_NVME_DRIVE = "MEMORY5_NVME_DRIVE"
"""Memory optimized instances with local NVME drive, 5th generation."""
MEMORY5_NVME_DRIVE_HIGH_PERFORMANCE = "MEMORY5_NVME_DRIVE_HIGH_PERFORMANCE"
"""Memory optimized instances with local NVME drive for high performance computing, 5th generation."""
MEMORY5_AMD = "MEMORY5_AMD"
"""Memory optimized instances based on AMD EPYC, 5th generation."""
MEMORY5_EBS_OPTIMIZED = "MEMORY5_EBS_OPTIMIZED"
"""Memory optimized instances that are also EBS-optimized, 5th generation."""
MEMORY6_GRAVITON = "MEMORY6_GRAVITON"
"""Memory optimized instances, 6th generation with Graviton2 processors."""
MEMORY6_GRAVITON2_NVME_DRIVE = "MEMORY6_GRAVITON2_NVME_DRIVE"
"""Memory optimized instances, 6th generation with Graviton2 processors and local NVME drive."""
COMPUTE3 = "COMPUTE3"
"""Compute optimized instances, 3rd generation."""
COMPUTE4 = "COMPUTE4"
"""Compute optimized instances, 4th generation."""
COMPUTE5 = "COMPUTE5"
"""Compute optimized instances, 5th generation."""
COMPUTE5_NVME_DRIVE = "COMPUTE5_NVME_DRIVE"
"""Compute optimized instances with local NVME drive, 5th generation."""
COMPUTE5_AMD = "COMPUTE5_AMD"
"""Compute optimized instances based on AMD EPYC, 5th generation."""
COMPUTE5_HIGH_PERFORMANCE = "COMPUTE5_HIGH_PERFORMANCE"
"""Compute optimized instances for high performance computing, 5th generation."""
COMPUTE6_GRAVITON2 = "COMPUTE6_GRAVITON2"
"""Compute optimized instances for high performance computing, 6th generation with Graviton2 processors."""
COMPUTE6_GRAVITON2_NVME_DRIVE = "COMPUTE6_GRAVITON2_NVME_DRIVE"
"""Compute optimized instances for high performance computing, 6th generation with Graviton2 processors and local NVME drive."""
COMPUTE6_GRAVITON2_HIGH_NETWORK_BANDWITH = "COMPUTE6_GRAVITON2_HIGH_NETWORK_BANDWITH"
"""Compute optimized instances for high performance computing, 6th generation with Graviton2 processors and high network bandwidth capabilities."""
STORAGE2 = "STORAGE2"
"""Storage-optimized instances, 2nd generation."""
STORAGE_COMPUTE_1 = "STORAGE_COMPUTE_1"
"""Storage/compute balanced instances, 1st generation."""
IO3 = "IO3"
"""I/O-optimized instances, 3rd generation."""
IO3_DENSE_NVME_DRIVE = "IO3_DENSE_NVME_DRIVE"
"""I/O-optimized instances with local NVME drive, 3rd generation."""
BURSTABLE2 = "BURSTABLE2"
"""Burstable instances, 2nd generation."""
BURSTABLE3 = "BURSTABLE3"
"""Burstable instances, 3rd generation."""
BURSTABLE3_AMD = "BURSTABLE3_AMD"
"""Burstable instances based on AMD EPYC, 3rd generation."""
BURSTABLE4_GRAVITON = "BURSTABLE4_GRAVITON"
"""Burstable instances, 4th generation with Graviton2 processors."""
MEMORY_INTENSIVE_1 = "MEMORY_INTENSIVE_1"
"""Memory-intensive instances, 1st generation."""
MEMORY_INTENSIVE_1_EXTENDED = "MEMORY_INTENSIVE_1_EXTENDED"
"""Memory-intensive instances, extended, 1st generation."""
FPGA1 = "FPGA1"
"""Instances with customizable hardware acceleration, 1st generation."""
GRAPHICS3 = "GRAPHICS3"
"""Graphics-optimized instances, 3rd generation."""
GRAPHICS4_NVME_DRIVE_HIGH_PERFORMANCE = "GRAPHICS4_NVME_DRIVE_HIGH_PERFORMANCE"
"""Graphics-optimized instances with NVME drive for high performance computing, 4th generation."""
PARALLEL2 = "PARALLEL2"
"""Parallel-processing optimized instances, 2nd generation."""
PARALLEL3 = "PARALLEL3"
"""Parallel-processing optimized instances, 3nd generation."""
ARM1 = "ARM1"
"""Arm processor based instances, 1st generation."""
STANDARD6_GRAVITON = "STANDARD6_GRAVITON"
"""Arm processor based instances, 2nd generation."""
STANDARD6_GRAVITON2_NVME_DRIVE = "STANDARD6_GRAVITON2_NVME_DRIVE"
"""Standard instances, 6th generation with Graviton2 processors and local NVME drive."""
HIGH_COMPUTE_MEMORY1 = "HIGH_COMPUTE_MEMORY1"
"""High memory and compute capacity instances, 1st generation."""
INFERENCE1 = "INFERENCE1"
"""Inferentia Chips based instances for machine learning inference applications, 1st generation."""
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.InstanceInitiatedShutdownBehavior")
class InstanceInitiatedShutdownBehavior(enum.Enum):
"""Provides the options for specifying the instance initiated shutdown behavior.
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingInstanceInitiatedShutdownBehavior
"""
STOP = "STOP"
"""The instance will stop when it initiates a shutdown."""
TERMINATE = "TERMINATE"
"""The instance will be terminated when it initiates a shutdown."""
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.InstanceProps",
jsii_struct_bases=[],
name_mapping={
"instance_type": "instanceType",
"machine_image": "machineImage",
"vpc": "vpc",
"allow_all_outbound": "allowAllOutbound",
"availability_zone": "availabilityZone",
"block_devices": "blockDevices",
"init": "init",
"init_options": "initOptions",
"instance_name": "instanceName",
"key_name": "keyName",
"private_ip_address": "privateIpAddress",
"resource_signal_timeout": "resourceSignalTimeout",
"role": "role",
"security_group": "securityGroup",
"source_dest_check": "sourceDestCheck",
"user_data": "userData",
"user_data_causes_replacement": "userDataCausesReplacement",
"vpc_subnets": "vpcSubnets",
},
)
class InstanceProps:
def __init__(
self,
*,
instance_type: "InstanceType",
machine_image: IMachineImage,
vpc: IVpc,
allow_all_outbound: typing.Optional[builtins.bool] = None,
availability_zone: typing.Optional[builtins.str] = None,
block_devices: typing.Optional[typing.List[BlockDevice]] = None,
init: typing.Optional[CloudFormationInit] = None,
init_options: typing.Optional[ApplyCloudFormationInitOptions] = None,
instance_name: typing.Optional[builtins.str] = None,
key_name: typing.Optional[builtins.str] = None,
private_ip_address: typing.Optional[builtins.str] = None,
resource_signal_timeout: typing.Optional[aws_cdk.core.Duration] = None,
role: typing.Optional[aws_cdk.aws_iam.IRole] = None,
security_group: typing.Optional[ISecurityGroup] = None,
source_dest_check: typing.Optional[builtins.bool] = None,
user_data: typing.Optional["UserData"] = None,
user_data_causes_replacement: typing.Optional[builtins.bool] = None,
vpc_subnets: typing.Optional["SubnetSelection"] = None,
) -> None:
"""Properties of an EC2 Instance.
:param instance_type: Type of instance to launch.
:param machine_image: AMI to launch.
:param vpc: VPC to launch the instance in.
:param allow_all_outbound: Whether the instance could initiate connections to anywhere by default. This property is only used when you do not provide a security group. Default: true
:param availability_zone: In which AZ to place the instance within the VPC. Default: - Random zone.
:param block_devices: Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched. Default: - Uses the block device mapping of the AMI
:param init: Apply the given CloudFormation Init configuration to the instance at startup. Default: - no CloudFormation init
:param init_options: Use the given options for applying CloudFormation Init. Describes the configsets to use and the timeout to wait Default: - default options
:param instance_name: The name of the instance. Default: - CDK generated name
:param key_name: Name of SSH keypair to grant access to instance. Default: - No SSH access will be possible.
:param private_ip_address: Defines a private IP address to associate with an instance. Private IP should be available within the VPC that the instance is build within. Default: - no association
:param resource_signal_timeout: The length of time to wait for the resourceSignalCount. The maximum value is 43200 (12 hours). Default: Duration.minutes(5)
:param role: An IAM role to associate with the instance profile assigned to this Auto Scaling Group. The role must be assumable by the service principal ``ec2.amazonaws.com``: Default: - A role will automatically be created, it can be accessed via the ``role`` property
:param security_group: Security Group to assign to this instance. Default: - create new security group
:param source_dest_check: Specifies whether to enable an instance launched in a VPC to perform NAT. This controls whether source/destination checking is enabled on the instance. A value of true means that checking is enabled, and false means that checking is disabled. The value must be false for the instance to perform NAT. Default: true
:param user_data: Specific UserData to use. The UserData may still be mutated after creation. Default: - A UserData object appropriate for the MachineImage's Operating System is created.
:param user_data_causes_replacement: Changes to the UserData force replacement. Depending the EC2 instance type, changing UserData either restarts the instance or replaces the instance. - Instance store-backed instances are replaced. - EBS-backed instances are restarted. By default, restarting does not execute the new UserData so you will need a different mechanism to ensure the instance is restarted. Setting this to ``true`` will make the instance's Logical ID depend on the UserData, which will cause CloudFormation to replace it if the UserData changes. Default: - true iff ``initOptions`` is specified, false otherwise.
:param vpc_subnets: Where to place the instance within the VPC. Default: - Private subnets.
"""
if isinstance(init_options, dict):
init_options = ApplyCloudFormationInitOptions(**init_options)
if isinstance(vpc_subnets, dict):
vpc_subnets = SubnetSelection(**vpc_subnets)
self._values: typing.Dict[str, typing.Any] = {
"instance_type": instance_type,
"machine_image": machine_image,
"vpc": vpc,
}
if allow_all_outbound is not None:
self._values["allow_all_outbound"] = allow_all_outbound
if availability_zone is not None:
self._values["availability_zone"] = availability_zone
if block_devices is not None:
self._values["block_devices"] = block_devices
if init is not None:
self._values["init"] = init
if init_options is not None:
self._values["init_options"] = init_options
if instance_name is not None:
self._values["instance_name"] = instance_name
if key_name is not None:
self._values["key_name"] = key_name
if private_ip_address is not None:
self._values["private_ip_address"] = private_ip_address
if resource_signal_timeout is not None:
self._values["resource_signal_timeout"] = resource_signal_timeout
if role is not None:
self._values["role"] = role
if security_group is not None:
self._values["security_group"] = security_group
if source_dest_check is not None:
self._values["source_dest_check"] = source_dest_check
if user_data is not None:
self._values["user_data"] = user_data
if user_data_causes_replacement is not None:
self._values["user_data_causes_replacement"] = user_data_causes_replacement
if vpc_subnets is not None:
self._values["vpc_subnets"] = vpc_subnets
@builtins.property
def instance_type(self) -> "InstanceType":
"""Type of instance to launch."""
result = self._values.get("instance_type")
assert result is not None, "Required property 'instance_type' is missing"
return result
@builtins.property
def machine_image(self) -> IMachineImage:
"""AMI to launch."""
result = self._values.get("machine_image")
assert result is not None, "Required property 'machine_image' is missing"
return result
@builtins.property
def vpc(self) -> IVpc:
"""VPC to launch the instance in."""
result = self._values.get("vpc")
assert result is not None, "Required property 'vpc' is missing"
return result
@builtins.property
def allow_all_outbound(self) -> typing.Optional[builtins.bool]:
"""Whether the instance could initiate connections to anywhere by default.
This property is only used when you do not provide a security group.
:default: true
"""
result = self._values.get("allow_all_outbound")
return result
@builtins.property
def availability_zone(self) -> typing.Optional[builtins.str]:
"""In which AZ to place the instance within the VPC.
:default: - Random zone.
"""
result = self._values.get("availability_zone")
return result
@builtins.property
def block_devices(self) -> typing.Optional[typing.List[BlockDevice]]:
"""Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.
Each instance that is launched has an associated root device volume,
either an Amazon EBS volume or an instance store volume.
You can use block device mappings to specify additional EBS volumes or
instance store volumes to attach to an instance when it is launched.
:default: - Uses the block device mapping of the AMI
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html
"""
result = self._values.get("block_devices")
return result
@builtins.property
def init(self) -> typing.Optional[CloudFormationInit]:
"""Apply the given CloudFormation Init configuration to the instance at startup.
:default: - no CloudFormation init
"""
result = self._values.get("init")
return result
@builtins.property
def init_options(self) -> typing.Optional[ApplyCloudFormationInitOptions]:
"""Use the given options for applying CloudFormation Init.
Describes the configsets to use and the timeout to wait
:default: - default options
"""
result = self._values.get("init_options")
return result
@builtins.property
def instance_name(self) -> typing.Optional[builtins.str]:
"""The name of the instance.
:default: - CDK generated name
"""
result = self._values.get("instance_name")
return result
@builtins.property
def key_name(self) -> typing.Optional[builtins.str]:
"""Name of SSH keypair to grant access to instance.
:default: - No SSH access will be possible.
"""
result = self._values.get("key_name")
return result
@builtins.property
def private_ip_address(self) -> typing.Optional[builtins.str]:
"""Defines a private IP address to associate with an instance.
Private IP should be available within the VPC that the instance is build within.
:default: - no association
"""
result = self._values.get("private_ip_address")
return result
@builtins.property
def resource_signal_timeout(self) -> typing.Optional[aws_cdk.core.Duration]:
"""The length of time to wait for the resourceSignalCount.
The maximum value is 43200 (12 hours).
:default: Duration.minutes(5)
"""
result = self._values.get("resource_signal_timeout")
return result
@builtins.property
def role(self) -> typing.Optional[aws_cdk.aws_iam.IRole]:
"""An IAM role to associate with the instance profile assigned to this Auto Scaling Group.
The role must be assumable by the service principal ``ec2.amazonaws.com``:
:default: - A role will automatically be created, it can be accessed via the ``role`` property
Example::
# Example automatically generated. See https://github.com/aws/jsii/issues/826
role = iam.Role(self, "MyRole",
assumed_by=iam.ServicePrincipal("ec2.amazonaws.com")
)
"""
result = self._values.get("role")
return result
@builtins.property
def security_group(self) -> typing.Optional[ISecurityGroup]:
"""Security Group to assign to this instance.
:default: - create new security group
"""
result = self._values.get("security_group")
return result
@builtins.property
def source_dest_check(self) -> typing.Optional[builtins.bool]:
"""Specifies whether to enable an instance launched in a VPC to perform NAT.
This controls whether source/destination checking is enabled on the instance.
A value of true means that checking is enabled, and false means that checking is disabled.
The value must be false for the instance to perform NAT.
:default: true
"""
result = self._values.get("source_dest_check")
return result
@builtins.property
def user_data(self) -> typing.Optional["UserData"]:
"""Specific UserData to use.
The UserData may still be mutated after creation.
:default:
- A UserData object appropriate for the MachineImage's
Operating System is created.
"""
result = self._values.get("user_data")
return result
@builtins.property
def user_data_causes_replacement(self) -> typing.Optional[builtins.bool]:
"""Changes to the UserData force replacement.
Depending the EC2 instance type, changing UserData either
restarts the instance or replaces the instance.
- Instance store-backed instances are replaced.
- EBS-backed instances are restarted.
By default, restarting does not execute the new UserData so you
will need a different mechanism to ensure the instance is restarted.
Setting this to ``true`` will make the instance's Logical ID depend on the
UserData, which will cause CloudFormation to replace it if the UserData
changes.
:default: - true iff ``initOptions`` is specified, false otherwise.
"""
result = self._values.get("user_data_causes_replacement")
return result
@builtins.property
def vpc_subnets(self) -> typing.Optional["SubnetSelection"]:
"""Where to place the instance within the VPC.
:default: - Private subnets.
"""
result = self._values.get("vpc_subnets")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InstanceProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.InstanceSize")
class InstanceSize(enum.Enum):
"""What size of instance to use."""
NANO = "NANO"
"""Instance size NANO (nano)."""
MICRO = "MICRO"
"""Instance size MICRO (micro)."""
SMALL = "SMALL"
"""Instance size SMALL (small)."""
MEDIUM = "MEDIUM"
"""Instance size MEDIUM (medium)."""
LARGE = "LARGE"
"""Instance size LARGE (large)."""
XLARGE = "XLARGE"
"""Instance size XLARGE (xlarge)."""
XLARGE2 = "XLARGE2"
"""Instance size XLARGE2 (2xlarge)."""
XLARGE4 = "XLARGE4"
"""Instance size XLARGE4 (4xlarge)."""
XLARGE6 = "XLARGE6"
"""Instance size XLARGE6 (6xlarge)."""
XLARGE8 = "XLARGE8"
"""Instance size XLARGE8 (8xlarge)."""
XLARGE9 = "XLARGE9"
"""Instance size XLARGE9 (9xlarge)."""
XLARGE10 = "XLARGE10"
"""Instance size XLARGE10 (10xlarge)."""
XLARGE12 = "XLARGE12"
"""Instance size XLARGE12 (12xlarge)."""
XLARGE16 = "XLARGE16"
"""Instance size XLARGE16 (16xlarge)."""
XLARGE18 = "XLARGE18"
"""Instance size XLARGE18 (18xlarge)."""
XLARGE24 = "XLARGE24"
"""Instance size XLARGE24 (24xlarge)."""
XLARGE32 = "XLARGE32"
"""Instance size XLARGE32 (32xlarge)."""
METAL = "METAL"
"""Instance size METAL (metal)."""
class InstanceType(metaclass=jsii.JSIIMeta, jsii_type="@aws-cdk/aws-ec2.InstanceType"):
"""Instance type for EC2 instances.
This class takes a literal string, good if you already
know the identifier of the type you want.
"""
def __init__(self, instance_type_identifier: builtins.str) -> None:
"""
:param instance_type_identifier: -
"""
jsii.create(InstanceType, self, [instance_type_identifier])
@jsii.member(jsii_name="of")
@builtins.classmethod
def of(
cls,
instance_class: InstanceClass,
instance_size: InstanceSize,
) -> "InstanceType":
"""Instance type for EC2 instances.
This class takes a combination of a class and size.
Be aware that not all combinations of class and size are available, and not all
classes are available in all regions.
:param instance_class: -
:param instance_size: -
"""
return jsii.sinvoke(cls, "of", [instance_class, instance_size])
@jsii.member(jsii_name="toString")
def to_string(self) -> builtins.str:
"""Return the instance type as a dotted string."""
return jsii.invoke(self, "toString", [])
@builtins.property # type: ignore
@jsii.member(jsii_name="architecture")
def architecture(self) -> InstanceArchitecture:
"""The instance's CPU architecture."""
return jsii.get(self, "architecture")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.InterfaceVpcEndpointAttributes",
jsii_struct_bases=[],
name_mapping={
"port": "port",
"vpc_endpoint_id": "vpcEndpointId",
"security_group_id": "securityGroupId",
"security_groups": "securityGroups",
},
)
class InterfaceVpcEndpointAttributes:
def __init__(
self,
*,
port: jsii.Number,
vpc_endpoint_id: builtins.str,
security_group_id: typing.Optional[builtins.str] = None,
security_groups: typing.Optional[typing.List[ISecurityGroup]] = None,
) -> None:
"""Construction properties for an ImportedInterfaceVpcEndpoint.
:param port: The port of the service of the interface VPC endpoint.
:param vpc_endpoint_id: The interface VPC endpoint identifier.
:param security_group_id: (deprecated) The identifier of the security group associated with the interface VPC endpoint.
:param security_groups: The security groups associated with the interface VPC endpoint.
"""
self._values: typing.Dict[str, typing.Any] = {
"port": port,
"vpc_endpoint_id": vpc_endpoint_id,
}
if security_group_id is not None:
self._values["security_group_id"] = security_group_id
if security_groups is not None:
self._values["security_groups"] = security_groups
@builtins.property
def port(self) -> jsii.Number:
"""The port of the service of the interface VPC endpoint."""
result = self._values.get("port")
assert result is not None, "Required property 'port' is missing"
return result
@builtins.property
def vpc_endpoint_id(self) -> builtins.str:
"""The interface VPC endpoint identifier."""
result = self._values.get("vpc_endpoint_id")
assert result is not None, "Required property 'vpc_endpoint_id' is missing"
return result
@builtins.property
def security_group_id(self) -> typing.Optional[builtins.str]:
"""(deprecated) The identifier of the security group associated with the interface VPC endpoint.
:deprecated: use ``securityGroups`` instead
:stability: deprecated
"""
result = self._values.get("security_group_id")
return result
@builtins.property
def security_groups(self) -> typing.Optional[typing.List[ISecurityGroup]]:
"""The security groups associated with the interface VPC endpoint."""
result = self._values.get("security_groups")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InterfaceVpcEndpointAttributes(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(IInterfaceVpcEndpointService)
class InterfaceVpcEndpointAwsService(
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.InterfaceVpcEndpointAwsService",
):
"""An AWS service for an interface VPC endpoint."""
def __init__(
self,
name: builtins.str,
prefix: typing.Optional[builtins.str] = None,
port: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param name: -
:param prefix: -
:param port: -
"""
jsii.create(InterfaceVpcEndpointAwsService, self, [name, prefix, port])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="APIGATEWAY")
def APIGATEWAY(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "APIGATEWAY")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="ATHENA")
def ATHENA(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "ATHENA")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CLOUDFORMATION")
def CLOUDFORMATION(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "CLOUDFORMATION")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CLOUDTRAIL")
def CLOUDTRAIL(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "CLOUDTRAIL")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CLOUDWATCH")
def CLOUDWATCH(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "CLOUDWATCH")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CLOUDWATCH_EVENTS")
def CLOUDWATCH_EVENTS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "CLOUDWATCH_EVENTS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CLOUDWATCH_LOGS")
def CLOUDWATCH_LOGS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "CLOUDWATCH_LOGS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CODEBUILD")
def CODEBUILD(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "CODEBUILD")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CODEBUILD_FIPS")
def CODEBUILD_FIPS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "CODEBUILD_FIPS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CODECOMMIT")
def CODECOMMIT(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "CODECOMMIT")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CODECOMMIT_FIPS")
def CODECOMMIT_FIPS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "CODECOMMIT_FIPS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CODECOMMIT_GIT")
def CODECOMMIT_GIT(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "CODECOMMIT_GIT")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CODECOMMIT_GIT_FIPS")
def CODECOMMIT_GIT_FIPS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "CODECOMMIT_GIT_FIPS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CODEPIPELINE")
def CODEPIPELINE(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "CODEPIPELINE")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="CONFIG")
def CONFIG(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "CONFIG")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="EC2")
def EC2(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "EC2")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="EC2_MESSAGES")
def EC2_MESSAGES(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "EC2_MESSAGES")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="ECR")
def ECR(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "ECR")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="ECR_DOCKER")
def ECR_DOCKER(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "ECR_DOCKER")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="ECS")
def ECS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "ECS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="ECS_AGENT")
def ECS_AGENT(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "ECS_AGENT")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="ECS_TELEMETRY")
def ECS_TELEMETRY(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "ECS_TELEMETRY")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="ELASTIC_FILESYSTEM")
def ELASTIC_FILESYSTEM(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "ELASTIC_FILESYSTEM")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="ELASTIC_FILESYSTEM_FIPS")
def ELASTIC_FILESYSTEM_FIPS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "ELASTIC_FILESYSTEM_FIPS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="ELASTIC_INFERENCE_RUNTIME")
def ELASTIC_INFERENCE_RUNTIME(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "ELASTIC_INFERENCE_RUNTIME")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="ELASTIC_LOAD_BALANCING")
def ELASTIC_LOAD_BALANCING(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "ELASTIC_LOAD_BALANCING")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="GLUE")
def GLUE(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "GLUE")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="KINESIS_FIREHOSE")
def KINESIS_FIREHOSE(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "KINESIS_FIREHOSE")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="KINESIS_STREAMS")
def KINESIS_STREAMS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "KINESIS_STREAMS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="KMS")
def KMS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "KMS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="LAMBDA")
def LAMBDA_(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "LAMBDA")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="REKOGNITION")
def REKOGNITION(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "REKOGNITION")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="REKOGNITION_FIPS")
def REKOGNITION_FIPS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "REKOGNITION_FIPS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="SAGEMAKER_API")
def SAGEMAKER_API(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "SAGEMAKER_API")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="SAGEMAKER_NOTEBOOK")
def SAGEMAKER_NOTEBOOK(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "SAGEMAKER_NOTEBOOK")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="SAGEMAKER_RUNTIME")
def SAGEMAKER_RUNTIME(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "SAGEMAKER_RUNTIME")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="SAGEMAKER_RUNTIME_FIPS")
def SAGEMAKER_RUNTIME_FIPS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "SAGEMAKER_RUNTIME_FIPS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="SECRETS_MANAGER")
def SECRETS_MANAGER(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "SECRETS_MANAGER")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="SERVICE_CATALOG")
def SERVICE_CATALOG(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "SERVICE_CATALOG")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="SNS")
def SNS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "SNS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="SQS")
def SQS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "SQS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="SSM")
def SSM(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "SSM")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="SSM_MESSAGES")
def SSM_MESSAGES(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "SSM_MESSAGES")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="STEP_FUNCTIONS")
def STEP_FUNCTIONS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "STEP_FUNCTIONS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="STORAGE_GATEWAY")
def STORAGE_GATEWAY(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "STORAGE_GATEWAY")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="STS")
def STS(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "STS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="TRANSFER")
def TRANSFER(cls) -> "InterfaceVpcEndpointAwsService":
return jsii.sget(cls, "TRANSFER")
@builtins.property # type: ignore
@jsii.member(jsii_name="name")
def name(self) -> builtins.str:
"""The name of the service."""
return jsii.get(self, "name")
@builtins.property # type: ignore
@jsii.member(jsii_name="port")
def port(self) -> jsii.Number:
"""The port of the service."""
return jsii.get(self, "port")
@builtins.property # type: ignore
@jsii.member(jsii_name="privateDnsDefault")
def private_dns_default(self) -> typing.Optional[builtins.bool]:
"""Whether Private DNS is supported by default."""
return jsii.get(self, "privateDnsDefault")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.InterfaceVpcEndpointOptions",
jsii_struct_bases=[],
name_mapping={
"service": "service",
"lookup_supported_azs": "lookupSupportedAzs",
"open": "open",
"private_dns_enabled": "privateDnsEnabled",
"security_groups": "securityGroups",
"subnets": "subnets",
},
)
class InterfaceVpcEndpointOptions:
def __init__(
self,
*,
service: IInterfaceVpcEndpointService,
lookup_supported_azs: typing.Optional[builtins.bool] = None,
open: typing.Optional[builtins.bool] = None,
private_dns_enabled: typing.Optional[builtins.bool] = None,
security_groups: typing.Optional[typing.List[ISecurityGroup]] = None,
subnets: typing.Optional["SubnetSelection"] = None,
) -> None:
"""Options to add an interface endpoint to a VPC.
:param service: The service to use for this interface VPC endpoint.
:param lookup_supported_azs: Limit to only those availability zones where the endpoint service can be created. Setting this to 'true' requires a lookup to be performed at synthesis time. Account and region must be set on the containing stack for this to work. Default: false
:param open: Whether to automatically allow VPC traffic to the endpoint. If enabled, all traffic to the endpoint from within the VPC will be automatically allowed. This is done based on the VPC's CIDR range. Default: true
:param private_dns_enabled: Whether to associate a private hosted zone with the specified VPC. This allows you to make requests to the service using its default DNS hostname. Default: set by the instance of IInterfaceVpcEndpointService, or true if not defined by the instance of IInterfaceVpcEndpointService
:param security_groups: The security groups to associate with this interface VPC endpoint. Default: - a new security group is created
:param subnets: The subnets in which to create an endpoint network interface. At most one per availability zone. Default: - private subnets
"""
if isinstance(subnets, dict):
subnets = SubnetSelection(**subnets)
self._values: typing.Dict[str, typing.Any] = {
"service": service,
}
if lookup_supported_azs is not None:
self._values["lookup_supported_azs"] = lookup_supported_azs
if open is not None:
self._values["open"] = open
if private_dns_enabled is not None:
self._values["private_dns_enabled"] = private_dns_enabled
if security_groups is not None:
self._values["security_groups"] = security_groups
if subnets is not None:
self._values["subnets"] = subnets
@builtins.property
def service(self) -> IInterfaceVpcEndpointService:
"""The service to use for this interface VPC endpoint."""
result = self._values.get("service")
assert result is not None, "Required property 'service' is missing"
return result
@builtins.property
def lookup_supported_azs(self) -> typing.Optional[builtins.bool]:
"""Limit to only those availability zones where the endpoint service can be created.
Setting this to 'true' requires a lookup to be performed at synthesis time. Account
and region must be set on the containing stack for this to work.
:default: false
"""
result = self._values.get("lookup_supported_azs")
return result
@builtins.property
def open(self) -> typing.Optional[builtins.bool]:
"""Whether to automatically allow VPC traffic to the endpoint.
If enabled, all traffic to the endpoint from within the VPC will be
automatically allowed. This is done based on the VPC's CIDR range.
:default: true
"""
result = self._values.get("open")
return result
@builtins.property
def private_dns_enabled(self) -> typing.Optional[builtins.bool]:
"""Whether to associate a private hosted zone with the specified VPC.
This
allows you to make requests to the service using its default DNS hostname.
:default:
set by the instance of IInterfaceVpcEndpointService, or true if
not defined by the instance of IInterfaceVpcEndpointService
"""
result = self._values.get("private_dns_enabled")
return result
@builtins.property
def security_groups(self) -> typing.Optional[typing.List[ISecurityGroup]]:
"""The security groups to associate with this interface VPC endpoint.
:default: - a new security group is created
"""
result = self._values.get("security_groups")
return result
@builtins.property
def subnets(self) -> typing.Optional["SubnetSelection"]:
"""The subnets in which to create an endpoint network interface.
At most one
per availability zone.
:default: - private subnets
"""
result = self._values.get("subnets")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InterfaceVpcEndpointOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.InterfaceVpcEndpointProps",
jsii_struct_bases=[InterfaceVpcEndpointOptions],
name_mapping={
"service": "service",
"lookup_supported_azs": "lookupSupportedAzs",
"open": "open",
"private_dns_enabled": "privateDnsEnabled",
"security_groups": "securityGroups",
"subnets": "subnets",
"vpc": "vpc",
},
)
class InterfaceVpcEndpointProps(InterfaceVpcEndpointOptions):
def __init__(
self,
*,
service: IInterfaceVpcEndpointService,
lookup_supported_azs: typing.Optional[builtins.bool] = None,
open: typing.Optional[builtins.bool] = None,
private_dns_enabled: typing.Optional[builtins.bool] = None,
security_groups: typing.Optional[typing.List[ISecurityGroup]] = None,
subnets: typing.Optional["SubnetSelection"] = None,
vpc: IVpc,
) -> None:
"""Construction properties for an InterfaceVpcEndpoint.
:param service: The service to use for this interface VPC endpoint.
:param lookup_supported_azs: Limit to only those availability zones where the endpoint service can be created. Setting this to 'true' requires a lookup to be performed at synthesis time. Account and region must be set on the containing stack for this to work. Default: false
:param open: Whether to automatically allow VPC traffic to the endpoint. If enabled, all traffic to the endpoint from within the VPC will be automatically allowed. This is done based on the VPC's CIDR range. Default: true
:param private_dns_enabled: Whether to associate a private hosted zone with the specified VPC. This allows you to make requests to the service using its default DNS hostname. Default: set by the instance of IInterfaceVpcEndpointService, or true if not defined by the instance of IInterfaceVpcEndpointService
:param security_groups: The security groups to associate with this interface VPC endpoint. Default: - a new security group is created
:param subnets: The subnets in which to create an endpoint network interface. At most one per availability zone. Default: - private subnets
:param vpc: The VPC network in which the interface endpoint will be used.
"""
if isinstance(subnets, dict):
subnets = SubnetSelection(**subnets)
self._values: typing.Dict[str, typing.Any] = {
"service": service,
"vpc": vpc,
}
if lookup_supported_azs is not None:
self._values["lookup_supported_azs"] = lookup_supported_azs
if open is not None:
self._values["open"] = open
if private_dns_enabled is not None:
self._values["private_dns_enabled"] = private_dns_enabled
if security_groups is not None:
self._values["security_groups"] = security_groups
if subnets is not None:
self._values["subnets"] = subnets
@builtins.property
def service(self) -> IInterfaceVpcEndpointService:
"""The service to use for this interface VPC endpoint."""
result = self._values.get("service")
assert result is not None, "Required property 'service' is missing"
return result
@builtins.property
def lookup_supported_azs(self) -> typing.Optional[builtins.bool]:
"""Limit to only those availability zones where the endpoint service can be created.
Setting this to 'true' requires a lookup to be performed at synthesis time. Account
and region must be set on the containing stack for this to work.
:default: false
"""
result = self._values.get("lookup_supported_azs")
return result
@builtins.property
def open(self) -> typing.Optional[builtins.bool]:
"""Whether to automatically allow VPC traffic to the endpoint.
If enabled, all traffic to the endpoint from within the VPC will be
automatically allowed. This is done based on the VPC's CIDR range.
:default: true
"""
result = self._values.get("open")
return result
@builtins.property
def private_dns_enabled(self) -> typing.Optional[builtins.bool]:
"""Whether to associate a private hosted zone with the specified VPC.
This
allows you to make requests to the service using its default DNS hostname.
:default:
set by the instance of IInterfaceVpcEndpointService, or true if
not defined by the instance of IInterfaceVpcEndpointService
"""
result = self._values.get("private_dns_enabled")
return result
@builtins.property
def security_groups(self) -> typing.Optional[typing.List[ISecurityGroup]]:
"""The security groups to associate with this interface VPC endpoint.
:default: - a new security group is created
"""
result = self._values.get("security_groups")
return result
@builtins.property
def subnets(self) -> typing.Optional["SubnetSelection"]:
"""The subnets in which to create an endpoint network interface.
At most one
per availability zone.
:default: - private subnets
"""
result = self._values.get("subnets")
return result
@builtins.property
def vpc(self) -> IVpc:
"""The VPC network in which the interface endpoint will be used."""
result = self._values.get("vpc")
assert result is not None, "Required property 'vpc' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InterfaceVpcEndpointProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(IInterfaceVpcEndpointService)
class InterfaceVpcEndpointService(
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.InterfaceVpcEndpointService",
):
"""A custom-hosted service for an interface VPC endpoint."""
def __init__(
self,
name: builtins.str,
port: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param name: -
:param port: -
"""
jsii.create(InterfaceVpcEndpointService, self, [name, port])
@builtins.property # type: ignore
@jsii.member(jsii_name="name")
def name(self) -> builtins.str:
"""The name of the service."""
return jsii.get(self, "name")
@builtins.property # type: ignore
@jsii.member(jsii_name="port")
def port(self) -> jsii.Number:
"""The port of the service."""
return jsii.get(self, "port")
@builtins.property # type: ignore
@jsii.member(jsii_name="privateDnsDefault")
def private_dns_default(self) -> typing.Optional[builtins.bool]:
"""Whether Private DNS is supported by default."""
return jsii.get(self, "privateDnsDefault")
@jsii.implements(ILaunchTemplate, aws_cdk.aws_iam.IGrantable, IConnectable)
class LaunchTemplate(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.LaunchTemplate",
):
"""This represents an EC2 LaunchTemplate.
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html
"""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
block_devices: typing.Optional[typing.List[BlockDevice]] = None,
cpu_credits: typing.Optional[CpuCredits] = None,
detailed_monitoring: typing.Optional[builtins.bool] = None,
disable_api_termination: typing.Optional[builtins.bool] = None,
ebs_optimized: typing.Optional[builtins.bool] = None,
hibernation_configured: typing.Optional[builtins.bool] = None,
instance_initiated_shutdown_behavior: typing.Optional[InstanceInitiatedShutdownBehavior] = None,
instance_type: typing.Optional[InstanceType] = None,
key_name: typing.Optional[builtins.str] = None,
launch_template_name: typing.Optional[builtins.str] = None,
machine_image: typing.Optional[IMachineImage] = None,
nitro_enclave_enabled: typing.Optional[builtins.bool] = None,
role: typing.Optional[aws_cdk.aws_iam.IRole] = None,
security_group: typing.Optional[ISecurityGroup] = None,
spot_options: typing.Optional["LaunchTemplateSpotOptions"] = None,
user_data: typing.Optional["UserData"] = None,
) -> None:
"""
:param scope: -
:param id: -
:param block_devices: Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched. Default: - Uses the block device mapping of the AMI
:param cpu_credits: CPU credit type for burstable EC2 instance types. Default: - No credit type is specified in the Launch Template.
:param detailed_monitoring: If set to true, then detailed monitoring will be enabled on instances created with this launch template. Default: False - Detailed monitoring is disabled.
:param disable_api_termination: If you set this parameter to true, you cannot terminate the instances launched with this launch template using the Amazon EC2 console, CLI, or API; otherwise, you can. Default: - The API termination setting is not specified in the Launch Template.
:param ebs_optimized: Indicates whether the instances are optimized for Amazon EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal Amazon EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance. Default: - EBS optimization is not specified in the launch template.
:param hibernation_configured: If you set this parameter to true, the instance is enabled for hibernation. Default: - Hibernation configuration is not specified in the launch template; defaulting to false.
:param instance_initiated_shutdown_behavior: Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown). Default: - Shutdown behavior is not specified in the launch template; defaults to STOP.
:param instance_type: Type of instance to launch. Default: - This Launch Template does not specify a default Instance Type.
:param key_name: Name of SSH keypair to grant access to instance. Default: - No SSH access will be possible.
:param launch_template_name: Name for this launch template. Default: Automatically generated name
:param machine_image: The AMI that will be used by instances. Default: - This Launch Template does not specify a default AMI.
:param nitro_enclave_enabled: If this parameter is set to true, the instance is enabled for AWS Nitro Enclaves; otherwise, it is not enabled for AWS Nitro Enclaves. Default: - Enablement of Nitro enclaves is not specified in the launch template; defaulting to false.
:param role: An IAM role to associate with the instance profile that is used by instances. The role must be assumable by the service principal ``ec2.amazonaws.com``: Default: - No new role is created.
:param security_group: Security group to assign to instances created with the launch template. Default: No security group is assigned.
:param spot_options: If this property is defined, then the Launch Template's InstanceMarketOptions will be set to use Spot instances, and the options for the Spot instances will be as defined. Default: - Instance launched with this template will not be spot instances.
:param user_data: The AMI that will be used by instances. Default: - This Launch Template creates a UserData based on the type of provided machineImage; no UserData is created if a machineImage is not provided
"""
props = LaunchTemplateProps(
block_devices=block_devices,
cpu_credits=cpu_credits,
detailed_monitoring=detailed_monitoring,
disable_api_termination=disable_api_termination,
ebs_optimized=ebs_optimized,
hibernation_configured=hibernation_configured,
instance_initiated_shutdown_behavior=instance_initiated_shutdown_behavior,
instance_type=instance_type,
key_name=key_name,
launch_template_name=launch_template_name,
machine_image=machine_image,
nitro_enclave_enabled=nitro_enclave_enabled,
role=role,
security_group=security_group,
spot_options=spot_options,
user_data=user_data,
)
jsii.create(LaunchTemplate, self, [scope, id, props])
@jsii.member(jsii_name="fromLaunchTemplateAttributes")
@builtins.classmethod
def from_launch_template_attributes(
cls,
scope: constructs.Construct,
id: builtins.str,
*,
launch_template_id: typing.Optional[builtins.str] = None,
launch_template_name: typing.Optional[builtins.str] = None,
version_number: typing.Optional[builtins.str] = None,
) -> ILaunchTemplate:
"""Import an existing LaunchTemplate.
:param scope: -
:param id: -
:param launch_template_id: The identifier of the Launch Template. Exactly one of ``launchTemplateId`` and ``launchTemplateName`` may be set. Default: None
:param launch_template_name: The name of the Launch Template. Exactly one of ``launchTemplateId`` and ``launchTemplateName`` may be set. Default: None
:param version_number: The version number of this launch template to use. Default: Version: "$Default"
"""
attrs = LaunchTemplateAttributes(
launch_template_id=launch_template_id,
launch_template_name=launch_template_name,
version_number=version_number,
)
return jsii.sinvoke(cls, "fromLaunchTemplateAttributes", [scope, id, attrs])
@builtins.property # type: ignore
@jsii.member(jsii_name="connections")
def connections(self) -> "Connections":
"""Allows specifying security group connections for the instance.
:note: Only available if you provide a securityGroup when constructing the LaunchTemplate.
"""
return jsii.get(self, "connections")
@builtins.property # type: ignore
@jsii.member(jsii_name="defaultVersionNumber")
def default_version_number(self) -> builtins.str:
"""The default version for the launch template.
:attribute: true
"""
return jsii.get(self, "defaultVersionNumber")
@builtins.property # type: ignore
@jsii.member(jsii_name="grantPrincipal")
def grant_principal(self) -> aws_cdk.aws_iam.IPrincipal:
"""Principal to grant permissions to.
:note: Only available if you provide a role when constructing the LaunchTemplate.
"""
return jsii.get(self, "grantPrincipal")
@builtins.property # type: ignore
@jsii.member(jsii_name="latestVersionNumber")
def latest_version_number(self) -> builtins.str:
"""The latest version of the launch template.
:attribute: true
"""
return jsii.get(self, "latestVersionNumber")
@builtins.property # type: ignore
@jsii.member(jsii_name="tags")
def _tags(self) -> aws_cdk.core.TagManager:
"""TagManager for tagging support."""
return jsii.get(self, "tags")
@builtins.property # type: ignore
@jsii.member(jsii_name="versionNumber")
def version_number(self) -> builtins.str:
"""The version number of this launch template to use."""
return jsii.get(self, "versionNumber")
@builtins.property # type: ignore
@jsii.member(jsii_name="launchTemplateId")
def launch_template_id(self) -> typing.Optional[builtins.str]:
"""The identifier of the Launch Template.
Exactly one of ``launchTemplateId`` and ``launchTemplateName`` will be set.
"""
return jsii.get(self, "launchTemplateId")
@builtins.property # type: ignore
@jsii.member(jsii_name="launchTemplateName")
def launch_template_name(self) -> typing.Optional[builtins.str]:
"""The name of the Launch Template.
Exactly one of ``launchTemplateId`` and ``launchTemplateName`` will be set.
"""
return jsii.get(self, "launchTemplateName")
@builtins.property # type: ignore
@jsii.member(jsii_name="osType")
def os_type(self) -> typing.Optional["OperatingSystemType"]:
"""The type of OS the instance is running.
:attribute: true
"""
return jsii.get(self, "osType")
@builtins.property # type: ignore
@jsii.member(jsii_name="role")
def role(self) -> typing.Optional[aws_cdk.aws_iam.IRole]:
"""IAM Role assumed by instances that are launched from this template.
:attribute: true
"""
return jsii.get(self, "role")
@builtins.property # type: ignore
@jsii.member(jsii_name="userData")
def user_data(self) -> typing.Optional["UserData"]:
"""UserData executed by instances that are launched from this template.
:attribute: true
"""
return jsii.get(self, "userData")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.LaunchTemplateAttributes",
jsii_struct_bases=[],
name_mapping={
"launch_template_id": "launchTemplateId",
"launch_template_name": "launchTemplateName",
"version_number": "versionNumber",
},
)
class LaunchTemplateAttributes:
def __init__(
self,
*,
launch_template_id: typing.Optional[builtins.str] = None,
launch_template_name: typing.Optional[builtins.str] = None,
version_number: typing.Optional[builtins.str] = None,
) -> None:
"""Attributes for an imported LaunchTemplate.
:param launch_template_id: The identifier of the Launch Template. Exactly one of ``launchTemplateId`` and ``launchTemplateName`` may be set. Default: None
:param launch_template_name: The name of the Launch Template. Exactly one of ``launchTemplateId`` and ``launchTemplateName`` may be set. Default: None
:param version_number: The version number of this launch template to use. Default: Version: "$Default"
"""
self._values: typing.Dict[str, typing.Any] = {}
if launch_template_id is not None:
self._values["launch_template_id"] = launch_template_id
if launch_template_name is not None:
self._values["launch_template_name"] = launch_template_name
if version_number is not None:
self._values["version_number"] = version_number
@builtins.property
def launch_template_id(self) -> typing.Optional[builtins.str]:
"""The identifier of the Launch Template.
Exactly one of ``launchTemplateId`` and ``launchTemplateName`` may be set.
:default: None
"""
result = self._values.get("launch_template_id")
return result
@builtins.property
def launch_template_name(self) -> typing.Optional[builtins.str]:
"""The name of the Launch Template.
Exactly one of ``launchTemplateId`` and ``launchTemplateName`` may be set.
:default: None
"""
result = self._values.get("launch_template_name")
return result
@builtins.property
def version_number(self) -> typing.Optional[builtins.str]:
"""The version number of this launch template to use.
:default: Version: "$Default"
"""
result = self._values.get("version_number")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LaunchTemplateAttributes(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.LaunchTemplateProps",
jsii_struct_bases=[],
name_mapping={
"block_devices": "blockDevices",
"cpu_credits": "cpuCredits",
"detailed_monitoring": "detailedMonitoring",
"disable_api_termination": "disableApiTermination",
"ebs_optimized": "ebsOptimized",
"hibernation_configured": "hibernationConfigured",
"instance_initiated_shutdown_behavior": "instanceInitiatedShutdownBehavior",
"instance_type": "instanceType",
"key_name": "keyName",
"launch_template_name": "launchTemplateName",
"machine_image": "machineImage",
"nitro_enclave_enabled": "nitroEnclaveEnabled",
"role": "role",
"security_group": "securityGroup",
"spot_options": "spotOptions",
"user_data": "userData",
},
)
class LaunchTemplateProps:
def __init__(
self,
*,
block_devices: typing.Optional[typing.List[BlockDevice]] = None,
cpu_credits: typing.Optional[CpuCredits] = None,
detailed_monitoring: typing.Optional[builtins.bool] = None,
disable_api_termination: typing.Optional[builtins.bool] = None,
ebs_optimized: typing.Optional[builtins.bool] = None,
hibernation_configured: typing.Optional[builtins.bool] = None,
instance_initiated_shutdown_behavior: typing.Optional[InstanceInitiatedShutdownBehavior] = None,
instance_type: typing.Optional[InstanceType] = None,
key_name: typing.Optional[builtins.str] = None,
launch_template_name: typing.Optional[builtins.str] = None,
machine_image: typing.Optional[IMachineImage] = None,
nitro_enclave_enabled: typing.Optional[builtins.bool] = None,
role: typing.Optional[aws_cdk.aws_iam.IRole] = None,
security_group: typing.Optional[ISecurityGroup] = None,
spot_options: typing.Optional["LaunchTemplateSpotOptions"] = None,
user_data: typing.Optional["UserData"] = None,
) -> None:
"""Properties of a LaunchTemplate.
:param block_devices: Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched. Default: - Uses the block device mapping of the AMI
:param cpu_credits: CPU credit type for burstable EC2 instance types. Default: - No credit type is specified in the Launch Template.
:param detailed_monitoring: If set to true, then detailed monitoring will be enabled on instances created with this launch template. Default: False - Detailed monitoring is disabled.
:param disable_api_termination: If you set this parameter to true, you cannot terminate the instances launched with this launch template using the Amazon EC2 console, CLI, or API; otherwise, you can. Default: - The API termination setting is not specified in the Launch Template.
:param ebs_optimized: Indicates whether the instances are optimized for Amazon EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal Amazon EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance. Default: - EBS optimization is not specified in the launch template.
:param hibernation_configured: If you set this parameter to true, the instance is enabled for hibernation. Default: - Hibernation configuration is not specified in the launch template; defaulting to false.
:param instance_initiated_shutdown_behavior: Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown). Default: - Shutdown behavior is not specified in the launch template; defaults to STOP.
:param instance_type: Type of instance to launch. Default: - This Launch Template does not specify a default Instance Type.
:param key_name: Name of SSH keypair to grant access to instance. Default: - No SSH access will be possible.
:param launch_template_name: Name for this launch template. Default: Automatically generated name
:param machine_image: The AMI that will be used by instances. Default: - This Launch Template does not specify a default AMI.
:param nitro_enclave_enabled: If this parameter is set to true, the instance is enabled for AWS Nitro Enclaves; otherwise, it is not enabled for AWS Nitro Enclaves. Default: - Enablement of Nitro enclaves is not specified in the launch template; defaulting to false.
:param role: An IAM role to associate with the instance profile that is used by instances. The role must be assumable by the service principal ``ec2.amazonaws.com``: Default: - No new role is created.
:param security_group: Security group to assign to instances created with the launch template. Default: No security group is assigned.
:param spot_options: If this property is defined, then the Launch Template's InstanceMarketOptions will be set to use Spot instances, and the options for the Spot instances will be as defined. Default: - Instance launched with this template will not be spot instances.
:param user_data: The AMI that will be used by instances. Default: - This Launch Template creates a UserData based on the type of provided machineImage; no UserData is created if a machineImage is not provided
"""
if isinstance(spot_options, dict):
spot_options = LaunchTemplateSpotOptions(**spot_options)
self._values: typing.Dict[str, typing.Any] = {}
if block_devices is not None:
self._values["block_devices"] = block_devices
if cpu_credits is not None:
self._values["cpu_credits"] = cpu_credits
if detailed_monitoring is not None:
self._values["detailed_monitoring"] = detailed_monitoring
if disable_api_termination is not None:
self._values["disable_api_termination"] = disable_api_termination
if ebs_optimized is not None:
self._values["ebs_optimized"] = ebs_optimized
if hibernation_configured is not None:
self._values["hibernation_configured"] = hibernation_configured
if instance_initiated_shutdown_behavior is not None:
self._values["instance_initiated_shutdown_behavior"] = instance_initiated_shutdown_behavior
if instance_type is not None:
self._values["instance_type"] = instance_type
if key_name is not None:
self._values["key_name"] = key_name
if launch_template_name is not None:
self._values["launch_template_name"] = launch_template_name
if machine_image is not None:
self._values["machine_image"] = machine_image
if nitro_enclave_enabled is not None:
self._values["nitro_enclave_enabled"] = nitro_enclave_enabled
if role is not None:
self._values["role"] = role
if security_group is not None:
self._values["security_group"] = security_group
if spot_options is not None:
self._values["spot_options"] = spot_options
if user_data is not None:
self._values["user_data"] = user_data
@builtins.property
def block_devices(self) -> typing.Optional[typing.List[BlockDevice]]:
"""Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.
Each instance that is launched has an associated root device volume,
either an Amazon EBS volume or an instance store volume.
You can use block device mappings to specify additional EBS volumes or
instance store volumes to attach to an instance when it is launched.
:default: - Uses the block device mapping of the AMI
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html
"""
result = self._values.get("block_devices")
return result
@builtins.property
def cpu_credits(self) -> typing.Optional[CpuCredits]:
"""CPU credit type for burstable EC2 instance types.
:default: - No credit type is specified in the Launch Template.
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html
"""
result = self._values.get("cpu_credits")
return result
@builtins.property
def detailed_monitoring(self) -> typing.Optional[builtins.bool]:
"""If set to true, then detailed monitoring will be enabled on instances created with this launch template.
:default: False - Detailed monitoring is disabled.
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch-new.html
"""
result = self._values.get("detailed_monitoring")
return result
@builtins.property
def disable_api_termination(self) -> typing.Optional[builtins.bool]:
"""If you set this parameter to true, you cannot terminate the instances launched with this launch template using the Amazon EC2 console, CLI, or API;
otherwise, you can.
:default: - The API termination setting is not specified in the Launch Template.
"""
result = self._values.get("disable_api_termination")
return result
@builtins.property
def ebs_optimized(self) -> typing.Optional[builtins.bool]:
"""Indicates whether the instances are optimized for Amazon EBS I/O.
This optimization provides dedicated throughput
to Amazon EBS and an optimized configuration stack to provide optimal Amazon EBS I/O performance. This optimization
isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance.
:default: - EBS optimization is not specified in the launch template.
"""
result = self._values.get("ebs_optimized")
return result
@builtins.property
def hibernation_configured(self) -> typing.Optional[builtins.bool]:
"""If you set this parameter to true, the instance is enabled for hibernation.
:default: - Hibernation configuration is not specified in the launch template; defaulting to false.
"""
result = self._values.get("hibernation_configured")
return result
@builtins.property
def instance_initiated_shutdown_behavior(
self,
) -> typing.Optional[InstanceInitiatedShutdownBehavior]:
"""Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).
:default: - Shutdown behavior is not specified in the launch template; defaults to STOP.
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingInstanceInitiatedShutdownBehavior
"""
result = self._values.get("instance_initiated_shutdown_behavior")
return result
@builtins.property
def instance_type(self) -> typing.Optional[InstanceType]:
"""Type of instance to launch.
:default: - This Launch Template does not specify a default Instance Type.
"""
result = self._values.get("instance_type")
return result
@builtins.property
def key_name(self) -> typing.Optional[builtins.str]:
"""Name of SSH keypair to grant access to instance.
:default: - No SSH access will be possible.
"""
result = self._values.get("key_name")
return result
@builtins.property
def launch_template_name(self) -> typing.Optional[builtins.str]:
"""Name for this launch template.
:default: Automatically generated name
"""
result = self._values.get("launch_template_name")
return result
@builtins.property
def machine_image(self) -> typing.Optional[IMachineImage]:
"""The AMI that will be used by instances.
:default: - This Launch Template does not specify a default AMI.
"""
result = self._values.get("machine_image")
return result
@builtins.property
def nitro_enclave_enabled(self) -> typing.Optional[builtins.bool]:
"""If this parameter is set to true, the instance is enabled for AWS Nitro Enclaves;
otherwise, it is not enabled for AWS Nitro Enclaves.
:default: - Enablement of Nitro enclaves is not specified in the launch template; defaulting to false.
"""
result = self._values.get("nitro_enclave_enabled")
return result
@builtins.property
def role(self) -> typing.Optional[aws_cdk.aws_iam.IRole]:
"""An IAM role to associate with the instance profile that is used by instances.
The role must be assumable by the service principal ``ec2.amazonaws.com``:
:default: - No new role is created.
Example::
# Example automatically generated. See https://github.com/aws/jsii/issues/826
role = iam.Role(self, "MyRole",
assumed_by=iam.ServicePrincipal("ec2.amazonaws.com")
)
"""
result = self._values.get("role")
return result
@builtins.property
def security_group(self) -> typing.Optional[ISecurityGroup]:
"""Security group to assign to instances created with the launch template.
:default: No security group is assigned.
"""
result = self._values.get("security_group")
return result
@builtins.property
def spot_options(self) -> typing.Optional["LaunchTemplateSpotOptions"]:
"""If this property is defined, then the Launch Template's InstanceMarketOptions will be set to use Spot instances, and the options for the Spot instances will be as defined.
:default: - Instance launched with this template will not be spot instances.
"""
result = self._values.get("spot_options")
return result
@builtins.property
def user_data(self) -> typing.Optional["UserData"]:
"""The AMI that will be used by instances.
:default:
- This Launch Template creates a UserData based on the type of provided
machineImage; no UserData is created if a machineImage is not provided
"""
result = self._values.get("user_data")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LaunchTemplateProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class LaunchTemplateSpecialVersions(
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.LaunchTemplateSpecialVersions",
):
"""A class that provides convenient access to special version tokens for LaunchTemplate versions."""
def __init__(self) -> None:
jsii.create(LaunchTemplateSpecialVersions, self, [])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="DEFAULT_VERSION")
def DEFAULT_VERSION(cls) -> builtins.str:
"""The special value that denotes that users of a Launch Template should reference the DEFAULT version of the template."""
return jsii.sget(cls, "DEFAULT_VERSION")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="LATEST_VERSION")
def LATEST_VERSION(cls) -> builtins.str:
"""The special value that denotes that users of a Launch Template should reference the LATEST version of the template."""
return jsii.sget(cls, "LATEST_VERSION")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.LaunchTemplateSpotOptions",
jsii_struct_bases=[],
name_mapping={
"block_duration": "blockDuration",
"interruption_behavior": "interruptionBehavior",
"max_price": "maxPrice",
"request_type": "requestType",
"valid_until": "validUntil",
},
)
class LaunchTemplateSpotOptions:
def __init__(
self,
*,
block_duration: typing.Optional[aws_cdk.core.Duration] = None,
interruption_behavior: typing.Optional["SpotInstanceInterruption"] = None,
max_price: typing.Optional[jsii.Number] = None,
request_type: typing.Optional["SpotRequestType"] = None,
valid_until: typing.Optional[aws_cdk.core.Expiration] = None,
) -> None:
"""Interface for the Spot market instance options provided in a LaunchTemplate.
:param block_duration: Spot Instances with a defined duration (also known as Spot blocks) are designed not to be interrupted and will run continuously for the duration you select. You can use a duration of 1, 2, 3, 4, 5, or 6 hours. Default: Requested spot instances do not have a pre-defined duration.
:param interruption_behavior: The behavior when a Spot Instance is interrupted. Default: Spot instances will terminate when interrupted.
:param max_price: Maximum hourly price you're willing to pay for each Spot instance. The value is given in dollars. ex: 0.01 for 1 cent per hour, or 0.001 for one-tenth of a cent per hour. Default: Maximum hourly price will default to the on-demand price for the instance type.
:param request_type: The Spot Instance request type. If you are using Spot Instances with an Auto Scaling group, use one-time requests, as the Amazon EC2 Auto Scaling service handles requesting new Spot Instances whenever the group is below its desired capacity. Default: One-time spot request.
:param valid_until: The end date of the request. For a one-time request, the request remains active until all instances launch, the request is canceled, or this date is reached. If the request is persistent, it remains active until it is canceled or this date and time is reached. Default: The default end date is 7 days from the current date.
"""
self._values: typing.Dict[str, typing.Any] = {}
if block_duration is not None:
self._values["block_duration"] = block_duration
if interruption_behavior is not None:
self._values["interruption_behavior"] = interruption_behavior
if max_price is not None:
self._values["max_price"] = max_price
if request_type is not None:
self._values["request_type"] = request_type
if valid_until is not None:
self._values["valid_until"] = valid_until
@builtins.property
def block_duration(self) -> typing.Optional[aws_cdk.core.Duration]:
"""Spot Instances with a defined duration (also known as Spot blocks) are designed not to be interrupted and will run continuously for the duration you select.
You can use a duration of 1, 2, 3, 4, 5, or 6 hours.
:default: Requested spot instances do not have a pre-defined duration.
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html#fixed-duration-spot-instances
"""
result = self._values.get("block_duration")
return result
@builtins.property
def interruption_behavior(self) -> typing.Optional["SpotInstanceInterruption"]:
"""The behavior when a Spot Instance is interrupted.
:default: Spot instances will terminate when interrupted.
"""
result = self._values.get("interruption_behavior")
return result
@builtins.property
def max_price(self) -> typing.Optional[jsii.Number]:
"""Maximum hourly price you're willing to pay for each Spot instance.
The value is given
in dollars. ex: 0.01 for 1 cent per hour, or 0.001 for one-tenth of a cent per hour.
:default: Maximum hourly price will default to the on-demand price for the instance type.
"""
result = self._values.get("max_price")
return result
@builtins.property
def request_type(self) -> typing.Optional["SpotRequestType"]:
"""The Spot Instance request type.
If you are using Spot Instances with an Auto Scaling group, use one-time requests, as the
Amazon EC2 Auto Scaling service handles requesting new Spot Instances whenever the group is
below its desired capacity.
:default: One-time spot request.
"""
result = self._values.get("request_type")
return result
@builtins.property
def valid_until(self) -> typing.Optional[aws_cdk.core.Expiration]:
"""The end date of the request.
For a one-time request, the request remains active until all instances
launch, the request is canceled, or this date is reached. If the request is persistent, it remains
active until it is canceled or this date and time is reached.
:default: The default end date is 7 days from the current date.
"""
result = self._values.get("valid_until")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LaunchTemplateSpotOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.LinuxUserDataOptions",
jsii_struct_bases=[],
name_mapping={"shebang": "shebang"},
)
class LinuxUserDataOptions:
def __init__(self, *, shebang: typing.Optional[builtins.str] = None) -> None:
"""Options when constructing UserData for Linux.
:param shebang: Shebang for the UserData script. Default: "#!/bin/bash"
"""
self._values: typing.Dict[str, typing.Any] = {}
if shebang is not None:
self._values["shebang"] = shebang
@builtins.property
def shebang(self) -> typing.Optional[builtins.str]:
"""Shebang for the UserData script.
:default: "#!/bin/bash"
"""
result = self._values.get("shebang")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LinuxUserDataOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.LocationPackageOptions",
jsii_struct_bases=[],
name_mapping={"key": "key", "service_restart_handles": "serviceRestartHandles"},
)
class LocationPackageOptions:
def __init__(
self,
*,
key: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List[InitServiceRestartHandle]] = None,
) -> None:
"""Options for InitPackage.rpm/InitPackage.msi.
:param key: Identifier key for this package. You can use this to order package installs. Default: - Automatically generated
:param service_restart_handles: Restart the given service after this command has run. Default: - Do not restart any service
"""
self._values: typing.Dict[str, typing.Any] = {}
if key is not None:
self._values["key"] = key
if service_restart_handles is not None:
self._values["service_restart_handles"] = service_restart_handles
@builtins.property
def key(self) -> typing.Optional[builtins.str]:
"""Identifier key for this package.
You can use this to order package installs.
:default: - Automatically generated
"""
result = self._values.get("key")
return result
@builtins.property
def service_restart_handles(
self,
) -> typing.Optional[typing.List[InitServiceRestartHandle]]:
"""Restart the given service after this command has run.
:default: - Do not restart any service
"""
result = self._values.get("service_restart_handles")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LocationPackageOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(IMachineImage)
class LookupMachineImage(
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.LookupMachineImage",
):
"""A machine image whose AMI ID will be searched using DescribeImages.
The most recent, available, launchable image matching the given filter
criteria will be used. Looking up AMIs may take a long time; specify
as many filter criteria as possible to narrow down the search.
The AMI selected will be cached in ``cdk.context.json`` and the same value
will be used on future runs. To refresh the AMI lookup, you will have to
evict the value from the cache using the ``cdk context`` command. See
https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information.
"""
def __init__(
self,
*,
name: builtins.str,
filters: typing.Optional[typing.Mapping[builtins.str, typing.List[builtins.str]]] = None,
owners: typing.Optional[typing.List[builtins.str]] = None,
user_data: typing.Optional["UserData"] = None,
windows: typing.Optional[builtins.bool] = None,
) -> None:
"""
:param name: Name of the image (may contain wildcards).
:param filters: Additional filters on the AMI. Default: - No additional filters
:param owners: Owner account IDs or aliases. Default: - All owners
:param user_data: Custom userdata for this image. Default: - Empty user data appropriate for the platform type
:param windows: Look for Windows images. Default: false
"""
props = LookupMachineImageProps(
name=name,
filters=filters,
owners=owners,
user_data=user_data,
windows=windows,
)
jsii.create(LookupMachineImage, self, [props])
@jsii.member(jsii_name="getImage")
def get_image(self, scope: aws_cdk.core.Construct) -> "MachineImageConfig":
"""Return the image to use in the given context.
:param scope: -
"""
return jsii.invoke(self, "getImage", [scope])
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.LookupMachineImageProps",
jsii_struct_bases=[],
name_mapping={
"name": "name",
"filters": "filters",
"owners": "owners",
"user_data": "userData",
"windows": "windows",
},
)
class LookupMachineImageProps:
def __init__(
self,
*,
name: builtins.str,
filters: typing.Optional[typing.Mapping[builtins.str, typing.List[builtins.str]]] = None,
owners: typing.Optional[typing.List[builtins.str]] = None,
user_data: typing.Optional["UserData"] = None,
windows: typing.Optional[builtins.bool] = None,
) -> None:
"""Properties for looking up an image.
:param name: Name of the image (may contain wildcards).
:param filters: Additional filters on the AMI. Default: - No additional filters
:param owners: Owner account IDs or aliases. Default: - All owners
:param user_data: Custom userdata for this image. Default: - Empty user data appropriate for the platform type
:param windows: Look for Windows images. Default: false
"""
self._values: typing.Dict[str, typing.Any] = {
"name": name,
}
if filters is not None:
self._values["filters"] = filters
if owners is not None:
self._values["owners"] = owners
if user_data is not None:
self._values["user_data"] = user_data
if windows is not None:
self._values["windows"] = windows
@builtins.property
def name(self) -> builtins.str:
"""Name of the image (may contain wildcards)."""
result = self._values.get("name")
assert result is not None, "Required property 'name' is missing"
return result
@builtins.property
def filters(
self,
) -> typing.Optional[typing.Mapping[builtins.str, typing.List[builtins.str]]]:
"""Additional filters on the AMI.
:default: - No additional filters
:see: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImages.html
"""
result = self._values.get("filters")
return result
@builtins.property
def owners(self) -> typing.Optional[typing.List[builtins.str]]:
"""Owner account IDs or aliases.
:default: - All owners
"""
result = self._values.get("owners")
return result
@builtins.property
def user_data(self) -> typing.Optional["UserData"]:
"""Custom userdata for this image.
:default: - Empty user data appropriate for the platform type
"""
result = self._values.get("user_data")
return result
@builtins.property
def windows(self) -> typing.Optional[builtins.bool]:
"""Look for Windows images.
:default: false
"""
result = self._values.get("windows")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "LookupMachineImageProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class MachineImage(
metaclass=jsii.JSIIAbstractClass,
jsii_type="@aws-cdk/aws-ec2.MachineImage",
):
"""Factory functions for standard Amazon Machine Image objects."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _MachineImageProxy
def __init__(self) -> None:
jsii.create(MachineImage, self, [])
@jsii.member(jsii_name="fromSSMParameter")
@builtins.classmethod
def from_ssm_parameter(
cls,
parameter_name: builtins.str,
os: "OperatingSystemType",
user_data: typing.Optional["UserData"] = None,
) -> IMachineImage:
"""An image specified in SSM parameter store that is automatically kept up-to-date.
This Machine Image automatically updates to the latest version on every
deployment. Be aware this will cause your instances to be replaced when a
new version of the image becomes available. Do not store stateful information
on the instance if you are using this image.
:param parameter_name: The name of SSM parameter containing the AMi id.
:param os: The operating system type of the AMI.
:param user_data: optional user data for the given image.
"""
return jsii.sinvoke(cls, "fromSSMParameter", [parameter_name, os, user_data])
@jsii.member(jsii_name="genericLinux")
@builtins.classmethod
def generic_linux(
cls,
ami_map: typing.Mapping[builtins.str, builtins.str],
*,
user_data: typing.Optional["UserData"] = None,
) -> IMachineImage:
"""A Linux image where you specify the AMI ID for every region.
:param ami_map: For every region where you are deploying the stack, specify the AMI ID for that region.
:param user_data: Initial user data. Default: - Empty UserData for Linux machines
"""
props = GenericLinuxImageProps(user_data=user_data)
return jsii.sinvoke(cls, "genericLinux", [ami_map, props])
@jsii.member(jsii_name="genericWindows")
@builtins.classmethod
def generic_windows(
cls,
ami_map: typing.Mapping[builtins.str, builtins.str],
*,
user_data: typing.Optional["UserData"] = None,
) -> IMachineImage:
"""A Windows image where you specify the AMI ID for every region.
:param ami_map: For every region where you are deploying the stack, specify the AMI ID for that region.
:param user_data: Initial user data. Default: - Empty UserData for Windows machines
"""
props = GenericWindowsImageProps(user_data=user_data)
return jsii.sinvoke(cls, "genericWindows", [ami_map, props])
@jsii.member(jsii_name="latestAmazonLinux")
@builtins.classmethod
def latest_amazon_linux(
cls,
*,
cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
edition: typing.Optional[AmazonLinuxEdition] = None,
generation: typing.Optional[AmazonLinuxGeneration] = None,
storage: typing.Optional[AmazonLinuxStorage] = None,
user_data: typing.Optional["UserData"] = None,
virtualization: typing.Optional[AmazonLinuxVirt] = None,
) -> IMachineImage:
"""An Amazon Linux image that is automatically kept up-to-date.
This Machine Image automatically updates to the latest version on every
deployment. Be aware this will cause your instances to be replaced when a
new version of the image becomes available. Do not store stateful information
on the instance if you are using this image.
:param cpu_type: CPU Type. Default: X86_64
:param edition: What edition of Amazon Linux to use. Default: Standard
:param generation: What generation of Amazon Linux to use. Default: AmazonLinux
:param storage: What storage backed image to use. Default: GeneralPurpose
:param user_data: Initial user data. Default: - Empty UserData for Linux machines
:param virtualization: Virtualization type. Default: HVM
"""
props = AmazonLinuxImageProps(
cpu_type=cpu_type,
edition=edition,
generation=generation,
storage=storage,
user_data=user_data,
virtualization=virtualization,
)
return jsii.sinvoke(cls, "latestAmazonLinux", [props])
@jsii.member(jsii_name="latestWindows")
@builtins.classmethod
def latest_windows(
cls,
version: "WindowsVersion",
*,
user_data: typing.Optional["UserData"] = None,
) -> IMachineImage:
"""A Windows image that is automatically kept up-to-date.
This Machine Image automatically updates to the latest version on every
deployment. Be aware this will cause your instances to be replaced when a
new version of the image becomes available. Do not store stateful information
on the instance if you are using this image.
:param version: -
:param user_data: Initial user data. Default: - Empty UserData for Windows machines
"""
props = WindowsImageProps(user_data=user_data)
return jsii.sinvoke(cls, "latestWindows", [version, props])
@jsii.member(jsii_name="lookup")
@builtins.classmethod
def lookup(
cls,
*,
name: builtins.str,
filters: typing.Optional[typing.Mapping[builtins.str, typing.List[builtins.str]]] = None,
owners: typing.Optional[typing.List[builtins.str]] = None,
user_data: typing.Optional["UserData"] = None,
windows: typing.Optional[builtins.bool] = None,
) -> IMachineImage:
"""Look up a shared Machine Image using DescribeImages.
The most recent, available, launchable image matching the given filter
criteria will be used. Looking up AMIs may take a long time; specify
as many filter criteria as possible to narrow down the search.
The AMI selected will be cached in ``cdk.context.json`` and the same value
will be used on future runs. To refresh the AMI lookup, you will have to
evict the value from the cache using the ``cdk context`` command. See
https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information.
:param name: Name of the image (may contain wildcards).
:param filters: Additional filters on the AMI. Default: - No additional filters
:param owners: Owner account IDs or aliases. Default: - All owners
:param user_data: Custom userdata for this image. Default: - Empty user data appropriate for the platform type
:param windows: Look for Windows images. Default: false
"""
props = LookupMachineImageProps(
name=name,
filters=filters,
owners=owners,
user_data=user_data,
windows=windows,
)
return jsii.sinvoke(cls, "lookup", [props])
class _MachineImageProxy(MachineImage):
pass
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.MachineImageConfig",
jsii_struct_bases=[],
name_mapping={"image_id": "imageId", "os_type": "osType", "user_data": "userData"},
)
class MachineImageConfig:
def __init__(
self,
*,
image_id: builtins.str,
os_type: "OperatingSystemType",
user_data: "UserData",
) -> None:
"""Configuration for a machine image.
:param image_id: The AMI ID of the image to use.
:param os_type: Operating system type for this image.
:param user_data: Initial UserData for this image.
"""
self._values: typing.Dict[str, typing.Any] = {
"image_id": image_id,
"os_type": os_type,
"user_data": user_data,
}
@builtins.property
def image_id(self) -> builtins.str:
"""The AMI ID of the image to use."""
result = self._values.get("image_id")
assert result is not None, "Required property 'image_id' is missing"
return result
@builtins.property
def os_type(self) -> "OperatingSystemType":
"""Operating system type for this image."""
result = self._values.get("os_type")
assert result is not None, "Required property 'os_type' is missing"
return result
@builtins.property
def user_data(self) -> "UserData":
"""Initial UserData for this image."""
result = self._values.get("user_data")
assert result is not None, "Required property 'user_data' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "MachineImageConfig(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.NamedPackageOptions",
jsii_struct_bases=[],
name_mapping={
"service_restart_handles": "serviceRestartHandles",
"version": "version",
},
)
class NamedPackageOptions:
def __init__(
self,
*,
service_restart_handles: typing.Optional[typing.List[InitServiceRestartHandle]] = None,
version: typing.Optional[typing.List[builtins.str]] = None,
) -> None:
"""Options for InitPackage.yum/apt/rubyGem/python.
:param service_restart_handles: Restart the given services after this command has run. Default: - Do not restart any service
:param version: Specify the versions to install. Default: - Install the latest version
"""
self._values: typing.Dict[str, typing.Any] = {}
if service_restart_handles is not None:
self._values["service_restart_handles"] = service_restart_handles
if version is not None:
self._values["version"] = version
@builtins.property
def service_restart_handles(
self,
) -> typing.Optional[typing.List[InitServiceRestartHandle]]:
"""Restart the given services after this command has run.
:default: - Do not restart any service
"""
result = self._values.get("service_restart_handles")
return result
@builtins.property
def version(self) -> typing.Optional[typing.List[builtins.str]]:
"""Specify the versions to install.
:default: - Install the latest version
"""
result = self._values.get("version")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "NamedPackageOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class NatInstanceImage(
LookupMachineImage,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.NatInstanceImage",
):
"""(experimental) Machine image representing the latest NAT instance image.
:stability: experimental
"""
def __init__(self) -> None:
"""
:stability: experimental
"""
jsii.create(NatInstanceImage, self, [])
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.NatInstanceProps",
jsii_struct_bases=[],
name_mapping={
"instance_type": "instanceType",
"allow_all_traffic": "allowAllTraffic",
"key_name": "keyName",
"machine_image": "machineImage",
"security_group": "securityGroup",
},
)
class NatInstanceProps:
def __init__(
self,
*,
instance_type: InstanceType,
allow_all_traffic: typing.Optional[builtins.bool] = None,
key_name: typing.Optional[builtins.str] = None,
machine_image: typing.Optional[IMachineImage] = None,
security_group: typing.Optional[ISecurityGroup] = None,
) -> None:
"""(experimental) Properties for a NAT instance.
:param instance_type: (experimental) Instance type of the NAT instance.
:param allow_all_traffic: (experimental) Allow all traffic through the NAT instance. If you set this to false, you must configure the NAT instance's security groups in another way, either by passing in a fully configured Security Group using the ``securityGroup`` property, or by configuring it using the ``.securityGroup`` or ``.connections`` members after passing the NAT Instance Provider to a Vpc. Default: true
:param key_name: (experimental) Name of SSH keypair to grant access to instance. Default: - No SSH access will be possible.
:param machine_image: (experimental) The machine image (AMI) to use. By default, will do an AMI lookup for the latest NAT instance image. If you have a specific AMI ID you want to use, pass a ``GenericLinuxImage``. For example:: ec2.NatProvider.instance({ instanceType: new ec2.InstanceType('t3.micro'), machineImage: new ec2.GenericLinuxImage({ 'us-east-2': 'ami-0f9c61b5a562a16af' }) }) Default: - Latest NAT instance image
:param security_group: (experimental) Security Group for NAT instances. Default: - A new security group will be created
:stability: experimental
"""
self._values: typing.Dict[str, typing.Any] = {
"instance_type": instance_type,
}
if allow_all_traffic is not None:
self._values["allow_all_traffic"] = allow_all_traffic
if key_name is not None:
self._values["key_name"] = key_name
if machine_image is not None:
self._values["machine_image"] = machine_image
if security_group is not None:
self._values["security_group"] = security_group
@builtins.property
def instance_type(self) -> InstanceType:
"""(experimental) Instance type of the NAT instance.
:stability: experimental
"""
result = self._values.get("instance_type")
assert result is not None, "Required property 'instance_type' is missing"
return result
@builtins.property
def allow_all_traffic(self) -> typing.Optional[builtins.bool]:
"""(experimental) Allow all traffic through the NAT instance.
If you set this to false, you must configure the NAT instance's security
groups in another way, either by passing in a fully configured Security
Group using the ``securityGroup`` property, or by configuring it using the
``.securityGroup`` or ``.connections`` members after passing the NAT Instance
Provider to a Vpc.
:default: true
:stability: experimental
"""
result = self._values.get("allow_all_traffic")
return result
@builtins.property
def key_name(self) -> typing.Optional[builtins.str]:
"""(experimental) Name of SSH keypair to grant access to instance.
:default: - No SSH access will be possible.
:stability: experimental
"""
result = self._values.get("key_name")
return result
@builtins.property
def machine_image(self) -> typing.Optional[IMachineImage]:
"""(experimental) The machine image (AMI) to use.
By default, will do an AMI lookup for the latest NAT instance image.
If you have a specific AMI ID you want to use, pass a ``GenericLinuxImage``. For example::
# Example automatically generated. See https://github.com/aws/jsii/issues/826
ec2.NatProvider.instance(
instance_type=ec2.InstanceType("t3.micro"),
machine_image=ec2.GenericLinuxImage(
us-east-2="ami-0f9c61b5a562a16af"
)
)
:default: - Latest NAT instance image
:stability: experimental
"""
result = self._values.get("machine_image")
return result
@builtins.property
def security_group(self) -> typing.Optional[ISecurityGroup]:
"""(experimental) Security Group for NAT instances.
:default: - A new security group will be created
:stability: experimental
"""
result = self._values.get("security_group")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "NatInstanceProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class NatProvider(
metaclass=jsii.JSIIAbstractClass,
jsii_type="@aws-cdk/aws-ec2.NatProvider",
):
"""(experimental) NAT providers.
Determines what type of NAT provider to create, either NAT gateways or NAT
instance.
:stability: experimental
"""
@builtins.staticmethod
def __jsii_proxy_class__():
return _NatProviderProxy
def __init__(self) -> None:
jsii.create(NatProvider, self, [])
@jsii.member(jsii_name="gateway")
@builtins.classmethod
def gateway(cls) -> "NatProvider":
"""(experimental) Use NAT Gateways to provide NAT services for your VPC.
NAT gateways are managed by AWS.
:see: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html
:stability: experimental
"""
return jsii.sinvoke(cls, "gateway", [])
@jsii.member(jsii_name="instance")
@builtins.classmethod
def instance(
cls,
*,
instance_type: InstanceType,
allow_all_traffic: typing.Optional[builtins.bool] = None,
key_name: typing.Optional[builtins.str] = None,
machine_image: typing.Optional[IMachineImage] = None,
security_group: typing.Optional[ISecurityGroup] = None,
) -> "NatInstanceProvider":
"""(experimental) Use NAT instances to provide NAT services for your VPC.
NAT instances are managed by you, but in return allow more configuration.
Be aware that instances created using this provider will not be
automatically replaced if they are stopped for any reason. You should implement
your own NatProvider based on AutoScaling groups if you need that.
:param instance_type: (experimental) Instance type of the NAT instance.
:param allow_all_traffic: (experimental) Allow all traffic through the NAT instance. If you set this to false, you must configure the NAT instance's security groups in another way, either by passing in a fully configured Security Group using the ``securityGroup`` property, or by configuring it using the ``.securityGroup`` or ``.connections`` members after passing the NAT Instance Provider to a Vpc. Default: true
:param key_name: (experimental) Name of SSH keypair to grant access to instance. Default: - No SSH access will be possible.
:param machine_image: (experimental) The machine image (AMI) to use. By default, will do an AMI lookup for the latest NAT instance image. If you have a specific AMI ID you want to use, pass a ``GenericLinuxImage``. For example:: ec2.NatProvider.instance({ instanceType: new ec2.InstanceType('t3.micro'), machineImage: new ec2.GenericLinuxImage({ 'us-east-2': 'ami-0f9c61b5a562a16af' }) }) Default: - Latest NAT instance image
:param security_group: (experimental) Security Group for NAT instances. Default: - A new security group will be created
:see: https://docs.aws.amazon.com/vpc/latest/userguide/VPC_NAT_Instance.html
:stability: experimental
"""
props = NatInstanceProps(
instance_type=instance_type,
allow_all_traffic=allow_all_traffic,
key_name=key_name,
machine_image=machine_image,
security_group=security_group,
)
return jsii.sinvoke(cls, "instance", [props])
@jsii.member(jsii_name="configureNat")
@abc.abstractmethod
def configure_nat(
self,
*,
nat_subnets: typing.List["PublicSubnet"],
private_subnets: typing.List["PrivateSubnet"],
vpc: "Vpc",
) -> None:
"""(experimental) Called by the VPC to configure NAT.
Don't call this directly, the VPC will call it automatically.
:param nat_subnets: (experimental) The public subnets where the NAT providers need to be placed.
:param private_subnets: (experimental) The private subnets that need to route through the NAT providers. There may be more private subnets than public subnets with NAT providers.
:param vpc: (experimental) The VPC we're configuring NAT for.
:stability: experimental
"""
...
@jsii.member(jsii_name="configureSubnet")
@abc.abstractmethod
def configure_subnet(self, subnet: "PrivateSubnet") -> None:
"""(experimental) Configures subnet with the gateway.
Don't call this directly, the VPC will call it automatically.
:param subnet: -
:stability: experimental
"""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="configuredGateways")
@abc.abstractmethod
def configured_gateways(self) -> typing.List[GatewayConfig]:
"""(experimental) Return list of gateways spawned by the provider.
:stability: experimental
"""
...
class _NatProviderProxy(NatProvider):
@jsii.member(jsii_name="configureNat")
def configure_nat(
self,
*,
nat_subnets: typing.List["PublicSubnet"],
private_subnets: typing.List["PrivateSubnet"],
vpc: "Vpc",
) -> None:
"""(experimental) Called by the VPC to configure NAT.
Don't call this directly, the VPC will call it automatically.
:param nat_subnets: (experimental) The public subnets where the NAT providers need to be placed.
:param private_subnets: (experimental) The private subnets that need to route through the NAT providers. There may be more private subnets than public subnets with NAT providers.
:param vpc: (experimental) The VPC we're configuring NAT for.
:stability: experimental
"""
options = ConfigureNatOptions(
nat_subnets=nat_subnets, private_subnets=private_subnets, vpc=vpc
)
return jsii.invoke(self, "configureNat", [options])
@jsii.member(jsii_name="configureSubnet")
def configure_subnet(self, subnet: "PrivateSubnet") -> None:
"""(experimental) Configures subnet with the gateway.
Don't call this directly, the VPC will call it automatically.
:param subnet: -
:stability: experimental
"""
return jsii.invoke(self, "configureSubnet", [subnet])
@builtins.property # type: ignore
@jsii.member(jsii_name="configuredGateways")
def configured_gateways(self) -> typing.List[GatewayConfig]:
"""(experimental) Return list of gateways spawned by the provider.
:stability: experimental
"""
return jsii.get(self, "configuredGateways")
@jsii.implements(INetworkAcl)
class NetworkAcl(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.NetworkAcl",
):
"""(experimental) Define a new custom network ACL.
By default, will deny all inbound and outbound traffic unless entries are
added explicitly allowing it.
:stability: experimental
"""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
vpc: IVpc,
network_acl_name: typing.Optional[builtins.str] = None,
subnet_selection: typing.Optional["SubnetSelection"] = None,
) -> None:
"""
:param scope: -
:param id: -
:param vpc: (experimental) The VPC in which to create the NetworkACL.
:param network_acl_name: (experimental) The name of the NetworkAcl. It is not recommended to use an explicit name. Default: If you don't specify a networkAclName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
:param subnet_selection: (experimental) Subnets in the given VPC to associate the ACL with. More subnets can always be added later by calling ``associateWithSubnets()``. Default: - No subnets associated
:stability: experimental
"""
props = NetworkAclProps(
vpc=vpc,
network_acl_name=network_acl_name,
subnet_selection=subnet_selection,
)
jsii.create(NetworkAcl, self, [scope, id, props])
@jsii.member(jsii_name="fromNetworkAclId")
@builtins.classmethod
def from_network_acl_id(
cls,
scope: constructs.Construct,
id: builtins.str,
network_acl_id: builtins.str,
) -> INetworkAcl:
"""(experimental) Import an existing NetworkAcl into this app.
:param scope: -
:param id: -
:param network_acl_id: -
:stability: experimental
"""
return jsii.sinvoke(cls, "fromNetworkAclId", [scope, id, network_acl_id])
@jsii.member(jsii_name="addEntry")
def add_entry(
self,
id: builtins.str,
*,
cidr: AclCidr,
rule_number: jsii.Number,
traffic: AclTraffic,
direction: typing.Optional["TrafficDirection"] = None,
network_acl_entry_name: typing.Optional[builtins.str] = None,
rule_action: typing.Optional[Action] = None,
) -> "NetworkAclEntry":
"""(experimental) Add a new entry to the ACL.
:param id: -
:param cidr: (experimental) The CIDR range to allow or deny.
:param rule_number: (experimental) Rule number to assign to the entry, such as 100. ACL entries are processed in ascending order by rule number. Entries can't use the same rule number unless one is an egress rule and the other is an ingress rule.
:param traffic: (experimental) What kind of traffic this ACL rule applies to.
:param direction: (experimental) Traffic direction, with respect to the subnet, this rule applies to. Default: TrafficDirection.INGRESS
:param network_acl_entry_name: (experimental) The name of the NetworkAclEntry. It is not recommended to use an explicit group name. Default: If you don't specify a NetworkAclName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
:param rule_action: (experimental) Whether to allow or deny traffic that matches the rule; valid values are "allow" or "deny". Any traffic that is not explicitly allowed is automatically denied in a custom ACL, all traffic is automatically allowed in a default ACL. Default: ALLOW
:stability: experimental
"""
options = CommonNetworkAclEntryOptions(
cidr=cidr,
rule_number=rule_number,
traffic=traffic,
direction=direction,
network_acl_entry_name=network_acl_entry_name,
rule_action=rule_action,
)
return jsii.invoke(self, "addEntry", [id, options])
@jsii.member(jsii_name="associateWithSubnet")
def associate_with_subnet(
self,
id: builtins.str,
*,
availability_zones: typing.Optional[typing.List[builtins.str]] = None,
one_per_az: typing.Optional[builtins.bool] = None,
subnet_filters: typing.Optional[typing.List["SubnetFilter"]] = None,
subnet_group_name: typing.Optional[builtins.str] = None,
subnet_name: typing.Optional[builtins.str] = None,
subnets: typing.Optional[typing.List[ISubnet]] = None,
subnet_type: typing.Optional["SubnetType"] = None,
) -> None:
"""(experimental) Associate the ACL with a given set of subnets.
:param id: -
:param availability_zones: Select subnets only in the given AZs. Default: no filtering on AZs is done
:param one_per_az: If true, return at most one subnet per AZ. Default: false
:param subnet_filters: List of provided subnet filters. Default: - none
:param subnet_group_name: Select the subnet group with the given name. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them. Otherwise, prefer ``subnetType``. This field does not select individual subnets, it selects all subnets that share the given subnet group name. This is the name supplied in ``subnetConfiguration``. At most one of ``subnetType`` and ``subnetGroupName`` can be supplied. Default: - Selection by type instead of by name
:param subnet_name: (deprecated) Alias for ``subnetGroupName``. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them.
:param subnets: Explicitly select individual subnets. Use this if you don't want to automatically use all subnets in a group, but have a need to control selection down to individual subnets. Cannot be specified together with ``subnetType`` or ``subnetGroupName``. Default: - Use all subnets in a selected group (all private subnets by default)
:param subnet_type: Select all subnets of the given type. At most one of ``subnetType`` and ``subnetGroupName`` can be supplied. Default: SubnetType.PRIVATE (or ISOLATED or PUBLIC if there are no PRIVATE subnets)
:stability: experimental
"""
selection = SubnetSelection(
availability_zones=availability_zones,
one_per_az=one_per_az,
subnet_filters=subnet_filters,
subnet_group_name=subnet_group_name,
subnet_name=subnet_name,
subnets=subnets,
subnet_type=subnet_type,
)
return jsii.invoke(self, "associateWithSubnet", [id, selection])
@builtins.property # type: ignore
@jsii.member(jsii_name="networkAclId")
def network_acl_id(self) -> builtins.str:
"""(experimental) The ID of the NetworkACL.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "networkAclId")
@builtins.property # type: ignore
@jsii.member(jsii_name="networkAclVpcId")
def network_acl_vpc_id(self) -> builtins.str:
"""(experimental) The VPC ID for this NetworkACL.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "networkAclVpcId")
@jsii.implements(INetworkAclEntry)
class NetworkAclEntry(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.NetworkAclEntry",
):
"""(experimental) Define an entry in a Network ACL table.
:stability: experimental
"""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
network_acl: INetworkAcl,
cidr: AclCidr,
rule_number: jsii.Number,
traffic: AclTraffic,
direction: typing.Optional["TrafficDirection"] = None,
network_acl_entry_name: typing.Optional[builtins.str] = None,
rule_action: typing.Optional[Action] = None,
) -> None:
"""
:param scope: -
:param id: -
:param network_acl: (experimental) The network ACL this entry applies to.
:param cidr: (experimental) The CIDR range to allow or deny.
:param rule_number: (experimental) Rule number to assign to the entry, such as 100. ACL entries are processed in ascending order by rule number. Entries can't use the same rule number unless one is an egress rule and the other is an ingress rule.
:param traffic: (experimental) What kind of traffic this ACL rule applies to.
:param direction: (experimental) Traffic direction, with respect to the subnet, this rule applies to. Default: TrafficDirection.INGRESS
:param network_acl_entry_name: (experimental) The name of the NetworkAclEntry. It is not recommended to use an explicit group name. Default: If you don't specify a NetworkAclName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
:param rule_action: (experimental) Whether to allow or deny traffic that matches the rule; valid values are "allow" or "deny". Any traffic that is not explicitly allowed is automatically denied in a custom ACL, all traffic is automatically allowed in a default ACL. Default: ALLOW
:stability: experimental
"""
props = NetworkAclEntryProps(
network_acl=network_acl,
cidr=cidr,
rule_number=rule_number,
traffic=traffic,
direction=direction,
network_acl_entry_name=network_acl_entry_name,
rule_action=rule_action,
)
jsii.create(NetworkAclEntry, self, [scope, id, props])
@builtins.property # type: ignore
@jsii.member(jsii_name="networkAcl")
def network_acl(self) -> INetworkAcl:
"""(experimental) The network ACL.
:stability: experimental
"""
return jsii.get(self, "networkAcl")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.NetworkAclEntryProps",
jsii_struct_bases=[CommonNetworkAclEntryOptions],
name_mapping={
"cidr": "cidr",
"rule_number": "ruleNumber",
"traffic": "traffic",
"direction": "direction",
"network_acl_entry_name": "networkAclEntryName",
"rule_action": "ruleAction",
"network_acl": "networkAcl",
},
)
class NetworkAclEntryProps(CommonNetworkAclEntryOptions):
def __init__(
self,
*,
cidr: AclCidr,
rule_number: jsii.Number,
traffic: AclTraffic,
direction: typing.Optional["TrafficDirection"] = None,
network_acl_entry_name: typing.Optional[builtins.str] = None,
rule_action: typing.Optional[Action] = None,
network_acl: INetworkAcl,
) -> None:
"""(experimental) Properties to create NetworkAclEntry.
:param cidr: (experimental) The CIDR range to allow or deny.
:param rule_number: (experimental) Rule number to assign to the entry, such as 100. ACL entries are processed in ascending order by rule number. Entries can't use the same rule number unless one is an egress rule and the other is an ingress rule.
:param traffic: (experimental) What kind of traffic this ACL rule applies to.
:param direction: (experimental) Traffic direction, with respect to the subnet, this rule applies to. Default: TrafficDirection.INGRESS
:param network_acl_entry_name: (experimental) The name of the NetworkAclEntry. It is not recommended to use an explicit group name. Default: If you don't specify a NetworkAclName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
:param rule_action: (experimental) Whether to allow or deny traffic that matches the rule; valid values are "allow" or "deny". Any traffic that is not explicitly allowed is automatically denied in a custom ACL, all traffic is automatically allowed in a default ACL. Default: ALLOW
:param network_acl: (experimental) The network ACL this entry applies to.
:stability: experimental
"""
self._values: typing.Dict[str, typing.Any] = {
"cidr": cidr,
"rule_number": rule_number,
"traffic": traffic,
"network_acl": network_acl,
}
if direction is not None:
self._values["direction"] = direction
if network_acl_entry_name is not None:
self._values["network_acl_entry_name"] = network_acl_entry_name
if rule_action is not None:
self._values["rule_action"] = rule_action
@builtins.property
def cidr(self) -> AclCidr:
"""(experimental) The CIDR range to allow or deny.
:stability: experimental
"""
result = self._values.get("cidr")
assert result is not None, "Required property 'cidr' is missing"
return result
@builtins.property
def rule_number(self) -> jsii.Number:
"""(experimental) Rule number to assign to the entry, such as 100.
ACL entries are processed in ascending order by rule number.
Entries can't use the same rule number unless one is an egress rule and the other is an ingress rule.
:stability: experimental
"""
result = self._values.get("rule_number")
assert result is not None, "Required property 'rule_number' is missing"
return result
@builtins.property
def traffic(self) -> AclTraffic:
"""(experimental) What kind of traffic this ACL rule applies to.
:stability: experimental
"""
result = self._values.get("traffic")
assert result is not None, "Required property 'traffic' is missing"
return result
@builtins.property
def direction(self) -> typing.Optional["TrafficDirection"]:
"""(experimental) Traffic direction, with respect to the subnet, this rule applies to.
:default: TrafficDirection.INGRESS
:stability: experimental
"""
result = self._values.get("direction")
return result
@builtins.property
def network_acl_entry_name(self) -> typing.Optional[builtins.str]:
"""(experimental) The name of the NetworkAclEntry.
It is not recommended to use an explicit group name.
:default:
If you don't specify a NetworkAclName, AWS CloudFormation generates a
unique physical ID and uses that ID for the group name.
:stability: experimental
"""
result = self._values.get("network_acl_entry_name")
return result
@builtins.property
def rule_action(self) -> typing.Optional[Action]:
"""(experimental) Whether to allow or deny traffic that matches the rule; valid values are "allow" or "deny".
Any traffic that is not explicitly allowed is automatically denied in a custom
ACL, all traffic is automatically allowed in a default ACL.
:default: ALLOW
:stability: experimental
"""
result = self._values.get("rule_action")
return result
@builtins.property
def network_acl(self) -> INetworkAcl:
"""(experimental) The network ACL this entry applies to.
:stability: experimental
"""
result = self._values.get("network_acl")
assert result is not None, "Required property 'network_acl' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "NetworkAclEntryProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.NetworkAclProps",
jsii_struct_bases=[],
name_mapping={
"vpc": "vpc",
"network_acl_name": "networkAclName",
"subnet_selection": "subnetSelection",
},
)
class NetworkAclProps:
def __init__(
self,
*,
vpc: IVpc,
network_acl_name: typing.Optional[builtins.str] = None,
subnet_selection: typing.Optional["SubnetSelection"] = None,
) -> None:
"""(experimental) Properties to create NetworkAcl.
:param vpc: (experimental) The VPC in which to create the NetworkACL.
:param network_acl_name: (experimental) The name of the NetworkAcl. It is not recommended to use an explicit name. Default: If you don't specify a networkAclName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
:param subnet_selection: (experimental) Subnets in the given VPC to associate the ACL with. More subnets can always be added later by calling ``associateWithSubnets()``. Default: - No subnets associated
:stability: experimental
"""
if isinstance(subnet_selection, dict):
subnet_selection = SubnetSelection(**subnet_selection)
self._values: typing.Dict[str, typing.Any] = {
"vpc": vpc,
}
if network_acl_name is not None:
self._values["network_acl_name"] = network_acl_name
if subnet_selection is not None:
self._values["subnet_selection"] = subnet_selection
@builtins.property
def vpc(self) -> IVpc:
"""(experimental) The VPC in which to create the NetworkACL.
:stability: experimental
"""
result = self._values.get("vpc")
assert result is not None, "Required property 'vpc' is missing"
return result
@builtins.property
def network_acl_name(self) -> typing.Optional[builtins.str]:
"""(experimental) The name of the NetworkAcl.
It is not recommended to use an explicit name.
:default:
If you don't specify a networkAclName, AWS CloudFormation generates a
unique physical ID and uses that ID for the group name.
:stability: experimental
"""
result = self._values.get("network_acl_name")
return result
@builtins.property
def subnet_selection(self) -> typing.Optional["SubnetSelection"]:
"""(experimental) Subnets in the given VPC to associate the ACL with.
More subnets can always be added later by calling
``associateWithSubnets()``.
:default: - No subnets associated
:stability: experimental
"""
result = self._values.get("subnet_selection")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "NetworkAclProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.OperatingSystemType")
class OperatingSystemType(enum.Enum):
"""The OS type of a particular image."""
LINUX = "LINUX"
WINDOWS = "WINDOWS"
UNKNOWN = "UNKNOWN"
"""Used when the type of the operating system is not known (for example, for imported Auto-Scaling Groups)."""
class Peer(metaclass=jsii.JSIIMeta, jsii_type="@aws-cdk/aws-ec2.Peer"):
"""Peer object factories (to be used in Security Group management).
The static methods on this object can be used to create peer objects
which represent a connection partner in Security Group rules.
Use this object if you need to represent connection partners using plain IP
addresses, or a prefix list ID.
If you want to address a connection partner by Security Group, you can just
use the Security Group (or the construct that contains a Security Group)
directly, as it already implements ``IPeer``.
"""
def __init__(self) -> None:
jsii.create(Peer, self, [])
@jsii.member(jsii_name="anyIpv4")
@builtins.classmethod
def any_ipv4(cls) -> IPeer:
"""Any IPv4 address."""
return jsii.sinvoke(cls, "anyIpv4", [])
@jsii.member(jsii_name="anyIpv6")
@builtins.classmethod
def any_ipv6(cls) -> IPeer:
"""Any IPv6 address."""
return jsii.sinvoke(cls, "anyIpv6", [])
@jsii.member(jsii_name="ipv4")
@builtins.classmethod
def ipv4(cls, cidr_ip: builtins.str) -> IPeer:
"""Create an IPv4 peer from a CIDR.
:param cidr_ip: -
"""
return jsii.sinvoke(cls, "ipv4", [cidr_ip])
@jsii.member(jsii_name="ipv6")
@builtins.classmethod
def ipv6(cls, cidr_ip: builtins.str) -> IPeer:
"""Create an IPv6 peer from a CIDR.
:param cidr_ip: -
"""
return jsii.sinvoke(cls, "ipv6", [cidr_ip])
@jsii.member(jsii_name="prefixList")
@builtins.classmethod
def prefix_list(cls, prefix_list_id: builtins.str) -> IPeer:
"""A prefix list.
:param prefix_list_id: -
"""
return jsii.sinvoke(cls, "prefixList", [prefix_list_id])
class Port(metaclass=jsii.JSIIMeta, jsii_type="@aws-cdk/aws-ec2.Port"):
"""Interface for classes that provide the connection-specification parts of a security group rule."""
def __init__(
self,
*,
protocol: "Protocol",
string_representation: builtins.str,
from_port: typing.Optional[jsii.Number] = None,
to_port: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param protocol: The protocol for the range.
:param string_representation: String representation for this object.
:param from_port: The starting port for the range. Default: - Not included in the rule
:param to_port: The ending port for the range. Default: - Not included in the rule
"""
props = PortProps(
protocol=protocol,
string_representation=string_representation,
from_port=from_port,
to_port=to_port,
)
jsii.create(Port, self, [props])
@jsii.member(jsii_name="allIcmp")
@builtins.classmethod
def all_icmp(cls) -> "Port":
"""All ICMP traffic."""
return jsii.sinvoke(cls, "allIcmp", [])
@jsii.member(jsii_name="allTcp")
@builtins.classmethod
def all_tcp(cls) -> "Port":
"""Any TCP traffic."""
return jsii.sinvoke(cls, "allTcp", [])
@jsii.member(jsii_name="allTraffic")
@builtins.classmethod
def all_traffic(cls) -> "Port":
"""All traffic."""
return jsii.sinvoke(cls, "allTraffic", [])
@jsii.member(jsii_name="allUdp")
@builtins.classmethod
def all_udp(cls) -> "Port":
"""Any UDP traffic."""
return jsii.sinvoke(cls, "allUdp", [])
@jsii.member(jsii_name="icmpPing")
@builtins.classmethod
def icmp_ping(cls) -> "Port":
"""ICMP ping (echo) traffic."""
return jsii.sinvoke(cls, "icmpPing", [])
@jsii.member(jsii_name="icmpType")
@builtins.classmethod
def icmp_type(cls, type: jsii.Number) -> "Port":
"""All codes for a single ICMP type.
:param type: -
"""
return jsii.sinvoke(cls, "icmpType", [type])
@jsii.member(jsii_name="icmpTypeAndCode")
@builtins.classmethod
def icmp_type_and_code(cls, type: jsii.Number, code: jsii.Number) -> "Port":
"""A specific combination of ICMP type and code.
:param type: -
:param code: -
:see: https://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml
"""
return jsii.sinvoke(cls, "icmpTypeAndCode", [type, code])
@jsii.member(jsii_name="tcp")
@builtins.classmethod
def tcp(cls, port: jsii.Number) -> "Port":
"""A single TCP port.
:param port: -
"""
return jsii.sinvoke(cls, "tcp", [port])
@jsii.member(jsii_name="tcpRange")
@builtins.classmethod
def tcp_range(cls, start_port: jsii.Number, end_port: jsii.Number) -> "Port":
"""A TCP port range.
:param start_port: -
:param end_port: -
"""
return jsii.sinvoke(cls, "tcpRange", [start_port, end_port])
@jsii.member(jsii_name="udp")
@builtins.classmethod
def udp(cls, port: jsii.Number) -> "Port":
"""A single UDP port.
:param port: -
"""
return jsii.sinvoke(cls, "udp", [port])
@jsii.member(jsii_name="udpRange")
@builtins.classmethod
def udp_range(cls, start_port: jsii.Number, end_port: jsii.Number) -> "Port":
"""A UDP port range.
:param start_port: -
:param end_port: -
"""
return jsii.sinvoke(cls, "udpRange", [start_port, end_port])
@jsii.member(jsii_name="toRuleJson")
def to_rule_json(self) -> typing.Any:
"""Produce the ingress/egress rule JSON for the given connection."""
return jsii.invoke(self, "toRuleJson", [])
@jsii.member(jsii_name="toString")
def to_string(self) -> builtins.str:
return jsii.invoke(self, "toString", [])
@builtins.property # type: ignore
@jsii.member(jsii_name="canInlineRule")
def can_inline_rule(self) -> builtins.bool:
"""Whether the rule containing this port range can be inlined into a securitygroup or not."""
return jsii.get(self, "canInlineRule")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.PortProps",
jsii_struct_bases=[],
name_mapping={
"protocol": "protocol",
"string_representation": "stringRepresentation",
"from_port": "fromPort",
"to_port": "toPort",
},
)
class PortProps:
def __init__(
self,
*,
protocol: "Protocol",
string_representation: builtins.str,
from_port: typing.Optional[jsii.Number] = None,
to_port: typing.Optional[jsii.Number] = None,
) -> None:
"""Properties to create a port range.
:param protocol: The protocol for the range.
:param string_representation: String representation for this object.
:param from_port: The starting port for the range. Default: - Not included in the rule
:param to_port: The ending port for the range. Default: - Not included in the rule
"""
self._values: typing.Dict[str, typing.Any] = {
"protocol": protocol,
"string_representation": string_representation,
}
if from_port is not None:
self._values["from_port"] = from_port
if to_port is not None:
self._values["to_port"] = to_port
@builtins.property
def protocol(self) -> "Protocol":
"""The protocol for the range."""
result = self._values.get("protocol")
assert result is not None, "Required property 'protocol' is missing"
return result
@builtins.property
def string_representation(self) -> builtins.str:
"""String representation for this object."""
result = self._values.get("string_representation")
assert result is not None, "Required property 'string_representation' is missing"
return result
@builtins.property
def from_port(self) -> typing.Optional[jsii.Number]:
"""The starting port for the range.
:default: - Not included in the rule
"""
result = self._values.get("from_port")
return result
@builtins.property
def to_port(self) -> typing.Optional[jsii.Number]:
"""The ending port for the range.
:default: - Not included in the rule
"""
result = self._values.get("to_port")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PortProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.Protocol")
class Protocol(enum.Enum):
"""Protocol for use in Connection Rules."""
ALL = "ALL"
TCP = "TCP"
UDP = "UDP"
ICMP = "ICMP"
ICMPV6 = "ICMPV6"
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.RouterType")
class RouterType(enum.Enum):
"""Type of router used in route."""
EGRESS_ONLY_INTERNET_GATEWAY = "EGRESS_ONLY_INTERNET_GATEWAY"
"""Egress-only Internet Gateway."""
GATEWAY = "GATEWAY"
"""Internet Gateway."""
INSTANCE = "INSTANCE"
"""Instance."""
NAT_GATEWAY = "NAT_GATEWAY"
"""NAT Gateway."""
NETWORK_INTERFACE = "NETWORK_INTERFACE"
"""Network Interface."""
VPC_PEERING_CONNECTION = "VPC_PEERING_CONNECTION"
"""VPC peering connection."""
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.S3DownloadOptions",
jsii_struct_bases=[],
name_mapping={
"bucket": "bucket",
"bucket_key": "bucketKey",
"local_file": "localFile",
},
)
class S3DownloadOptions:
def __init__(
self,
*,
bucket: aws_cdk.aws_s3.IBucket,
bucket_key: builtins.str,
local_file: typing.Optional[builtins.str] = None,
) -> None:
"""Options when downloading files from S3.
:param bucket: Name of the S3 bucket to download from.
:param bucket_key: The key of the file to download.
:param local_file: The name of the local file. Default: Linux - /tmp/bucketKey Windows - %TEMP%/bucketKey
"""
self._values: typing.Dict[str, typing.Any] = {
"bucket": bucket,
"bucket_key": bucket_key,
}
if local_file is not None:
self._values["local_file"] = local_file
@builtins.property
def bucket(self) -> aws_cdk.aws_s3.IBucket:
"""Name of the S3 bucket to download from."""
result = self._values.get("bucket")
assert result is not None, "Required property 'bucket' is missing"
return result
@builtins.property
def bucket_key(self) -> builtins.str:
"""The key of the file to download."""
result = self._values.get("bucket_key")
assert result is not None, "Required property 'bucket_key' is missing"
return result
@builtins.property
def local_file(self) -> typing.Optional[builtins.str]:
"""The name of the local file.
:default:
Linux - /tmp/bucketKey
Windows - %TEMP%/bucketKey
"""
result = self._values.get("local_file")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "S3DownloadOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(ISecurityGroup)
class SecurityGroup(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.SecurityGroup",
):
"""Creates an Amazon EC2 security group within a VPC.
Security Groups act like a firewall with a set of rules, and are associated
with any AWS resource that has or creates Elastic Network Interfaces (ENIs).
A typical example of a resource that has a security group is an Instance (or
Auto Scaling Group of instances)
If you are defining new infrastructure in CDK, there is a good chance you
won't have to interact with this class at all. Like IAM Roles, Security
Groups need to exist to control access between AWS resources, but CDK will
automatically generate and populate them with least-privilege permissions
for you so you can concentrate on your business logic.
All Constructs that require Security Groups will create one for you if you
don't specify one at construction. After construction, you can selectively
allow connections to and between constructs via--for example-- the ``instance.connections``
object. Think of it as "allowing connections to your instance", rather than
"adding ingress rules a security group". See the `Allowing
Connections <https://docs.aws.amazon.com/cdk/api/latest/docs/aws-ec2-readme.html#allowing-connections>`_
section in the library documentation for examples.
Direct manipulation of the Security Group through ``addIngressRule`` and
``addEgressRule`` is possible, but mutation through the ``.connections`` object
is recommended. If you peer two constructs with security groups this way,
appropriate rules will be created in both.
If you have an existing security group you want to use in your CDK application,
you would import it like this::
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
security_group = SecurityGroup.from_security_group_id(self, "SG", "sg-12345",
mutable=False
)
"""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
vpc: IVpc,
allow_all_outbound: typing.Optional[builtins.bool] = None,
description: typing.Optional[builtins.str] = None,
security_group_name: typing.Optional[builtins.str] = None,
) -> None:
"""
:param scope: -
:param id: -
:param vpc: The VPC in which to create the security group.
:param allow_all_outbound: Whether to allow all outbound traffic by default. If this is set to true, there will only be a single egress rule which allows all outbound traffic. If this is set to false, no outbound traffic will be allowed by default and all egress traffic must be explicitly authorized. Default: true
:param description: A description of the security group. Default: The default name will be the construct's CDK path.
:param security_group_name: The name of the security group. For valid values, see the GroupName parameter of the CreateSecurityGroup action in the Amazon EC2 API Reference. It is not recommended to use an explicit group name. Default: If you don't specify a GroupName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
"""
props = SecurityGroupProps(
vpc=vpc,
allow_all_outbound=allow_all_outbound,
description=description,
security_group_name=security_group_name,
)
jsii.create(SecurityGroup, self, [scope, id, props])
@jsii.member(jsii_name="fromLookup")
@builtins.classmethod
def from_lookup(
cls,
scope: constructs.Construct,
id: builtins.str,
security_group_id: builtins.str,
) -> ISecurityGroup:
"""Look up a security group by id.
:param scope: -
:param id: -
:param security_group_id: -
"""
return jsii.sinvoke(cls, "fromLookup", [scope, id, security_group_id])
@jsii.member(jsii_name="fromSecurityGroupId")
@builtins.classmethod
def from_security_group_id(
cls,
scope: constructs.Construct,
id: builtins.str,
security_group_id: builtins.str,
*,
allow_all_outbound: typing.Optional[builtins.bool] = None,
mutable: typing.Optional[builtins.bool] = None,
) -> ISecurityGroup:
"""Import an existing security group into this app.
This method will assume that the Security Group has a rule in it which allows
all outbound traffic, and so will not add egress rules to the imported Security
Group (only ingress rules).
If your existing Security Group needs to have egress rules added, pass the
``allowAllOutbound: false`` option on import.
:param scope: -
:param id: -
:param security_group_id: -
:param allow_all_outbound: (experimental) Mark the SecurityGroup as having been created allowing all outbound traffic. Only if this is set to false will egress rules be added to this security group. Be aware, this would undo any potential "all outbound traffic" default. Default: true
:param mutable: (experimental) If a SecurityGroup is mutable CDK can add rules to existing groups. Beware that making a SecurityGroup immutable might lead to issue due to missing ingress/egress rules for new resources. Default: true
"""
options = SecurityGroupImportOptions(
allow_all_outbound=allow_all_outbound, mutable=mutable
)
return jsii.sinvoke(cls, "fromSecurityGroupId", [scope, id, security_group_id, options])
@jsii.member(jsii_name="isSecurityGroup")
@builtins.classmethod
def is_security_group(cls, x: typing.Any) -> builtins.bool:
"""Return whether the indicated object is a security group.
:param x: -
"""
return jsii.sinvoke(cls, "isSecurityGroup", [x])
@jsii.member(jsii_name="addEgressRule")
def add_egress_rule(
self,
peer: IPeer,
connection: Port,
description: typing.Optional[builtins.str] = None,
remote_rule: typing.Optional[builtins.bool] = None,
) -> None:
"""Add an egress rule for the current security group.
``remoteRule`` controls where the Rule object is created if the peer is also a
securityGroup and they are in different stack. If false (default) the
rule object is created under the current SecurityGroup object. If true and the
peer is also a SecurityGroup, the rule object is created under the remote
SecurityGroup object.
:param peer: -
:param connection: -
:param description: -
:param remote_rule: -
"""
return jsii.invoke(self, "addEgressRule", [peer, connection, description, remote_rule])
@jsii.member(jsii_name="addIngressRule")
def add_ingress_rule(
self,
peer: IPeer,
connection: Port,
description: typing.Optional[builtins.str] = None,
remote_rule: typing.Optional[builtins.bool] = None,
) -> None:
"""Add an ingress rule for the current security group.
``remoteRule`` controls where the Rule object is created if the peer is also a
securityGroup and they are in different stack. If false (default) the
rule object is created under the current SecurityGroup object. If true and the
peer is also a SecurityGroup, the rule object is created under the remote
SecurityGroup object.
:param peer: -
:param connection: -
:param description: -
:param remote_rule: -
"""
return jsii.invoke(self, "addIngressRule", [peer, connection, description, remote_rule])
@jsii.member(jsii_name="toEgressRuleConfig")
def to_egress_rule_config(self) -> typing.Any:
"""Produce the egress rule JSON for the given connection."""
return jsii.invoke(self, "toEgressRuleConfig", [])
@jsii.member(jsii_name="toIngressRuleConfig")
def to_ingress_rule_config(self) -> typing.Any:
"""Produce the ingress rule JSON for the given connection."""
return jsii.invoke(self, "toIngressRuleConfig", [])
@builtins.property # type: ignore
@jsii.member(jsii_name="allowAllOutbound")
def allow_all_outbound(self) -> builtins.bool:
"""Whether the SecurityGroup has been configured to allow all outbound traffic."""
return jsii.get(self, "allowAllOutbound")
@builtins.property # type: ignore
@jsii.member(jsii_name="canInlineRule")
def can_inline_rule(self) -> builtins.bool:
"""Whether the rule can be inlined into a SecurityGroup or not."""
return jsii.get(self, "canInlineRule")
@builtins.property # type: ignore
@jsii.member(jsii_name="connections")
def connections(self) -> "Connections":
return jsii.get(self, "connections")
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroupId")
def security_group_id(self) -> builtins.str:
"""The ID of the security group.
:attribute: true
"""
return jsii.get(self, "securityGroupId")
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroupName")
def security_group_name(self) -> builtins.str:
"""An attribute that represents the security group name.
:attribute: true
"""
return jsii.get(self, "securityGroupName")
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroupVpcId")
def security_group_vpc_id(self) -> builtins.str:
"""The VPC ID this security group is part of.
:attribute: true
"""
return jsii.get(self, "securityGroupVpcId")
@builtins.property # type: ignore
@jsii.member(jsii_name="uniqueId")
def unique_id(self) -> builtins.str:
"""A unique identifier for this connection peer."""
return jsii.get(self, "uniqueId")
@builtins.property # type: ignore
@jsii.member(jsii_name="defaultPort")
def default_port(self) -> typing.Optional[Port]:
return jsii.get(self, "defaultPort")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.SecurityGroupImportOptions",
jsii_struct_bases=[],
name_mapping={"allow_all_outbound": "allowAllOutbound", "mutable": "mutable"},
)
class SecurityGroupImportOptions:
def __init__(
self,
*,
allow_all_outbound: typing.Optional[builtins.bool] = None,
mutable: typing.Optional[builtins.bool] = None,
) -> None:
"""Additional options for imported security groups.
:param allow_all_outbound: (experimental) Mark the SecurityGroup as having been created allowing all outbound traffic. Only if this is set to false will egress rules be added to this security group. Be aware, this would undo any potential "all outbound traffic" default. Default: true
:param mutable: (experimental) If a SecurityGroup is mutable CDK can add rules to existing groups. Beware that making a SecurityGroup immutable might lead to issue due to missing ingress/egress rules for new resources. Default: true
"""
self._values: typing.Dict[str, typing.Any] = {}
if allow_all_outbound is not None:
self._values["allow_all_outbound"] = allow_all_outbound
if mutable is not None:
self._values["mutable"] = mutable
@builtins.property
def allow_all_outbound(self) -> typing.Optional[builtins.bool]:
"""(experimental) Mark the SecurityGroup as having been created allowing all outbound traffic.
Only if this is set to false will egress rules be added to this security
group. Be aware, this would undo any potential "all outbound traffic"
default.
:default: true
:stability: experimental
"""
result = self._values.get("allow_all_outbound")
return result
@builtins.property
def mutable(self) -> typing.Optional[builtins.bool]:
"""(experimental) If a SecurityGroup is mutable CDK can add rules to existing groups.
Beware that making a SecurityGroup immutable might lead to issue
due to missing ingress/egress rules for new resources.
:default: true
:stability: experimental
"""
result = self._values.get("mutable")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SecurityGroupImportOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.SecurityGroupProps",
jsii_struct_bases=[],
name_mapping={
"vpc": "vpc",
"allow_all_outbound": "allowAllOutbound",
"description": "description",
"security_group_name": "securityGroupName",
},
)
class SecurityGroupProps:
def __init__(
self,
*,
vpc: IVpc,
allow_all_outbound: typing.Optional[builtins.bool] = None,
description: typing.Optional[builtins.str] = None,
security_group_name: typing.Optional[builtins.str] = None,
) -> None:
"""
:param vpc: The VPC in which to create the security group.
:param allow_all_outbound: Whether to allow all outbound traffic by default. If this is set to true, there will only be a single egress rule which allows all outbound traffic. If this is set to false, no outbound traffic will be allowed by default and all egress traffic must be explicitly authorized. Default: true
:param description: A description of the security group. Default: The default name will be the construct's CDK path.
:param security_group_name: The name of the security group. For valid values, see the GroupName parameter of the CreateSecurityGroup action in the Amazon EC2 API Reference. It is not recommended to use an explicit group name. Default: If you don't specify a GroupName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
"""
self._values: typing.Dict[str, typing.Any] = {
"vpc": vpc,
}
if allow_all_outbound is not None:
self._values["allow_all_outbound"] = allow_all_outbound
if description is not None:
self._values["description"] = description
if security_group_name is not None:
self._values["security_group_name"] = security_group_name
@builtins.property
def vpc(self) -> IVpc:
"""The VPC in which to create the security group."""
result = self._values.get("vpc")
assert result is not None, "Required property 'vpc' is missing"
return result
@builtins.property
def allow_all_outbound(self) -> typing.Optional[builtins.bool]:
"""Whether to allow all outbound traffic by default.
If this is set to true, there will only be a single egress rule which allows all
outbound traffic. If this is set to false, no outbound traffic will be allowed by
default and all egress traffic must be explicitly authorized.
:default: true
"""
result = self._values.get("allow_all_outbound")
return result
@builtins.property
def description(self) -> typing.Optional[builtins.str]:
"""A description of the security group.
:default: The default name will be the construct's CDK path.
"""
result = self._values.get("description")
return result
@builtins.property
def security_group_name(self) -> typing.Optional[builtins.str]:
"""The name of the security group.
For valid values, see the GroupName
parameter of the CreateSecurityGroup action in the Amazon EC2 API
Reference.
It is not recommended to use an explicit group name.
:default:
If you don't specify a GroupName, AWS CloudFormation generates a
unique physical ID and uses that ID for the group name.
"""
result = self._values.get("security_group_name")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SecurityGroupProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.SelectedSubnets",
jsii_struct_bases=[],
name_mapping={
"availability_zones": "availabilityZones",
"has_public": "hasPublic",
"internet_connectivity_established": "internetConnectivityEstablished",
"subnet_ids": "subnetIds",
"subnets": "subnets",
},
)
class SelectedSubnets:
def __init__(
self,
*,
availability_zones: typing.List[builtins.str],
has_public: builtins.bool,
internet_connectivity_established: aws_cdk.core.IDependable,
subnet_ids: typing.List[builtins.str],
subnets: typing.List[ISubnet],
) -> None:
"""Result of selecting a subset of subnets from a VPC.
:param availability_zones: The respective AZs of each subnet.
:param has_public: Whether any of the given subnets are from the VPC's public subnets.
:param internet_connectivity_established: Dependency representing internet connectivity for these subnets.
:param subnet_ids: The subnet IDs.
:param subnets: Selected subnet objects.
"""
self._values: typing.Dict[str, typing.Any] = {
"availability_zones": availability_zones,
"has_public": has_public,
"internet_connectivity_established": internet_connectivity_established,
"subnet_ids": subnet_ids,
"subnets": subnets,
}
@builtins.property
def availability_zones(self) -> typing.List[builtins.str]:
"""The respective AZs of each subnet."""
result = self._values.get("availability_zones")
assert result is not None, "Required property 'availability_zones' is missing"
return result
@builtins.property
def has_public(self) -> builtins.bool:
"""Whether any of the given subnets are from the VPC's public subnets."""
result = self._values.get("has_public")
assert result is not None, "Required property 'has_public' is missing"
return result
@builtins.property
def internet_connectivity_established(self) -> aws_cdk.core.IDependable:
"""Dependency representing internet connectivity for these subnets."""
result = self._values.get("internet_connectivity_established")
assert result is not None, "Required property 'internet_connectivity_established' is missing"
return result
@builtins.property
def subnet_ids(self) -> typing.List[builtins.str]:
"""The subnet IDs."""
result = self._values.get("subnet_ids")
assert result is not None, "Required property 'subnet_ids' is missing"
return result
@builtins.property
def subnets(self) -> typing.List[ISubnet]:
"""Selected subnet objects."""
result = self._values.get("subnets")
assert result is not None, "Required property 'subnets' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SelectedSubnets(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.SpotInstanceInterruption")
class SpotInstanceInterruption(enum.Enum):
"""Provides the options for the types of interruption for spot instances."""
STOP = "STOP"
"""The instance will stop when interrupted."""
TERMINATE = "TERMINATE"
"""The instance will be terminated when interrupted."""
HIBERNATE = "HIBERNATE"
"""The instance will hibernate when interrupted."""
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.SpotRequestType")
class SpotRequestType(enum.Enum):
"""The Spot Instance request type.
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html
"""
ONE_TIME = "ONE_TIME"
"""A one-time Spot Instance request remains active until Amazon EC2 launches the Spot Instance, the request expires, or you cancel the request.
If the Spot price exceeds your maximum price
or capacity is not available, your Spot Instance is terminated and the Spot Instance request
is closed.
"""
PERSISTENT = "PERSISTENT"
"""A persistent Spot Instance request remains active until it expires or you cancel it, even if the request is fulfilled.
If the Spot price exceeds your maximum price or capacity is not available,
your Spot Instance is interrupted. After your instance is interrupted, when your maximum price exceeds
the Spot price or capacity becomes available again, the Spot Instance is started if stopped or resumed
if hibernated.
"""
@jsii.implements(ISubnet)
class Subnet(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.Subnet",
):
"""Represents a new VPC subnet resource.
:resource: AWS::EC2::Subnet
"""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
availability_zone: builtins.str,
cidr_block: builtins.str,
vpc_id: builtins.str,
map_public_ip_on_launch: typing.Optional[builtins.bool] = None,
) -> None:
"""
:param scope: -
:param id: -
:param availability_zone: The availability zone for the subnet.
:param cidr_block: The CIDR notation for this subnet.
:param vpc_id: The VPC which this subnet is part of.
:param map_public_ip_on_launch: Controls if a public IP is associated to an instance at launch. Default: true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.
"""
props = SubnetProps(
availability_zone=availability_zone,
cidr_block=cidr_block,
vpc_id=vpc_id,
map_public_ip_on_launch=map_public_ip_on_launch,
)
jsii.create(Subnet, self, [scope, id, props])
@jsii.member(jsii_name="fromSubnetAttributes")
@builtins.classmethod
def from_subnet_attributes(
cls,
scope: constructs.Construct,
id: builtins.str,
*,
subnet_id: builtins.str,
availability_zone: typing.Optional[builtins.str] = None,
ipv4_cidr_block: typing.Optional[builtins.str] = None,
route_table_id: typing.Optional[builtins.str] = None,
) -> ISubnet:
"""
:param scope: -
:param id: -
:param subnet_id: The subnetId for this particular subnet.
:param availability_zone: The Availability Zone the subnet is located in. Default: - No AZ information, cannot use AZ selection features
:param ipv4_cidr_block: The IPv4 CIDR block associated with the subnet. Default: - No CIDR information, cannot use CIDR filter features
:param route_table_id: The ID of the route table for this particular subnet. Default: - No route table information, cannot create VPC endpoints
"""
attrs = SubnetAttributes(
subnet_id=subnet_id,
availability_zone=availability_zone,
ipv4_cidr_block=ipv4_cidr_block,
route_table_id=route_table_id,
)
return jsii.sinvoke(cls, "fromSubnetAttributes", [scope, id, attrs])
@jsii.member(jsii_name="fromSubnetId")
@builtins.classmethod
def from_subnet_id(
cls,
scope: constructs.Construct,
id: builtins.str,
subnet_id: builtins.str,
) -> ISubnet:
"""Import existing subnet from id.
:param scope: -
:param id: -
:param subnet_id: -
"""
return jsii.sinvoke(cls, "fromSubnetId", [scope, id, subnet_id])
@jsii.member(jsii_name="isVpcSubnet")
@builtins.classmethod
def is_vpc_subnet(cls, x: typing.Any) -> builtins.bool:
"""
:param x: -
"""
return jsii.sinvoke(cls, "isVpcSubnet", [x])
@jsii.member(jsii_name="addDefaultInternetRoute")
def add_default_internet_route(
self,
gateway_id: builtins.str,
gateway_attachment: aws_cdk.core.IDependable,
) -> None:
"""Create a default route that points to a passed IGW, with a dependency on the IGW's attachment to the VPC.
:param gateway_id: the logical ID (ref) of the gateway attached to your VPC.
:param gateway_attachment: the gateway attachment construct to be added as a dependency.
"""
return jsii.invoke(self, "addDefaultInternetRoute", [gateway_id, gateway_attachment])
@jsii.member(jsii_name="addDefaultNatRoute")
def add_default_nat_route(self, nat_gateway_id: builtins.str) -> None:
"""Adds an entry to this subnets route table that points to the passed NATGatwayId.
:param nat_gateway_id: The ID of the NAT gateway.
"""
return jsii.invoke(self, "addDefaultNatRoute", [nat_gateway_id])
@jsii.member(jsii_name="addRoute")
def add_route(
self,
id: builtins.str,
*,
router_id: builtins.str,
router_type: RouterType,
destination_cidr_block: typing.Optional[builtins.str] = None,
destination_ipv6_cidr_block: typing.Optional[builtins.str] = None,
enables_internet_connectivity: typing.Optional[builtins.bool] = None,
) -> None:
"""Adds an entry to this subnets route table.
:param id: -
:param router_id: The ID of the router. Can be an instance ID, gateway ID, etc, depending on the router type.
:param router_type: What type of router to route this traffic to.
:param destination_cidr_block: IPv4 range this route applies to. Default: '0.0.0.0/0'
:param destination_ipv6_cidr_block: IPv6 range this route applies to. Default: - Uses IPv6
:param enables_internet_connectivity: Whether this route will enable internet connectivity. If true, this route will be added before any AWS resources that depend on internet connectivity in the VPC will be created. Default: false
"""
options = AddRouteOptions(
router_id=router_id,
router_type=router_type,
destination_cidr_block=destination_cidr_block,
destination_ipv6_cidr_block=destination_ipv6_cidr_block,
enables_internet_connectivity=enables_internet_connectivity,
)
return jsii.invoke(self, "addRoute", [id, options])
@jsii.member(jsii_name="associateNetworkAcl")
def associate_network_acl(self, id: builtins.str, network_acl: INetworkAcl) -> None:
"""Associate a Network ACL with this subnet.
:param id: -
:param network_acl: -
"""
return jsii.invoke(self, "associateNetworkAcl", [id, network_acl])
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZone")
def availability_zone(self) -> builtins.str:
"""The Availability Zone the subnet is located in."""
return jsii.get(self, "availabilityZone")
@builtins.property # type: ignore
@jsii.member(jsii_name="dependencyElements")
def dependency_elements(self) -> typing.List[aws_cdk.core.IDependable]:
"""Parts of this VPC subnet."""
return jsii.get(self, "dependencyElements")
@builtins.property # type: ignore
@jsii.member(jsii_name="internetConnectivityEstablished")
def internet_connectivity_established(self) -> aws_cdk.core.IDependable:
"""Dependable that can be depended upon to force internet connectivity established on the VPC."""
return jsii.get(self, "internetConnectivityEstablished")
@builtins.property # type: ignore
@jsii.member(jsii_name="ipv4CidrBlock")
def ipv4_cidr_block(self) -> builtins.str:
"""The IPv4 CIDR block for this subnet.
:attribute: true
"""
return jsii.get(self, "ipv4CidrBlock")
@builtins.property # type: ignore
@jsii.member(jsii_name="networkAcl")
def network_acl(self) -> INetworkAcl:
"""Network ACL associated with this Subnet.
Upon creation, this is the default ACL which allows all traffic, except
explicit DENY entries that you add.
You can replace it with a custom ACL which denies all traffic except
the explicit ALLOW entries that you add by creating a ``NetworkAcl``
object and calling ``associateNetworkAcl()``.
"""
return jsii.get(self, "networkAcl")
@builtins.property # type: ignore
@jsii.member(jsii_name="routeTable")
def route_table(self) -> IRouteTable:
"""The routeTableId attached to this subnet."""
return jsii.get(self, "routeTable")
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetAvailabilityZone")
def subnet_availability_zone(self) -> builtins.str:
"""
:attribute: true
"""
return jsii.get(self, "subnetAvailabilityZone")
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetId")
def subnet_id(self) -> builtins.str:
"""The subnetId for this particular subnet."""
return jsii.get(self, "subnetId")
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetIpv6CidrBlocks")
def subnet_ipv6_cidr_blocks(self) -> typing.List[builtins.str]:
"""
:attribute: true
"""
return jsii.get(self, "subnetIpv6CidrBlocks")
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetNetworkAclAssociationId")
def subnet_network_acl_association_id(self) -> builtins.str:
"""
:attribute: true
"""
return jsii.get(self, "subnetNetworkAclAssociationId")
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetOutpostArn")
def subnet_outpost_arn(self) -> builtins.str:
"""The Amazon Resource Name (ARN) of the Outpost for this subnet (if one exists).
:attribute: true
"""
return jsii.get(self, "subnetOutpostArn")
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetVpcId")
def subnet_vpc_id(self) -> builtins.str:
"""
:attribute: true
"""
return jsii.get(self, "subnetVpcId")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.SubnetAttributes",
jsii_struct_bases=[],
name_mapping={
"subnet_id": "subnetId",
"availability_zone": "availabilityZone",
"ipv4_cidr_block": "ipv4CidrBlock",
"route_table_id": "routeTableId",
},
)
class SubnetAttributes:
def __init__(
self,
*,
subnet_id: builtins.str,
availability_zone: typing.Optional[builtins.str] = None,
ipv4_cidr_block: typing.Optional[builtins.str] = None,
route_table_id: typing.Optional[builtins.str] = None,
) -> None:
"""
:param subnet_id: The subnetId for this particular subnet.
:param availability_zone: The Availability Zone the subnet is located in. Default: - No AZ information, cannot use AZ selection features
:param ipv4_cidr_block: The IPv4 CIDR block associated with the subnet. Default: - No CIDR information, cannot use CIDR filter features
:param route_table_id: The ID of the route table for this particular subnet. Default: - No route table information, cannot create VPC endpoints
"""
self._values: typing.Dict[str, typing.Any] = {
"subnet_id": subnet_id,
}
if availability_zone is not None:
self._values["availability_zone"] = availability_zone
if ipv4_cidr_block is not None:
self._values["ipv4_cidr_block"] = ipv4_cidr_block
if route_table_id is not None:
self._values["route_table_id"] = route_table_id
@builtins.property
def subnet_id(self) -> builtins.str:
"""The subnetId for this particular subnet."""
result = self._values.get("subnet_id")
assert result is not None, "Required property 'subnet_id' is missing"
return result
@builtins.property
def availability_zone(self) -> typing.Optional[builtins.str]:
"""The Availability Zone the subnet is located in.
:default: - No AZ information, cannot use AZ selection features
"""
result = self._values.get("availability_zone")
return result
@builtins.property
def ipv4_cidr_block(self) -> typing.Optional[builtins.str]:
"""The IPv4 CIDR block associated with the subnet.
:default: - No CIDR information, cannot use CIDR filter features
"""
result = self._values.get("ipv4_cidr_block")
return result
@builtins.property
def route_table_id(self) -> typing.Optional[builtins.str]:
"""The ID of the route table for this particular subnet.
:default: - No route table information, cannot create VPC endpoints
"""
result = self._values.get("route_table_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SubnetAttributes(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.SubnetConfiguration",
jsii_struct_bases=[],
name_mapping={
"name": "name",
"subnet_type": "subnetType",
"cidr_mask": "cidrMask",
"reserved": "reserved",
},
)
class SubnetConfiguration:
def __init__(
self,
*,
name: builtins.str,
subnet_type: "SubnetType",
cidr_mask: typing.Optional[jsii.Number] = None,
reserved: typing.Optional[builtins.bool] = None,
) -> None:
"""Specify configuration parameters for a single subnet group in a VPC.
:param name: Logical name for the subnet group. This name can be used when selecting VPC subnets to distinguish between different subnet groups of the same type.
:param subnet_type: The type of Subnet to configure. The Subnet type will control the ability to route and connect to the Internet.
:param cidr_mask: The number of leading 1 bits in the routing mask. The number of available IP addresses in each subnet of this group will be equal to ``2^(32 - cidrMask) - 2``. Valid values are ``16--28``. Default: - Available IP space is evenly divided across subnets.
:param reserved: Controls if subnet IP space needs to be reserved. When true, the IP space for the subnet is reserved but no actual resources are provisioned. This space is only dependent on the number of availability zones and on ``cidrMask`` - all other subnet properties are ignored. Default: false
"""
self._values: typing.Dict[str, typing.Any] = {
"name": name,
"subnet_type": subnet_type,
}
if cidr_mask is not None:
self._values["cidr_mask"] = cidr_mask
if reserved is not None:
self._values["reserved"] = reserved
@builtins.property
def name(self) -> builtins.str:
"""Logical name for the subnet group.
This name can be used when selecting VPC subnets to distinguish
between different subnet groups of the same type.
"""
result = self._values.get("name")
assert result is not None, "Required property 'name' is missing"
return result
@builtins.property
def subnet_type(self) -> "SubnetType":
"""The type of Subnet to configure.
The Subnet type will control the ability to route and connect to the
Internet.
"""
result = self._values.get("subnet_type")
assert result is not None, "Required property 'subnet_type' is missing"
return result
@builtins.property
def cidr_mask(self) -> typing.Optional[jsii.Number]:
"""The number of leading 1 bits in the routing mask.
The number of available IP addresses in each subnet of this group
will be equal to ``2^(32 - cidrMask) - 2``.
Valid values are ``16--28``.
:default: - Available IP space is evenly divided across subnets.
"""
result = self._values.get("cidr_mask")
return result
@builtins.property
def reserved(self) -> typing.Optional[builtins.bool]:
"""Controls if subnet IP space needs to be reserved.
When true, the IP space for the subnet is reserved but no actual
resources are provisioned. This space is only dependent on the
number of availability zones and on ``cidrMask`` - all other subnet
properties are ignored.
:default: false
"""
result = self._values.get("reserved")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SubnetConfiguration(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class SubnetFilter(
metaclass=jsii.JSIIAbstractClass,
jsii_type="@aws-cdk/aws-ec2.SubnetFilter",
):
"""Contains logic which chooses a set of subnets from a larger list, in conjunction with SubnetSelection, to determine where to place AWS resources such as VPC endpoints, EC2 instances, etc."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _SubnetFilterProxy
def __init__(self) -> None:
jsii.create(SubnetFilter, self, [])
@jsii.member(jsii_name="availabilityZones")
@builtins.classmethod
def availability_zones(
cls,
availability_zones: typing.List[builtins.str],
) -> "SubnetFilter":
"""Chooses subnets which are in one of the given availability zones.
:param availability_zones: -
"""
return jsii.sinvoke(cls, "availabilityZones", [availability_zones])
@jsii.member(jsii_name="containsIpAddresses")
@builtins.classmethod
def contains_ip_addresses(
cls,
ipv4addrs: typing.List[builtins.str],
) -> "SubnetFilter":
"""Chooses subnets which contain any of the specified IP addresses.
:param ipv4addrs: -
"""
return jsii.sinvoke(cls, "containsIpAddresses", [ipv4addrs])
@jsii.member(jsii_name="onePerAz")
@builtins.classmethod
def one_per_az(cls) -> "SubnetFilter":
"""Chooses subnets such that there is at most one per availability zone."""
return jsii.sinvoke(cls, "onePerAz", [])
@jsii.member(jsii_name="selectSubnets")
def select_subnets(self, _subnets: typing.List[ISubnet]) -> typing.List[ISubnet]:
"""Executes the subnet filtering logic, returning a filtered set of subnets.
:param _subnets: -
"""
return jsii.invoke(self, "selectSubnets", [_subnets])
class _SubnetFilterProxy(SubnetFilter):
pass
@jsii.implements(ISubnetNetworkAclAssociation)
class SubnetNetworkAclAssociation(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.SubnetNetworkAclAssociation",
):
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
network_acl: INetworkAcl,
subnet: ISubnet,
subnet_network_acl_association_name: typing.Optional[builtins.str] = None,
) -> None:
"""
:param scope: -
:param id: -
:param network_acl: (experimental) The Network ACL this association is defined for.
:param subnet: (experimental) ID of the Subnet.
:param subnet_network_acl_association_name: (experimental) The name of the SubnetNetworkAclAssociation. It is not recommended to use an explicit name. Default: If you don't specify a SubnetNetworkAclAssociationName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
"""
props = SubnetNetworkAclAssociationProps(
network_acl=network_acl,
subnet=subnet,
subnet_network_acl_association_name=subnet_network_acl_association_name,
)
jsii.create(SubnetNetworkAclAssociation, self, [scope, id, props])
@jsii.member(jsii_name="fromSubnetNetworkAclAssociationAssociationId")
@builtins.classmethod
def from_subnet_network_acl_association_association_id(
cls,
scope: constructs.Construct,
id: builtins.str,
subnet_network_acl_association_association_id: builtins.str,
) -> ISubnetNetworkAclAssociation:
"""
:param scope: -
:param id: -
:param subnet_network_acl_association_association_id: -
"""
return jsii.sinvoke(cls, "fromSubnetNetworkAclAssociationAssociationId", [scope, id, subnet_network_acl_association_association_id])
@builtins.property # type: ignore
@jsii.member(jsii_name="networkAcl")
def network_acl(self) -> INetworkAcl:
"""ID for the current Network ACL.
:attribute: true
"""
return jsii.get(self, "networkAcl")
@builtins.property # type: ignore
@jsii.member(jsii_name="subnet")
def subnet(self) -> ISubnet:
"""ID of the Subnet.
:attribute: true
"""
return jsii.get(self, "subnet")
@builtins.property # type: ignore
@jsii.member(jsii_name="subnetNetworkAclAssociationAssociationId")
def subnet_network_acl_association_association_id(self) -> builtins.str:
"""ID for the current SubnetNetworkAclAssociation.
:attribute: true
"""
return jsii.get(self, "subnetNetworkAclAssociationAssociationId")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.SubnetNetworkAclAssociationProps",
jsii_struct_bases=[],
name_mapping={
"network_acl": "networkAcl",
"subnet": "subnet",
"subnet_network_acl_association_name": "subnetNetworkAclAssociationName",
},
)
class SubnetNetworkAclAssociationProps:
def __init__(
self,
*,
network_acl: INetworkAcl,
subnet: ISubnet,
subnet_network_acl_association_name: typing.Optional[builtins.str] = None,
) -> None:
"""(experimental) Properties to create a SubnetNetworkAclAssociation.
:param network_acl: (experimental) The Network ACL this association is defined for.
:param subnet: (experimental) ID of the Subnet.
:param subnet_network_acl_association_name: (experimental) The name of the SubnetNetworkAclAssociation. It is not recommended to use an explicit name. Default: If you don't specify a SubnetNetworkAclAssociationName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
:stability: experimental
"""
self._values: typing.Dict[str, typing.Any] = {
"network_acl": network_acl,
"subnet": subnet,
}
if subnet_network_acl_association_name is not None:
self._values["subnet_network_acl_association_name"] = subnet_network_acl_association_name
@builtins.property
def network_acl(self) -> INetworkAcl:
"""(experimental) The Network ACL this association is defined for.
:stability: experimental
:attribute: true
"""
result = self._values.get("network_acl")
assert result is not None, "Required property 'network_acl' is missing"
return result
@builtins.property
def subnet(self) -> ISubnet:
"""(experimental) ID of the Subnet.
:stability: experimental
:attribute: true
"""
result = self._values.get("subnet")
assert result is not None, "Required property 'subnet' is missing"
return result
@builtins.property
def subnet_network_acl_association_name(self) -> typing.Optional[builtins.str]:
"""(experimental) The name of the SubnetNetworkAclAssociation.
It is not recommended to use an explicit name.
:default:
If you don't specify a SubnetNetworkAclAssociationName, AWS CloudFormation generates a
unique physical ID and uses that ID for the group name.
:stability: experimental
"""
result = self._values.get("subnet_network_acl_association_name")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SubnetNetworkAclAssociationProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.SubnetProps",
jsii_struct_bases=[],
name_mapping={
"availability_zone": "availabilityZone",
"cidr_block": "cidrBlock",
"vpc_id": "vpcId",
"map_public_ip_on_launch": "mapPublicIpOnLaunch",
},
)
class SubnetProps:
def __init__(
self,
*,
availability_zone: builtins.str,
cidr_block: builtins.str,
vpc_id: builtins.str,
map_public_ip_on_launch: typing.Optional[builtins.bool] = None,
) -> None:
"""Specify configuration parameters for a VPC subnet.
:param availability_zone: The availability zone for the subnet.
:param cidr_block: The CIDR notation for this subnet.
:param vpc_id: The VPC which this subnet is part of.
:param map_public_ip_on_launch: Controls if a public IP is associated to an instance at launch. Default: true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.
"""
self._values: typing.Dict[str, typing.Any] = {
"availability_zone": availability_zone,
"cidr_block": cidr_block,
"vpc_id": vpc_id,
}
if map_public_ip_on_launch is not None:
self._values["map_public_ip_on_launch"] = map_public_ip_on_launch
@builtins.property
def availability_zone(self) -> builtins.str:
"""The availability zone for the subnet."""
result = self._values.get("availability_zone")
assert result is not None, "Required property 'availability_zone' is missing"
return result
@builtins.property
def cidr_block(self) -> builtins.str:
"""The CIDR notation for this subnet."""
result = self._values.get("cidr_block")
assert result is not None, "Required property 'cidr_block' is missing"
return result
@builtins.property
def vpc_id(self) -> builtins.str:
"""The VPC which this subnet is part of."""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def map_public_ip_on_launch(self) -> typing.Optional[builtins.bool]:
"""Controls if a public IP is associated to an instance at launch.
:default: true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.
"""
result = self._values.get("map_public_ip_on_launch")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SubnetProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.SubnetSelection",
jsii_struct_bases=[],
name_mapping={
"availability_zones": "availabilityZones",
"one_per_az": "onePerAz",
"subnet_filters": "subnetFilters",
"subnet_group_name": "subnetGroupName",
"subnet_name": "subnetName",
"subnets": "subnets",
"subnet_type": "subnetType",
},
)
class SubnetSelection:
def __init__(
self,
*,
availability_zones: typing.Optional[typing.List[builtins.str]] = None,
one_per_az: typing.Optional[builtins.bool] = None,
subnet_filters: typing.Optional[typing.List[SubnetFilter]] = None,
subnet_group_name: typing.Optional[builtins.str] = None,
subnet_name: typing.Optional[builtins.str] = None,
subnets: typing.Optional[typing.List[ISubnet]] = None,
subnet_type: typing.Optional["SubnetType"] = None,
) -> None:
"""Customize subnets that are selected for placement of ENIs.
Constructs that allow customization of VPC placement use parameters of this
type to provide placement settings.
By default, the instances are placed in the private subnets.
:param availability_zones: Select subnets only in the given AZs. Default: no filtering on AZs is done
:param one_per_az: If true, return at most one subnet per AZ. Default: false
:param subnet_filters: List of provided subnet filters. Default: - none
:param subnet_group_name: Select the subnet group with the given name. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them. Otherwise, prefer ``subnetType``. This field does not select individual subnets, it selects all subnets that share the given subnet group name. This is the name supplied in ``subnetConfiguration``. At most one of ``subnetType`` and ``subnetGroupName`` can be supplied. Default: - Selection by type instead of by name
:param subnet_name: (deprecated) Alias for ``subnetGroupName``. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them.
:param subnets: Explicitly select individual subnets. Use this if you don't want to automatically use all subnets in a group, but have a need to control selection down to individual subnets. Cannot be specified together with ``subnetType`` or ``subnetGroupName``. Default: - Use all subnets in a selected group (all private subnets by default)
:param subnet_type: Select all subnets of the given type. At most one of ``subnetType`` and ``subnetGroupName`` can be supplied. Default: SubnetType.PRIVATE (or ISOLATED or PUBLIC if there are no PRIVATE subnets)
"""
self._values: typing.Dict[str, typing.Any] = {}
if availability_zones is not None:
self._values["availability_zones"] = availability_zones
if one_per_az is not None:
self._values["one_per_az"] = one_per_az
if subnet_filters is not None:
self._values["subnet_filters"] = subnet_filters
if subnet_group_name is not None:
self._values["subnet_group_name"] = subnet_group_name
if subnet_name is not None:
self._values["subnet_name"] = subnet_name
if subnets is not None:
self._values["subnets"] = subnets
if subnet_type is not None:
self._values["subnet_type"] = subnet_type
@builtins.property
def availability_zones(self) -> typing.Optional[typing.List[builtins.str]]:
"""Select subnets only in the given AZs.
:default: no filtering on AZs is done
"""
result = self._values.get("availability_zones")
return result
@builtins.property
def one_per_az(self) -> typing.Optional[builtins.bool]:
"""If true, return at most one subnet per AZ.
:default: false
"""
result = self._values.get("one_per_az")
return result
@builtins.property
def subnet_filters(self) -> typing.Optional[typing.List[SubnetFilter]]:
"""List of provided subnet filters.
:default: - none
"""
result = self._values.get("subnet_filters")
return result
@builtins.property
def subnet_group_name(self) -> typing.Optional[builtins.str]:
"""Select the subnet group with the given name.
Select the subnet group with the given name. This only needs
to be used if you have multiple subnet groups of the same type
and you need to distinguish between them. Otherwise, prefer
``subnetType``.
This field does not select individual subnets, it selects all subnets that
share the given subnet group name. This is the name supplied in
``subnetConfiguration``.
At most one of ``subnetType`` and ``subnetGroupName`` can be supplied.
:default: - Selection by type instead of by name
"""
result = self._values.get("subnet_group_name")
return result
@builtins.property
def subnet_name(self) -> typing.Optional[builtins.str]:
"""(deprecated) Alias for ``subnetGroupName``.
Select the subnet group with the given name. This only needs
to be used if you have multiple subnet groups of the same type
and you need to distinguish between them.
:deprecated: Use ``subnetGroupName`` instead
:stability: deprecated
"""
result = self._values.get("subnet_name")
return result
@builtins.property
def subnets(self) -> typing.Optional[typing.List[ISubnet]]:
"""Explicitly select individual subnets.
Use this if you don't want to automatically use all subnets in
a group, but have a need to control selection down to
individual subnets.
Cannot be specified together with ``subnetType`` or ``subnetGroupName``.
:default: - Use all subnets in a selected group (all private subnets by default)
"""
result = self._values.get("subnets")
return result
@builtins.property
def subnet_type(self) -> typing.Optional["SubnetType"]:
"""Select all subnets of the given type.
At most one of ``subnetType`` and ``subnetGroupName`` can be supplied.
:default: SubnetType.PRIVATE (or ISOLATED or PUBLIC if there are no PRIVATE subnets)
"""
result = self._values.get("subnet_type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "SubnetSelection(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.SubnetType")
class SubnetType(enum.Enum):
"""The type of Subnet."""
ISOLATED = "ISOLATED"
"""Isolated Subnets do not route traffic to the Internet (in this VPC).
This can be good for subnets with RDS or Elasticache instances,
or which route Internet traffic through a peer VPC.
"""
PRIVATE = "PRIVATE"
"""Subnet that routes to the internet, but not vice versa.
Instances in a private subnet can connect to the Internet, but will not
allow connections to be initiated from the Internet. Internet traffic will
be routed via a NAT Gateway.
Normally a Private subnet will use a NAT gateway in the same AZ, but
if ``natGateways`` is used to reduce the number of NAT gateways, a NAT
gateway from another AZ will be used instead.
"""
PUBLIC = "PUBLIC"
"""Subnet connected to the Internet.
Instances in a Public subnet can connect to the Internet and can be
connected to from the Internet as long as they are launched with public
IPs (controlled on the AutoScalingGroup or other constructs that launch
instances).
Public subnets route outbound traffic via an Internet Gateway.
"""
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.TrafficDirection")
class TrafficDirection(enum.Enum):
"""(experimental) Direction of traffic the AclEntry applies to.
:stability: experimental
"""
EGRESS = "EGRESS"
"""(experimental) Traffic leaving the subnet.
:stability: experimental
"""
INGRESS = "INGRESS"
"""(experimental) Traffic entering the subnet.
:stability: experimental
"""
class UserData(metaclass=jsii.JSIIAbstractClass, jsii_type="@aws-cdk/aws-ec2.UserData"):
"""Instance User Data."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _UserDataProxy
def __init__(self) -> None:
jsii.create(UserData, self, [])
@jsii.member(jsii_name="custom")
@builtins.classmethod
def custom(cls, content: builtins.str) -> "UserData":
"""Create a userdata object with custom content.
:param content: -
"""
return jsii.sinvoke(cls, "custom", [content])
@jsii.member(jsii_name="forLinux")
@builtins.classmethod
def for_linux(cls, *, shebang: typing.Optional[builtins.str] = None) -> "UserData":
"""Create a userdata object for Linux hosts.
:param shebang: Shebang for the UserData script. Default: "#!/bin/bash"
"""
options = LinuxUserDataOptions(shebang=shebang)
return jsii.sinvoke(cls, "forLinux", [options])
@jsii.member(jsii_name="forOperatingSystem")
@builtins.classmethod
def for_operating_system(cls, os: OperatingSystemType) -> "UserData":
"""
:param os: -
"""
return jsii.sinvoke(cls, "forOperatingSystem", [os])
@jsii.member(jsii_name="forWindows")
@builtins.classmethod
def for_windows(cls) -> "UserData":
"""Create a userdata object for Windows hosts."""
return jsii.sinvoke(cls, "forWindows", [])
@jsii.member(jsii_name="addCommands")
@abc.abstractmethod
def add_commands(self, *commands: builtins.str) -> None:
"""Add one or more commands to the user data.
:param commands: -
"""
...
@jsii.member(jsii_name="addExecuteFileCommand")
@abc.abstractmethod
def add_execute_file_command(
self,
*,
file_path: builtins.str,
arguments: typing.Optional[builtins.str] = None,
) -> None:
"""Adds commands to execute a file.
:param file_path: The path to the file.
:param arguments: The arguments to be passed to the file. Default: No arguments are passed to the file.
"""
...
@jsii.member(jsii_name="addOnExitCommands")
@abc.abstractmethod
def add_on_exit_commands(self, *commands: builtins.str) -> None:
"""Add one or more commands to the user data that will run when the script exits.
:param commands: -
"""
...
@jsii.member(jsii_name="addS3DownloadCommand")
@abc.abstractmethod
def add_s3_download_command(
self,
*,
bucket: aws_cdk.aws_s3.IBucket,
bucket_key: builtins.str,
local_file: typing.Optional[builtins.str] = None,
) -> builtins.str:
"""Adds commands to download a file from S3.
:param bucket: Name of the S3 bucket to download from.
:param bucket_key: The key of the file to download.
:param local_file: The name of the local file. Default: Linux - /tmp/bucketKey Windows - %TEMP%/bucketKey
:return: : The local path that the file will be downloaded to
"""
...
@jsii.member(jsii_name="addSignalOnExitCommand")
@abc.abstractmethod
def add_signal_on_exit_command(self, resource: aws_cdk.core.Resource) -> None:
"""Adds a command which will send a cfn-signal when the user data script ends.
:param resource: -
"""
...
@jsii.member(jsii_name="render")
@abc.abstractmethod
def render(self) -> builtins.str:
"""Render the UserData for use in a construct."""
...
class _UserDataProxy(UserData):
@jsii.member(jsii_name="addCommands")
def add_commands(self, *commands: builtins.str) -> None:
"""Add one or more commands to the user data.
:param commands: -
"""
return jsii.invoke(self, "addCommands", [*commands])
@jsii.member(jsii_name="addExecuteFileCommand")
def add_execute_file_command(
self,
*,
file_path: builtins.str,
arguments: typing.Optional[builtins.str] = None,
) -> None:
"""Adds commands to execute a file.
:param file_path: The path to the file.
:param arguments: The arguments to be passed to the file. Default: No arguments are passed to the file.
"""
params = ExecuteFileOptions(file_path=file_path, arguments=arguments)
return jsii.invoke(self, "addExecuteFileCommand", [params])
@jsii.member(jsii_name="addOnExitCommands")
def add_on_exit_commands(self, *commands: builtins.str) -> None:
"""Add one or more commands to the user data that will run when the script exits.
:param commands: -
"""
return jsii.invoke(self, "addOnExitCommands", [*commands])
@jsii.member(jsii_name="addS3DownloadCommand")
def add_s3_download_command(
self,
*,
bucket: aws_cdk.aws_s3.IBucket,
bucket_key: builtins.str,
local_file: typing.Optional[builtins.str] = None,
) -> builtins.str:
"""Adds commands to download a file from S3.
:param bucket: Name of the S3 bucket to download from.
:param bucket_key: The key of the file to download.
:param local_file: The name of the local file. Default: Linux - /tmp/bucketKey Windows - %TEMP%/bucketKey
:return: : The local path that the file will be downloaded to
"""
params = S3DownloadOptions(
bucket=bucket, bucket_key=bucket_key, local_file=local_file
)
return jsii.invoke(self, "addS3DownloadCommand", [params])
@jsii.member(jsii_name="addSignalOnExitCommand")
def add_signal_on_exit_command(self, resource: aws_cdk.core.Resource) -> None:
"""Adds a command which will send a cfn-signal when the user data script ends.
:param resource: -
"""
return jsii.invoke(self, "addSignalOnExitCommand", [resource])
@jsii.member(jsii_name="render")
def render(self) -> builtins.str:
"""Render the UserData for use in a construct."""
return jsii.invoke(self, "render", [])
@jsii.implements(IVolume)
class Volume(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.Volume",
):
"""Creates a new EBS Volume in AWS EC2."""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
availability_zone: builtins.str,
auto_enable_io: typing.Optional[builtins.bool] = None,
enable_multi_attach: typing.Optional[builtins.bool] = None,
encrypted: typing.Optional[builtins.bool] = None,
encryption_key: typing.Optional[aws_cdk.aws_kms.IKey] = None,
iops: typing.Optional[jsii.Number] = None,
size: typing.Optional[aws_cdk.core.Size] = None,
snapshot_id: typing.Optional[builtins.str] = None,
volume_name: typing.Optional[builtins.str] = None,
volume_type: typing.Optional[EbsDeviceVolumeType] = None,
) -> None:
"""
:param scope: -
:param id: -
:param availability_zone: The Availability Zone in which to create the volume.
:param auto_enable_io: Indicates whether the volume is auto-enabled for I/O operations. By default, Amazon EBS disables I/O to the volume from attached EC2 instances when it determines that a volume's data is potentially inconsistent. If the consistency of the volume is not a concern, and you prefer that the volume be made available immediately if it's impaired, you can configure the volume to automatically enable I/O. Default: false
:param enable_multi_attach: Indicates whether Amazon EBS Multi-Attach is enabled. See {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volumes-multi.html#considerations|Considerations and limitations} for the constraints of multi-attach. Default: false
:param encrypted: Specifies whether the volume should be encrypted. The effect of setting the encryption state to true depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-by-default|Encryption by Default} in the Amazon Elastic Compute Cloud User Guide. Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances|Supported Instance Types.} Default: false
:param encryption_key: The customer-managed encryption key that is used to encrypt the Volume. The encrypted property must be true if this is provided. Note: If using an {@link aws-kms.IKey} created from a {@link aws-kms.Key.fromKeyArn()} here, then the KMS key **must** have the following in its Key policy; otherwise, the Volume will fail to create:: { "Effect": "Allow", "Principal": { "AWS": "<arn for your account-user> ex: arn:aws:iam::00000000000:root" }, "Resource": "*", "Action": [ "kms:DescribeKey", "kms:GenerateDataKeyWithoutPlainText", ], "Condition": { "StringEquals": { "kms:ViaService": "ec2.<Region>.amazonaws.com", (eg: ec2.us-east-1.amazonaws.com) "kms:CallerAccount": "0000000000" (your account ID) } } } Default: The default KMS key for the account, region, and EC2 service is used.
:param iops: The number of I/O operations per second (IOPS) to provision for the volume, with a maximum ratio of 50 IOPS/GiB. See {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html#EBSVolumeTypes_piops|Provisioned IOPS SSD (io1) volumes} for more information. This parameter is valid only for PROVISIONED_IOPS_SSD volumes. Default: None -- Required for {@link EbsDeviceVolumeType.PROVISIONED_IOPS_SSD}
:param size: The size of the volume, in GiBs. You must specify either a snapshot ID or a volume size. See {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html#ebs-volume-characteristics|Volume Characteristics} for details on the allowable size for each type of volume. Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.
:param snapshot_id: The snapshot from which to create the volume. You must specify either a snapshot ID or a volume size. Default: The EBS volume is not created from a snapshot.
:param volume_name: The value of the physicalName property of this resource. Default: The physical name will be allocated by CloudFormation at deployment time
:param volume_type: The type of the volume; what type of storage to use to form the EBS Volume. Default: {@link EbsDeviceVolumeType.GENERAL_PURPOSE_SSD}
"""
props = VolumeProps(
availability_zone=availability_zone,
auto_enable_io=auto_enable_io,
enable_multi_attach=enable_multi_attach,
encrypted=encrypted,
encryption_key=encryption_key,
iops=iops,
size=size,
snapshot_id=snapshot_id,
volume_name=volume_name,
volume_type=volume_type,
)
jsii.create(Volume, self, [scope, id, props])
@jsii.member(jsii_name="fromVolumeAttributes")
@builtins.classmethod
def from_volume_attributes(
cls,
scope: constructs.Construct,
id: builtins.str,
*,
availability_zone: builtins.str,
volume_id: builtins.str,
encryption_key: typing.Optional[aws_cdk.aws_kms.IKey] = None,
) -> IVolume:
"""Import an existing EBS Volume into the Stack.
:param scope: the scope of the import.
:param id: the ID of the imported Volume in the construct tree.
:param availability_zone: The availability zone that the EBS Volume is contained within (ex: us-west-2a).
:param volume_id: The EBS Volume's ID.
:param encryption_key: The customer-managed encryption key that is used to encrypt the Volume. Default: None -- The EBS Volume is not using a customer-managed KMS key for encryption.
"""
attrs = VolumeAttributes(
availability_zone=availability_zone,
volume_id=volume_id,
encryption_key=encryption_key,
)
return jsii.sinvoke(cls, "fromVolumeAttributes", [scope, id, attrs])
@jsii.member(jsii_name="grantAttachVolume")
def grant_attach_volume(
self,
grantee: aws_cdk.aws_iam.IGrantable,
instances: typing.Optional[typing.List[IInstance]] = None,
) -> aws_cdk.aws_iam.Grant:
"""Grants permission to attach this Volume to an instance.
CAUTION: Granting an instance permission to attach to itself using this method will lead to
an unresolvable circular reference between the instance role and the instance.
Use {@link IVolume.grantAttachVolumeToSelf} to grant an instance permission to attach this
volume to itself.
:param grantee: -
:param instances: -
"""
return jsii.invoke(self, "grantAttachVolume", [grantee, instances])
@jsii.member(jsii_name="grantAttachVolumeByResourceTag")
def grant_attach_volume_by_resource_tag(
self,
grantee: aws_cdk.aws_iam.IGrantable,
constructs: typing.List[constructs.Construct],
tag_key_suffix: typing.Optional[builtins.str] = None,
) -> aws_cdk.aws_iam.Grant:
"""Grants permission to attach the Volume by a ResourceTag condition.
If you are looking to
grant an Instance, AutoScalingGroup, EC2-Fleet, SpotFleet, ECS host, etc the ability to attach
this volume to **itself** then this is the method you want to use.
This is implemented by adding a Tag with key ``VolumeGrantAttach-<suffix>`` to the given
constructs and this Volume, and then conditioning the Grant such that the grantee is only
given the ability to AttachVolume if both the Volume and the destination Instance have that
tag applied to them.
:param grantee: -
:param constructs: -
:param tag_key_suffix: -
"""
return jsii.invoke(self, "grantAttachVolumeByResourceTag", [grantee, constructs, tag_key_suffix])
@jsii.member(jsii_name="grantDetachVolume")
def grant_detach_volume(
self,
grantee: aws_cdk.aws_iam.IGrantable,
instances: typing.Optional[typing.List[IInstance]] = None,
) -> aws_cdk.aws_iam.Grant:
"""Grants permission to detach this Volume from an instance CAUTION: Granting an instance permission to detach from itself using this method will lead to an unresolvable circular reference between the instance role and the instance.
Use {@link IVolume.grantDetachVolumeFromSelf} to grant an instance permission to detach this
volume from itself.
:param grantee: -
:param instances: -
"""
return jsii.invoke(self, "grantDetachVolume", [grantee, instances])
@jsii.member(jsii_name="grantDetachVolumeByResourceTag")
def grant_detach_volume_by_resource_tag(
self,
grantee: aws_cdk.aws_iam.IGrantable,
constructs: typing.List[constructs.Construct],
tag_key_suffix: typing.Optional[builtins.str] = None,
) -> aws_cdk.aws_iam.Grant:
"""Grants permission to detach the Volume by a ResourceTag condition.
This is implemented via the same mechanism as {@link IVolume.grantAttachVolumeByResourceTag},
and is subject to the same conditions.
:param grantee: -
:param constructs: -
:param tag_key_suffix: -
"""
return jsii.invoke(self, "grantDetachVolumeByResourceTag", [grantee, constructs, tag_key_suffix])
@jsii.member(jsii_name="validateProps")
def _validate_props(
self,
*,
availability_zone: builtins.str,
auto_enable_io: typing.Optional[builtins.bool] = None,
enable_multi_attach: typing.Optional[builtins.bool] = None,
encrypted: typing.Optional[builtins.bool] = None,
encryption_key: typing.Optional[aws_cdk.aws_kms.IKey] = None,
iops: typing.Optional[jsii.Number] = None,
size: typing.Optional[aws_cdk.core.Size] = None,
snapshot_id: typing.Optional[builtins.str] = None,
volume_name: typing.Optional[builtins.str] = None,
volume_type: typing.Optional[EbsDeviceVolumeType] = None,
) -> None:
"""
:param availability_zone: The Availability Zone in which to create the volume.
:param auto_enable_io: Indicates whether the volume is auto-enabled for I/O operations. By default, Amazon EBS disables I/O to the volume from attached EC2 instances when it determines that a volume's data is potentially inconsistent. If the consistency of the volume is not a concern, and you prefer that the volume be made available immediately if it's impaired, you can configure the volume to automatically enable I/O. Default: false
:param enable_multi_attach: Indicates whether Amazon EBS Multi-Attach is enabled. See {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volumes-multi.html#considerations|Considerations and limitations} for the constraints of multi-attach. Default: false
:param encrypted: Specifies whether the volume should be encrypted. The effect of setting the encryption state to true depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-by-default|Encryption by Default} in the Amazon Elastic Compute Cloud User Guide. Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances|Supported Instance Types.} Default: false
:param encryption_key: The customer-managed encryption key that is used to encrypt the Volume. The encrypted property must be true if this is provided. Note: If using an {@link aws-kms.IKey} created from a {@link aws-kms.Key.fromKeyArn()} here, then the KMS key **must** have the following in its Key policy; otherwise, the Volume will fail to create:: { "Effect": "Allow", "Principal": { "AWS": "<arn for your account-user> ex: arn:aws:iam::00000000000:root" }, "Resource": "*", "Action": [ "kms:DescribeKey", "kms:GenerateDataKeyWithoutPlainText", ], "Condition": { "StringEquals": { "kms:ViaService": "ec2.<Region>.amazonaws.com", (eg: ec2.us-east-1.amazonaws.com) "kms:CallerAccount": "0000000000" (your account ID) } } } Default: The default KMS key for the account, region, and EC2 service is used.
:param iops: The number of I/O operations per second (IOPS) to provision for the volume, with a maximum ratio of 50 IOPS/GiB. See {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html#EBSVolumeTypes_piops|Provisioned IOPS SSD (io1) volumes} for more information. This parameter is valid only for PROVISIONED_IOPS_SSD volumes. Default: None -- Required for {@link EbsDeviceVolumeType.PROVISIONED_IOPS_SSD}
:param size: The size of the volume, in GiBs. You must specify either a snapshot ID or a volume size. See {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html#ebs-volume-characteristics|Volume Characteristics} for details on the allowable size for each type of volume. Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.
:param snapshot_id: The snapshot from which to create the volume. You must specify either a snapshot ID or a volume size. Default: The EBS volume is not created from a snapshot.
:param volume_name: The value of the physicalName property of this resource. Default: The physical name will be allocated by CloudFormation at deployment time
:param volume_type: The type of the volume; what type of storage to use to form the EBS Volume. Default: {@link EbsDeviceVolumeType.GENERAL_PURPOSE_SSD}
"""
props = VolumeProps(
availability_zone=availability_zone,
auto_enable_io=auto_enable_io,
enable_multi_attach=enable_multi_attach,
encrypted=encrypted,
encryption_key=encryption_key,
iops=iops,
size=size,
snapshot_id=snapshot_id,
volume_name=volume_name,
volume_type=volume_type,
)
return jsii.invoke(self, "validateProps", [props])
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZone")
def availability_zone(self) -> builtins.str:
"""The availability zone that the EBS Volume is contained within (ex: us-west-2a)."""
return jsii.get(self, "availabilityZone")
@builtins.property # type: ignore
@jsii.member(jsii_name="volumeId")
def volume_id(self) -> builtins.str:
"""The EBS Volume's ID."""
return jsii.get(self, "volumeId")
@builtins.property # type: ignore
@jsii.member(jsii_name="encryptionKey")
def encryption_key(self) -> typing.Optional[aws_cdk.aws_kms.IKey]:
"""The customer-managed encryption key that is used to encrypt the Volume."""
return jsii.get(self, "encryptionKey")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.VolumeAttributes",
jsii_struct_bases=[],
name_mapping={
"availability_zone": "availabilityZone",
"volume_id": "volumeId",
"encryption_key": "encryptionKey",
},
)
class VolumeAttributes:
def __init__(
self,
*,
availability_zone: builtins.str,
volume_id: builtins.str,
encryption_key: typing.Optional[aws_cdk.aws_kms.IKey] = None,
) -> None:
"""Attributes required to import an existing EBS Volume into the Stack.
:param availability_zone: The availability zone that the EBS Volume is contained within (ex: us-west-2a).
:param volume_id: The EBS Volume's ID.
:param encryption_key: The customer-managed encryption key that is used to encrypt the Volume. Default: None -- The EBS Volume is not using a customer-managed KMS key for encryption.
"""
self._values: typing.Dict[str, typing.Any] = {
"availability_zone": availability_zone,
"volume_id": volume_id,
}
if encryption_key is not None:
self._values["encryption_key"] = encryption_key
@builtins.property
def availability_zone(self) -> builtins.str:
"""The availability zone that the EBS Volume is contained within (ex: us-west-2a)."""
result = self._values.get("availability_zone")
assert result is not None, "Required property 'availability_zone' is missing"
return result
@builtins.property
def volume_id(self) -> builtins.str:
"""The EBS Volume's ID."""
result = self._values.get("volume_id")
assert result is not None, "Required property 'volume_id' is missing"
return result
@builtins.property
def encryption_key(self) -> typing.Optional[aws_cdk.aws_kms.IKey]:
"""The customer-managed encryption key that is used to encrypt the Volume.
:default: None -- The EBS Volume is not using a customer-managed KMS key for encryption.
"""
result = self._values.get("encryption_key")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "VolumeAttributes(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.VolumeProps",
jsii_struct_bases=[],
name_mapping={
"availability_zone": "availabilityZone",
"auto_enable_io": "autoEnableIo",
"enable_multi_attach": "enableMultiAttach",
"encrypted": "encrypted",
"encryption_key": "encryptionKey",
"iops": "iops",
"size": "size",
"snapshot_id": "snapshotId",
"volume_name": "volumeName",
"volume_type": "volumeType",
},
)
class VolumeProps:
def __init__(
self,
*,
availability_zone: builtins.str,
auto_enable_io: typing.Optional[builtins.bool] = None,
enable_multi_attach: typing.Optional[builtins.bool] = None,
encrypted: typing.Optional[builtins.bool] = None,
encryption_key: typing.Optional[aws_cdk.aws_kms.IKey] = None,
iops: typing.Optional[jsii.Number] = None,
size: typing.Optional[aws_cdk.core.Size] = None,
snapshot_id: typing.Optional[builtins.str] = None,
volume_name: typing.Optional[builtins.str] = None,
volume_type: typing.Optional[EbsDeviceVolumeType] = None,
) -> None:
"""Properties of an EBS Volume.
:param availability_zone: The Availability Zone in which to create the volume.
:param auto_enable_io: Indicates whether the volume is auto-enabled for I/O operations. By default, Amazon EBS disables I/O to the volume from attached EC2 instances when it determines that a volume's data is potentially inconsistent. If the consistency of the volume is not a concern, and you prefer that the volume be made available immediately if it's impaired, you can configure the volume to automatically enable I/O. Default: false
:param enable_multi_attach: Indicates whether Amazon EBS Multi-Attach is enabled. See {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volumes-multi.html#considerations|Considerations and limitations} for the constraints of multi-attach. Default: false
:param encrypted: Specifies whether the volume should be encrypted. The effect of setting the encryption state to true depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-by-default|Encryption by Default} in the Amazon Elastic Compute Cloud User Guide. Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances|Supported Instance Types.} Default: false
:param encryption_key: The customer-managed encryption key that is used to encrypt the Volume. The encrypted property must be true if this is provided. Note: If using an {@link aws-kms.IKey} created from a {@link aws-kms.Key.fromKeyArn()} here, then the KMS key **must** have the following in its Key policy; otherwise, the Volume will fail to create:: { "Effect": "Allow", "Principal": { "AWS": "<arn for your account-user> ex: arn:aws:iam::00000000000:root" }, "Resource": "*", "Action": [ "kms:DescribeKey", "kms:GenerateDataKeyWithoutPlainText", ], "Condition": { "StringEquals": { "kms:ViaService": "ec2.<Region>.amazonaws.com", (eg: ec2.us-east-1.amazonaws.com) "kms:CallerAccount": "0000000000" (your account ID) } } } Default: The default KMS key for the account, region, and EC2 service is used.
:param iops: The number of I/O operations per second (IOPS) to provision for the volume, with a maximum ratio of 50 IOPS/GiB. See {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html#EBSVolumeTypes_piops|Provisioned IOPS SSD (io1) volumes} for more information. This parameter is valid only for PROVISIONED_IOPS_SSD volumes. Default: None -- Required for {@link EbsDeviceVolumeType.PROVISIONED_IOPS_SSD}
:param size: The size of the volume, in GiBs. You must specify either a snapshot ID or a volume size. See {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html#ebs-volume-characteristics|Volume Characteristics} for details on the allowable size for each type of volume. Default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.
:param snapshot_id: The snapshot from which to create the volume. You must specify either a snapshot ID or a volume size. Default: The EBS volume is not created from a snapshot.
:param volume_name: The value of the physicalName property of this resource. Default: The physical name will be allocated by CloudFormation at deployment time
:param volume_type: The type of the volume; what type of storage to use to form the EBS Volume. Default: {@link EbsDeviceVolumeType.GENERAL_PURPOSE_SSD}
"""
self._values: typing.Dict[str, typing.Any] = {
"availability_zone": availability_zone,
}
if auto_enable_io is not None:
self._values["auto_enable_io"] = auto_enable_io
if enable_multi_attach is not None:
self._values["enable_multi_attach"] = enable_multi_attach
if encrypted is not None:
self._values["encrypted"] = encrypted
if encryption_key is not None:
self._values["encryption_key"] = encryption_key
if iops is not None:
self._values["iops"] = iops
if size is not None:
self._values["size"] = size
if snapshot_id is not None:
self._values["snapshot_id"] = snapshot_id
if volume_name is not None:
self._values["volume_name"] = volume_name
if volume_type is not None:
self._values["volume_type"] = volume_type
@builtins.property
def availability_zone(self) -> builtins.str:
"""The Availability Zone in which to create the volume."""
result = self._values.get("availability_zone")
assert result is not None, "Required property 'availability_zone' is missing"
return result
@builtins.property
def auto_enable_io(self) -> typing.Optional[builtins.bool]:
"""Indicates whether the volume is auto-enabled for I/O operations.
By default, Amazon EBS disables I/O to the volume from attached EC2
instances when it determines that a volume's data is potentially inconsistent. If the consistency of the volume is not a concern, and
you prefer that the volume be made available immediately if it's impaired, you can configure the volume to automatically enable I/O.
:default: false
"""
result = self._values.get("auto_enable_io")
return result
@builtins.property
def enable_multi_attach(self) -> typing.Optional[builtins.bool]:
"""Indicates whether Amazon EBS Multi-Attach is enabled.
See {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volumes-multi.html#considerations|Considerations and limitations}
for the constraints of multi-attach.
:default: false
"""
result = self._values.get("enable_multi_attach")
return result
@builtins.property
def encrypted(self) -> typing.Optional[builtins.bool]:
"""Specifies whether the volume should be encrypted.
The effect of setting the encryption state to true depends on the volume origin
(new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information,
see {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#encryption-by-default|Encryption by Default}
in the Amazon Elastic Compute Cloud User Guide.
Encrypted Amazon EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see
{@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances|Supported Instance Types.}
:default: false
"""
result = self._values.get("encrypted")
return result
@builtins.property
def encryption_key(self) -> typing.Optional[aws_cdk.aws_kms.IKey]:
"""The customer-managed encryption key that is used to encrypt the Volume.
The encrypted property must
be true if this is provided.
Note: If using an {@link aws-kms.IKey} created from a {@link aws-kms.Key.fromKeyArn()} here,
then the KMS key **must** have the following in its Key policy; otherwise, the Volume
will fail to create::
{
"Effect": "Allow",
"Principal": { "AWS": "<arn for your account-user> ex: arn:aws:iam::00000000000:root" },
"Resource": "*",
"Action": [
"kms:DescribeKey",
"kms:GenerateDataKeyWithoutPlainText",
],
"Condition": {
"StringEquals": {
"kms:ViaService": "ec2.<Region>.amazonaws.com", (eg: ec2.us-east-1.amazonaws.com)
"kms:CallerAccount": "0000000000" (your account ID)
}
}
}
:default: The default KMS key for the account, region, and EC2 service is used.
"""
result = self._values.get("encryption_key")
return result
@builtins.property
def iops(self) -> typing.Optional[jsii.Number]:
"""The number of I/O operations per second (IOPS) to provision for the volume, with a maximum ratio of 50 IOPS/GiB.
See {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html#EBSVolumeTypes_piops|Provisioned IOPS SSD (io1) volumes}
for more information.
This parameter is valid only for PROVISIONED_IOPS_SSD volumes.
:default: None -- Required for {@link EbsDeviceVolumeType.PROVISIONED_IOPS_SSD}
"""
result = self._values.get("iops")
return result
@builtins.property
def size(self) -> typing.Optional[aws_cdk.core.Size]:
"""The size of the volume, in GiBs.
You must specify either a snapshot ID or a volume size.
See {@link https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html#ebs-volume-characteristics|Volume Characteristics}
for details on the allowable size for each type of volume.
:default: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.
"""
result = self._values.get("size")
return result
@builtins.property
def snapshot_id(self) -> typing.Optional[builtins.str]:
"""The snapshot from which to create the volume.
You must specify either a snapshot ID or a volume size.
:default: The EBS volume is not created from a snapshot.
"""
result = self._values.get("snapshot_id")
return result
@builtins.property
def volume_name(self) -> typing.Optional[builtins.str]:
"""The value of the physicalName property of this resource.
:default: The physical name will be allocated by CloudFormation at deployment time
"""
result = self._values.get("volume_name")
return result
@builtins.property
def volume_type(self) -> typing.Optional[EbsDeviceVolumeType]:
"""The type of the volume;
what type of storage to use to form the EBS Volume.
:default: {@link EbsDeviceVolumeType.GENERAL_PURPOSE_SSD}
"""
result = self._values.get("volume_type")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "VolumeProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(IVpc)
class Vpc(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.Vpc",
):
"""Define an AWS Virtual Private Cloud.
See the package-level documentation of this package for an overview
of the various dimensions in which you can configure your VPC.
For example::
# Example automatically generated. See https://github.com/aws/jsii/issues/826
vpc = ec2.Vpc(self, "TheVPC",
cidr="10.0.0.0/16"
)
# Iterate the private subnets
selection = vpc.select_subnets(
subnet_type=ec2.SubnetType.PRIVATE
)
for subnet in selection.subnets:
pass
:resource: AWS::EC2::VPC
"""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
cidr: typing.Optional[builtins.str] = None,
default_instance_tenancy: typing.Optional[DefaultInstanceTenancy] = None,
enable_dns_hostnames: typing.Optional[builtins.bool] = None,
enable_dns_support: typing.Optional[builtins.bool] = None,
flow_logs: typing.Optional[typing.Mapping[builtins.str, FlowLogOptions]] = None,
gateway_endpoints: typing.Optional[typing.Mapping[builtins.str, GatewayVpcEndpointOptions]] = None,
max_azs: typing.Optional[jsii.Number] = None,
nat_gateway_provider: typing.Optional[NatProvider] = None,
nat_gateways: typing.Optional[jsii.Number] = None,
nat_gateway_subnets: typing.Optional[SubnetSelection] = None,
subnet_configuration: typing.Optional[typing.List[SubnetConfiguration]] = None,
vpn_connections: typing.Optional[typing.Mapping[builtins.str, "VpnConnectionOptions"]] = None,
vpn_gateway: typing.Optional[builtins.bool] = None,
vpn_gateway_asn: typing.Optional[jsii.Number] = None,
vpn_route_propagation: typing.Optional[typing.List[SubnetSelection]] = None,
) -> None:
"""Vpc creates a VPC that spans a whole region.
It will automatically divide the provided VPC CIDR range, and create public and private subnets per Availability Zone.
Network routing for the public subnets will be configured to allow outbound access directly via an Internet Gateway.
Network routing for the private subnets will be configured to allow outbound access via a set of resilient NAT Gateways (one per AZ).
:param scope: -
:param id: -
:param cidr: The CIDR range to use for the VPC, e.g. '10.0.0.0/16'. Should be a minimum of /28 and maximum size of /16. The range will be split across all subnets per Availability Zone. Default: Vpc.DEFAULT_CIDR_RANGE
:param default_instance_tenancy: The default tenancy of instances launched into the VPC. By setting this to dedicated tenancy, instances will be launched on hardware dedicated to a single AWS customer, unless specifically specified at instance launch time. Please note, not all instance types are usable with Dedicated tenancy. Default: DefaultInstanceTenancy.Default (shared) tenancy
:param enable_dns_hostnames: Indicates whether the instances launched in the VPC get public DNS hostnames. If this attribute is true, instances in the VPC get public DNS hostnames, but only if the enableDnsSupport attribute is also set to true. Default: true
:param enable_dns_support: Indicates whether the DNS resolution is supported for the VPC. If this attribute is false, the Amazon-provided DNS server in the VPC that resolves public DNS hostnames to IP addresses is not enabled. If this attribute is true, queries to the Amazon provided DNS server at the 169.254.169.253 IP address, or the reserved IP address at the base of the VPC IPv4 network range plus two will succeed. Default: true
:param flow_logs: Flow logs to add to this VPC. Default: - No flow logs.
:param gateway_endpoints: Gateway endpoints to add to this VPC. Default: - None.
:param max_azs: Define the maximum number of AZs to use in this region. If the region has more AZs than you want to use (for example, because of EIP limits), pick a lower number here. The AZs will be sorted and picked from the start of the list. If you pick a higher number than the number of AZs in the region, all AZs in the region will be selected. To use "all AZs" available to your account, use a high number (such as 99). Be aware that environment-agnostic stacks will be created with access to only 2 AZs, so to use more than 2 AZs, be sure to specify the account and region on your stack. Default: 3
:param nat_gateway_provider: (experimental) What type of NAT provider to use. Select between NAT gateways or NAT instances. NAT gateways may not be available in all AWS regions. Default: NatProvider.gateway()
:param nat_gateways: The number of NAT Gateways/Instances to create. The type of NAT gateway or instance will be determined by the ``natGatewayProvider`` parameter. You can set this number lower than the number of Availability Zones in your VPC in order to save on NAT cost. Be aware you may be charged for cross-AZ data traffic instead. Default: - One NAT gateway/instance per Availability Zone
:param nat_gateway_subnets: Configures the subnets which will have NAT Gateways/Instances. You can pick a specific group of subnets by specifying the group name; the picked subnets must be public subnets. Only necessary if you have more than one public subnet group. Default: - All public subnets.
:param subnet_configuration: Configure the subnets to build for each AZ. Each entry in this list configures a Subnet Group; each group will contain a subnet for each Availability Zone. For example, if you want 1 public subnet, 1 private subnet, and 1 isolated subnet in each AZ provide the following:: new ec2.Vpc(this, 'VPC', { subnetConfiguration: [ { cidrMask: 24, name: 'ingress', subnetType: ec2.SubnetType.PUBLIC, }, { cidrMask: 24, name: 'application', subnetType: ec2.SubnetType.PRIVATE, }, { cidrMask: 28, name: 'rds', subnetType: ec2.SubnetType.ISOLATED, } ] }); Default: - The VPC CIDR will be evenly divided between 1 public and 1 private subnet per AZ.
:param vpn_connections: VPN connections to this VPC. Default: - No connections.
:param vpn_gateway: Indicates whether a VPN gateway should be created and attached to this VPC. Default: - true when vpnGatewayAsn or vpnConnections is specified
:param vpn_gateway_asn: The private Autonomous System Number (ASN) for the VPN gateway. Default: - Amazon default ASN.
:param vpn_route_propagation: Where to propagate VPN routes. Default: - On the route tables associated with private subnets. If no private subnets exists, isolated subnets are used. If no isolated subnets exists, public subnets are used.
"""
props = VpcProps(
cidr=cidr,
default_instance_tenancy=default_instance_tenancy,
enable_dns_hostnames=enable_dns_hostnames,
enable_dns_support=enable_dns_support,
flow_logs=flow_logs,
gateway_endpoints=gateway_endpoints,
max_azs=max_azs,
nat_gateway_provider=nat_gateway_provider,
nat_gateways=nat_gateways,
nat_gateway_subnets=nat_gateway_subnets,
subnet_configuration=subnet_configuration,
vpn_connections=vpn_connections,
vpn_gateway=vpn_gateway,
vpn_gateway_asn=vpn_gateway_asn,
vpn_route_propagation=vpn_route_propagation,
)
jsii.create(Vpc, self, [scope, id, props])
@jsii.member(jsii_name="fromLookup")
@builtins.classmethod
def from_lookup(
cls,
scope: constructs.Construct,
id: builtins.str,
*,
is_default: typing.Optional[builtins.bool] = None,
subnet_group_name_tag: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
vpc_id: typing.Optional[builtins.str] = None,
vpc_name: typing.Optional[builtins.str] = None,
) -> IVpc:
"""Import an existing VPC from by querying the AWS environment this stack is deployed to.
This function only needs to be used to use VPCs not defined in your CDK
application. If you are looking to share a VPC between stacks, you can
pass the ``Vpc`` object between stacks and use it as normal.
Calling this method will lead to a lookup when the CDK CLI is executed.
You can therefore not use any values that will only be available at
CloudFormation execution time (i.e., Tokens).
The VPC information will be cached in ``cdk.context.json`` and the same VPC
will be used on future runs. To refresh the lookup, you will have to
evict the value from the cache using the ``cdk context`` command. See
https://docs.aws.amazon.com/cdk/latest/guide/context.html for more information.
:param scope: -
:param id: -
:param is_default: Whether to match the default VPC. Default: Don't care whether we return the default VPC
:param subnet_group_name_tag: Optional tag for subnet group name. If not provided, we'll look at the aws-cdk:subnet-name tag. If the subnet does not have the specified tag, we'll use its type as the name. Default: aws-cdk:subnet-name
:param tags: Tags on the VPC. The VPC must have all of these tags Default: Don't filter on tags
:param vpc_id: The ID of the VPC. If given, will import exactly this VPC. Default: Don't filter on vpcId
:param vpc_name: The name of the VPC. If given, will import the VPC with this name. Default: Don't filter on vpcName
"""
options = VpcLookupOptions(
is_default=is_default,
subnet_group_name_tag=subnet_group_name_tag,
tags=tags,
vpc_id=vpc_id,
vpc_name=vpc_name,
)
return jsii.sinvoke(cls, "fromLookup", [scope, id, options])
@jsii.member(jsii_name="fromVpcAttributes")
@builtins.classmethod
def from_vpc_attributes(
cls,
scope: constructs.Construct,
id: builtins.str,
*,
availability_zones: typing.List[builtins.str],
vpc_id: builtins.str,
isolated_subnet_ids: typing.Optional[typing.List[builtins.str]] = None,
isolated_subnet_names: typing.Optional[typing.List[builtins.str]] = None,
isolated_subnet_route_table_ids: typing.Optional[typing.List[builtins.str]] = None,
private_subnet_ids: typing.Optional[typing.List[builtins.str]] = None,
private_subnet_names: typing.Optional[typing.List[builtins.str]] = None,
private_subnet_route_table_ids: typing.Optional[typing.List[builtins.str]] = None,
public_subnet_ids: typing.Optional[typing.List[builtins.str]] = None,
public_subnet_names: typing.Optional[typing.List[builtins.str]] = None,
public_subnet_route_table_ids: typing.Optional[typing.List[builtins.str]] = None,
vpc_cidr_block: typing.Optional[builtins.str] = None,
vpn_gateway_id: typing.Optional[builtins.str] = None,
) -> IVpc:
"""Import a VPC by supplying all attributes directly.
NOTE: using ``fromVpcAttributes()`` with deploy-time parameters (like a ``Fn.importValue()`` or
``CfnParameter`` to represent a list of subnet IDs) sometimes accidentally works. It happens
to work for constructs that need a list of subnets (like ``AutoScalingGroup`` and ``eks.Cluster``)
but it does not work for constructs that need individual subnets (like
``Instance``). See https://github.com/aws/aws-cdk/issues/4118 for more
information.
Prefer to use ``Vpc.fromLookup()`` instead.
:param scope: -
:param id: -
:param availability_zones: List of availability zones for the subnets in this VPC.
:param vpc_id: VPC's identifier.
:param isolated_subnet_ids: List of isolated subnet IDs. Must be undefined or match the availability zones in length and order.
:param isolated_subnet_names: List of names for the isolated subnets. Must be undefined or have a name for every isolated subnet group.
:param isolated_subnet_route_table_ids: List of IDs of routing tables for the isolated subnets. Must be undefined or have a name for every isolated subnet group.
:param private_subnet_ids: List of private subnet IDs. Must be undefined or match the availability zones in length and order.
:param private_subnet_names: List of names for the private subnets. Must be undefined or have a name for every private subnet group.
:param private_subnet_route_table_ids: List of IDs of routing tables for the private subnets. Must be undefined or have a name for every private subnet group.
:param public_subnet_ids: List of public subnet IDs. Must be undefined or match the availability zones in length and order.
:param public_subnet_names: List of names for the public subnets. Must be undefined or have a name for every public subnet group.
:param public_subnet_route_table_ids: List of IDs of routing tables for the public subnets. Must be undefined or have a name for every public subnet group.
:param vpc_cidr_block: VPC's CIDR range. Default: - Retrieving the CIDR from the VPC will fail
:param vpn_gateway_id: VPN gateway's identifier.
"""
attrs = VpcAttributes(
availability_zones=availability_zones,
vpc_id=vpc_id,
isolated_subnet_ids=isolated_subnet_ids,
isolated_subnet_names=isolated_subnet_names,
isolated_subnet_route_table_ids=isolated_subnet_route_table_ids,
private_subnet_ids=private_subnet_ids,
private_subnet_names=private_subnet_names,
private_subnet_route_table_ids=private_subnet_route_table_ids,
public_subnet_ids=public_subnet_ids,
public_subnet_names=public_subnet_names,
public_subnet_route_table_ids=public_subnet_route_table_ids,
vpc_cidr_block=vpc_cidr_block,
vpn_gateway_id=vpn_gateway_id,
)
return jsii.sinvoke(cls, "fromVpcAttributes", [scope, id, attrs])
@jsii.member(jsii_name="addDynamoDbEndpoint")
def add_dynamo_db_endpoint(
self,
id: builtins.str,
subnets: typing.Optional[typing.List[SubnetSelection]] = None,
) -> "GatewayVpcEndpoint":
"""(deprecated) Adds a new DynamoDB gateway endpoint to this VPC.
:param id: -
:param subnets: -
:deprecated: use ``addGatewayEndpoint()`` instead
:stability: deprecated
"""
return jsii.invoke(self, "addDynamoDbEndpoint", [id, subnets])
@jsii.member(jsii_name="addFlowLog")
def add_flow_log(
self,
id: builtins.str,
*,
destination: typing.Optional[FlowLogDestination] = None,
traffic_type: typing.Optional[FlowLogTrafficType] = None,
) -> "FlowLog":
"""Adds a new flow log to this VPC.
:param id: -
:param destination: (experimental) Specifies the type of destination to which the flow log data is to be published. Flow log data can be published to CloudWatch Logs or Amazon S3 Default: FlowLogDestinationType.toCloudWatchLogs()
:param traffic_type: (experimental) The type of traffic to log. You can log traffic that the resource accepts or rejects, or all traffic. Default: ALL
"""
options = FlowLogOptions(destination=destination, traffic_type=traffic_type)
return jsii.invoke(self, "addFlowLog", [id, options])
@jsii.member(jsii_name="addGatewayEndpoint")
def add_gateway_endpoint(
self,
id: builtins.str,
*,
service: IGatewayVpcEndpointService,
subnets: typing.Optional[typing.List[SubnetSelection]] = None,
) -> "GatewayVpcEndpoint":
"""Adds a new gateway endpoint to this VPC.
:param id: -
:param service: The service to use for this gateway VPC endpoint.
:param subnets: Where to add endpoint routing. By default, this endpoint will be routable from all subnets in the VPC. Specify a list of subnet selection objects here to be more specific. Default: - All subnets in the VPC
"""
options = GatewayVpcEndpointOptions(service=service, subnets=subnets)
return jsii.invoke(self, "addGatewayEndpoint", [id, options])
@jsii.member(jsii_name="addInterfaceEndpoint")
def add_interface_endpoint(
self,
id: builtins.str,
*,
service: IInterfaceVpcEndpointService,
lookup_supported_azs: typing.Optional[builtins.bool] = None,
open: typing.Optional[builtins.bool] = None,
private_dns_enabled: typing.Optional[builtins.bool] = None,
security_groups: typing.Optional[typing.List[ISecurityGroup]] = None,
subnets: typing.Optional[SubnetSelection] = None,
) -> "InterfaceVpcEndpoint":
"""Adds a new interface endpoint to this VPC.
:param id: -
:param service: The service to use for this interface VPC endpoint.
:param lookup_supported_azs: Limit to only those availability zones where the endpoint service can be created. Setting this to 'true' requires a lookup to be performed at synthesis time. Account and region must be set on the containing stack for this to work. Default: false
:param open: Whether to automatically allow VPC traffic to the endpoint. If enabled, all traffic to the endpoint from within the VPC will be automatically allowed. This is done based on the VPC's CIDR range. Default: true
:param private_dns_enabled: Whether to associate a private hosted zone with the specified VPC. This allows you to make requests to the service using its default DNS hostname. Default: set by the instance of IInterfaceVpcEndpointService, or true if not defined by the instance of IInterfaceVpcEndpointService
:param security_groups: The security groups to associate with this interface VPC endpoint. Default: - a new security group is created
:param subnets: The subnets in which to create an endpoint network interface. At most one per availability zone. Default: - private subnets
"""
options = InterfaceVpcEndpointOptions(
service=service,
lookup_supported_azs=lookup_supported_azs,
open=open,
private_dns_enabled=private_dns_enabled,
security_groups=security_groups,
subnets=subnets,
)
return jsii.invoke(self, "addInterfaceEndpoint", [id, options])
@jsii.member(jsii_name="addS3Endpoint")
def add_s3_endpoint(
self,
id: builtins.str,
subnets: typing.Optional[typing.List[SubnetSelection]] = None,
) -> "GatewayVpcEndpoint":
"""(deprecated) Adds a new S3 gateway endpoint to this VPC.
:param id: -
:param subnets: -
:deprecated: use ``addGatewayEndpoint()`` instead
:stability: deprecated
"""
return jsii.invoke(self, "addS3Endpoint", [id, subnets])
@jsii.member(jsii_name="addVpnConnection")
def add_vpn_connection(
self,
id: builtins.str,
*,
ip: builtins.str,
asn: typing.Optional[jsii.Number] = None,
static_routes: typing.Optional[typing.List[builtins.str]] = None,
tunnel_options: typing.Optional[typing.List["VpnTunnelOption"]] = None,
) -> "VpnConnection":
"""Adds a new VPN connection to this VPC.
:param id: -
:param ip: The ip address of the customer gateway.
:param asn: The ASN of the customer gateway. Default: 65000
:param static_routes: The static routes to be routed from the VPN gateway to the customer gateway. Default: Dynamic routing (BGP)
:param tunnel_options: The tunnel options for the VPN connection. At most two elements (one per tunnel). Duplicates not allowed. Default: Amazon generated tunnel options
"""
options = VpnConnectionOptions(
ip=ip, asn=asn, static_routes=static_routes, tunnel_options=tunnel_options
)
return jsii.invoke(self, "addVpnConnection", [id, options])
@jsii.member(jsii_name="enableVpnGateway")
def enable_vpn_gateway(
self,
*,
vpn_route_propagation: typing.Optional[typing.List[SubnetSelection]] = None,
type: builtins.str,
amazon_side_asn: typing.Optional[jsii.Number] = None,
) -> None:
"""Adds a VPN Gateway to this VPC.
:param vpn_route_propagation: Provide an array of subnets where the route propagation should be added. Default: noPropagation
:param type: Default type ipsec.1.
:param amazon_side_asn: Explicitly specify an Asn or let aws pick an Asn for you. Default: 65000
"""
options = EnableVpnGatewayOptions(
vpn_route_propagation=vpn_route_propagation,
type=type,
amazon_side_asn=amazon_side_asn,
)
return jsii.invoke(self, "enableVpnGateway", [options])
@jsii.member(jsii_name="selectSubnetObjects")
def _select_subnet_objects(
self,
*,
availability_zones: typing.Optional[typing.List[builtins.str]] = None,
one_per_az: typing.Optional[builtins.bool] = None,
subnet_filters: typing.Optional[typing.List[SubnetFilter]] = None,
subnet_group_name: typing.Optional[builtins.str] = None,
subnet_name: typing.Optional[builtins.str] = None,
subnets: typing.Optional[typing.List[ISubnet]] = None,
subnet_type: typing.Optional[SubnetType] = None,
) -> typing.List[ISubnet]:
"""Return the subnets appropriate for the placement strategy.
:param availability_zones: Select subnets only in the given AZs. Default: no filtering on AZs is done
:param one_per_az: If true, return at most one subnet per AZ. Default: false
:param subnet_filters: List of provided subnet filters. Default: - none
:param subnet_group_name: Select the subnet group with the given name. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them. Otherwise, prefer ``subnetType``. This field does not select individual subnets, it selects all subnets that share the given subnet group name. This is the name supplied in ``subnetConfiguration``. At most one of ``subnetType`` and ``subnetGroupName`` can be supplied. Default: - Selection by type instead of by name
:param subnet_name: (deprecated) Alias for ``subnetGroupName``. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them.
:param subnets: Explicitly select individual subnets. Use this if you don't want to automatically use all subnets in a group, but have a need to control selection down to individual subnets. Cannot be specified together with ``subnetType`` or ``subnetGroupName``. Default: - Use all subnets in a selected group (all private subnets by default)
:param subnet_type: Select all subnets of the given type. At most one of ``subnetType`` and ``subnetGroupName`` can be supplied. Default: SubnetType.PRIVATE (or ISOLATED or PUBLIC if there are no PRIVATE subnets)
"""
selection = SubnetSelection(
availability_zones=availability_zones,
one_per_az=one_per_az,
subnet_filters=subnet_filters,
subnet_group_name=subnet_group_name,
subnet_name=subnet_name,
subnets=subnets,
subnet_type=subnet_type,
)
return jsii.invoke(self, "selectSubnetObjects", [selection])
@jsii.member(jsii_name="selectSubnets")
def select_subnets(
self,
*,
availability_zones: typing.Optional[typing.List[builtins.str]] = None,
one_per_az: typing.Optional[builtins.bool] = None,
subnet_filters: typing.Optional[typing.List[SubnetFilter]] = None,
subnet_group_name: typing.Optional[builtins.str] = None,
subnet_name: typing.Optional[builtins.str] = None,
subnets: typing.Optional[typing.List[ISubnet]] = None,
subnet_type: typing.Optional[SubnetType] = None,
) -> SelectedSubnets:
"""Returns IDs of selected subnets.
:param availability_zones: Select subnets only in the given AZs. Default: no filtering on AZs is done
:param one_per_az: If true, return at most one subnet per AZ. Default: false
:param subnet_filters: List of provided subnet filters. Default: - none
:param subnet_group_name: Select the subnet group with the given name. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them. Otherwise, prefer ``subnetType``. This field does not select individual subnets, it selects all subnets that share the given subnet group name. This is the name supplied in ``subnetConfiguration``. At most one of ``subnetType`` and ``subnetGroupName`` can be supplied. Default: - Selection by type instead of by name
:param subnet_name: (deprecated) Alias for ``subnetGroupName``. Select the subnet group with the given name. This only needs to be used if you have multiple subnet groups of the same type and you need to distinguish between them.
:param subnets: Explicitly select individual subnets. Use this if you don't want to automatically use all subnets in a group, but have a need to control selection down to individual subnets. Cannot be specified together with ``subnetType`` or ``subnetGroupName``. Default: - Use all subnets in a selected group (all private subnets by default)
:param subnet_type: Select all subnets of the given type. At most one of ``subnetType`` and ``subnetGroupName`` can be supplied. Default: SubnetType.PRIVATE (or ISOLATED or PUBLIC if there are no PRIVATE subnets)
"""
selection = SubnetSelection(
availability_zones=availability_zones,
one_per_az=one_per_az,
subnet_filters=subnet_filters,
subnet_group_name=subnet_group_name,
subnet_name=subnet_name,
subnets=subnets,
subnet_type=subnet_type,
)
return jsii.invoke(self, "selectSubnets", [selection])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="DEFAULT_CIDR_RANGE")
def DEFAULT_CIDR_RANGE(cls) -> builtins.str:
"""The default CIDR range used when creating VPCs.
This can be overridden using VpcProps when creating a VPCNetwork resource.
e.g. new VpcResource(this, { cidr: '192.168.0.0./16' })
"""
return jsii.sget(cls, "DEFAULT_CIDR_RANGE")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="DEFAULT_SUBNETS")
def DEFAULT_SUBNETS(cls) -> typing.List[SubnetConfiguration]:
"""The default subnet configuration.
1 Public and 1 Private subnet per AZ evenly split
"""
return jsii.sget(cls, "DEFAULT_SUBNETS")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="DEFAULT_SUBNETS_NO_NAT")
def DEFAULT_SUBNETS_NO_NAT(cls) -> typing.List[SubnetConfiguration]:
"""The default subnet configuration if natGateways specified to be 0.
1 Public and 1 Isolated Subnet per AZ evenly split
"""
return jsii.sget(cls, "DEFAULT_SUBNETS_NO_NAT")
@builtins.property # type: ignore
@jsii.member(jsii_name="availabilityZones")
def availability_zones(self) -> typing.List[builtins.str]:
"""AZs for this VPC."""
return jsii.get(self, "availabilityZones")
@builtins.property # type: ignore
@jsii.member(jsii_name="dnsHostnamesEnabled")
def dns_hostnames_enabled(self) -> builtins.bool:
"""Indicates if instances launched in this VPC will have public DNS hostnames."""
return jsii.get(self, "dnsHostnamesEnabled")
@builtins.property # type: ignore
@jsii.member(jsii_name="dnsSupportEnabled")
def dns_support_enabled(self) -> builtins.bool:
"""Indicates if DNS support is enabled for this VPC."""
return jsii.get(self, "dnsSupportEnabled")
@builtins.property # type: ignore
@jsii.member(jsii_name="internetConnectivityEstablished")
def internet_connectivity_established(self) -> aws_cdk.core.IDependable:
"""Dependencies for internet connectivity."""
return jsii.get(self, "internetConnectivityEstablished")
@builtins.property # type: ignore
@jsii.member(jsii_name="isolatedSubnets")
def isolated_subnets(self) -> typing.List[ISubnet]:
"""List of isolated subnets in this VPC."""
return jsii.get(self, "isolatedSubnets")
@builtins.property # type: ignore
@jsii.member(jsii_name="natDependencies")
def _nat_dependencies(self) -> typing.List[aws_cdk.core.IConstruct]:
"""(deprecated) Dependencies for NAT connectivity.
:deprecated: - This value is no longer used.
:stability: deprecated
"""
return jsii.get(self, "natDependencies")
@builtins.property # type: ignore
@jsii.member(jsii_name="privateSubnets")
def private_subnets(self) -> typing.List[ISubnet]:
"""List of private subnets in this VPC."""
return jsii.get(self, "privateSubnets")
@builtins.property # type: ignore
@jsii.member(jsii_name="publicSubnets")
def public_subnets(self) -> typing.List[ISubnet]:
"""List of public subnets in this VPC."""
return jsii.get(self, "publicSubnets")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcCidrBlock")
def vpc_cidr_block(self) -> builtins.str:
"""CIDR range for this VPC.
:attribute: true
"""
return jsii.get(self, "vpcCidrBlock")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcCidrBlockAssociations")
def vpc_cidr_block_associations(self) -> typing.List[builtins.str]:
"""
:attribute: true
"""
return jsii.get(self, "vpcCidrBlockAssociations")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcDefaultNetworkAcl")
def vpc_default_network_acl(self) -> builtins.str:
"""
:attribute: true
"""
return jsii.get(self, "vpcDefaultNetworkAcl")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcDefaultSecurityGroup")
def vpc_default_security_group(self) -> builtins.str:
"""
:attribute: true
"""
return jsii.get(self, "vpcDefaultSecurityGroup")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcId")
def vpc_id(self) -> builtins.str:
"""Identifier for this VPC."""
return jsii.get(self, "vpcId")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcIpv6CidrBlocks")
def vpc_ipv6_cidr_blocks(self) -> typing.List[builtins.str]:
"""
:attribute: true
"""
return jsii.get(self, "vpcIpv6CidrBlocks")
@builtins.property # type: ignore
@jsii.member(jsii_name="internetGatewayId")
def internet_gateway_id(self) -> typing.Optional[builtins.str]:
"""Internet Gateway for the VPC.
Note that in case the VPC is configured only
with ISOLATED subnets, this attribute will be ``undefined``.
"""
return jsii.get(self, "internetGatewayId")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpnGatewayId")
def vpn_gateway_id(self) -> typing.Optional[builtins.str]:
"""Returns the id of the VPN Gateway (if enabled)."""
return jsii.get(self, "vpnGatewayId")
@builtins.property # type: ignore
@jsii.member(jsii_name="incompleteSubnetDefinition")
def _incomplete_subnet_definition(self) -> builtins.bool:
"""If this is set to true, don't error out on trying to select subnets."""
return jsii.get(self, "incompleteSubnetDefinition")
@_incomplete_subnet_definition.setter # type: ignore
def _incomplete_subnet_definition(self, value: builtins.bool) -> None:
jsii.set(self, "incompleteSubnetDefinition", value)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.VpcAttributes",
jsii_struct_bases=[],
name_mapping={
"availability_zones": "availabilityZones",
"vpc_id": "vpcId",
"isolated_subnet_ids": "isolatedSubnetIds",
"isolated_subnet_names": "isolatedSubnetNames",
"isolated_subnet_route_table_ids": "isolatedSubnetRouteTableIds",
"private_subnet_ids": "privateSubnetIds",
"private_subnet_names": "privateSubnetNames",
"private_subnet_route_table_ids": "privateSubnetRouteTableIds",
"public_subnet_ids": "publicSubnetIds",
"public_subnet_names": "publicSubnetNames",
"public_subnet_route_table_ids": "publicSubnetRouteTableIds",
"vpc_cidr_block": "vpcCidrBlock",
"vpn_gateway_id": "vpnGatewayId",
},
)
class VpcAttributes:
def __init__(
self,
*,
availability_zones: typing.List[builtins.str],
vpc_id: builtins.str,
isolated_subnet_ids: typing.Optional[typing.List[builtins.str]] = None,
isolated_subnet_names: typing.Optional[typing.List[builtins.str]] = None,
isolated_subnet_route_table_ids: typing.Optional[typing.List[builtins.str]] = None,
private_subnet_ids: typing.Optional[typing.List[builtins.str]] = None,
private_subnet_names: typing.Optional[typing.List[builtins.str]] = None,
private_subnet_route_table_ids: typing.Optional[typing.List[builtins.str]] = None,
public_subnet_ids: typing.Optional[typing.List[builtins.str]] = None,
public_subnet_names: typing.Optional[typing.List[builtins.str]] = None,
public_subnet_route_table_ids: typing.Optional[typing.List[builtins.str]] = None,
vpc_cidr_block: typing.Optional[builtins.str] = None,
vpn_gateway_id: typing.Optional[builtins.str] = None,
) -> None:
"""Properties that reference an external Vpc.
:param availability_zones: List of availability zones for the subnets in this VPC.
:param vpc_id: VPC's identifier.
:param isolated_subnet_ids: List of isolated subnet IDs. Must be undefined or match the availability zones in length and order.
:param isolated_subnet_names: List of names for the isolated subnets. Must be undefined or have a name for every isolated subnet group.
:param isolated_subnet_route_table_ids: List of IDs of routing tables for the isolated subnets. Must be undefined or have a name for every isolated subnet group.
:param private_subnet_ids: List of private subnet IDs. Must be undefined or match the availability zones in length and order.
:param private_subnet_names: List of names for the private subnets. Must be undefined or have a name for every private subnet group.
:param private_subnet_route_table_ids: List of IDs of routing tables for the private subnets. Must be undefined or have a name for every private subnet group.
:param public_subnet_ids: List of public subnet IDs. Must be undefined or match the availability zones in length and order.
:param public_subnet_names: List of names for the public subnets. Must be undefined or have a name for every public subnet group.
:param public_subnet_route_table_ids: List of IDs of routing tables for the public subnets. Must be undefined or have a name for every public subnet group.
:param vpc_cidr_block: VPC's CIDR range. Default: - Retrieving the CIDR from the VPC will fail
:param vpn_gateway_id: VPN gateway's identifier.
"""
self._values: typing.Dict[str, typing.Any] = {
"availability_zones": availability_zones,
"vpc_id": vpc_id,
}
if isolated_subnet_ids is not None:
self._values["isolated_subnet_ids"] = isolated_subnet_ids
if isolated_subnet_names is not None:
self._values["isolated_subnet_names"] = isolated_subnet_names
if isolated_subnet_route_table_ids is not None:
self._values["isolated_subnet_route_table_ids"] = isolated_subnet_route_table_ids
if private_subnet_ids is not None:
self._values["private_subnet_ids"] = private_subnet_ids
if private_subnet_names is not None:
self._values["private_subnet_names"] = private_subnet_names
if private_subnet_route_table_ids is not None:
self._values["private_subnet_route_table_ids"] = private_subnet_route_table_ids
if public_subnet_ids is not None:
self._values["public_subnet_ids"] = public_subnet_ids
if public_subnet_names is not None:
self._values["public_subnet_names"] = public_subnet_names
if public_subnet_route_table_ids is not None:
self._values["public_subnet_route_table_ids"] = public_subnet_route_table_ids
if vpc_cidr_block is not None:
self._values["vpc_cidr_block"] = vpc_cidr_block
if vpn_gateway_id is not None:
self._values["vpn_gateway_id"] = vpn_gateway_id
@builtins.property
def availability_zones(self) -> typing.List[builtins.str]:
"""List of availability zones for the subnets in this VPC."""
result = self._values.get("availability_zones")
assert result is not None, "Required property 'availability_zones' is missing"
return result
@builtins.property
def vpc_id(self) -> builtins.str:
"""VPC's identifier."""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def isolated_subnet_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""List of isolated subnet IDs.
Must be undefined or match the availability zones in length and order.
"""
result = self._values.get("isolated_subnet_ids")
return result
@builtins.property
def isolated_subnet_names(self) -> typing.Optional[typing.List[builtins.str]]:
"""List of names for the isolated subnets.
Must be undefined or have a name for every isolated subnet group.
"""
result = self._values.get("isolated_subnet_names")
return result
@builtins.property
def isolated_subnet_route_table_ids(
self,
) -> typing.Optional[typing.List[builtins.str]]:
"""List of IDs of routing tables for the isolated subnets.
Must be undefined or have a name for every isolated subnet group.
"""
result = self._values.get("isolated_subnet_route_table_ids")
return result
@builtins.property
def private_subnet_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""List of private subnet IDs.
Must be undefined or match the availability zones in length and order.
"""
result = self._values.get("private_subnet_ids")
return result
@builtins.property
def private_subnet_names(self) -> typing.Optional[typing.List[builtins.str]]:
"""List of names for the private subnets.
Must be undefined or have a name for every private subnet group.
"""
result = self._values.get("private_subnet_names")
return result
@builtins.property
def private_subnet_route_table_ids(
self,
) -> typing.Optional[typing.List[builtins.str]]:
"""List of IDs of routing tables for the private subnets.
Must be undefined or have a name for every private subnet group.
"""
result = self._values.get("private_subnet_route_table_ids")
return result
@builtins.property
def public_subnet_ids(self) -> typing.Optional[typing.List[builtins.str]]:
"""List of public subnet IDs.
Must be undefined or match the availability zones in length and order.
"""
result = self._values.get("public_subnet_ids")
return result
@builtins.property
def public_subnet_names(self) -> typing.Optional[typing.List[builtins.str]]:
"""List of names for the public subnets.
Must be undefined or have a name for every public subnet group.
"""
result = self._values.get("public_subnet_names")
return result
@builtins.property
def public_subnet_route_table_ids(
self,
) -> typing.Optional[typing.List[builtins.str]]:
"""List of IDs of routing tables for the public subnets.
Must be undefined or have a name for every public subnet group.
"""
result = self._values.get("public_subnet_route_table_ids")
return result
@builtins.property
def vpc_cidr_block(self) -> typing.Optional[builtins.str]:
"""VPC's CIDR range.
:default: - Retrieving the CIDR from the VPC will fail
"""
result = self._values.get("vpc_cidr_block")
return result
@builtins.property
def vpn_gateway_id(self) -> typing.Optional[builtins.str]:
"""VPN gateway's identifier."""
result = self._values.get("vpn_gateway_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "VpcAttributes(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(IVpcEndpoint)
class VpcEndpoint(
aws_cdk.core.Resource,
metaclass=jsii.JSIIAbstractClass,
jsii_type="@aws-cdk/aws-ec2.VpcEndpoint",
):
@builtins.staticmethod
def __jsii_proxy_class__():
return _VpcEndpointProxy
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
account: typing.Optional[builtins.str] = None,
physical_name: typing.Optional[builtins.str] = None,
region: typing.Optional[builtins.str] = None,
) -> None:
"""
:param scope: -
:param id: -
:param account: The AWS account ID this resource belongs to. Default: - the resource is in the same account as the stack it belongs to
:param physical_name: The value passed in by users to the physical name prop of the resource. - ``undefined`` implies that a physical name will be allocated by CloudFormation during deployment. - a concrete value implies a specific physical name - ``PhysicalName.GENERATE_IF_NEEDED`` is a marker that indicates that a physical will only be generated by the CDK if it is needed for cross-environment references. Otherwise, it will be allocated by CloudFormation. Default: - The physical name will be allocated by CloudFormation at deployment time
:param region: The AWS region this resource belongs to. Default: - the resource is in the same region as the stack it belongs to
"""
props = aws_cdk.core.ResourceProps(
account=account, physical_name=physical_name, region=region
)
jsii.create(VpcEndpoint, self, [scope, id, props])
@jsii.member(jsii_name="addToPolicy")
def add_to_policy(self, statement: aws_cdk.aws_iam.PolicyStatement) -> None:
"""Adds a statement to the policy document of the VPC endpoint. The statement must have a Principal.
Not all interface VPC endpoints support policy. For more information
see https://docs.aws.amazon.com/vpc/latest/userguide/vpce-interface.html
:param statement: the IAM statement to add.
"""
return jsii.invoke(self, "addToPolicy", [statement])
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointId")
@abc.abstractmethod
def vpc_endpoint_id(self) -> builtins.str:
"""The VPC endpoint identifier."""
...
@builtins.property # type: ignore
@jsii.member(jsii_name="policyDocument")
def _policy_document(self) -> typing.Optional[aws_cdk.aws_iam.PolicyDocument]:
return jsii.get(self, "policyDocument")
@_policy_document.setter # type: ignore
def _policy_document(
self,
value: typing.Optional[aws_cdk.aws_iam.PolicyDocument],
) -> None:
jsii.set(self, "policyDocument", value)
class _VpcEndpointProxy(
VpcEndpoint, jsii.proxy_for(aws_cdk.core.Resource) # type: ignore
):
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointId")
def vpc_endpoint_id(self) -> builtins.str:
"""The VPC endpoint identifier."""
return jsii.get(self, "vpcEndpointId")
@jsii.implements(IVpcEndpointService)
class VpcEndpointService(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.VpcEndpointService",
):
"""(experimental) A VPC endpoint service.
:stability: experimental
:resource: AWS::EC2::VPCEndpointService
"""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
vpc_endpoint_service_load_balancers: typing.List[IVpcEndpointServiceLoadBalancer],
acceptance_required: typing.Optional[builtins.bool] = None,
vpc_endpoint_service_name: typing.Optional[builtins.str] = None,
whitelisted_principals: typing.Optional[typing.List[aws_cdk.aws_iam.ArnPrincipal]] = None,
) -> None:
"""
:param scope: -
:param id: -
:param vpc_endpoint_service_load_balancers: (experimental) One or more load balancers to host the VPC Endpoint Service.
:param acceptance_required: (experimental) Whether requests from service consumers to connect to the service through an endpoint must be accepted. Default: true
:param vpc_endpoint_service_name: (deprecated) Name of the Vpc Endpoint Service. Default: - CDK generated name
:param whitelisted_principals: (experimental) IAM users, IAM roles, or AWS accounts to allow inbound connections from. These principals can connect to your service using VPC endpoints. Takes a list of one or more ArnPrincipal. Default: - no principals
:stability: experimental
"""
props = VpcEndpointServiceProps(
vpc_endpoint_service_load_balancers=vpc_endpoint_service_load_balancers,
acceptance_required=acceptance_required,
vpc_endpoint_service_name=vpc_endpoint_service_name,
whitelisted_principals=whitelisted_principals,
)
jsii.create(VpcEndpointService, self, [scope, id, props])
@builtins.property # type: ignore
@jsii.member(jsii_name="acceptanceRequired")
def acceptance_required(self) -> builtins.bool:
"""(experimental) Whether to require manual acceptance of new connections to the service.
:stability: experimental
"""
return jsii.get(self, "acceptanceRequired")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointServiceId")
def vpc_endpoint_service_id(self) -> builtins.str:
"""(experimental) The id of the VPC Endpoint Service, like vpce-svc-xxxxxxxxxxxxxxxx.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "vpcEndpointServiceId")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointServiceLoadBalancers")
def vpc_endpoint_service_load_balancers(
self,
) -> typing.List[IVpcEndpointServiceLoadBalancer]:
"""(experimental) One or more network load balancers to host the service.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "vpcEndpointServiceLoadBalancers")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointServiceName")
def vpc_endpoint_service_name(self) -> builtins.str:
"""(experimental) The service name of the VPC Endpoint Service that clients use to connect to, like com.amazonaws.vpce..vpce-svc-xxxxxxxxxxxxxxxx.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "vpcEndpointServiceName")
@builtins.property # type: ignore
@jsii.member(jsii_name="whitelistedPrincipals")
def whitelisted_principals(self) -> typing.List[aws_cdk.aws_iam.ArnPrincipal]:
"""(experimental) One or more Principal ARNs to allow inbound connections to.
:stability: experimental
"""
return jsii.get(self, "whitelistedPrincipals")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.VpcEndpointServiceProps",
jsii_struct_bases=[],
name_mapping={
"vpc_endpoint_service_load_balancers": "vpcEndpointServiceLoadBalancers",
"acceptance_required": "acceptanceRequired",
"vpc_endpoint_service_name": "vpcEndpointServiceName",
"whitelisted_principals": "whitelistedPrincipals",
},
)
class VpcEndpointServiceProps:
def __init__(
self,
*,
vpc_endpoint_service_load_balancers: typing.List[IVpcEndpointServiceLoadBalancer],
acceptance_required: typing.Optional[builtins.bool] = None,
vpc_endpoint_service_name: typing.Optional[builtins.str] = None,
whitelisted_principals: typing.Optional[typing.List[aws_cdk.aws_iam.ArnPrincipal]] = None,
) -> None:
"""(experimental) Construction properties for a VpcEndpointService.
:param vpc_endpoint_service_load_balancers: (experimental) One or more load balancers to host the VPC Endpoint Service.
:param acceptance_required: (experimental) Whether requests from service consumers to connect to the service through an endpoint must be accepted. Default: true
:param vpc_endpoint_service_name: (deprecated) Name of the Vpc Endpoint Service. Default: - CDK generated name
:param whitelisted_principals: (experimental) IAM users, IAM roles, or AWS accounts to allow inbound connections from. These principals can connect to your service using VPC endpoints. Takes a list of one or more ArnPrincipal. Default: - no principals
:stability: experimental
"""
self._values: typing.Dict[str, typing.Any] = {
"vpc_endpoint_service_load_balancers": vpc_endpoint_service_load_balancers,
}
if acceptance_required is not None:
self._values["acceptance_required"] = acceptance_required
if vpc_endpoint_service_name is not None:
self._values["vpc_endpoint_service_name"] = vpc_endpoint_service_name
if whitelisted_principals is not None:
self._values["whitelisted_principals"] = whitelisted_principals
@builtins.property
def vpc_endpoint_service_load_balancers(
self,
) -> typing.List[IVpcEndpointServiceLoadBalancer]:
"""(experimental) One or more load balancers to host the VPC Endpoint Service.
:stability: experimental
"""
result = self._values.get("vpc_endpoint_service_load_balancers")
assert result is not None, "Required property 'vpc_endpoint_service_load_balancers' is missing"
return result
@builtins.property
def acceptance_required(self) -> typing.Optional[builtins.bool]:
"""(experimental) Whether requests from service consumers to connect to the service through an endpoint must be accepted.
:default: true
:stability: experimental
"""
result = self._values.get("acceptance_required")
return result
@builtins.property
def vpc_endpoint_service_name(self) -> typing.Optional[builtins.str]:
"""(deprecated) Name of the Vpc Endpoint Service.
:default: - CDK generated name
:deprecated: This property is not used
:stability: deprecated
"""
result = self._values.get("vpc_endpoint_service_name")
return result
@builtins.property
def whitelisted_principals(
self,
) -> typing.Optional[typing.List[aws_cdk.aws_iam.ArnPrincipal]]:
"""(experimental) IAM users, IAM roles, or AWS accounts to allow inbound connections from.
These principals can connect to your service using VPC endpoints. Takes a
list of one or more ArnPrincipal.
:default: - no principals
:stability: experimental
"""
result = self._values.get("whitelisted_principals")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "VpcEndpointServiceProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.VpcEndpointType")
class VpcEndpointType(enum.Enum):
"""The type of VPC endpoint."""
INTERFACE = "INTERFACE"
"""Interface.
An interface endpoint is an elastic network interface with a private IP
address that serves as an entry point for traffic destined to a supported
service.
"""
GATEWAY = "GATEWAY"
"""Gateway.
A gateway endpoint is a gateway that is a target for a specified route in
your route table, used for traffic destined to a supported AWS service.
"""
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.VpcLookupOptions",
jsii_struct_bases=[],
name_mapping={
"is_default": "isDefault",
"subnet_group_name_tag": "subnetGroupNameTag",
"tags": "tags",
"vpc_id": "vpcId",
"vpc_name": "vpcName",
},
)
class VpcLookupOptions:
def __init__(
self,
*,
is_default: typing.Optional[builtins.bool] = None,
subnet_group_name_tag: typing.Optional[builtins.str] = None,
tags: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
vpc_id: typing.Optional[builtins.str] = None,
vpc_name: typing.Optional[builtins.str] = None,
) -> None:
"""Properties for looking up an existing VPC.
The combination of properties must specify filter down to exactly one
non-default VPC, otherwise an error is raised.
:param is_default: Whether to match the default VPC. Default: Don't care whether we return the default VPC
:param subnet_group_name_tag: Optional tag for subnet group name. If not provided, we'll look at the aws-cdk:subnet-name tag. If the subnet does not have the specified tag, we'll use its type as the name. Default: aws-cdk:subnet-name
:param tags: Tags on the VPC. The VPC must have all of these tags Default: Don't filter on tags
:param vpc_id: The ID of the VPC. If given, will import exactly this VPC. Default: Don't filter on vpcId
:param vpc_name: The name of the VPC. If given, will import the VPC with this name. Default: Don't filter on vpcName
"""
self._values: typing.Dict[str, typing.Any] = {}
if is_default is not None:
self._values["is_default"] = is_default
if subnet_group_name_tag is not None:
self._values["subnet_group_name_tag"] = subnet_group_name_tag
if tags is not None:
self._values["tags"] = tags
if vpc_id is not None:
self._values["vpc_id"] = vpc_id
if vpc_name is not None:
self._values["vpc_name"] = vpc_name
@builtins.property
def is_default(self) -> typing.Optional[builtins.bool]:
"""Whether to match the default VPC.
:default: Don't care whether we return the default VPC
"""
result = self._values.get("is_default")
return result
@builtins.property
def subnet_group_name_tag(self) -> typing.Optional[builtins.str]:
"""Optional tag for subnet group name.
If not provided, we'll look at the aws-cdk:subnet-name tag.
If the subnet does not have the specified tag,
we'll use its type as the name.
:default: aws-cdk:subnet-name
"""
result = self._values.get("subnet_group_name_tag")
return result
@builtins.property
def tags(self) -> typing.Optional[typing.Mapping[builtins.str, builtins.str]]:
"""Tags on the VPC.
The VPC must have all of these tags
:default: Don't filter on tags
"""
result = self._values.get("tags")
return result
@builtins.property
def vpc_id(self) -> typing.Optional[builtins.str]:
"""The ID of the VPC.
If given, will import exactly this VPC.
:default: Don't filter on vpcId
"""
result = self._values.get("vpc_id")
return result
@builtins.property
def vpc_name(self) -> typing.Optional[builtins.str]:
"""The name of the VPC.
If given, will import the VPC with this name.
:default: Don't filter on vpcName
"""
result = self._values.get("vpc_name")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "VpcLookupOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.VpcProps",
jsii_struct_bases=[],
name_mapping={
"cidr": "cidr",
"default_instance_tenancy": "defaultInstanceTenancy",
"enable_dns_hostnames": "enableDnsHostnames",
"enable_dns_support": "enableDnsSupport",
"flow_logs": "flowLogs",
"gateway_endpoints": "gatewayEndpoints",
"max_azs": "maxAzs",
"nat_gateway_provider": "natGatewayProvider",
"nat_gateways": "natGateways",
"nat_gateway_subnets": "natGatewaySubnets",
"subnet_configuration": "subnetConfiguration",
"vpn_connections": "vpnConnections",
"vpn_gateway": "vpnGateway",
"vpn_gateway_asn": "vpnGatewayAsn",
"vpn_route_propagation": "vpnRoutePropagation",
},
)
class VpcProps:
def __init__(
self,
*,
cidr: typing.Optional[builtins.str] = None,
default_instance_tenancy: typing.Optional[DefaultInstanceTenancy] = None,
enable_dns_hostnames: typing.Optional[builtins.bool] = None,
enable_dns_support: typing.Optional[builtins.bool] = None,
flow_logs: typing.Optional[typing.Mapping[builtins.str, FlowLogOptions]] = None,
gateway_endpoints: typing.Optional[typing.Mapping[builtins.str, GatewayVpcEndpointOptions]] = None,
max_azs: typing.Optional[jsii.Number] = None,
nat_gateway_provider: typing.Optional[NatProvider] = None,
nat_gateways: typing.Optional[jsii.Number] = None,
nat_gateway_subnets: typing.Optional[SubnetSelection] = None,
subnet_configuration: typing.Optional[typing.List[SubnetConfiguration]] = None,
vpn_connections: typing.Optional[typing.Mapping[builtins.str, "VpnConnectionOptions"]] = None,
vpn_gateway: typing.Optional[builtins.bool] = None,
vpn_gateway_asn: typing.Optional[jsii.Number] = None,
vpn_route_propagation: typing.Optional[typing.List[SubnetSelection]] = None,
) -> None:
"""Configuration for Vpc.
:param cidr: The CIDR range to use for the VPC, e.g. '10.0.0.0/16'. Should be a minimum of /28 and maximum size of /16. The range will be split across all subnets per Availability Zone. Default: Vpc.DEFAULT_CIDR_RANGE
:param default_instance_tenancy: The default tenancy of instances launched into the VPC. By setting this to dedicated tenancy, instances will be launched on hardware dedicated to a single AWS customer, unless specifically specified at instance launch time. Please note, not all instance types are usable with Dedicated tenancy. Default: DefaultInstanceTenancy.Default (shared) tenancy
:param enable_dns_hostnames: Indicates whether the instances launched in the VPC get public DNS hostnames. If this attribute is true, instances in the VPC get public DNS hostnames, but only if the enableDnsSupport attribute is also set to true. Default: true
:param enable_dns_support: Indicates whether the DNS resolution is supported for the VPC. If this attribute is false, the Amazon-provided DNS server in the VPC that resolves public DNS hostnames to IP addresses is not enabled. If this attribute is true, queries to the Amazon provided DNS server at the 169.254.169.253 IP address, or the reserved IP address at the base of the VPC IPv4 network range plus two will succeed. Default: true
:param flow_logs: Flow logs to add to this VPC. Default: - No flow logs.
:param gateway_endpoints: Gateway endpoints to add to this VPC. Default: - None.
:param max_azs: Define the maximum number of AZs to use in this region. If the region has more AZs than you want to use (for example, because of EIP limits), pick a lower number here. The AZs will be sorted and picked from the start of the list. If you pick a higher number than the number of AZs in the region, all AZs in the region will be selected. To use "all AZs" available to your account, use a high number (such as 99). Be aware that environment-agnostic stacks will be created with access to only 2 AZs, so to use more than 2 AZs, be sure to specify the account and region on your stack. Default: 3
:param nat_gateway_provider: (experimental) What type of NAT provider to use. Select between NAT gateways or NAT instances. NAT gateways may not be available in all AWS regions. Default: NatProvider.gateway()
:param nat_gateways: The number of NAT Gateways/Instances to create. The type of NAT gateway or instance will be determined by the ``natGatewayProvider`` parameter. You can set this number lower than the number of Availability Zones in your VPC in order to save on NAT cost. Be aware you may be charged for cross-AZ data traffic instead. Default: - One NAT gateway/instance per Availability Zone
:param nat_gateway_subnets: Configures the subnets which will have NAT Gateways/Instances. You can pick a specific group of subnets by specifying the group name; the picked subnets must be public subnets. Only necessary if you have more than one public subnet group. Default: - All public subnets.
:param subnet_configuration: Configure the subnets to build for each AZ. Each entry in this list configures a Subnet Group; each group will contain a subnet for each Availability Zone. For example, if you want 1 public subnet, 1 private subnet, and 1 isolated subnet in each AZ provide the following:: new ec2.Vpc(this, 'VPC', { subnetConfiguration: [ { cidrMask: 24, name: 'ingress', subnetType: ec2.SubnetType.PUBLIC, }, { cidrMask: 24, name: 'application', subnetType: ec2.SubnetType.PRIVATE, }, { cidrMask: 28, name: 'rds', subnetType: ec2.SubnetType.ISOLATED, } ] }); Default: - The VPC CIDR will be evenly divided between 1 public and 1 private subnet per AZ.
:param vpn_connections: VPN connections to this VPC. Default: - No connections.
:param vpn_gateway: Indicates whether a VPN gateway should be created and attached to this VPC. Default: - true when vpnGatewayAsn or vpnConnections is specified
:param vpn_gateway_asn: The private Autonomous System Number (ASN) for the VPN gateway. Default: - Amazon default ASN.
:param vpn_route_propagation: Where to propagate VPN routes. Default: - On the route tables associated with private subnets. If no private subnets exists, isolated subnets are used. If no isolated subnets exists, public subnets are used.
"""
if isinstance(nat_gateway_subnets, dict):
nat_gateway_subnets = SubnetSelection(**nat_gateway_subnets)
self._values: typing.Dict[str, typing.Any] = {}
if cidr is not None:
self._values["cidr"] = cidr
if default_instance_tenancy is not None:
self._values["default_instance_tenancy"] = default_instance_tenancy
if enable_dns_hostnames is not None:
self._values["enable_dns_hostnames"] = enable_dns_hostnames
if enable_dns_support is not None:
self._values["enable_dns_support"] = enable_dns_support
if flow_logs is not None:
self._values["flow_logs"] = flow_logs
if gateway_endpoints is not None:
self._values["gateway_endpoints"] = gateway_endpoints
if max_azs is not None:
self._values["max_azs"] = max_azs
if nat_gateway_provider is not None:
self._values["nat_gateway_provider"] = nat_gateway_provider
if nat_gateways is not None:
self._values["nat_gateways"] = nat_gateways
if nat_gateway_subnets is not None:
self._values["nat_gateway_subnets"] = nat_gateway_subnets
if subnet_configuration is not None:
self._values["subnet_configuration"] = subnet_configuration
if vpn_connections is not None:
self._values["vpn_connections"] = vpn_connections
if vpn_gateway is not None:
self._values["vpn_gateway"] = vpn_gateway
if vpn_gateway_asn is not None:
self._values["vpn_gateway_asn"] = vpn_gateway_asn
if vpn_route_propagation is not None:
self._values["vpn_route_propagation"] = vpn_route_propagation
@builtins.property
def cidr(self) -> typing.Optional[builtins.str]:
"""The CIDR range to use for the VPC, e.g. '10.0.0.0/16'.
Should be a minimum of /28 and maximum size of /16. The range will be
split across all subnets per Availability Zone.
:default: Vpc.DEFAULT_CIDR_RANGE
"""
result = self._values.get("cidr")
return result
@builtins.property
def default_instance_tenancy(self) -> typing.Optional[DefaultInstanceTenancy]:
"""The default tenancy of instances launched into the VPC.
By setting this to dedicated tenancy, instances will be launched on
hardware dedicated to a single AWS customer, unless specifically specified
at instance launch time. Please note, not all instance types are usable
with Dedicated tenancy.
:default: DefaultInstanceTenancy.Default (shared) tenancy
"""
result = self._values.get("default_instance_tenancy")
return result
@builtins.property
def enable_dns_hostnames(self) -> typing.Optional[builtins.bool]:
"""Indicates whether the instances launched in the VPC get public DNS hostnames.
If this attribute is true, instances in the VPC get public DNS hostnames,
but only if the enableDnsSupport attribute is also set to true.
:default: true
"""
result = self._values.get("enable_dns_hostnames")
return result
@builtins.property
def enable_dns_support(self) -> typing.Optional[builtins.bool]:
"""Indicates whether the DNS resolution is supported for the VPC.
If this attribute is false, the Amazon-provided DNS server in the VPC that
resolves public DNS hostnames to IP addresses is not enabled. If this
attribute is true, queries to the Amazon provided DNS server at the
169.254.169.253 IP address, or the reserved IP address at the base of the
VPC IPv4 network range plus two will succeed.
:default: true
"""
result = self._values.get("enable_dns_support")
return result
@builtins.property
def flow_logs(
self,
) -> typing.Optional[typing.Mapping[builtins.str, FlowLogOptions]]:
"""Flow logs to add to this VPC.
:default: - No flow logs.
"""
result = self._values.get("flow_logs")
return result
@builtins.property
def gateway_endpoints(
self,
) -> typing.Optional[typing.Mapping[builtins.str, GatewayVpcEndpointOptions]]:
"""Gateway endpoints to add to this VPC.
:default: - None.
"""
result = self._values.get("gateway_endpoints")
return result
@builtins.property
def max_azs(self) -> typing.Optional[jsii.Number]:
"""Define the maximum number of AZs to use in this region.
If the region has more AZs than you want to use (for example, because of
EIP limits), pick a lower number here. The AZs will be sorted and picked
from the start of the list.
If you pick a higher number than the number of AZs in the region, all AZs
in the region will be selected. To use "all AZs" available to your
account, use a high number (such as 99).
Be aware that environment-agnostic stacks will be created with access to
only 2 AZs, so to use more than 2 AZs, be sure to specify the account and
region on your stack.
:default: 3
"""
result = self._values.get("max_azs")
return result
@builtins.property
def nat_gateway_provider(self) -> typing.Optional[NatProvider]:
"""(experimental) What type of NAT provider to use.
Select between NAT gateways or NAT instances. NAT gateways
may not be available in all AWS regions.
:default: NatProvider.gateway()
:stability: experimental
"""
result = self._values.get("nat_gateway_provider")
return result
@builtins.property
def nat_gateways(self) -> typing.Optional[jsii.Number]:
"""The number of NAT Gateways/Instances to create.
The type of NAT gateway or instance will be determined by the
``natGatewayProvider`` parameter.
You can set this number lower than the number of Availability Zones in your
VPC in order to save on NAT cost. Be aware you may be charged for
cross-AZ data traffic instead.
:default: - One NAT gateway/instance per Availability Zone
"""
result = self._values.get("nat_gateways")
return result
@builtins.property
def nat_gateway_subnets(self) -> typing.Optional[SubnetSelection]:
"""Configures the subnets which will have NAT Gateways/Instances.
You can pick a specific group of subnets by specifying the group name;
the picked subnets must be public subnets.
Only necessary if you have more than one public subnet group.
:default: - All public subnets.
"""
result = self._values.get("nat_gateway_subnets")
return result
@builtins.property
def subnet_configuration(self) -> typing.Optional[typing.List[SubnetConfiguration]]:
"""Configure the subnets to build for each AZ.
Each entry in this list configures a Subnet Group; each group will contain a
subnet for each Availability Zone.
For example, if you want 1 public subnet, 1 private subnet, and 1 isolated
subnet in each AZ provide the following::
# Example automatically generated. See https://github.com/aws/jsii/issues/826
ec2.Vpc(self, "VPC",
subnet_configuration=[{
"cidr_mask": 24,
"name": "ingress",
"subnet_type": ec2.SubnetType.PUBLIC
}, {
"cidr_mask": 24,
"name": "application",
"subnet_type": ec2.SubnetType.PRIVATE
}, {
"cidr_mask": 28,
"name": "rds",
"subnet_type": ec2.SubnetType.ISOLATED
}
]
)
:default:
- The VPC CIDR will be evenly divided between 1 public and 1
private subnet per AZ.
"""
result = self._values.get("subnet_configuration")
return result
@builtins.property
def vpn_connections(
self,
) -> typing.Optional[typing.Mapping[builtins.str, "VpnConnectionOptions"]]:
"""VPN connections to this VPC.
:default: - No connections.
"""
result = self._values.get("vpn_connections")
return result
@builtins.property
def vpn_gateway(self) -> typing.Optional[builtins.bool]:
"""Indicates whether a VPN gateway should be created and attached to this VPC.
:default: - true when vpnGatewayAsn or vpnConnections is specified
"""
result = self._values.get("vpn_gateway")
return result
@builtins.property
def vpn_gateway_asn(self) -> typing.Optional[jsii.Number]:
"""The private Autonomous System Number (ASN) for the VPN gateway.
:default: - Amazon default ASN.
"""
result = self._values.get("vpn_gateway_asn")
return result
@builtins.property
def vpn_route_propagation(self) -> typing.Optional[typing.List[SubnetSelection]]:
"""Where to propagate VPN routes.
:default:
- On the route tables associated with private subnets. If no
private subnets exists, isolated subnets are used. If no isolated subnets
exists, public subnets are used.
"""
result = self._values.get("vpn_route_propagation")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "VpcProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(IVpnConnection)
class VpnConnection(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.VpnConnection",
):
"""Define a VPN Connection.
:resource: AWS::EC2::VPNConnection
"""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
vpc: IVpc,
ip: builtins.str,
asn: typing.Optional[jsii.Number] = None,
static_routes: typing.Optional[typing.List[builtins.str]] = None,
tunnel_options: typing.Optional[typing.List["VpnTunnelOption"]] = None,
) -> None:
"""
:param scope: -
:param id: -
:param vpc: The VPC to connect to.
:param ip: The ip address of the customer gateway.
:param asn: The ASN of the customer gateway. Default: 65000
:param static_routes: The static routes to be routed from the VPN gateway to the customer gateway. Default: Dynamic routing (BGP)
:param tunnel_options: The tunnel options for the VPN connection. At most two elements (one per tunnel). Duplicates not allowed. Default: Amazon generated tunnel options
"""
props = VpnConnectionProps(
vpc=vpc,
ip=ip,
asn=asn,
static_routes=static_routes,
tunnel_options=tunnel_options,
)
jsii.create(VpnConnection, self, [scope, id, props])
@jsii.member(jsii_name="metricAll")
@builtins.classmethod
def metric_all(
cls,
metric_name: builtins.str,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""Return the given named metric for all VPN connections in the account/region.
:param metric_name: -
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
"""
props = aws_cdk.aws_cloudwatch.MetricOptions(
account=account,
color=color,
dimensions=dimensions,
label=label,
period=period,
region=region,
statistic=statistic,
unit=unit,
)
return jsii.sinvoke(cls, "metricAll", [metric_name, props])
@jsii.member(jsii_name="metricAllTunnelDataIn")
@builtins.classmethod
def metric_all_tunnel_data_in(
cls,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""Metric for the tunnel data in of all VPN connections in the account/region.
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
:default: sum over 5 minutes
"""
props = aws_cdk.aws_cloudwatch.MetricOptions(
account=account,
color=color,
dimensions=dimensions,
label=label,
period=period,
region=region,
statistic=statistic,
unit=unit,
)
return jsii.sinvoke(cls, "metricAllTunnelDataIn", [props])
@jsii.member(jsii_name="metricAllTunnelDataOut")
@builtins.classmethod
def metric_all_tunnel_data_out(
cls,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""Metric for the tunnel data out of all VPN connections.
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
:default: sum over 5 minutes
"""
props = aws_cdk.aws_cloudwatch.MetricOptions(
account=account,
color=color,
dimensions=dimensions,
label=label,
period=period,
region=region,
statistic=statistic,
unit=unit,
)
return jsii.sinvoke(cls, "metricAllTunnelDataOut", [props])
@jsii.member(jsii_name="metricAllTunnelState")
@builtins.classmethod
def metric_all_tunnel_state(
cls,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""Metric for the tunnel state of all VPN connections in the account/region.
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
:default: average over 5 minutes
"""
props = aws_cdk.aws_cloudwatch.MetricOptions(
account=account,
color=color,
dimensions=dimensions,
label=label,
period=period,
region=region,
statistic=statistic,
unit=unit,
)
return jsii.sinvoke(cls, "metricAllTunnelState", [props])
@jsii.member(jsii_name="metric")
def metric(
self,
metric_name: builtins.str,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""Return the given named metric for this VPNConnection.
:param metric_name: -
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
"""
props = aws_cdk.aws_cloudwatch.MetricOptions(
account=account,
color=color,
dimensions=dimensions,
label=label,
period=period,
region=region,
statistic=statistic,
unit=unit,
)
return jsii.invoke(self, "metric", [metric_name, props])
@jsii.member(jsii_name="metricTunnelDataIn")
def metric_tunnel_data_in(
self,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""The bytes received through the VPN tunnel.
Sum over 5 minutes
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
"""
props = aws_cdk.aws_cloudwatch.MetricOptions(
account=account,
color=color,
dimensions=dimensions,
label=label,
period=period,
region=region,
statistic=statistic,
unit=unit,
)
return jsii.invoke(self, "metricTunnelDataIn", [props])
@jsii.member(jsii_name="metricTunnelDataOut")
def metric_tunnel_data_out(
self,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""The bytes sent through the VPN tunnel.
Sum over 5 minutes
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
"""
props = aws_cdk.aws_cloudwatch.MetricOptions(
account=account,
color=color,
dimensions=dimensions,
label=label,
period=period,
region=region,
statistic=statistic,
unit=unit,
)
return jsii.invoke(self, "metricTunnelDataOut", [props])
@jsii.member(jsii_name="metricTunnelState")
def metric_tunnel_state(
self,
*,
account: typing.Optional[builtins.str] = None,
color: typing.Optional[builtins.str] = None,
dimensions: typing.Optional[typing.Mapping[builtins.str, typing.Any]] = None,
label: typing.Optional[builtins.str] = None,
period: typing.Optional[aws_cdk.core.Duration] = None,
region: typing.Optional[builtins.str] = None,
statistic: typing.Optional[builtins.str] = None,
unit: typing.Optional[aws_cdk.aws_cloudwatch.Unit] = None,
) -> aws_cdk.aws_cloudwatch.Metric:
"""The state of the tunnel. 0 indicates DOWN and 1 indicates UP.
Average over 5 minutes
:param account: Account which this metric comes from. Default: - Deployment account.
:param color: The hex color code, prefixed with '#' (e.g. '#00ff00'), to use when this metric is rendered on a graph. The ``Color`` class has a set of standard colors that can be used here. Default: - Automatic color
:param dimensions: Dimensions of the metric. Default: - No dimensions.
:param label: Label for this metric when added to a Graph in a Dashboard. Default: - No label
:param period: The period over which the specified statistic is applied. Default: Duration.minutes(5)
:param region: Region which this metric comes from. Default: - Deployment region.
:param statistic: What function to use for aggregating. Can be one of the following: - "Minimum" | "min" - "Maximum" | "max" - "Average" | "avg" - "Sum" | "sum" - "SampleCount | "n" - "pNN.NN" Default: Average
:param unit: Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
"""
props = aws_cdk.aws_cloudwatch.MetricOptions(
account=account,
color=color,
dimensions=dimensions,
label=label,
period=period,
region=region,
statistic=statistic,
unit=unit,
)
return jsii.invoke(self, "metricTunnelState", [props])
@builtins.property # type: ignore
@jsii.member(jsii_name="customerGatewayAsn")
def customer_gateway_asn(self) -> jsii.Number:
"""The ASN of the customer gateway."""
return jsii.get(self, "customerGatewayAsn")
@builtins.property # type: ignore
@jsii.member(jsii_name="customerGatewayId")
def customer_gateway_id(self) -> builtins.str:
"""The id of the customer gateway."""
return jsii.get(self, "customerGatewayId")
@builtins.property # type: ignore
@jsii.member(jsii_name="customerGatewayIp")
def customer_gateway_ip(self) -> builtins.str:
"""The ip address of the customer gateway."""
return jsii.get(self, "customerGatewayIp")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpnId")
def vpn_id(self) -> builtins.str:
"""The id of the VPN connection."""
return jsii.get(self, "vpnId")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.VpnConnectionOptions",
jsii_struct_bases=[],
name_mapping={
"ip": "ip",
"asn": "asn",
"static_routes": "staticRoutes",
"tunnel_options": "tunnelOptions",
},
)
class VpnConnectionOptions:
def __init__(
self,
*,
ip: builtins.str,
asn: typing.Optional[jsii.Number] = None,
static_routes: typing.Optional[typing.List[builtins.str]] = None,
tunnel_options: typing.Optional[typing.List["VpnTunnelOption"]] = None,
) -> None:
"""
:param ip: The ip address of the customer gateway.
:param asn: The ASN of the customer gateway. Default: 65000
:param static_routes: The static routes to be routed from the VPN gateway to the customer gateway. Default: Dynamic routing (BGP)
:param tunnel_options: The tunnel options for the VPN connection. At most two elements (one per tunnel). Duplicates not allowed. Default: Amazon generated tunnel options
"""
self._values: typing.Dict[str, typing.Any] = {
"ip": ip,
}
if asn is not None:
self._values["asn"] = asn
if static_routes is not None:
self._values["static_routes"] = static_routes
if tunnel_options is not None:
self._values["tunnel_options"] = tunnel_options
@builtins.property
def ip(self) -> builtins.str:
"""The ip address of the customer gateway."""
result = self._values.get("ip")
assert result is not None, "Required property 'ip' is missing"
return result
@builtins.property
def asn(self) -> typing.Optional[jsii.Number]:
"""The ASN of the customer gateway.
:default: 65000
"""
result = self._values.get("asn")
return result
@builtins.property
def static_routes(self) -> typing.Optional[typing.List[builtins.str]]:
"""The static routes to be routed from the VPN gateway to the customer gateway.
:default: Dynamic routing (BGP)
"""
result = self._values.get("static_routes")
return result
@builtins.property
def tunnel_options(self) -> typing.Optional[typing.List["VpnTunnelOption"]]:
"""The tunnel options for the VPN connection.
At most two elements (one per tunnel).
Duplicates not allowed.
:default: Amazon generated tunnel options
"""
result = self._values.get("tunnel_options")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "VpnConnectionOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.VpnConnectionProps",
jsii_struct_bases=[VpnConnectionOptions],
name_mapping={
"ip": "ip",
"asn": "asn",
"static_routes": "staticRoutes",
"tunnel_options": "tunnelOptions",
"vpc": "vpc",
},
)
class VpnConnectionProps(VpnConnectionOptions):
def __init__(
self,
*,
ip: builtins.str,
asn: typing.Optional[jsii.Number] = None,
static_routes: typing.Optional[typing.List[builtins.str]] = None,
tunnel_options: typing.Optional[typing.List["VpnTunnelOption"]] = None,
vpc: IVpc,
) -> None:
"""
:param ip: The ip address of the customer gateway.
:param asn: The ASN of the customer gateway. Default: 65000
:param static_routes: The static routes to be routed from the VPN gateway to the customer gateway. Default: Dynamic routing (BGP)
:param tunnel_options: The tunnel options for the VPN connection. At most two elements (one per tunnel). Duplicates not allowed. Default: Amazon generated tunnel options
:param vpc: The VPC to connect to.
"""
self._values: typing.Dict[str, typing.Any] = {
"ip": ip,
"vpc": vpc,
}
if asn is not None:
self._values["asn"] = asn
if static_routes is not None:
self._values["static_routes"] = static_routes
if tunnel_options is not None:
self._values["tunnel_options"] = tunnel_options
@builtins.property
def ip(self) -> builtins.str:
"""The ip address of the customer gateway."""
result = self._values.get("ip")
assert result is not None, "Required property 'ip' is missing"
return result
@builtins.property
def asn(self) -> typing.Optional[jsii.Number]:
"""The ASN of the customer gateway.
:default: 65000
"""
result = self._values.get("asn")
return result
@builtins.property
def static_routes(self) -> typing.Optional[typing.List[builtins.str]]:
"""The static routes to be routed from the VPN gateway to the customer gateway.
:default: Dynamic routing (BGP)
"""
result = self._values.get("static_routes")
return result
@builtins.property
def tunnel_options(self) -> typing.Optional[typing.List["VpnTunnelOption"]]:
"""The tunnel options for the VPN connection.
At most two elements (one per tunnel).
Duplicates not allowed.
:default: Amazon generated tunnel options
"""
result = self._values.get("tunnel_options")
return result
@builtins.property
def vpc(self) -> IVpc:
"""The VPC to connect to."""
result = self._values.get("vpc")
assert result is not None, "Required property 'vpc' is missing"
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "VpnConnectionProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.VpnConnectionType")
class VpnConnectionType(enum.Enum):
"""The VPN connection type."""
IPSEC_1 = "IPSEC_1"
"""The IPsec 1 VPN connection type."""
DUMMY = "DUMMY"
"""Dummy member TODO: remove once https://github.com/aws/jsii/issues/231 is fixed."""
@jsii.implements(IVpnGateway)
class VpnGateway(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.VpnGateway",
):
"""The VPN Gateway that shall be added to the VPC.
:resource: AWS::EC2::VPNGateway
"""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
type: builtins.str,
amazon_side_asn: typing.Optional[jsii.Number] = None,
) -> None:
"""
:param scope: -
:param id: -
:param type: Default type ipsec.1.
:param amazon_side_asn: Explicitly specify an Asn or let aws pick an Asn for you. Default: 65000
"""
props = VpnGatewayProps(type=type, amazon_side_asn=amazon_side_asn)
jsii.create(VpnGateway, self, [scope, id, props])
@builtins.property # type: ignore
@jsii.member(jsii_name="gatewayId")
def gateway_id(self) -> builtins.str:
"""The virtual private gateway Id."""
return jsii.get(self, "gatewayId")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.VpnGatewayProps",
jsii_struct_bases=[],
name_mapping={"type": "type", "amazon_side_asn": "amazonSideAsn"},
)
class VpnGatewayProps:
def __init__(
self,
*,
type: builtins.str,
amazon_side_asn: typing.Optional[jsii.Number] = None,
) -> None:
"""The VpnGateway Properties.
:param type: Default type ipsec.1.
:param amazon_side_asn: Explicitly specify an Asn or let aws pick an Asn for you. Default: 65000
"""
self._values: typing.Dict[str, typing.Any] = {
"type": type,
}
if amazon_side_asn is not None:
self._values["amazon_side_asn"] = amazon_side_asn
@builtins.property
def type(self) -> builtins.str:
"""Default type ipsec.1."""
result = self._values.get("type")
assert result is not None, "Required property 'type' is missing"
return result
@builtins.property
def amazon_side_asn(self) -> typing.Optional[jsii.Number]:
"""Explicitly specify an Asn or let aws pick an Asn for you.
:default: 65000
"""
result = self._values.get("amazon_side_asn")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "VpnGatewayProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.VpnTunnelOption",
jsii_struct_bases=[],
name_mapping={
"pre_shared_key": "preSharedKey",
"tunnel_inside_cidr": "tunnelInsideCidr",
},
)
class VpnTunnelOption:
def __init__(
self,
*,
pre_shared_key: typing.Optional[builtins.str] = None,
tunnel_inside_cidr: typing.Optional[builtins.str] = None,
) -> None:
"""
:param pre_shared_key: The pre-shared key (PSK) to establish initial authentication between the virtual private gateway and customer gateway. Allowed characters are alphanumeric characters and ._. Must be between 8 and 64 characters in length and cannot start with zero (0). Default: an Amazon generated pre-shared key
:param tunnel_inside_cidr: The range of inside IP addresses for the tunnel. Any specified CIDR blocks must be unique across all VPN connections that use the same virtual private gateway. A size /30 CIDR block from the 169.254.0.0/16 range. Default: an Amazon generated inside IP CIDR
"""
self._values: typing.Dict[str, typing.Any] = {}
if pre_shared_key is not None:
self._values["pre_shared_key"] = pre_shared_key
if tunnel_inside_cidr is not None:
self._values["tunnel_inside_cidr"] = tunnel_inside_cidr
@builtins.property
def pre_shared_key(self) -> typing.Optional[builtins.str]:
"""The pre-shared key (PSK) to establish initial authentication between the virtual private gateway and customer gateway.
Allowed characters are alphanumeric characters
and ._. Must be between 8 and 64 characters in length and cannot start with zero (0).
:default: an Amazon generated pre-shared key
"""
result = self._values.get("pre_shared_key")
return result
@builtins.property
def tunnel_inside_cidr(self) -> typing.Optional[builtins.str]:
"""The range of inside IP addresses for the tunnel.
Any specified CIDR blocks must be
unique across all VPN connections that use the same virtual private gateway.
A size /30 CIDR block from the 169.254.0.0/16 range.
:default: an Amazon generated inside IP CIDR
"""
result = self._values.get("tunnel_inside_cidr")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "VpnTunnelOption(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.WindowsImageProps",
jsii_struct_bases=[],
name_mapping={"user_data": "userData"},
)
class WindowsImageProps:
def __init__(self, *, user_data: typing.Optional[UserData] = None) -> None:
"""Configuration options for WindowsImage.
:param user_data: Initial user data. Default: - Empty UserData for Windows machines
"""
self._values: typing.Dict[str, typing.Any] = {}
if user_data is not None:
self._values["user_data"] = user_data
@builtins.property
def user_data(self) -> typing.Optional[UserData]:
"""Initial user data.
:default: - Empty UserData for Windows machines
"""
result = self._values.get("user_data")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "WindowsImageProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.enum(jsii_type="@aws-cdk/aws-ec2.WindowsVersion")
class WindowsVersion(enum.Enum):
"""The Windows version to use for the WindowsImage."""
WINDOWS_SERVER_2008_SP2_ENGLISH_64BIT_SQL_2008_SP4_EXPRESS = "WINDOWS_SERVER_2008_SP2_ENGLISH_64BIT_SQL_2008_SP4_EXPRESS"
WINDOWS_SERVER_2012_R2_RTM_CHINESE_SIMPLIFIED_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_CHINESE_SIMPLIFIED_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_CHINESE_TRADITIONAL_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_CHINESE_TRADITIONAL_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_DUTCH_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_DUTCH_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP2_ENTERPRISE = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP2_ENTERPRISE"
WINDOWS_SERVER_2012_R2_RTM_HUNGARIAN_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_HUNGARIAN_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_BASE"
WINDOWS_SERVER_2016_ENGLISH_CORE_CONTAINERS = "WINDOWS_SERVER_2016_ENGLISH_CORE_CONTAINERS"
WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP1_WEB = "WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP1_WEB"
WINDOWS_SERVER_2016_GERMAL_FULL_BASE = "WINDOWS_SERVER_2016_GERMAL_FULL_BASE"
WINDOWS_SERVER_2003_R2_SP2_LANGUAGE_PACKS_32BIT_BASE = "WINDOWS_SERVER_2003_R2_SP2_LANGUAGE_PACKS_32BIT_BASE"
WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2008_R2_SP3_WEB = "WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2008_R2_SP3_WEB"
WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_EXPRESS = "WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_EXPRESS"
WINDOWS_SERVER_2012_R2_SP1_PORTUGESE_BRAZIL_64BIT_CORE = "WINDOWS_SERVER_2012_R2_SP1_PORTUGESE_BRAZIL_64BIT_CORE"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP2_STANDARD = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP2_STANDARD"
WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP2_EXPRESS = "WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP2_EXPRESS"
WINDOWS_SERVER_2012_RTM_ITALIAN_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_ITALIAN_64BIT_BASE"
WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP1_EXPRESS = "WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP1_EXPRESS"
WINDOWS_SERVER_2016_ENGLISH_DEEP_LEARNING = "WINDOWS_SERVER_2016_ENGLISH_DEEP_LEARNING"
WINDOWS_SERVER_2019_ITALIAN_FULL_BASE = "WINDOWS_SERVER_2019_ITALIAN_FULL_BASE"
WINDOWS_SERVER_2008_R2_SP1_KOREAN_64BIT_BASE = "WINDOWS_SERVER_2008_R2_SP1_KOREAN_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP1_EXPRESS = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP1_EXPRESS"
WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP2_WEB = "WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP2_WEB"
WINDOWS_SERVER_2016_JAPANESE_FULL_FQL_2016_SP2_WEB = "WINDOWS_SERVER_2016_JAPANESE_FULL_FQL_2016_SP2_WEB"
WINDOWS_SERVER_2016_KOREAN_FULL_BASE = "WINDOWS_SERVER_2016_KOREAN_FULL_BASE"
WINDOWS_SERVER_2016_KOREAN_FULL_SQL_2016_SP2_STANDARD = "WINDOWS_SERVER_2016_KOREAN_FULL_SQL_2016_SP2_STANDARD"
WINDOWS_SERVER_2016_PORTUGESE_PORTUGAL_FULL_BASE = "WINDOWS_SERVER_2016_PORTUGESE_PORTUGAL_FULL_BASE"
WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_WEB = "WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_WEB"
WINDOWS_SERVER_2019_FRENCH_FULL_BASE = "WINDOWS_SERVER_2019_FRENCH_FULL_BASE"
WINDOWS_SERVER_2019_KOREAN_FULL_BASE = "WINDOWS_SERVER_2019_KOREAN_FULL_BASE"
WINDOWS_SERVER_2008_R2_SP1_CHINESE_HONG_KONG_SAR_64BIT_BASE = "WINDOWS_SERVER_2008_R2_SP1_CHINESE_HONG_KONG_SAR_64BIT_BASE"
WINDOWS_SERVER_2008_R2_SP1_CHINESE_PRC_64BIT_BASE = "WINDOWS_SERVER_2008_R2_SP1_CHINESE_PRC_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_FRENCH_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_FRENCH_64BIT_BASE"
WINDOWS_SERVER_2016_ENGLISH_FULL_CONTAINERS = "WINDOWS_SERVER_2016_ENGLISH_FULL_CONTAINERS"
WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_STANDARD = "WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_STANDARD"
WINDOWS_SERVER_2016_RUSSIAN_FULL_BASE = "WINDOWS_SERVER_2016_RUSSIAN_FULL_BASE"
WINDOWS_SERVER_2019_CHINESE_SIMPLIFIED_FULL_BASE = "WINDOWS_SERVER_2019_CHINESE_SIMPLIFIED_FULL_BASE"
WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2016_SP2_STANDARD = "WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2016_SP2_STANDARD"
WINDOWS_SERVER_2019_HUNGARIAN_FULL_BASE = "WINDOWS_SERVER_2019_HUNGARIAN_FULL_BASE"
WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2008_R2_SP3_EXPRESS = "WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2008_R2_SP3_EXPRESS"
WINDOWS_SERVER_2007_R2_SP1_LANGUAGE_PACKS_64BIT_BASE = "WINDOWS_SERVER_2007_R2_SP1_LANGUAGE_PACKS_64BIT_BASE"
WINDOWS_SERVER_2008_SP2_ENGLISH_32BIT_BASE = "WINDOWS_SERVER_2008_SP2_ENGLISH_32BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2012_SP4_ENTERPRISE = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2012_SP4_ENTERPRISE"
WINDOWS_SERVER_2012_RTM_CHINESE_TRADITIONAL_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_CHINESE_TRADITIONAL_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2008_R2_SP3_EXPRESS = "WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2008_R2_SP3_EXPRESS"
WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP2_STANDARD = "WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP2_STANDARD"
WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP2_EXPRESS = "WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP2_EXPRESS"
WINDOWS_SERVER_2016_POLISH_FULL_BASE = "WINDOWS_SERVER_2016_POLISH_FULL_BASE"
WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2016_SP2_WEB = "WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2016_SP2_WEB"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP3_STANDARD = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP3_STANDARD"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP2_EXPRESS = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP2_EXPRESS"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_DEEP_LEARNING = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_DEEP_LEARNING"
WINDOWS_SERVER_2012_R2_RTM_GERMAN_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_GERMAN_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_EXPRESS = "WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_EXPRESS"
WINDOWS_SERVER_2012_R2_RTM_RUSSIAN_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_RUSSIAN_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_CHINESE_TRADITIONAL_HONG_KONG_SAR_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_CHINESE_TRADITIONAL_HONG_KONG_SAR_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_HUNGARIAN_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_HUNGARIAN_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP3_STANDARD = "WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP3_STANDARD"
WINDOWS_SERVER_2019_ENGLISH_FULL_HYPERV = "WINDOWS_SERVER_2019_ENGLISH_FULL_HYPERV"
WINDOWS_SERVER_2003_R2_SP2_ENGLISH_64BIT_SQL_2005_SP4_EXPRESS = "WINDOWS_SERVER_2003_R2_SP2_ENGLISH_64BIT_SQL_2005_SP4_EXPRESS"
WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2012_SP4_EXPRESS = "WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2012_SP4_EXPRESS"
WINDOWS_SERVER_2012_RTM_GERMAN_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_GERMAN_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2008_R2_SP3_STANDARD = "WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2008_R2_SP3_STANDARD"
WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP2_STANDARD = "WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP2_STANDARD"
WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_EXPRESS = "WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_EXPRESS"
WINDOWS_SERVER_2019_JAPANESE_FULL_BASE = "WINDOWS_SERVER_2019_JAPANESE_FULL_BASE"
WINDOWS_SERVER_2019_RUSSIAN_FULL_BASE = "WINDOWS_SERVER_2019_RUSSIAN_FULL_BASE"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP2_STANDARD = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP2_STANDARD"
WINDOWS_SERVER_2012_R2_RTM_ITALIAN_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_ITALIAN_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2008_R2_SP3_STANDARD = "WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2008_R2_SP3_STANDARD"
WINDOWS_SERVER_2016_ENGLISH_FULL_HYPERV = "WINDOWS_SERVER_2016_ENGLISH_FULL_HYPERV"
WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP2_ENTERPRISE = "WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP2_ENTERPRISE"
WINDOWS_SERVER_2019_CHINESE_TRADITIONAL_FULL_BASE = "WINDOWS_SERVER_2019_CHINESE_TRADITIONAL_FULL_BASE"
WINDOWS_SERVER_2019_ENGLISH_CORE_BASE = "WINDOWS_SERVER_2019_ENGLISH_CORE_BASE"
WINDOWS_SERVER_2019_ENGLISH_CORE_CONTAINERSLATEST = "WINDOWS_SERVER_2019_ENGLISH_CORE_CONTAINERSLATEST"
WINDOWS_SERVER_2008_SP2_ENGLISH_64BIT_BASE = "WINDOWS_SERVER_2008_SP2_ENGLISH_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_FRENCH_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_FRENCH_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_POLISH_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_POLISH_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2012_SP4_EXPRESS = "WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2012_SP4_EXPRESS"
WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP3_STANDARD = "WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP3_STANDARD"
WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_2012_SP4_STANDARD = "WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_2012_SP4_STANDARD"
WINDOWS_SERVER_2016_ENGLISH_CORE_CONTAINERSLATEST = "WINDOWS_SERVER_2016_ENGLISH_CORE_CONTAINERSLATEST"
WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2016_SP2_EXPRESS = "WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2016_SP2_EXPRESS"
WINDOWS_SERVER_2019_TURKISH_FULL_BASE = "WINDOWS_SERVER_2019_TURKISH_FULL_BASE"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP2_EXPRESS = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP2_EXPRESS"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP3_WEB = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP3_WEB"
WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_WEB = "WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_WEB"
WINDOWS_SERVER_2012_R2_RTM_PORTUGESE_BRAZIL_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_PORTUGESE_BRAZIL_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_PORTUGESE_PORTUGAL_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_PORTUGESE_PORTUGAL_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_SWEDISH_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_SWEDISH_64BIT_BASE"
WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_EXPRESS = "WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_EXPRESS"
WINDOWS_SERVER_2016_ITALIAN_FULL_BASE = "WINDOWS_SERVER_2016_ITALIAN_FULL_BASE"
WINDOWS_SERVER_2016_SPANISH_FULL_BASE = "WINDOWS_SERVER_2016_SPANISH_FULL_BASE"
WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_STANDARD = "WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_STANDARD"
WINDOWS_SERVER_2003_R2_SP2_LANGUAGE_PACKS_64BIT_SQL_2005_SP4_STANDARD = "WINDOWS_SERVER_2003_R2_SP2_LANGUAGE_PACKS_64BIT_SQL_2005_SP4_STANDARD"
WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2008_R2_SP3_STANDARD = "WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2008_R2_SP3_STANDARD"
WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_STANDARD = "WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_STANDARD"
WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2007_R2_SP3_WEB = "WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2007_R2_SP3_WEB"
WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP2_WEB = "WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP2_WEB"
WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_ENTERPRISE = "WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_ENTERPRISE"
WINDOWS_SERVER_2016_PORTUGESE_BRAZIL_FULL_BASE = "WINDOWS_SERVER_2016_PORTUGESE_BRAZIL_FULL_BASE"
WINDOWS_SERVER_2019_ENGLISH_FULL_BASE = "WINDOWS_SERVER_2019_ENGLISH_FULL_BASE"
WINDOWS_SERVER_2003_R2_SP2_ENGLISH_32BIT_BASE = "WINDOWS_SERVER_2003_R2_SP2_ENGLISH_32BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_CZECH_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_CZECH_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP1_STANDARD = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP1_STANDARD"
WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP2_EXPRESS = "WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP2_EXPRESS"
WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2012_SP4_STANDARD = "WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2012_SP4_STANDARD"
WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP1_ENTERPRISE = "WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP1_ENTERPRISE"
WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP1_WEB = "WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP1_WEB"
WINDOWS_SERVER_2016_SWEDISH_FULL_BASE = "WINDOWS_SERVER_2016_SWEDISH_FULL_BASE"
WINDOWS_SERVER_2016_TURKISH_FULL_BASE = "WINDOWS_SERVER_2016_TURKISH_FULL_BASE"
WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_CORE_SQL_2012_SP4_STANDARD = "WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_CORE_SQL_2012_SP4_STANDARD"
WINDOWS_SERVER_2008_R2_SP1_LANGUAGE_PACKS_64BIT_SQL_2008_R2_SP3_STANDARD = "WINDOWS_SERVER_2008_R2_SP1_LANGUAGE_PACKS_64BIT_SQL_2008_R2_SP3_STANDARD"
WINDOWS_SERVER_2012_RTM_CZECH_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_CZECH_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_TURKISH_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_TURKISH_64BIT_BASE"
WINDOWS_SERVER_2016_DUTCH_FULL_BASE = "WINDOWS_SERVER_2016_DUTCH_FULL_BASE"
WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP2_EXPRESS = "WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP2_EXPRESS"
WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2017_ENTERPRISE = "WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2017_ENTERPRISE"
WINDOWS_SERVER_2016_HUNGARIAN_FULL_BASE = "WINDOWS_SERVER_2016_HUNGARIAN_FULL_BASE"
WINDOWS_SERVER_2016_KOREAN_FULL_SQL_2016_SP1_STANDARD = "WINDOWS_SERVER_2016_KOREAN_FULL_SQL_2016_SP1_STANDARD"
WINDOWS_SERVER_2019_SPANISH_FULL_BASE = "WINDOWS_SERVER_2019_SPANISH_FULL_BASE"
WINDOWS_SERVER_2003_R2_SP2_ENGLISH_64BIT_BASE = "WINDOWS_SERVER_2003_R2_SP2_ENGLISH_64BIT_BASE"
WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_BASE = "WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_BASE"
WINDOWS_SERVER_2008_R2_SP1_LANGUAGE_PACKS_64BIT_SQL_2008_R2_SP3_EXPRESS = "WINDOWS_SERVER_2008_R2_SP1_LANGUAGE_PACKS_64BIT_SQL_2008_R2_SP3_EXPRESS"
WINDOWS_SERVER_2012_SP2_PORTUGESE_BRAZIL_64BIT_BASE = "WINDOWS_SERVER_2012_SP2_PORTUGESE_BRAZIL_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP1_WEB = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP1_WEB"
WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP3_EXPRESS = "WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP3_EXPRESS"
WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP2_ENTERPRISE = "WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP2_ENTERPRISE"
WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_BASE"
WINDOWS_SERVER_2019_ENGLISH_FULL_CONTAINERSLATEST = "WINDOWS_SERVER_2019_ENGLISH_FULL_CONTAINERSLATEST"
WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_ENTERPRISE = "WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_ENTERPRISE"
WINDOWS_SERVER_1709_ENGLISH_CORE_CONTAINERSLATEST = "WINDOWS_SERVER_1709_ENGLISH_CORE_CONTAINERSLATEST"
WINDOWS_SERVER_1803_ENGLISH_CORE_BASE = "WINDOWS_SERVER_1803_ENGLISH_CORE_BASE"
WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_WEB = "WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_WEB"
WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_BASE = "WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_BASE"
WINDOWS_SERVER_2008_SP2_ENGLISH_64BIT_SQL_2008_SP4_STANDARD = "WINDOWS_SERVER_2008_SP2_ENGLISH_64BIT_SQL_2008_SP4_STANDARD"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_PORTUGESE_BRAZIL_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_PORTUGESE_BRAZIL_64BIT_BASE"
WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_WEB = "WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_WEB"
WINDOWS_SERVER_2016_ENGLISH_P3 = "WINDOWS_SERVER_2016_ENGLISH_P3"
WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP1_ENTERPRISE = "WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP1_ENTERPRISE"
WINDOWS_SERVER_2003_R2_SP2_LANGUAGE_PACKS_64BIT_BASE = "WINDOWS_SERVER_2003_R2_SP2_LANGUAGE_PACKS_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_CHINESE_TRADITIONAL_HONG_KONG_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_CHINESE_TRADITIONAL_HONG_KONG_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP3_EXPRESS = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP3_EXPRESS"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP2_ENTERPRISE = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP2_ENTERPRISE"
WINDOWS_SERVER_2012_RTM_CHINESE_SIMPLIFIED_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_CHINESE_SIMPLIFIED_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2012_SP4_WEB = "WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2012_SP4_WEB"
WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP3_WEB = "WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP3_WEB"
WINDOWS_SERVER_2016_JAPANESE_FULL_BASE = "WINDOWS_SERVER_2016_JAPANESE_FULL_BASE"
WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP1_EXPRESS = "WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP1_EXPRESS"
WINDOWS_SERVER_1803_ENGLISH_CORE_CONTAINERSLATEST = "WINDOWS_SERVER_1803_ENGLISH_CORE_CONTAINERSLATEST"
WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2012_SP4_STANDARD = "WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2012_SP4_STANDARD"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_CORE = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_CORE"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP2_WEB = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP2_WEB"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP3_ENTERPRISE = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP3_ENTERPRISE"
WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP2_STANDARD = "WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP2_STANDARD"
WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_2014_SP3_WEB = "WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_2014_SP3_WEB"
WINDOWS_SERVER_2012_RTM_SWEDISH_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_SWEDISH_64BIT_BASE"
WINDOWS_SERVER_2016_CHINESE_SIMPLIFIED_FULL_BASE = "WINDOWS_SERVER_2016_CHINESE_SIMPLIFIED_FULL_BASE"
WINDOWS_SERVER_2019_POLISH_FULL_BASE = "WINDOWS_SERVER_2019_POLISH_FULL_BASE"
WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2008_R2_SP3_WEB = "WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2008_R2_SP3_WEB"
WINDOWS_SERVER_2008_R2_SP1_PORTUGESE_BRAZIL_64BIT_BASE = "WINDOWS_SERVER_2008_R2_SP1_PORTUGESE_BRAZIL_64BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_ENTERPRISE = "WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_ENTERPRISE"
WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2016_SP2_EXPRESS = "WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2016_SP2_EXPRESS"
WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP3_EXPRESS = "WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP3_EXPRESS"
WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP2_STANDARD = "WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP2_STANDARD"
WINDOWS_SERVER_2016_ENGLISH_CORE_BASE = "WINDOWS_SERVER_2016_ENGLISH_CORE_BASE"
WINDOWS_SERVER_2016_ENGLISH_FULL_BASE = "WINDOWS_SERVER_2016_ENGLISH_FULL_BASE"
WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2017_WEB = "WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2017_WEB"
WINDOWS_SERVER_2019_GERMAN_FULL_BASE = "WINDOWS_SERVER_2019_GERMAN_FULL_BASE"
WINDOWS_SERVER_2003_R2_SP2_ENGLISH_64BIT_SQL_2005_SP4_STANDARD = "WINDOWS_SERVER_2003_R2_SP2_ENGLISH_64BIT_SQL_2005_SP4_STANDARD"
WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_ENTERPRISE = "WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_ENTERPRISE"
WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2008_R2_SP3_EXPRESS = "WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2008_R2_SP3_EXPRESS"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP1_ENTERPRISE = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP1_ENTERPRISE"
WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP2_WEB = "WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP2_WEB"
WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2008_R2_SP3_EXPRESS = "WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2008_R2_SP3_EXPRESS"
WINDOWS_SERVER_2016_FRENCH_FULL_BASE = "WINDOWS_SERVER_2016_FRENCH_FULL_BASE"
WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP2_ENTERPRISE = "WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP2_ENTERPRISE"
WINDOWS_SERVER_2019_CZECH_FULL_BASE = "WINDOWS_SERVER_2019_CZECH_FULL_BASE"
WINDOWS_SERVER_1809_ENGLISH_CORE_BASE = "WINDOWS_SERVER_1809_ENGLISH_CORE_BASE"
WINDOWS_SERVER_1809_ENGLISH_CORE_CONTAINERSLATEST = "WINDOWS_SERVER_1809_ENGLISH_CORE_CONTAINERSLATEST"
WINDOWS_SERVER_2003_R2_SP2_LANGUAGE_PACKS_64BIT_SQL_2005_SP4_EXPRESS = "WINDOWS_SERVER_2003_R2_SP2_LANGUAGE_PACKS_64BIT_SQL_2005_SP4_EXPRESS"
WINDOWS_SERVER_2012_R2_RTM_TURKISH_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_TURKISH_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2012_SP4_WEB = "WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2012_SP4_WEB"
WINDOWS_SERVER_2012_RTM_POLISH_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_POLISH_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_SPANISH_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_SPANISH_64BIT_BASE"
WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_ENTERPRISE = "WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_ENTERPRISE"
WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP2_EXPRESS = "WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP2_EXPRESS"
WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2016_SP2_ENTERPRISE = "WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2016_SP2_ENTERPRISE"
WINDOWS_SERVER_1709_ENGLISH_CORE_BASE = "WINDOWS_SERVER_1709_ENGLISH_CORE_BASE"
WINDOWS_SERVER_2008_R2_SP1_ENGLISH_61BIT_SQL_2012_RTM_SP2_ENTERPRISE = "WINDOWS_SERVER_2008_R2_SP1_ENGLISH_61BIT_SQL_2012_RTM_SP2_ENTERPRISE"
WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_STANDARD = "WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_STANDARD"
WINDOWS_SERVER_2008_SP2_PORTUGESE_BRAZIL_32BIT_BASE = "WINDOWS_SERVER_2008_SP2_PORTUGESE_BRAZIL_32BIT_BASE"
WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP2_STANDARD = "WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP2_STANDARD"
WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2012_SP4_EXPRESS = "WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2012_SP4_EXPRESS"
WINDOWS_SERVER_2012_RTM_PORTUGESE_PORTUGAL_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_PORTUGESE_PORTUGAL_64BIT_BASE"
WINDOWS_SERVER_2016_CZECH_FULL_BASE = "WINDOWS_SERVER_2016_CZECH_FULL_BASE"
WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP1_STANDARD = "WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP1_STANDARD"
WINDOWS_SERVER_2019_DUTCH_FULL_BASE = "WINDOWS_SERVER_2019_DUTCH_FULL_BASE"
WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_CORE = "WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_CORE"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP2_WEB = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP2_WEB"
WINDOWS_SERVER_2012_R2_RTM_KOREAN_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_KOREAN_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_DUTCH_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_DUTCH_64BIT_BASE"
WINDOWS_SERVER_2016_ENGLISH_64BIT_SQL_2012_SP4_ENTERPRISE = "WINDOWS_SERVER_2016_ENGLISH_64BIT_SQL_2012_SP4_ENTERPRISE"
WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP1_STANDARD = "WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP1_STANDARD"
WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_EXPRESS = "WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_EXPRESS"
WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_WEB = "WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_WEB"
WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2017_STANDARD = "WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2017_STANDARD"
WINDOWS_SERVER_2019_PORTUGESE_BRAZIL_FULL_BASE = "WINDOWS_SERVER_2019_PORTUGESE_BRAZIL_FULL_BASE"
WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2008_R2_SP3_STANDARD = "WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2008_R2_SP3_STANDARD"
WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SHAREPOINT_2010_SP2_FOUNDATION = "WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SHAREPOINT_2010_SP2_FOUNDATION"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_P3 = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_P3"
WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP3_STANDARD = "WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP3_STANDARD"
WINDOWS_SERVER_2012_R2_RTM_SPANISH_64BIT_BASE = "WINDOWS_SERVER_2012_R2_RTM_SPANISH_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP3_EXPRESS = "WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP3_EXPRESS"
WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_STANDARD = "WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_STANDARD"
WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP2_STANDARD = "WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP2_STANDARD"
WINDOWS_SERVER_2019_PORTUGESE_PORTUGAL_FULL_BASE = "WINDOWS_SERVER_2019_PORTUGESE_PORTUGAL_FULL_BASE"
WINDOWS_SERVER_2019_SWEDISH_FULL_BASE = "WINDOWS_SERVER_2019_SWEDISH_FULL_BASE"
WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_HYPERV = "WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_HYPERV"
WINDOWS_SERVER_2012_RTM_KOREAN_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_KOREAN_64BIT_BASE"
WINDOWS_SERVER_2012_RTM_RUSSIAN_64BIT_BASE = "WINDOWS_SERVER_2012_RTM_RUSSIAN_64BIT_BASE"
WINDOWS_SERVER_2016_CHINESE_TRADITIONAL_FULL_BASE = "WINDOWS_SERVER_2016_CHINESE_TRADITIONAL_FULL_BASE"
WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP2_WEB = "WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP2_WEB"
WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2017_EXPRESS = "WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2017_EXPRESS"
@jsii.implements(IInstance)
class BastionHostLinux(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.BastionHostLinux",
):
"""(experimental) This creates a linux bastion host you can use to connect to other instances or services in your VPC.
The recommended way to connect to the bastion host is by using AWS Systems Manager Session Manager.
The operating system is Amazon Linux 2 with the latest SSM agent installed
You can also configure this bastion host to allow connections via SSH
:stability: experimental
:resource: AWS::EC2::Instance
"""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
vpc: IVpc,
availability_zone: typing.Optional[builtins.str] = None,
block_devices: typing.Optional[typing.List[BlockDevice]] = None,
instance_name: typing.Optional[builtins.str] = None,
instance_type: typing.Optional[InstanceType] = None,
machine_image: typing.Optional[IMachineImage] = None,
security_group: typing.Optional[ISecurityGroup] = None,
subnet_selection: typing.Optional[SubnetSelection] = None,
) -> None:
"""
:param scope: -
:param id: -
:param vpc: (experimental) VPC to launch the instance in.
:param availability_zone: (experimental) In which AZ to place the instance within the VPC. Default: - Random zone.
:param block_devices: (experimental) Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched. Default: - Uses the block device mapping of the AMI
:param instance_name: (experimental) The name of the instance. Default: 'BastionHost'
:param instance_type: (experimental) Type of instance to launch. Default: 't3.nano'
:param machine_image: (experimental) The machine image to use, assumed to have SSM Agent preinstalled. Default: - An Amazon Linux 2 image which is kept up-to-date automatically (the instance may be replaced on every deployment) and already has SSM Agent installed.
:param security_group: (experimental) Security Group to assign to this instance. Default: - create new security group with no inbound and all outbound traffic allowed
:param subnet_selection: (experimental) Select the subnets to run the bastion host in. Set this to PUBLIC if you need to connect to this instance via the internet and cannot use SSM. You have to allow port 22 manually by using the connections field Default: - private subnets of the supplied VPC
:stability: experimental
"""
props = BastionHostLinuxProps(
vpc=vpc,
availability_zone=availability_zone,
block_devices=block_devices,
instance_name=instance_name,
instance_type=instance_type,
machine_image=machine_image,
security_group=security_group,
subnet_selection=subnet_selection,
)
jsii.create(BastionHostLinux, self, [scope, id, props])
@jsii.member(jsii_name="allowSshAccessFrom")
def allow_ssh_access_from(self, *peer: IPeer) -> None:
"""(experimental) Allow SSH access from the given peer or peers.
Necessary if you want to connect to the instance using ssh. If not
called, you should use SSM Session Manager to connect to the instance.
:param peer: -
:stability: experimental
"""
return jsii.invoke(self, "allowSshAccessFrom", [*peer])
@builtins.property # type: ignore
@jsii.member(jsii_name="connections")
def connections(self) -> "Connections":
"""(experimental) Allows specify security group connections for the instance.
:stability: experimental
"""
return jsii.get(self, "connections")
@builtins.property # type: ignore
@jsii.member(jsii_name="grantPrincipal")
def grant_principal(self) -> aws_cdk.aws_iam.IPrincipal:
"""(experimental) The principal to grant permissions to.
:stability: experimental
"""
return jsii.get(self, "grantPrincipal")
@builtins.property # type: ignore
@jsii.member(jsii_name="instance")
def instance(self) -> Instance:
"""(experimental) The underlying instance resource.
:stability: experimental
"""
return jsii.get(self, "instance")
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceAvailabilityZone")
def instance_availability_zone(self) -> builtins.str:
"""(experimental) The availability zone the instance was launched in.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "instanceAvailabilityZone")
@builtins.property # type: ignore
@jsii.member(jsii_name="instanceId")
def instance_id(self) -> builtins.str:
"""(experimental) The instance's ID.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "instanceId")
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePrivateDnsName")
def instance_private_dns_name(self) -> builtins.str:
"""(experimental) Private DNS name for this instance.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "instancePrivateDnsName")
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePrivateIp")
def instance_private_ip(self) -> builtins.str:
"""(experimental) Private IP for this instance.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "instancePrivateIp")
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePublicDnsName")
def instance_public_dns_name(self) -> builtins.str:
"""(experimental) Publicly-routable DNS name for this instance.
(May be an empty string if the instance does not have a public name).
:stability: experimental
:attribute: true
"""
return jsii.get(self, "instancePublicDnsName")
@builtins.property # type: ignore
@jsii.member(jsii_name="instancePublicIp")
def instance_public_ip(self) -> builtins.str:
"""(experimental) Publicly-routable IP address for this instance.
(May be an empty string if the instance does not have a public IP).
:stability: experimental
:attribute: true
"""
return jsii.get(self, "instancePublicIp")
@builtins.property # type: ignore
@jsii.member(jsii_name="role")
def role(self) -> aws_cdk.aws_iam.IRole:
"""(experimental) The IAM role assumed by the instance.
:stability: experimental
"""
return jsii.get(self, "role")
@builtins.property # type: ignore
@jsii.member(jsii_name="stack")
def stack(self) -> aws_cdk.core.Stack:
"""(experimental) The stack in which this resource is defined.
:stability: experimental
"""
return jsii.get(self, "stack")
@jsii.implements(IConnectable)
class Connections(metaclass=jsii.JSIIMeta, jsii_type="@aws-cdk/aws-ec2.Connections"):
"""Manage the allowed network connections for constructs with Security Groups.
Security Groups can be thought of as a firewall for network-connected
devices. This class makes it easy to allow network connections to and
from security groups, and between security groups individually. When
establishing connectivity between security groups, it will automatically
add rules in both security groups
This object can manage one or more security groups.
"""
def __init__(
self,
*,
default_port: typing.Optional[Port] = None,
peer: typing.Optional[IPeer] = None,
security_groups: typing.Optional[typing.List[ISecurityGroup]] = None,
) -> None:
"""
:param default_port: Default port range for initiating connections to and from this object. Default: - No default port
:param peer: Class that represents the rule by which others can connect to this connectable. This object is required, but will be derived from securityGroup if that is passed. Default: Derived from securityGroup if set.
:param security_groups: What securityGroup(s) this object is managing connections for. Default: No security groups
"""
props = ConnectionsProps(
default_port=default_port, peer=peer, security_groups=security_groups
)
jsii.create(Connections, self, [props])
@jsii.member(jsii_name="addSecurityGroup")
def add_security_group(self, *security_groups: ISecurityGroup) -> None:
"""Add a security group to the list of security groups managed by this object.
:param security_groups: -
"""
return jsii.invoke(self, "addSecurityGroup", [*security_groups])
@jsii.member(jsii_name="allowDefaultPortFrom")
def allow_default_port_from(
self,
other: IConnectable,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Allow connections from the peer on our default port.
Even if the peer has a default port, we will always use our default port.
:param other: -
:param description: -
"""
return jsii.invoke(self, "allowDefaultPortFrom", [other, description])
@jsii.member(jsii_name="allowDefaultPortFromAnyIpv4")
def allow_default_port_from_any_ipv4(
self,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Allow default connections from all IPv4 ranges.
:param description: -
"""
return jsii.invoke(self, "allowDefaultPortFromAnyIpv4", [description])
@jsii.member(jsii_name="allowDefaultPortInternally")
def allow_default_port_internally(
self,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Allow hosts inside the security group to connect to each other.
:param description: -
"""
return jsii.invoke(self, "allowDefaultPortInternally", [description])
@jsii.member(jsii_name="allowDefaultPortTo")
def allow_default_port_to(
self,
other: IConnectable,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Allow connections from the peer on our default port.
Even if the peer has a default port, we will always use our default port.
:param other: -
:param description: -
"""
return jsii.invoke(self, "allowDefaultPortTo", [other, description])
@jsii.member(jsii_name="allowFrom")
def allow_from(
self,
other: IConnectable,
port_range: Port,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Allow connections from the peer on the given port.
:param other: -
:param port_range: -
:param description: -
"""
return jsii.invoke(self, "allowFrom", [other, port_range, description])
@jsii.member(jsii_name="allowFromAnyIpv4")
def allow_from_any_ipv4(
self,
port_range: Port,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Allow from any IPv4 ranges.
:param port_range: -
:param description: -
"""
return jsii.invoke(self, "allowFromAnyIpv4", [port_range, description])
@jsii.member(jsii_name="allowInternally")
def allow_internally(
self,
port_range: Port,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Allow hosts inside the security group to connect to each other on the given port.
:param port_range: -
:param description: -
"""
return jsii.invoke(self, "allowInternally", [port_range, description])
@jsii.member(jsii_name="allowTo")
def allow_to(
self,
other: IConnectable,
port_range: Port,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Allow connections to the peer on the given port.
:param other: -
:param port_range: -
:param description: -
"""
return jsii.invoke(self, "allowTo", [other, port_range, description])
@jsii.member(jsii_name="allowToAnyIpv4")
def allow_to_any_ipv4(
self,
port_range: Port,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Allow to all IPv4 ranges.
:param port_range: -
:param description: -
"""
return jsii.invoke(self, "allowToAnyIpv4", [port_range, description])
@jsii.member(jsii_name="allowToDefaultPort")
def allow_to_default_port(
self,
other: IConnectable,
description: typing.Optional[builtins.str] = None,
) -> None:
"""Allow connections to the security group on their default port.
:param other: -
:param description: -
"""
return jsii.invoke(self, "allowToDefaultPort", [other, description])
@builtins.property # type: ignore
@jsii.member(jsii_name="connections")
def connections(self) -> "Connections":
return jsii.get(self, "connections")
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroups")
def security_groups(self) -> typing.List[ISecurityGroup]:
return jsii.get(self, "securityGroups")
@builtins.property # type: ignore
@jsii.member(jsii_name="defaultPort")
def default_port(self) -> typing.Optional[Port]:
"""The default port configured for this connection peer, if available."""
return jsii.get(self, "defaultPort")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.EbsDeviceOptions",
jsii_struct_bases=[EbsDeviceOptionsBase],
name_mapping={
"delete_on_termination": "deleteOnTermination",
"iops": "iops",
"volume_type": "volumeType",
"encrypted": "encrypted",
},
)
class EbsDeviceOptions(EbsDeviceOptionsBase):
def __init__(
self,
*,
delete_on_termination: typing.Optional[builtins.bool] = None,
iops: typing.Optional[jsii.Number] = None,
volume_type: typing.Optional[EbsDeviceVolumeType] = None,
encrypted: typing.Optional[builtins.bool] = None,
) -> None:
"""Block device options for an EBS volume.
:param delete_on_termination: Indicates whether to delete the volume when the instance is terminated. Default: - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)
:param iops: The number of I/O operations per second (IOPS) to provision for the volume. Must only be set for {@link volumeType}: {@link EbsDeviceVolumeType.IO1} The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS, you need at least 100 GiB storage on the volume. Default: - none, required for {@link EbsDeviceVolumeType.IO1}
:param volume_type: The EBS volume type. Default: {@link EbsDeviceVolumeType.GP2}
:param encrypted: Specifies whether the EBS volume is encrypted. Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption Default: false
"""
self._values: typing.Dict[str, typing.Any] = {}
if delete_on_termination is not None:
self._values["delete_on_termination"] = delete_on_termination
if iops is not None:
self._values["iops"] = iops
if volume_type is not None:
self._values["volume_type"] = volume_type
if encrypted is not None:
self._values["encrypted"] = encrypted
@builtins.property
def delete_on_termination(self) -> typing.Optional[builtins.bool]:
"""Indicates whether to delete the volume when the instance is terminated.
:default: - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)
"""
result = self._values.get("delete_on_termination")
return result
@builtins.property
def iops(self) -> typing.Optional[jsii.Number]:
"""The number of I/O operations per second (IOPS) to provision for the volume.
Must only be set for {@link volumeType}: {@link EbsDeviceVolumeType.IO1}
The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS,
you need at least 100 GiB storage on the volume.
:default: - none, required for {@link EbsDeviceVolumeType.IO1}
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
"""
result = self._values.get("iops")
return result
@builtins.property
def volume_type(self) -> typing.Optional[EbsDeviceVolumeType]:
"""The EBS volume type.
:default: {@link EbsDeviceVolumeType.GP2}
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
"""
result = self._values.get("volume_type")
return result
@builtins.property
def encrypted(self) -> typing.Optional[builtins.bool]:
"""Specifies whether the EBS volume is encrypted.
Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption
:default: false
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances
"""
result = self._values.get("encrypted")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "EbsDeviceOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.EbsDeviceProps",
jsii_struct_bases=[EbsDeviceSnapshotOptions],
name_mapping={
"delete_on_termination": "deleteOnTermination",
"iops": "iops",
"volume_type": "volumeType",
"volume_size": "volumeSize",
"snapshot_id": "snapshotId",
},
)
class EbsDeviceProps(EbsDeviceSnapshotOptions):
def __init__(
self,
*,
delete_on_termination: typing.Optional[builtins.bool] = None,
iops: typing.Optional[jsii.Number] = None,
volume_type: typing.Optional[EbsDeviceVolumeType] = None,
volume_size: typing.Optional[jsii.Number] = None,
snapshot_id: typing.Optional[builtins.str] = None,
) -> None:
"""Properties of an EBS block device.
:param delete_on_termination: Indicates whether to delete the volume when the instance is terminated. Default: - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)
:param iops: The number of I/O operations per second (IOPS) to provision for the volume. Must only be set for {@link volumeType}: {@link EbsDeviceVolumeType.IO1} The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS, you need at least 100 GiB storage on the volume. Default: - none, required for {@link EbsDeviceVolumeType.IO1}
:param volume_type: The EBS volume type. Default: {@link EbsDeviceVolumeType.GP2}
:param volume_size: The volume size, in Gibibytes (GiB). If you specify volumeSize, it must be equal or greater than the size of the snapshot. Default: - The snapshot size
:param snapshot_id: The snapshot ID of the volume to use. Default: - No snapshot will be used
"""
self._values: typing.Dict[str, typing.Any] = {}
if delete_on_termination is not None:
self._values["delete_on_termination"] = delete_on_termination
if iops is not None:
self._values["iops"] = iops
if volume_type is not None:
self._values["volume_type"] = volume_type
if volume_size is not None:
self._values["volume_size"] = volume_size
if snapshot_id is not None:
self._values["snapshot_id"] = snapshot_id
@builtins.property
def delete_on_termination(self) -> typing.Optional[builtins.bool]:
"""Indicates whether to delete the volume when the instance is terminated.
:default: - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)
"""
result = self._values.get("delete_on_termination")
return result
@builtins.property
def iops(self) -> typing.Optional[jsii.Number]:
"""The number of I/O operations per second (IOPS) to provision for the volume.
Must only be set for {@link volumeType}: {@link EbsDeviceVolumeType.IO1}
The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS,
you need at least 100 GiB storage on the volume.
:default: - none, required for {@link EbsDeviceVolumeType.IO1}
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
"""
result = self._values.get("iops")
return result
@builtins.property
def volume_type(self) -> typing.Optional[EbsDeviceVolumeType]:
"""The EBS volume type.
:default: {@link EbsDeviceVolumeType.GP2}
:see: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
"""
result = self._values.get("volume_type")
return result
@builtins.property
def volume_size(self) -> typing.Optional[jsii.Number]:
"""The volume size, in Gibibytes (GiB).
If you specify volumeSize, it must be equal or greater than the size of the snapshot.
:default: - The snapshot size
"""
result = self._values.get("volume_size")
return result
@builtins.property
def snapshot_id(self) -> typing.Optional[builtins.str]:
"""The snapshot ID of the volume to use.
:default: - No snapshot will be used
"""
result = self._values.get("snapshot_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "EbsDeviceProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.EnableVpnGatewayOptions",
jsii_struct_bases=[VpnGatewayProps],
name_mapping={
"type": "type",
"amazon_side_asn": "amazonSideAsn",
"vpn_route_propagation": "vpnRoutePropagation",
},
)
class EnableVpnGatewayOptions(VpnGatewayProps):
def __init__(
self,
*,
type: builtins.str,
amazon_side_asn: typing.Optional[jsii.Number] = None,
vpn_route_propagation: typing.Optional[typing.List[SubnetSelection]] = None,
) -> None:
"""Options for the Vpc.enableVpnGateway() method.
:param type: Default type ipsec.1.
:param amazon_side_asn: Explicitly specify an Asn or let aws pick an Asn for you. Default: 65000
:param vpn_route_propagation: Provide an array of subnets where the route propagation should be added. Default: noPropagation
"""
self._values: typing.Dict[str, typing.Any] = {
"type": type,
}
if amazon_side_asn is not None:
self._values["amazon_side_asn"] = amazon_side_asn
if vpn_route_propagation is not None:
self._values["vpn_route_propagation"] = vpn_route_propagation
@builtins.property
def type(self) -> builtins.str:
"""Default type ipsec.1."""
result = self._values.get("type")
assert result is not None, "Required property 'type' is missing"
return result
@builtins.property
def amazon_side_asn(self) -> typing.Optional[jsii.Number]:
"""Explicitly specify an Asn or let aws pick an Asn for you.
:default: 65000
"""
result = self._values.get("amazon_side_asn")
return result
@builtins.property
def vpn_route_propagation(self) -> typing.Optional[typing.List[SubnetSelection]]:
"""Provide an array of subnets where the route propagation should be added.
:default: noPropagation
"""
result = self._values.get("vpn_route_propagation")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "EnableVpnGatewayOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(IFlowLog)
class FlowLog(
aws_cdk.core.Resource,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.FlowLog",
):
"""(experimental) A VPC flow log.
:stability: experimental
:resource: AWS::EC2::FlowLog
"""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
resource_type: FlowLogResourceType,
flow_log_name: typing.Optional[builtins.str] = None,
destination: typing.Optional[FlowLogDestination] = None,
traffic_type: typing.Optional[FlowLogTrafficType] = None,
) -> None:
"""
:param scope: -
:param id: -
:param resource_type: (experimental) The type of resource for which to create the flow log.
:param flow_log_name: (experimental) The name of the FlowLog. It is not recommended to use an explicit name. Default: If you don't specify a flowLogName, AWS CloudFormation generates a unique physical ID and uses that ID for the group name.
:param destination: (experimental) Specifies the type of destination to which the flow log data is to be published. Flow log data can be published to CloudWatch Logs or Amazon S3 Default: FlowLogDestinationType.toCloudWatchLogs()
:param traffic_type: (experimental) The type of traffic to log. You can log traffic that the resource accepts or rejects, or all traffic. Default: ALL
:stability: experimental
"""
props = FlowLogProps(
resource_type=resource_type,
flow_log_name=flow_log_name,
destination=destination,
traffic_type=traffic_type,
)
jsii.create(FlowLog, self, [scope, id, props])
@jsii.member(jsii_name="fromFlowLogId")
@builtins.classmethod
def from_flow_log_id(
cls,
scope: constructs.Construct,
id: builtins.str,
flow_log_id: builtins.str,
) -> IFlowLog:
"""(experimental) Import a Flow Log by it's Id.
:param scope: -
:param id: -
:param flow_log_id: -
:stability: experimental
"""
return jsii.sinvoke(cls, "fromFlowLogId", [scope, id, flow_log_id])
@builtins.property # type: ignore
@jsii.member(jsii_name="flowLogId")
def flow_log_id(self) -> builtins.str:
"""(experimental) The Id of the VPC Flow Log.
:stability: experimental
:attribute: true
"""
return jsii.get(self, "flowLogId")
@builtins.property # type: ignore
@jsii.member(jsii_name="bucket")
def bucket(self) -> typing.Optional[aws_cdk.aws_s3.IBucket]:
"""(experimental) The S3 bucket to publish flow logs to.
:stability: experimental
"""
return jsii.get(self, "bucket")
@builtins.property # type: ignore
@jsii.member(jsii_name="iamRole")
def iam_role(self) -> typing.Optional[aws_cdk.aws_iam.IRole]:
"""(experimental) The iam role used to publish logs to CloudWatch.
:stability: experimental
"""
return jsii.get(self, "iamRole")
@builtins.property # type: ignore
@jsii.member(jsii_name="keyPrefix")
def key_prefix(self) -> typing.Optional[builtins.str]:
"""(experimental) S3 bucket key prefix to publish the flow logs under.
:stability: experimental
"""
return jsii.get(self, "keyPrefix")
@builtins.property # type: ignore
@jsii.member(jsii_name="logGroup")
def log_group(self) -> typing.Optional[aws_cdk.aws_logs.ILogGroup]:
"""(experimental) The CloudWatch Logs LogGroup to publish flow logs to.
:stability: experimental
"""
return jsii.get(self, "logGroup")
@jsii.implements(IGatewayVpcEndpointService)
class GatewayVpcEndpointAwsService(
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.GatewayVpcEndpointAwsService",
):
"""An AWS service for a gateway VPC endpoint."""
def __init__(
self,
name: builtins.str,
prefix: typing.Optional[builtins.str] = None,
) -> None:
"""
:param name: -
:param prefix: -
"""
jsii.create(GatewayVpcEndpointAwsService, self, [name, prefix])
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="DYNAMODB")
def DYNAMODB(cls) -> "GatewayVpcEndpointAwsService":
return jsii.sget(cls, "DYNAMODB")
@jsii.python.classproperty # type: ignore
@jsii.member(jsii_name="S3")
def S3(cls) -> "GatewayVpcEndpointAwsService":
return jsii.sget(cls, "S3")
@builtins.property # type: ignore
@jsii.member(jsii_name="name")
def name(self) -> builtins.str:
"""The name of the service."""
return jsii.get(self, "name")
@jsii.implements(IMachineImage)
class GenericLinuxImage(
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.GenericLinuxImage",
):
"""Construct a Linux machine image from an AMI map.
Linux images IDs are not published to SSM parameter store yet, so you'll have to
manually specify an AMI map.
"""
def __init__(
self,
ami_map: typing.Mapping[builtins.str, builtins.str],
*,
user_data: typing.Optional[UserData] = None,
) -> None:
"""
:param ami_map: -
:param user_data: Initial user data. Default: - Empty UserData for Linux machines
"""
props = GenericLinuxImageProps(user_data=user_data)
jsii.create(GenericLinuxImage, self, [ami_map, props])
@jsii.member(jsii_name="getImage")
def get_image(self, scope: aws_cdk.core.Construct) -> MachineImageConfig:
"""Return the image to use in the given context.
:param scope: -
"""
return jsii.invoke(self, "getImage", [scope])
@jsii.implements(IMachineImage)
class GenericSSMParameterImage(
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.GenericSSMParameterImage",
):
"""Select the image based on a given SSM parameter.
This Machine Image automatically updates to the latest version on every
deployment. Be aware this will cause your instances to be replaced when a
new version of the image becomes available. Do not store stateful information
on the instance if you are using this image.
The AMI ID is selected using the values published to the SSM parameter store.
"""
def __init__(
self,
parameter_name: builtins.str,
os: OperatingSystemType,
user_data: typing.Optional[UserData] = None,
) -> None:
"""
:param parameter_name: -
:param os: -
:param user_data: -
"""
jsii.create(GenericSSMParameterImage, self, [parameter_name, os, user_data])
@jsii.member(jsii_name="getImage")
def get_image(self, scope: aws_cdk.core.Construct) -> MachineImageConfig:
"""Return the image to use in the given context.
:param scope: -
"""
return jsii.invoke(self, "getImage", [scope])
@jsii.implements(IMachineImage)
class GenericWindowsImage(
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.GenericWindowsImage",
):
"""Construct a Windows machine image from an AMI map.
Allows you to create a generic Windows EC2 , manually specify an AMI map.
"""
def __init__(
self,
ami_map: typing.Mapping[builtins.str, builtins.str],
*,
user_data: typing.Optional[UserData] = None,
) -> None:
"""
:param ami_map: -
:param user_data: Initial user data. Default: - Empty UserData for Windows machines
"""
props = GenericWindowsImageProps(user_data=user_data)
jsii.create(GenericWindowsImage, self, [ami_map, props])
@jsii.member(jsii_name="getImage")
def get_image(self, scope: aws_cdk.core.Construct) -> MachineImageConfig:
"""Return the image to use in the given context.
:param scope: -
"""
return jsii.invoke(self, "getImage", [scope])
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IGatewayVpcEndpoint")
class IGatewayVpcEndpoint(IVpcEndpoint, typing_extensions.Protocol):
"""A gateway VPC endpoint."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IGatewayVpcEndpointProxy
class _IGatewayVpcEndpointProxy(
jsii.proxy_for(IVpcEndpoint) # type: ignore
):
"""A gateway VPC endpoint."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IGatewayVpcEndpoint"
pass
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IInterfaceVpcEndpoint")
class IInterfaceVpcEndpoint(IVpcEndpoint, IConnectable, typing_extensions.Protocol):
"""An interface VPC endpoint."""
@builtins.staticmethod
def __jsii_proxy_class__():
return _IInterfaceVpcEndpointProxy
class _IInterfaceVpcEndpointProxy(
jsii.proxy_for(IVpcEndpoint), # type: ignore
jsii.proxy_for(IConnectable), # type: ignore
):
"""An interface VPC endpoint."""
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IInterfaceVpcEndpoint"
pass
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IPrivateSubnet")
class IPrivateSubnet(ISubnet, typing_extensions.Protocol):
@builtins.staticmethod
def __jsii_proxy_class__():
return _IPrivateSubnetProxy
class _IPrivateSubnetProxy(
jsii.proxy_for(ISubnet) # type: ignore
):
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IPrivateSubnet"
pass
@jsii.interface(jsii_type="@aws-cdk/aws-ec2.IPublicSubnet")
class IPublicSubnet(ISubnet, typing_extensions.Protocol):
@builtins.staticmethod
def __jsii_proxy_class__():
return _IPublicSubnetProxy
class _IPublicSubnetProxy(
jsii.proxy_for(ISubnet) # type: ignore
):
__jsii_type__: typing.ClassVar[str] = "@aws-cdk/aws-ec2.IPublicSubnet"
pass
class InitCommand(
InitElement,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.InitCommand",
):
"""Command to execute on the instance."""
@jsii.member(jsii_name="argvCommand")
@builtins.classmethod
def argv_command(
cls,
argv: typing.List[builtins.str],
*,
cwd: typing.Optional[builtins.str] = None,
env: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
ignore_errors: typing.Optional[builtins.bool] = None,
key: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List[InitServiceRestartHandle]] = None,
test_cmd: typing.Optional[builtins.str] = None,
wait_after_completion: typing.Optional[InitCommandWaitDuration] = None,
) -> "InitCommand":
"""Run a command from an argv array.
You do not need to escape space characters or enclose command parameters in quotes.
:param argv: -
:param cwd: The working directory. Default: - Use default working directory
:param env: Sets environment variables for the command. This property overwrites, rather than appends, the existing environment. Default: - Use current environment
:param ignore_errors: Continue running if this command fails. Default: false
:param key: Identifier key for this command. Commands are executed in lexicographical order of their key names. Default: - Automatically generated based on index
:param service_restart_handles: Restart the given service(s) after this command has run. Default: - Do not restart any service
:param test_cmd: Command to determine whether this command should be run. If the test passes (exits with error code of 0), the command is run. Default: - Always run the command
:param wait_after_completion: The duration to wait after a command has finished in case the command causes a reboot. Set this value to ``InitCommandWaitDuration.none()`` if you do not want to wait for every command; ``InitCommandWaitDuration.forever()`` directs cfn-init to exit and resume only after the reboot is complete. For Windows systems only. Default: - 60 seconds
"""
options = InitCommandOptions(
cwd=cwd,
env=env,
ignore_errors=ignore_errors,
key=key,
service_restart_handles=service_restart_handles,
test_cmd=test_cmd,
wait_after_completion=wait_after_completion,
)
return jsii.sinvoke(cls, "argvCommand", [argv, options])
@jsii.member(jsii_name="shellCommand")
@builtins.classmethod
def shell_command(
cls,
shell_command: builtins.str,
*,
cwd: typing.Optional[builtins.str] = None,
env: typing.Optional[typing.Mapping[builtins.str, builtins.str]] = None,
ignore_errors: typing.Optional[builtins.bool] = None,
key: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List[InitServiceRestartHandle]] = None,
test_cmd: typing.Optional[builtins.str] = None,
wait_after_completion: typing.Optional[InitCommandWaitDuration] = None,
) -> "InitCommand":
"""Run a shell command.
Remember that some characters like ``&``, ``|``, ``;``, ``>`` etc. have special meaning in a shell and
need to be preceded by a ``\\`` if you want to treat them as part of a filename.
:param shell_command: -
:param cwd: The working directory. Default: - Use default working directory
:param env: Sets environment variables for the command. This property overwrites, rather than appends, the existing environment. Default: - Use current environment
:param ignore_errors: Continue running if this command fails. Default: false
:param key: Identifier key for this command. Commands are executed in lexicographical order of their key names. Default: - Automatically generated based on index
:param service_restart_handles: Restart the given service(s) after this command has run. Default: - Do not restart any service
:param test_cmd: Command to determine whether this command should be run. If the test passes (exits with error code of 0), the command is run. Default: - Always run the command
:param wait_after_completion: The duration to wait after a command has finished in case the command causes a reboot. Set this value to ``InitCommandWaitDuration.none()`` if you do not want to wait for every command; ``InitCommandWaitDuration.forever()`` directs cfn-init to exit and resume only after the reboot is complete. For Windows systems only. Default: - 60 seconds
"""
options = InitCommandOptions(
cwd=cwd,
env=env,
ignore_errors=ignore_errors,
key=key,
service_restart_handles=service_restart_handles,
test_cmd=test_cmd,
wait_after_completion=wait_after_completion,
)
return jsii.sinvoke(cls, "shellCommand", [shell_command, options])
@builtins.property # type: ignore
@jsii.member(jsii_name="elementType")
def element_type(self) -> builtins.str:
"""Returns the init element type for this element."""
return jsii.get(self, "elementType")
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.InitFileAssetOptions",
jsii_struct_bases=[InitFileOptions, aws_cdk.aws_s3_assets.AssetOptions],
name_mapping={
"base64_encoded": "base64Encoded",
"group": "group",
"mode": "mode",
"owner": "owner",
"service_restart_handles": "serviceRestartHandles",
"exclude": "exclude",
"follow": "follow",
"ignore_mode": "ignoreMode",
"asset_hash": "assetHash",
"asset_hash_type": "assetHashType",
"bundling": "bundling",
"readers": "readers",
"source_hash": "sourceHash",
},
)
class InitFileAssetOptions(InitFileOptions, aws_cdk.aws_s3_assets.AssetOptions):
def __init__(
self,
*,
base64_encoded: typing.Optional[builtins.bool] = None,
group: typing.Optional[builtins.str] = None,
mode: typing.Optional[builtins.str] = None,
owner: typing.Optional[builtins.str] = None,
service_restart_handles: typing.Optional[typing.List[InitServiceRestartHandle]] = None,
exclude: typing.Optional[typing.List[builtins.str]] = None,
follow: typing.Optional[aws_cdk.assets.FollowMode] = None,
ignore_mode: typing.Optional[aws_cdk.core.IgnoreMode] = None,
asset_hash: typing.Optional[builtins.str] = None,
asset_hash_type: typing.Optional[aws_cdk.core.AssetHashType] = None,
bundling: typing.Optional[aws_cdk.core.BundlingOptions] = None,
readers: typing.Optional[typing.List[aws_cdk.aws_iam.IGrantable]] = None,
source_hash: typing.Optional[builtins.str] = None,
) -> None:
"""Additional options for creating an InitFile from an asset.
:param base64_encoded: True if the inlined content (from a string or file) should be treated as base64 encoded. Only applicable for inlined string and file content. Default: false
:param group: The name of the owning group for this file. Not supported for Windows systems. Default: 'root'
:param mode: A six-digit octal value representing the mode for this file. Use the first three digits for symlinks and the last three digits for setting permissions. To create a symlink, specify 120xxx, where xxx defines the permissions of the target file. To specify permissions for a file, use the last three digits, such as 000644. Not supported for Windows systems. Default: '000644'
:param owner: The name of the owning user for this file. Not supported for Windows systems. Default: 'root'
:param service_restart_handles: Restart the given service after this file has been written. Default: - Do not restart any service
:param exclude: (deprecated) Glob patterns to exclude from the copy. Default: nothing is excluded
:param follow: (deprecated) A strategy for how to handle symlinks. Default: Never
:param ignore_mode: (deprecated) The ignore behavior to use for exclude patterns. Default: - GLOB for file assets, DOCKER or GLOB for docker assets depending on whether the '
:param asset_hash: Specify a custom hash for this asset. If ``assetHashType`` is set it must be set to ``AssetHashType.CUSTOM``. For consistency, this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be the asset hash. NOTE: the hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will need to make sure it is updated every time the asset changes, or otherwise it is possible that some deployments will not be invalidated. Default: - based on ``assetHashType``
:param asset_hash_type: Specifies the type of hash to calculate for this asset. If ``assetHash`` is configured, this option must be ``undefined`` or ``AssetHashType.CUSTOM``. Default: - the default is ``AssetHashType.SOURCE``, but if ``assetHash`` is explicitly specified this value defaults to ``AssetHashType.CUSTOM``.
:param bundling: (experimental) Bundle the asset by executing a command in a Docker container. The asset path will be mounted at ``/asset-input``. The Docker container is responsible for putting content at ``/asset-output``. The content at ``/asset-output`` will be zipped and used as the final asset. Default: - uploaded as-is to S3 if the asset is a regular file or a .zip file, archived into a .zip file and uploaded to S3 otherwise
:param readers: (experimental) A list of principals that should be able to read this asset from S3. You can use ``asset.grantRead(principal)`` to grant read permissions later. Default: - No principals that can read file asset.
:param source_hash: (deprecated) Custom hash to use when identifying the specific version of the asset. For consistency, this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be the asset hash. NOTE: the source hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to Amazon S3, etc. If you chose to customize the source hash, you will need to make sure it is updated every time the source changes, or otherwise it is possible that some deployments will not be invalidated. Default: - automatically calculate source hash based on the contents of the source file or directory.
"""
if isinstance(bundling, dict):
bundling = aws_cdk.core.BundlingOptions(**bundling)
self._values: typing.Dict[str, typing.Any] = {}
if base64_encoded is not None:
self._values["base64_encoded"] = base64_encoded
if group is not None:
self._values["group"] = group
if mode is not None:
self._values["mode"] = mode
if owner is not None:
self._values["owner"] = owner
if service_restart_handles is not None:
self._values["service_restart_handles"] = service_restart_handles
if exclude is not None:
self._values["exclude"] = exclude
if follow is not None:
self._values["follow"] = follow
if ignore_mode is not None:
self._values["ignore_mode"] = ignore_mode
if asset_hash is not None:
self._values["asset_hash"] = asset_hash
if asset_hash_type is not None:
self._values["asset_hash_type"] = asset_hash_type
if bundling is not None:
self._values["bundling"] = bundling
if readers is not None:
self._values["readers"] = readers
if source_hash is not None:
self._values["source_hash"] = source_hash
@builtins.property
def base64_encoded(self) -> typing.Optional[builtins.bool]:
"""True if the inlined content (from a string or file) should be treated as base64 encoded.
Only applicable for inlined string and file content.
:default: false
"""
result = self._values.get("base64_encoded")
return result
@builtins.property
def group(self) -> typing.Optional[builtins.str]:
"""The name of the owning group for this file.
Not supported for Windows systems.
:default: 'root'
"""
result = self._values.get("group")
return result
@builtins.property
def mode(self) -> typing.Optional[builtins.str]:
"""A six-digit octal value representing the mode for this file.
Use the first three digits for symlinks and the last three digits for
setting permissions. To create a symlink, specify 120xxx, where xxx
defines the permissions of the target file. To specify permissions for a
file, use the last three digits, such as 000644.
Not supported for Windows systems.
:default: '000644'
"""
result = self._values.get("mode")
return result
@builtins.property
def owner(self) -> typing.Optional[builtins.str]:
"""The name of the owning user for this file.
Not supported for Windows systems.
:default: 'root'
"""
result = self._values.get("owner")
return result
@builtins.property
def service_restart_handles(
self,
) -> typing.Optional[typing.List[InitServiceRestartHandle]]:
"""Restart the given service after this file has been written.
:default: - Do not restart any service
"""
result = self._values.get("service_restart_handles")
return result
@builtins.property
def exclude(self) -> typing.Optional[typing.List[builtins.str]]:
"""(deprecated) Glob patterns to exclude from the copy.
:default: nothing is excluded
:stability: deprecated
"""
result = self._values.get("exclude")
return result
@builtins.property
def follow(self) -> typing.Optional[aws_cdk.assets.FollowMode]:
"""(deprecated) A strategy for how to handle symlinks.
:default: Never
:stability: deprecated
"""
result = self._values.get("follow")
return result
@builtins.property
def ignore_mode(self) -> typing.Optional[aws_cdk.core.IgnoreMode]:
"""(deprecated) The ignore behavior to use for exclude patterns.
:default:
- GLOB for file assets, DOCKER or GLOB for docker assets depending on whether the
'
:stability: deprecated
:aws-cdk: /aws-ecr-assets:dockerIgnoreSupport' flag is set.
"""
result = self._values.get("ignore_mode")
return result
@builtins.property
def asset_hash(self) -> typing.Optional[builtins.str]:
"""Specify a custom hash for this asset.
If ``assetHashType`` is set it must
be set to ``AssetHashType.CUSTOM``. For consistency, this custom hash will
be SHA256 hashed and encoded as hex. The resulting hash will be the asset
hash.
NOTE: the hash is used in order to identify a specific revision of the asset, and
used for optimizing and caching deployment activities related to this asset such as
packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will
need to make sure it is updated every time the asset changes, or otherwise it is
possible that some deployments will not be invalidated.
:default: - based on ``assetHashType``
"""
result = self._values.get("asset_hash")
return result
@builtins.property
def asset_hash_type(self) -> typing.Optional[aws_cdk.core.AssetHashType]:
"""Specifies the type of hash to calculate for this asset.
If ``assetHash`` is configured, this option must be ``undefined`` or
``AssetHashType.CUSTOM``.
:default:
- the default is ``AssetHashType.SOURCE``, but if ``assetHash`` is
explicitly specified this value defaults to ``AssetHashType.CUSTOM``.
"""
result = self._values.get("asset_hash_type")
return result
@builtins.property
def bundling(self) -> typing.Optional[aws_cdk.core.BundlingOptions]:
"""(experimental) Bundle the asset by executing a command in a Docker container.
The asset path will be mounted at ``/asset-input``. The Docker
container is responsible for putting content at ``/asset-output``.
The content at ``/asset-output`` will be zipped and used as the
final asset.
:default:
- uploaded as-is to S3 if the asset is a regular file or a .zip file,
archived into a .zip file and uploaded to S3 otherwise
:stability: experimental
"""
result = self._values.get("bundling")
return result
@builtins.property
def readers(self) -> typing.Optional[typing.List[aws_cdk.aws_iam.IGrantable]]:
"""(experimental) A list of principals that should be able to read this asset from S3.
You can use ``asset.grantRead(principal)`` to grant read permissions later.
:default: - No principals that can read file asset.
:stability: experimental
"""
result = self._values.get("readers")
return result
@builtins.property
def source_hash(self) -> typing.Optional[builtins.str]:
"""(deprecated) Custom hash to use when identifying the specific version of the asset.
For consistency,
this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be
the asset hash.
NOTE: the source hash is used in order to identify a specific revision of the asset,
and used for optimizing and caching deployment activities related to this asset such as
packaging, uploading to Amazon S3, etc. If you chose to customize the source hash,
you will need to make sure it is updated every time the source changes, or otherwise
it is possible that some deployments will not be invalidated.
:default:
- automatically calculate source hash based on the contents
of the source file or directory.
:deprecated: see ``assetHash`` and ``assetHashType``
:stability: deprecated
"""
result = self._values.get("source_hash")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InitFileAssetOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.InitSourceAssetOptions",
jsii_struct_bases=[InitSourceOptions, aws_cdk.aws_s3_assets.AssetOptions],
name_mapping={
"service_restart_handles": "serviceRestartHandles",
"exclude": "exclude",
"follow": "follow",
"ignore_mode": "ignoreMode",
"asset_hash": "assetHash",
"asset_hash_type": "assetHashType",
"bundling": "bundling",
"readers": "readers",
"source_hash": "sourceHash",
},
)
class InitSourceAssetOptions(InitSourceOptions, aws_cdk.aws_s3_assets.AssetOptions):
def __init__(
self,
*,
service_restart_handles: typing.Optional[typing.List[InitServiceRestartHandle]] = None,
exclude: typing.Optional[typing.List[builtins.str]] = None,
follow: typing.Optional[aws_cdk.assets.FollowMode] = None,
ignore_mode: typing.Optional[aws_cdk.core.IgnoreMode] = None,
asset_hash: typing.Optional[builtins.str] = None,
asset_hash_type: typing.Optional[aws_cdk.core.AssetHashType] = None,
bundling: typing.Optional[aws_cdk.core.BundlingOptions] = None,
readers: typing.Optional[typing.List[aws_cdk.aws_iam.IGrantable]] = None,
source_hash: typing.Optional[builtins.str] = None,
) -> None:
"""Additional options for an InitSource that builds an asset from local files.
:param service_restart_handles: Restart the given services after this archive has been extracted. Default: - Do not restart any service
:param exclude: (deprecated) Glob patterns to exclude from the copy. Default: nothing is excluded
:param follow: (deprecated) A strategy for how to handle symlinks. Default: Never
:param ignore_mode: (deprecated) The ignore behavior to use for exclude patterns. Default: - GLOB for file assets, DOCKER or GLOB for docker assets depending on whether the '
:param asset_hash: Specify a custom hash for this asset. If ``assetHashType`` is set it must be set to ``AssetHashType.CUSTOM``. For consistency, this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be the asset hash. NOTE: the hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will need to make sure it is updated every time the asset changes, or otherwise it is possible that some deployments will not be invalidated. Default: - based on ``assetHashType``
:param asset_hash_type: Specifies the type of hash to calculate for this asset. If ``assetHash`` is configured, this option must be ``undefined`` or ``AssetHashType.CUSTOM``. Default: - the default is ``AssetHashType.SOURCE``, but if ``assetHash`` is explicitly specified this value defaults to ``AssetHashType.CUSTOM``.
:param bundling: (experimental) Bundle the asset by executing a command in a Docker container. The asset path will be mounted at ``/asset-input``. The Docker container is responsible for putting content at ``/asset-output``. The content at ``/asset-output`` will be zipped and used as the final asset. Default: - uploaded as-is to S3 if the asset is a regular file or a .zip file, archived into a .zip file and uploaded to S3 otherwise
:param readers: (experimental) A list of principals that should be able to read this asset from S3. You can use ``asset.grantRead(principal)`` to grant read permissions later. Default: - No principals that can read file asset.
:param source_hash: (deprecated) Custom hash to use when identifying the specific version of the asset. For consistency, this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be the asset hash. NOTE: the source hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to Amazon S3, etc. If you chose to customize the source hash, you will need to make sure it is updated every time the source changes, or otherwise it is possible that some deployments will not be invalidated. Default: - automatically calculate source hash based on the contents of the source file or directory.
"""
if isinstance(bundling, dict):
bundling = aws_cdk.core.BundlingOptions(**bundling)
self._values: typing.Dict[str, typing.Any] = {}
if service_restart_handles is not None:
self._values["service_restart_handles"] = service_restart_handles
if exclude is not None:
self._values["exclude"] = exclude
if follow is not None:
self._values["follow"] = follow
if ignore_mode is not None:
self._values["ignore_mode"] = ignore_mode
if asset_hash is not None:
self._values["asset_hash"] = asset_hash
if asset_hash_type is not None:
self._values["asset_hash_type"] = asset_hash_type
if bundling is not None:
self._values["bundling"] = bundling
if readers is not None:
self._values["readers"] = readers
if source_hash is not None:
self._values["source_hash"] = source_hash
@builtins.property
def service_restart_handles(
self,
) -> typing.Optional[typing.List[InitServiceRestartHandle]]:
"""Restart the given services after this archive has been extracted.
:default: - Do not restart any service
"""
result = self._values.get("service_restart_handles")
return result
@builtins.property
def exclude(self) -> typing.Optional[typing.List[builtins.str]]:
"""(deprecated) Glob patterns to exclude from the copy.
:default: nothing is excluded
:stability: deprecated
"""
result = self._values.get("exclude")
return result
@builtins.property
def follow(self) -> typing.Optional[aws_cdk.assets.FollowMode]:
"""(deprecated) A strategy for how to handle symlinks.
:default: Never
:stability: deprecated
"""
result = self._values.get("follow")
return result
@builtins.property
def ignore_mode(self) -> typing.Optional[aws_cdk.core.IgnoreMode]:
"""(deprecated) The ignore behavior to use for exclude patterns.
:default:
- GLOB for file assets, DOCKER or GLOB for docker assets depending on whether the
'
:stability: deprecated
:aws-cdk: /aws-ecr-assets:dockerIgnoreSupport' flag is set.
"""
result = self._values.get("ignore_mode")
return result
@builtins.property
def asset_hash(self) -> typing.Optional[builtins.str]:
"""Specify a custom hash for this asset.
If ``assetHashType`` is set it must
be set to ``AssetHashType.CUSTOM``. For consistency, this custom hash will
be SHA256 hashed and encoded as hex. The resulting hash will be the asset
hash.
NOTE: the hash is used in order to identify a specific revision of the asset, and
used for optimizing and caching deployment activities related to this asset such as
packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will
need to make sure it is updated every time the asset changes, or otherwise it is
possible that some deployments will not be invalidated.
:default: - based on ``assetHashType``
"""
result = self._values.get("asset_hash")
return result
@builtins.property
def asset_hash_type(self) -> typing.Optional[aws_cdk.core.AssetHashType]:
"""Specifies the type of hash to calculate for this asset.
If ``assetHash`` is configured, this option must be ``undefined`` or
``AssetHashType.CUSTOM``.
:default:
- the default is ``AssetHashType.SOURCE``, but if ``assetHash`` is
explicitly specified this value defaults to ``AssetHashType.CUSTOM``.
"""
result = self._values.get("asset_hash_type")
return result
@builtins.property
def bundling(self) -> typing.Optional[aws_cdk.core.BundlingOptions]:
"""(experimental) Bundle the asset by executing a command in a Docker container.
The asset path will be mounted at ``/asset-input``. The Docker
container is responsible for putting content at ``/asset-output``.
The content at ``/asset-output`` will be zipped and used as the
final asset.
:default:
- uploaded as-is to S3 if the asset is a regular file or a .zip file,
archived into a .zip file and uploaded to S3 otherwise
:stability: experimental
"""
result = self._values.get("bundling")
return result
@builtins.property
def readers(self) -> typing.Optional[typing.List[aws_cdk.aws_iam.IGrantable]]:
"""(experimental) A list of principals that should be able to read this asset from S3.
You can use ``asset.grantRead(principal)`` to grant read permissions later.
:default: - No principals that can read file asset.
:stability: experimental
"""
result = self._values.get("readers")
return result
@builtins.property
def source_hash(self) -> typing.Optional[builtins.str]:
"""(deprecated) Custom hash to use when identifying the specific version of the asset.
For consistency,
this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be
the asset hash.
NOTE: the source hash is used in order to identify a specific revision of the asset,
and used for optimizing and caching deployment activities related to this asset such as
packaging, uploading to Amazon S3, etc. If you chose to customize the source hash,
you will need to make sure it is updated every time the source changes, or otherwise
it is possible that some deployments will not be invalidated.
:default:
- automatically calculate source hash based on the contents
of the source file or directory.
:deprecated: see ``assetHash`` and ``assetHashType``
:stability: deprecated
"""
result = self._values.get("source_hash")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "InitSourceAssetOptions(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(IInterfaceVpcEndpoint)
class InterfaceVpcEndpoint(
VpcEndpoint,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.InterfaceVpcEndpoint",
):
"""A interface VPC endpoint.
:resource: AWS::EC2::VPCEndpoint
"""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
vpc: IVpc,
service: IInterfaceVpcEndpointService,
lookup_supported_azs: typing.Optional[builtins.bool] = None,
open: typing.Optional[builtins.bool] = None,
private_dns_enabled: typing.Optional[builtins.bool] = None,
security_groups: typing.Optional[typing.List[ISecurityGroup]] = None,
subnets: typing.Optional[SubnetSelection] = None,
) -> None:
"""
:param scope: -
:param id: -
:param vpc: The VPC network in which the interface endpoint will be used.
:param service: The service to use for this interface VPC endpoint.
:param lookup_supported_azs: Limit to only those availability zones where the endpoint service can be created. Setting this to 'true' requires a lookup to be performed at synthesis time. Account and region must be set on the containing stack for this to work. Default: false
:param open: Whether to automatically allow VPC traffic to the endpoint. If enabled, all traffic to the endpoint from within the VPC will be automatically allowed. This is done based on the VPC's CIDR range. Default: true
:param private_dns_enabled: Whether to associate a private hosted zone with the specified VPC. This allows you to make requests to the service using its default DNS hostname. Default: set by the instance of IInterfaceVpcEndpointService, or true if not defined by the instance of IInterfaceVpcEndpointService
:param security_groups: The security groups to associate with this interface VPC endpoint. Default: - a new security group is created
:param subnets: The subnets in which to create an endpoint network interface. At most one per availability zone. Default: - private subnets
"""
props = InterfaceVpcEndpointProps(
vpc=vpc,
service=service,
lookup_supported_azs=lookup_supported_azs,
open=open,
private_dns_enabled=private_dns_enabled,
security_groups=security_groups,
subnets=subnets,
)
jsii.create(InterfaceVpcEndpoint, self, [scope, id, props])
@jsii.member(jsii_name="fromInterfaceVpcEndpointAttributes")
@builtins.classmethod
def from_interface_vpc_endpoint_attributes(
cls,
scope: constructs.Construct,
id: builtins.str,
*,
port: jsii.Number,
vpc_endpoint_id: builtins.str,
security_group_id: typing.Optional[builtins.str] = None,
security_groups: typing.Optional[typing.List[ISecurityGroup]] = None,
) -> IInterfaceVpcEndpoint:
"""Imports an existing interface VPC endpoint.
:param scope: -
:param id: -
:param port: The port of the service of the interface VPC endpoint.
:param vpc_endpoint_id: The interface VPC endpoint identifier.
:param security_group_id: (deprecated) The identifier of the security group associated with the interface VPC endpoint.
:param security_groups: The security groups associated with the interface VPC endpoint.
"""
attrs = InterfaceVpcEndpointAttributes(
port=port,
vpc_endpoint_id=vpc_endpoint_id,
security_group_id=security_group_id,
security_groups=security_groups,
)
return jsii.sinvoke(cls, "fromInterfaceVpcEndpointAttributes", [scope, id, attrs])
@builtins.property # type: ignore
@jsii.member(jsii_name="connections")
def connections(self) -> Connections:
"""Access to network connections."""
return jsii.get(self, "connections")
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroupId")
def security_group_id(self) -> builtins.str:
"""(deprecated) The identifier of the first security group associated with this interface VPC endpoint.
:deprecated: use the ``connections`` object
:stability: deprecated
"""
return jsii.get(self, "securityGroupId")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointCreationTimestamp")
def vpc_endpoint_creation_timestamp(self) -> builtins.str:
"""The date and time the interface VPC endpoint was created.
:attribute: true
"""
return jsii.get(self, "vpcEndpointCreationTimestamp")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointDnsEntries")
def vpc_endpoint_dns_entries(self) -> typing.List[builtins.str]:
"""The DNS entries for the interface VPC endpoint.
:attribute: true
"""
return jsii.get(self, "vpcEndpointDnsEntries")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointId")
def vpc_endpoint_id(self) -> builtins.str:
"""The interface VPC endpoint identifier."""
return jsii.get(self, "vpcEndpointId")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointNetworkInterfaceIds")
def vpc_endpoint_network_interface_ids(self) -> typing.List[builtins.str]:
"""One or more network interfaces for the interface VPC endpoint.
:attribute: true
"""
return jsii.get(self, "vpcEndpointNetworkInterfaceIds")
@jsii.implements(IConnectable)
class NatInstanceProvider(
NatProvider,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.NatInstanceProvider",
):
"""NAT provider which uses NAT Instances."""
def __init__(
self,
*,
instance_type: InstanceType,
allow_all_traffic: typing.Optional[builtins.bool] = None,
key_name: typing.Optional[builtins.str] = None,
machine_image: typing.Optional[IMachineImage] = None,
security_group: typing.Optional[ISecurityGroup] = None,
) -> None:
"""
:param instance_type: (experimental) Instance type of the NAT instance.
:param allow_all_traffic: (experimental) Allow all traffic through the NAT instance. If you set this to false, you must configure the NAT instance's security groups in another way, either by passing in a fully configured Security Group using the ``securityGroup`` property, or by configuring it using the ``.securityGroup`` or ``.connections`` members after passing the NAT Instance Provider to a Vpc. Default: true
:param key_name: (experimental) Name of SSH keypair to grant access to instance. Default: - No SSH access will be possible.
:param machine_image: (experimental) The machine image (AMI) to use. By default, will do an AMI lookup for the latest NAT instance image. If you have a specific AMI ID you want to use, pass a ``GenericLinuxImage``. For example:: ec2.NatProvider.instance({ instanceType: new ec2.InstanceType('t3.micro'), machineImage: new ec2.GenericLinuxImage({ 'us-east-2': 'ami-0f9c61b5a562a16af' }) }) Default: - Latest NAT instance image
:param security_group: (experimental) Security Group for NAT instances. Default: - A new security group will be created
"""
props = NatInstanceProps(
instance_type=instance_type,
allow_all_traffic=allow_all_traffic,
key_name=key_name,
machine_image=machine_image,
security_group=security_group,
)
jsii.create(NatInstanceProvider, self, [props])
@jsii.member(jsii_name="configureNat")
def configure_nat(
self,
*,
nat_subnets: typing.List["PublicSubnet"],
private_subnets: typing.List["PrivateSubnet"],
vpc: Vpc,
) -> None:
"""Called by the VPC to configure NAT.
Don't call this directly, the VPC will call it automatically.
:param nat_subnets: (experimental) The public subnets where the NAT providers need to be placed.
:param private_subnets: (experimental) The private subnets that need to route through the NAT providers. There may be more private subnets than public subnets with NAT providers.
:param vpc: (experimental) The VPC we're configuring NAT for.
"""
options = ConfigureNatOptions(
nat_subnets=nat_subnets, private_subnets=private_subnets, vpc=vpc
)
return jsii.invoke(self, "configureNat", [options])
@jsii.member(jsii_name="configureSubnet")
def configure_subnet(self, subnet: "PrivateSubnet") -> None:
"""Configures subnet with the gateway.
Don't call this directly, the VPC will call it automatically.
:param subnet: -
"""
return jsii.invoke(self, "configureSubnet", [subnet])
@builtins.property # type: ignore
@jsii.member(jsii_name="configuredGateways")
def configured_gateways(self) -> typing.List[GatewayConfig]:
"""Return list of gateways spawned by the provider."""
return jsii.get(self, "configuredGateways")
@builtins.property # type: ignore
@jsii.member(jsii_name="connections")
def connections(self) -> Connections:
"""Manage the Security Groups associated with the NAT instances."""
return jsii.get(self, "connections")
@builtins.property # type: ignore
@jsii.member(jsii_name="securityGroup")
def security_group(self) -> ISecurityGroup:
"""The Security Group associated with the NAT instances."""
return jsii.get(self, "securityGroup")
@jsii.implements(IPrivateSubnet)
class PrivateSubnet(
Subnet,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.PrivateSubnet",
):
"""Represents a private VPC subnet resource."""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
availability_zone: builtins.str,
cidr_block: builtins.str,
vpc_id: builtins.str,
map_public_ip_on_launch: typing.Optional[builtins.bool] = None,
) -> None:
"""
:param scope: -
:param id: -
:param availability_zone: The availability zone for the subnet.
:param cidr_block: The CIDR notation for this subnet.
:param vpc_id: The VPC which this subnet is part of.
:param map_public_ip_on_launch: Controls if a public IP is associated to an instance at launch. Default: true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.
"""
props = PrivateSubnetProps(
availability_zone=availability_zone,
cidr_block=cidr_block,
vpc_id=vpc_id,
map_public_ip_on_launch=map_public_ip_on_launch,
)
jsii.create(PrivateSubnet, self, [scope, id, props])
@jsii.member(jsii_name="fromPrivateSubnetAttributes")
@builtins.classmethod
def from_private_subnet_attributes(
cls,
scope: constructs.Construct,
id: builtins.str,
*,
subnet_id: builtins.str,
availability_zone: typing.Optional[builtins.str] = None,
ipv4_cidr_block: typing.Optional[builtins.str] = None,
route_table_id: typing.Optional[builtins.str] = None,
) -> IPrivateSubnet:
"""
:param scope: -
:param id: -
:param subnet_id: The subnetId for this particular subnet.
:param availability_zone: The Availability Zone the subnet is located in. Default: - No AZ information, cannot use AZ selection features
:param ipv4_cidr_block: The IPv4 CIDR block associated with the subnet. Default: - No CIDR information, cannot use CIDR filter features
:param route_table_id: The ID of the route table for this particular subnet. Default: - No route table information, cannot create VPC endpoints
"""
attrs = PrivateSubnetAttributes(
subnet_id=subnet_id,
availability_zone=availability_zone,
ipv4_cidr_block=ipv4_cidr_block,
route_table_id=route_table_id,
)
return jsii.sinvoke(cls, "fromPrivateSubnetAttributes", [scope, id, attrs])
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.PrivateSubnetAttributes",
jsii_struct_bases=[SubnetAttributes],
name_mapping={
"subnet_id": "subnetId",
"availability_zone": "availabilityZone",
"ipv4_cidr_block": "ipv4CidrBlock",
"route_table_id": "routeTableId",
},
)
class PrivateSubnetAttributes(SubnetAttributes):
def __init__(
self,
*,
subnet_id: builtins.str,
availability_zone: typing.Optional[builtins.str] = None,
ipv4_cidr_block: typing.Optional[builtins.str] = None,
route_table_id: typing.Optional[builtins.str] = None,
) -> None:
"""
:param subnet_id: The subnetId for this particular subnet.
:param availability_zone: The Availability Zone the subnet is located in. Default: - No AZ information, cannot use AZ selection features
:param ipv4_cidr_block: The IPv4 CIDR block associated with the subnet. Default: - No CIDR information, cannot use CIDR filter features
:param route_table_id: The ID of the route table for this particular subnet. Default: - No route table information, cannot create VPC endpoints
"""
self._values: typing.Dict[str, typing.Any] = {
"subnet_id": subnet_id,
}
if availability_zone is not None:
self._values["availability_zone"] = availability_zone
if ipv4_cidr_block is not None:
self._values["ipv4_cidr_block"] = ipv4_cidr_block
if route_table_id is not None:
self._values["route_table_id"] = route_table_id
@builtins.property
def subnet_id(self) -> builtins.str:
"""The subnetId for this particular subnet."""
result = self._values.get("subnet_id")
assert result is not None, "Required property 'subnet_id' is missing"
return result
@builtins.property
def availability_zone(self) -> typing.Optional[builtins.str]:
"""The Availability Zone the subnet is located in.
:default: - No AZ information, cannot use AZ selection features
"""
result = self._values.get("availability_zone")
return result
@builtins.property
def ipv4_cidr_block(self) -> typing.Optional[builtins.str]:
"""The IPv4 CIDR block associated with the subnet.
:default: - No CIDR information, cannot use CIDR filter features
"""
result = self._values.get("ipv4_cidr_block")
return result
@builtins.property
def route_table_id(self) -> typing.Optional[builtins.str]:
"""The ID of the route table for this particular subnet.
:default: - No route table information, cannot create VPC endpoints
"""
result = self._values.get("route_table_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PrivateSubnetAttributes(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.PrivateSubnetProps",
jsii_struct_bases=[SubnetProps],
name_mapping={
"availability_zone": "availabilityZone",
"cidr_block": "cidrBlock",
"vpc_id": "vpcId",
"map_public_ip_on_launch": "mapPublicIpOnLaunch",
},
)
class PrivateSubnetProps(SubnetProps):
def __init__(
self,
*,
availability_zone: builtins.str,
cidr_block: builtins.str,
vpc_id: builtins.str,
map_public_ip_on_launch: typing.Optional[builtins.bool] = None,
) -> None:
"""
:param availability_zone: The availability zone for the subnet.
:param cidr_block: The CIDR notation for this subnet.
:param vpc_id: The VPC which this subnet is part of.
:param map_public_ip_on_launch: Controls if a public IP is associated to an instance at launch. Default: true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.
"""
self._values: typing.Dict[str, typing.Any] = {
"availability_zone": availability_zone,
"cidr_block": cidr_block,
"vpc_id": vpc_id,
}
if map_public_ip_on_launch is not None:
self._values["map_public_ip_on_launch"] = map_public_ip_on_launch
@builtins.property
def availability_zone(self) -> builtins.str:
"""The availability zone for the subnet."""
result = self._values.get("availability_zone")
assert result is not None, "Required property 'availability_zone' is missing"
return result
@builtins.property
def cidr_block(self) -> builtins.str:
"""The CIDR notation for this subnet."""
result = self._values.get("cidr_block")
assert result is not None, "Required property 'cidr_block' is missing"
return result
@builtins.property
def vpc_id(self) -> builtins.str:
"""The VPC which this subnet is part of."""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def map_public_ip_on_launch(self) -> typing.Optional[builtins.bool]:
"""Controls if a public IP is associated to an instance at launch.
:default: true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.
"""
result = self._values.get("map_public_ip_on_launch")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PrivateSubnetProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.implements(IPublicSubnet)
class PublicSubnet(
Subnet,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.PublicSubnet",
):
"""Represents a public VPC subnet resource."""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
availability_zone: builtins.str,
cidr_block: builtins.str,
vpc_id: builtins.str,
map_public_ip_on_launch: typing.Optional[builtins.bool] = None,
) -> None:
"""
:param scope: -
:param id: -
:param availability_zone: The availability zone for the subnet.
:param cidr_block: The CIDR notation for this subnet.
:param vpc_id: The VPC which this subnet is part of.
:param map_public_ip_on_launch: Controls if a public IP is associated to an instance at launch. Default: true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.
"""
props = PublicSubnetProps(
availability_zone=availability_zone,
cidr_block=cidr_block,
vpc_id=vpc_id,
map_public_ip_on_launch=map_public_ip_on_launch,
)
jsii.create(PublicSubnet, self, [scope, id, props])
@jsii.member(jsii_name="fromPublicSubnetAttributes")
@builtins.classmethod
def from_public_subnet_attributes(
cls,
scope: constructs.Construct,
id: builtins.str,
*,
subnet_id: builtins.str,
availability_zone: typing.Optional[builtins.str] = None,
ipv4_cidr_block: typing.Optional[builtins.str] = None,
route_table_id: typing.Optional[builtins.str] = None,
) -> IPublicSubnet:
"""
:param scope: -
:param id: -
:param subnet_id: The subnetId for this particular subnet.
:param availability_zone: The Availability Zone the subnet is located in. Default: - No AZ information, cannot use AZ selection features
:param ipv4_cidr_block: The IPv4 CIDR block associated with the subnet. Default: - No CIDR information, cannot use CIDR filter features
:param route_table_id: The ID of the route table for this particular subnet. Default: - No route table information, cannot create VPC endpoints
"""
attrs = PublicSubnetAttributes(
subnet_id=subnet_id,
availability_zone=availability_zone,
ipv4_cidr_block=ipv4_cidr_block,
route_table_id=route_table_id,
)
return jsii.sinvoke(cls, "fromPublicSubnetAttributes", [scope, id, attrs])
@jsii.member(jsii_name="addNatGateway")
def add_nat_gateway(self) -> CfnNatGateway:
"""Creates a new managed NAT gateway attached to this public subnet.
Also adds the EIP for the managed NAT.
:return: A ref to the the NAT Gateway ID
"""
return jsii.invoke(self, "addNatGateway", [])
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.PublicSubnetAttributes",
jsii_struct_bases=[SubnetAttributes],
name_mapping={
"subnet_id": "subnetId",
"availability_zone": "availabilityZone",
"ipv4_cidr_block": "ipv4CidrBlock",
"route_table_id": "routeTableId",
},
)
class PublicSubnetAttributes(SubnetAttributes):
def __init__(
self,
*,
subnet_id: builtins.str,
availability_zone: typing.Optional[builtins.str] = None,
ipv4_cidr_block: typing.Optional[builtins.str] = None,
route_table_id: typing.Optional[builtins.str] = None,
) -> None:
"""
:param subnet_id: The subnetId for this particular subnet.
:param availability_zone: The Availability Zone the subnet is located in. Default: - No AZ information, cannot use AZ selection features
:param ipv4_cidr_block: The IPv4 CIDR block associated with the subnet. Default: - No CIDR information, cannot use CIDR filter features
:param route_table_id: The ID of the route table for this particular subnet. Default: - No route table information, cannot create VPC endpoints
"""
self._values: typing.Dict[str, typing.Any] = {
"subnet_id": subnet_id,
}
if availability_zone is not None:
self._values["availability_zone"] = availability_zone
if ipv4_cidr_block is not None:
self._values["ipv4_cidr_block"] = ipv4_cidr_block
if route_table_id is not None:
self._values["route_table_id"] = route_table_id
@builtins.property
def subnet_id(self) -> builtins.str:
"""The subnetId for this particular subnet."""
result = self._values.get("subnet_id")
assert result is not None, "Required property 'subnet_id' is missing"
return result
@builtins.property
def availability_zone(self) -> typing.Optional[builtins.str]:
"""The Availability Zone the subnet is located in.
:default: - No AZ information, cannot use AZ selection features
"""
result = self._values.get("availability_zone")
return result
@builtins.property
def ipv4_cidr_block(self) -> typing.Optional[builtins.str]:
"""The IPv4 CIDR block associated with the subnet.
:default: - No CIDR information, cannot use CIDR filter features
"""
result = self._values.get("ipv4_cidr_block")
return result
@builtins.property
def route_table_id(self) -> typing.Optional[builtins.str]:
"""The ID of the route table for this particular subnet.
:default: - No route table information, cannot create VPC endpoints
"""
result = self._values.get("route_table_id")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PublicSubnetAttributes(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
@jsii.data_type(
jsii_type="@aws-cdk/aws-ec2.PublicSubnetProps",
jsii_struct_bases=[SubnetProps],
name_mapping={
"availability_zone": "availabilityZone",
"cidr_block": "cidrBlock",
"vpc_id": "vpcId",
"map_public_ip_on_launch": "mapPublicIpOnLaunch",
},
)
class PublicSubnetProps(SubnetProps):
def __init__(
self,
*,
availability_zone: builtins.str,
cidr_block: builtins.str,
vpc_id: builtins.str,
map_public_ip_on_launch: typing.Optional[builtins.bool] = None,
) -> None:
"""
:param availability_zone: The availability zone for the subnet.
:param cidr_block: The CIDR notation for this subnet.
:param vpc_id: The VPC which this subnet is part of.
:param map_public_ip_on_launch: Controls if a public IP is associated to an instance at launch. Default: true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.
"""
self._values: typing.Dict[str, typing.Any] = {
"availability_zone": availability_zone,
"cidr_block": cidr_block,
"vpc_id": vpc_id,
}
if map_public_ip_on_launch is not None:
self._values["map_public_ip_on_launch"] = map_public_ip_on_launch
@builtins.property
def availability_zone(self) -> builtins.str:
"""The availability zone for the subnet."""
result = self._values.get("availability_zone")
assert result is not None, "Required property 'availability_zone' is missing"
return result
@builtins.property
def cidr_block(self) -> builtins.str:
"""The CIDR notation for this subnet."""
result = self._values.get("cidr_block")
assert result is not None, "Required property 'cidr_block' is missing"
return result
@builtins.property
def vpc_id(self) -> builtins.str:
"""The VPC which this subnet is part of."""
result = self._values.get("vpc_id")
assert result is not None, "Required property 'vpc_id' is missing"
return result
@builtins.property
def map_public_ip_on_launch(self) -> typing.Optional[builtins.bool]:
"""Controls if a public IP is associated to an instance at launch.
:default: true in Subnet.Public, false in Subnet.Private or Subnet.Isolated.
"""
result = self._values.get("map_public_ip_on_launch")
return result
def __eq__(self, rhs: typing.Any) -> builtins.bool:
return isinstance(rhs, self.__class__) and rhs._values == self._values
def __ne__(self, rhs: typing.Any) -> builtins.bool:
return not (rhs == self)
def __repr__(self) -> str:
return "PublicSubnetProps(%s)" % ", ".join(
k + "=" + repr(v) for k, v in self._values.items()
)
class WindowsImage(
GenericSSMParameterImage,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.WindowsImage",
):
"""Select the latest version of the indicated Windows version.
This Machine Image automatically updates to the latest version on every
deployment. Be aware this will cause your instances to be replaced when a
new version of the image becomes available. Do not store stateful information
on the instance if you are using this image.
The AMI ID is selected using the values published to the SSM parameter store.
https://aws.amazon.com/blogs/mt/query-for-the-latest-windows-ami-using-systems-manager-parameter-store/
"""
def __init__(
self,
version: WindowsVersion,
*,
user_data: typing.Optional[UserData] = None,
) -> None:
"""
:param version: -
:param user_data: Initial user data. Default: - Empty UserData for Windows machines
"""
props = WindowsImageProps(user_data=user_data)
jsii.create(WindowsImage, self, [version, props])
class AmazonLinuxImage(
GenericSSMParameterImage,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.AmazonLinuxImage",
):
"""Selects the latest version of Amazon Linux.
This Machine Image automatically updates to the latest version on every
deployment. Be aware this will cause your instances to be replaced when a
new version of the image becomes available. Do not store stateful information
on the instance if you are using this image.
The AMI ID is selected using the values published to the SSM parameter store.
"""
def __init__(
self,
*,
cpu_type: typing.Optional[AmazonLinuxCpuType] = None,
edition: typing.Optional[AmazonLinuxEdition] = None,
generation: typing.Optional[AmazonLinuxGeneration] = None,
storage: typing.Optional[AmazonLinuxStorage] = None,
user_data: typing.Optional[UserData] = None,
virtualization: typing.Optional[AmazonLinuxVirt] = None,
) -> None:
"""
:param cpu_type: CPU Type. Default: X86_64
:param edition: What edition of Amazon Linux to use. Default: Standard
:param generation: What generation of Amazon Linux to use. Default: AmazonLinux
:param storage: What storage backed image to use. Default: GeneralPurpose
:param user_data: Initial user data. Default: - Empty UserData for Linux machines
:param virtualization: Virtualization type. Default: HVM
"""
props = AmazonLinuxImageProps(
cpu_type=cpu_type,
edition=edition,
generation=generation,
storage=storage,
user_data=user_data,
virtualization=virtualization,
)
jsii.create(AmazonLinuxImage, self, [props])
@jsii.implements(IGatewayVpcEndpoint)
class GatewayVpcEndpoint(
VpcEndpoint,
metaclass=jsii.JSIIMeta,
jsii_type="@aws-cdk/aws-ec2.GatewayVpcEndpoint",
):
"""A gateway VPC endpoint.
:resource: AWS::EC2::VPCEndpoint
"""
def __init__(
self,
scope: constructs.Construct,
id: builtins.str,
*,
vpc: IVpc,
service: IGatewayVpcEndpointService,
subnets: typing.Optional[typing.List[SubnetSelection]] = None,
) -> None:
"""
:param scope: -
:param id: -
:param vpc: The VPC network in which the gateway endpoint will be used.
:param service: The service to use for this gateway VPC endpoint.
:param subnets: Where to add endpoint routing. By default, this endpoint will be routable from all subnets in the VPC. Specify a list of subnet selection objects here to be more specific. Default: - All subnets in the VPC
"""
props = GatewayVpcEndpointProps(vpc=vpc, service=service, subnets=subnets)
jsii.create(GatewayVpcEndpoint, self, [scope, id, props])
@jsii.member(jsii_name="fromGatewayVpcEndpointId")
@builtins.classmethod
def from_gateway_vpc_endpoint_id(
cls,
scope: constructs.Construct,
id: builtins.str,
gateway_vpc_endpoint_id: builtins.str,
) -> IGatewayVpcEndpoint:
"""
:param scope: -
:param id: -
:param gateway_vpc_endpoint_id: -
"""
return jsii.sinvoke(cls, "fromGatewayVpcEndpointId", [scope, id, gateway_vpc_endpoint_id])
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointCreationTimestamp")
def vpc_endpoint_creation_timestamp(self) -> builtins.str:
"""The date and time the gateway VPC endpoint was created.
:attribute: true
"""
return jsii.get(self, "vpcEndpointCreationTimestamp")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointDnsEntries")
def vpc_endpoint_dns_entries(self) -> typing.List[builtins.str]:
"""
:attribute: true
"""
return jsii.get(self, "vpcEndpointDnsEntries")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointId")
def vpc_endpoint_id(self) -> builtins.str:
"""The gateway VPC endpoint identifier."""
return jsii.get(self, "vpcEndpointId")
@builtins.property # type: ignore
@jsii.member(jsii_name="vpcEndpointNetworkInterfaceIds")
def vpc_endpoint_network_interface_ids(self) -> typing.List[builtins.str]:
"""
:attribute: true
"""
return jsii.get(self, "vpcEndpointNetworkInterfaceIds")
__all__ = [
"AclCidr",
"AclCidrConfig",
"AclIcmp",
"AclPortRange",
"AclTraffic",
"AclTrafficConfig",
"Action",
"AddRouteOptions",
"AmazonLinuxCpuType",
"AmazonLinuxEdition",
"AmazonLinuxGeneration",
"AmazonLinuxImage",
"AmazonLinuxImageProps",
"AmazonLinuxStorage",
"AmazonLinuxVirt",
"ApplyCloudFormationInitOptions",
"AttachInitOptions",
"BastionHostLinux",
"BastionHostLinuxProps",
"BlockDevice",
"BlockDeviceVolume",
"CfnCapacityReservation",
"CfnCapacityReservationProps",
"CfnCarrierGateway",
"CfnCarrierGatewayProps",
"CfnClientVpnAuthorizationRule",
"CfnClientVpnAuthorizationRuleProps",
"CfnClientVpnEndpoint",
"CfnClientVpnEndpointProps",
"CfnClientVpnRoute",
"CfnClientVpnRouteProps",
"CfnClientVpnTargetNetworkAssociation",
"CfnClientVpnTargetNetworkAssociationProps",
"CfnCustomerGateway",
"CfnCustomerGatewayProps",
"CfnDHCPOptions",
"CfnDHCPOptionsProps",
"CfnEC2Fleet",
"CfnEC2FleetProps",
"CfnEIP",
"CfnEIPAssociation",
"CfnEIPAssociationProps",
"CfnEIPProps",
"CfnEgressOnlyInternetGateway",
"CfnEgressOnlyInternetGatewayProps",
"CfnFlowLog",
"CfnFlowLogProps",
"CfnGatewayRouteTableAssociation",
"CfnGatewayRouteTableAssociationProps",
"CfnHost",
"CfnHostProps",
"CfnInstance",
"CfnInstanceProps",
"CfnInternetGateway",
"CfnInternetGatewayProps",
"CfnLaunchTemplate",
"CfnLaunchTemplateProps",
"CfnLocalGatewayRoute",
"CfnLocalGatewayRouteProps",
"CfnLocalGatewayRouteTableVPCAssociation",
"CfnLocalGatewayRouteTableVPCAssociationProps",
"CfnNatGateway",
"CfnNatGatewayProps",
"CfnNetworkAcl",
"CfnNetworkAclEntry",
"CfnNetworkAclEntryProps",
"CfnNetworkAclProps",
"CfnNetworkInsightsAnalysis",
"CfnNetworkInsightsAnalysisProps",
"CfnNetworkInsightsPath",
"CfnNetworkInsightsPathProps",
"CfnNetworkInterface",
"CfnNetworkInterfaceAttachment",
"CfnNetworkInterfaceAttachmentProps",
"CfnNetworkInterfacePermission",
"CfnNetworkInterfacePermissionProps",
"CfnNetworkInterfaceProps",
"CfnPlacementGroup",
"CfnPlacementGroupProps",
"CfnPrefixList",
"CfnPrefixListProps",
"CfnRoute",
"CfnRouteProps",
"CfnRouteTable",
"CfnRouteTableProps",
"CfnSecurityGroup",
"CfnSecurityGroupEgress",
"CfnSecurityGroupEgressProps",
"CfnSecurityGroupIngress",
"CfnSecurityGroupIngressProps",
"CfnSecurityGroupProps",
"CfnSpotFleet",
"CfnSpotFleetProps",
"CfnSubnet",
"CfnSubnetCidrBlock",
"CfnSubnetCidrBlockProps",
"CfnSubnetNetworkAclAssociation",
"CfnSubnetNetworkAclAssociationProps",
"CfnSubnetProps",
"CfnSubnetRouteTableAssociation",
"CfnSubnetRouteTableAssociationProps",
"CfnTrafficMirrorFilter",
"CfnTrafficMirrorFilterProps",
"CfnTrafficMirrorFilterRule",
"CfnTrafficMirrorFilterRuleProps",
"CfnTrafficMirrorSession",
"CfnTrafficMirrorSessionProps",
"CfnTrafficMirrorTarget",
"CfnTrafficMirrorTargetProps",
"CfnTransitGateway",
"CfnTransitGatewayAttachment",
"CfnTransitGatewayAttachmentProps",
"CfnTransitGatewayProps",
"CfnTransitGatewayRoute",
"CfnTransitGatewayRouteProps",
"CfnTransitGatewayRouteTable",
"CfnTransitGatewayRouteTableAssociation",
"CfnTransitGatewayRouteTableAssociationProps",
"CfnTransitGatewayRouteTablePropagation",
"CfnTransitGatewayRouteTablePropagationProps",
"CfnTransitGatewayRouteTableProps",
"CfnVPC",
"CfnVPCCidrBlock",
"CfnVPCCidrBlockProps",
"CfnVPCDHCPOptionsAssociation",
"CfnVPCDHCPOptionsAssociationProps",
"CfnVPCEndpoint",
"CfnVPCEndpointConnectionNotification",
"CfnVPCEndpointConnectionNotificationProps",
"CfnVPCEndpointProps",
"CfnVPCEndpointService",
"CfnVPCEndpointServicePermissions",
"CfnVPCEndpointServicePermissionsProps",
"CfnVPCEndpointServiceProps",
"CfnVPCGatewayAttachment",
"CfnVPCGatewayAttachmentProps",
"CfnVPCPeeringConnection",
"CfnVPCPeeringConnectionProps",
"CfnVPCProps",
"CfnVPNConnection",
"CfnVPNConnectionProps",
"CfnVPNConnectionRoute",
"CfnVPNConnectionRouteProps",
"CfnVPNGateway",
"CfnVPNGatewayProps",
"CfnVPNGatewayRoutePropagation",
"CfnVPNGatewayRoutePropagationProps",
"CfnVolume",
"CfnVolumeAttachment",
"CfnVolumeAttachmentProps",
"CfnVolumeProps",
"CloudFormationInit",
"CommonNetworkAclEntryOptions",
"ConfigSetProps",
"ConfigureNatOptions",
"ConnectionRule",
"Connections",
"ConnectionsProps",
"CpuCredits",
"DefaultInstanceTenancy",
"EbsDeviceOptions",
"EbsDeviceOptionsBase",
"EbsDeviceProps",
"EbsDeviceSnapshotOptions",
"EbsDeviceVolumeType",
"EnableVpnGatewayOptions",
"ExecuteFileOptions",
"FlowLog",
"FlowLogDestination",
"FlowLogDestinationConfig",
"FlowLogDestinationType",
"FlowLogOptions",
"FlowLogProps",
"FlowLogResourceType",
"FlowLogTrafficType",
"GatewayConfig",
"GatewayVpcEndpoint",
"GatewayVpcEndpointAwsService",
"GatewayVpcEndpointOptions",
"GatewayVpcEndpointProps",
"GenericLinuxImage",
"GenericLinuxImageProps",
"GenericSSMParameterImage",
"GenericWindowsImage",
"GenericWindowsImageProps",
"IConnectable",
"IFlowLog",
"IGatewayVpcEndpoint",
"IGatewayVpcEndpointService",
"IInstance",
"IInterfaceVpcEndpoint",
"IInterfaceVpcEndpointService",
"ILaunchTemplate",
"IMachineImage",
"INetworkAcl",
"INetworkAclEntry",
"IPeer",
"IPrivateSubnet",
"IPublicSubnet",
"IRouteTable",
"ISecurityGroup",
"ISubnet",
"ISubnetNetworkAclAssociation",
"IVolume",
"IVpc",
"IVpcEndpoint",
"IVpcEndpointService",
"IVpcEndpointServiceLoadBalancer",
"IVpnConnection",
"IVpnGateway",
"InitCommand",
"InitCommandOptions",
"InitCommandWaitDuration",
"InitConfig",
"InitElement",
"InitFile",
"InitFileAssetOptions",
"InitFileOptions",
"InitGroup",
"InitPackage",
"InitService",
"InitServiceOptions",
"InitServiceRestartHandle",
"InitSource",
"InitSourceAssetOptions",
"InitSourceOptions",
"InitUser",
"InitUserOptions",
"Instance",
"InstanceArchitecture",
"InstanceClass",
"InstanceInitiatedShutdownBehavior",
"InstanceProps",
"InstanceSize",
"InstanceType",
"InterfaceVpcEndpoint",
"InterfaceVpcEndpointAttributes",
"InterfaceVpcEndpointAwsService",
"InterfaceVpcEndpointOptions",
"InterfaceVpcEndpointProps",
"InterfaceVpcEndpointService",
"LaunchTemplate",
"LaunchTemplateAttributes",
"LaunchTemplateProps",
"LaunchTemplateSpecialVersions",
"LaunchTemplateSpotOptions",
"LinuxUserDataOptions",
"LocationPackageOptions",
"LookupMachineImage",
"LookupMachineImageProps",
"MachineImage",
"MachineImageConfig",
"NamedPackageOptions",
"NatInstanceImage",
"NatInstanceProps",
"NatInstanceProvider",
"NatProvider",
"NetworkAcl",
"NetworkAclEntry",
"NetworkAclEntryProps",
"NetworkAclProps",
"OperatingSystemType",
"Peer",
"Port",
"PortProps",
"PrivateSubnet",
"PrivateSubnetAttributes",
"PrivateSubnetProps",
"Protocol",
"PublicSubnet",
"PublicSubnetAttributes",
"PublicSubnetProps",
"RouterType",
"S3DownloadOptions",
"SecurityGroup",
"SecurityGroupImportOptions",
"SecurityGroupProps",
"SelectedSubnets",
"SpotInstanceInterruption",
"SpotRequestType",
"Subnet",
"SubnetAttributes",
"SubnetConfiguration",
"SubnetFilter",
"SubnetNetworkAclAssociation",
"SubnetNetworkAclAssociationProps",
"SubnetProps",
"SubnetSelection",
"SubnetType",
"TrafficDirection",
"UserData",
"Volume",
"VolumeAttributes",
"VolumeProps",
"Vpc",
"VpcAttributes",
"VpcEndpoint",
"VpcEndpointService",
"VpcEndpointServiceProps",
"VpcEndpointType",
"VpcLookupOptions",
"VpcProps",
"VpnConnection",
"VpnConnectionOptions",
"VpnConnectionProps",
"VpnConnectionType",
"VpnGateway",
"VpnGatewayProps",
"VpnTunnelOption",
"WindowsImage",
"WindowsImageProps",
"WindowsVersion",
]
publication.publish()
|
[
"awszac@amazon.com"
] |
awszac@amazon.com
|
d8aecaeaad45662898a7a2b940b2d161fd4d637f
|
dc8e74f46e0e30254ef5d5c3d019a38e804ddcf1
|
/Subsetting columns.py
|
b3ab2d8cb410c3898ba5729ab4fd2f965786350e
|
[] |
no_license
|
abhiwer/Data-Manupulation-with-Pandas
|
079553dad59f092cbd5aacb8a55c3ddcc7f10a6e
|
18d943ed035946d4579893f6a19d08c39d5b1058
|
refs/heads/master
| 2022-11-30T06:36:41.933399
| 2020-08-07T01:33:39
| 2020-08-07T01:33:39
| 282,557,842
| 1
| 3
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,362
|
py
|
'''
Subsetting columns
When working with data, you may not need all of the variables in your dataset. Square-brackets ([]) can be used to select only the columns that matter to you in an order that makes sense to you. To select only "col_a" of the DataFrame df, use
df["col_a"]
To select "col_a" and "col_b" of df, use
df[["col_a", "col_b"]]
homelessness is available and pandas is loaded as pd.
Instructions 1/3
35 XP
Instructions 1/3
35 XP
1
Create a DataFrame called individuals that contains only the individuals column of homelessness.
Print the head of the result.
Take Hint (-10 XP)
2
Create a DataFrame called state_fam that contains only the state and family_members columns of homelessness, in that order.
Print the head of the result.
3
Create a DataFrame called ind_state that contains the individuals and state columns of homelessness, in that order.
Print the head of the result.
'''
# Select the individuals column
individuals = homelessness["individuals"]
# Print the head of the result
print(individuals.head())
# Select the state and family_members columns
state_fam = homelessness[["state", "family_members"]]
# Print the head of the result
print(state_fam.head())
# Select only the individuals and state columns, in that order
ind_state = homelessness[["individuals", "state"]]
# Print the head of the result
print(ind_state.head())
|
[
"rajanpan97@gmail.com"
] |
rajanpan97@gmail.com
|
220208648d63d893d8f2ff091103d838f9d1bee0
|
8c6cd503fb4c909c6f85a7640f67cf46f1f25225
|
/btorch/models/detectron2/layers/roi_align_rotated.py
|
6f4935e9795f389a0529e6d637ef54b9bbb1f342
|
[
"MIT"
] |
permissive
|
vladstreltsin/blox
|
84c1cf10ccbd4aaa6ea4c0e5bc144d7eb72990cc
|
2822b84220e512c8012b1b4ec51d6e534bd4d652
|
refs/heads/main
| 2023-04-16T19:07:13.920603
| 2021-05-09T14:59:22
| 2021-05-09T14:59:22
| 335,411,889
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 391
|
py
|
import detectron2.layers.roi_align_rotated as rar
from blox_old.btorch.module import TorchModule
class ROIAlignRotated(TorchModule):
def __init__(self, *args, name=None, **kwargs):
super(ROIAlignRotated, self).__init__(module=rar.ROIAlignRotated(*args, **kwargs),
In=('x', 'rois'), Out=1, name=name)
self.lock_ports = True
|
[
"vladstreltsin@gmail.com"
] |
vladstreltsin@gmail.com
|
ee1c8da9f7d25a5437f1ac26ab3f462d47218f21
|
1d182c8cf1ce19019e0b1cba4a16ee1a2a49751e
|
/scripts/cifar/demo_cifar10_pil.py
|
427d474176654ca775583b455d30f8b5ed927e9e
|
[
"MIT"
] |
permissive
|
zxt881108/pytorch-cv
|
e30ac8638a8819b637c6bbef717f733264229126
|
6f2d1760f12c9a56a3e7b19ba74bc41451ea284c
|
refs/heads/master
| 2020-06-18T18:16:09.741626
| 2019-04-29T14:11:06
| 2019-04-29T14:11:06
| 196,396,348
| 5
| 0
| null | 2019-07-11T13:06:29
| 2019-07-11T13:06:28
| null |
UTF-8
|
Python
| false
| false
| 2,233
|
py
|
import os
import sys
import argparse
from PIL import Image
import torch
import torch.nn.functional as F
from torchvision import transforms
cur_path = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(cur_path, '../..'))
from model.model_zoo import get_model
def parse_args():
parser = argparse.ArgumentParser(description='Predict CIFAR10 classes from a given image')
parser.add_argument('--model', type=str, default='CIFAR_ResNeXt29_16x64d',
help='name of the model to use')
parser.add_argument('--root', type=str, default=os.path.expanduser('~/.torch/models'),
help='pre-trained model root')
parser.add_argument('--saved-params', type=str, default='',
help='path to the saved model parameters')
parser.add_argument('--cuda', action='store_true', default=False, help='demo with GPU')
parser.add_argument('--input-pic', type=str, default=os.path.join(cur_path, '../png/cat.jpg'),
help='path to the input picture')
opt = parser.parse_args()
return opt
if __name__ == '__main__':
# config
classes = 10
class_names = ['airplane', 'automobile', 'bird', 'cat', 'deer',
'dog', 'frog', 'horse', 'ship', 'truck']
args = parse_args()
device = torch.device('cpu')
if args.cuda:
device = torch.device('cuda:0')
# Load Model
model_name = args.model
pretrained = True if args.saved_params == '' else False
kwargs = {'classes': classes, 'pretrained': pretrained, 'root': args.root, }
net = get_model(model_name, **kwargs).to(device)
net.eval()
# Load Images
img = Image.open(args.input_pic)
# Transform
transform_fn = transforms.Compose([
transforms.Resize(32),
transforms.CenterCrop(32),
transforms.ToTensor(),
transforms.Normalize([0.4914, 0.4822, 0.4465], [0.2023, 0.1994, 0.2010])
])
img = transform_fn(img).to(device)
with torch.no_grad():
pred = net(img.unsqueeze(0)).squeeze()
ind = pred.argmax()
print('The input picture is classified to be [%s], with probability %.3f.' %
(class_names[ind.item()], F.softmax(pred, 0)[ind].item()))
|
[
"tinyshine@yeah.net"
] |
tinyshine@yeah.net
|
6f8ccec00f8d26d83db3fc3ce5156eb4ccadfe49
|
541ac8cd5fa84bfc52175ba3b0d717a6d16d3d0d
|
/manage.py
|
8df23867541dce625f994c79715c583540317b77
|
[] |
no_license
|
benrudolph/secretary
|
d7d1a7755cf4b22a92cb3ae75a51304277af78bd
|
117eafca3a4a0e582f748b98d669b2213e04e81d
|
refs/heads/master
| 2020-04-29T10:37:22.284272
| 2015-03-24T02:39:14
| 2015-03-24T02:39:14
| 32,771,741
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 251
|
py
|
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bonhomie.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
|
[
"rudolphben@gmail.com"
] |
rudolphben@gmail.com
|
8e85ad171e89f27d649e1e69ed29a7c6f361555e
|
6f2cc06f1f9513e1432e9d7a399cc943beb89a40
|
/mmpredict_field.py
|
d6459fa796f13043af2d52dd12b0eb3ab74a8460
|
[] |
no_license
|
DableUTeeF/mifov_final
|
1f54eaebca568cda9e8801846eef228b04a174db
|
da7ee669bff3ba1e5cb95d9c6cd7c30876310d1b
|
refs/heads/master
| 2023-08-21T14:32:32.543441
| 2021-09-30T16:40:18
| 2021-09-30T16:40:18
| 381,572,649
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,742
|
py
|
import sys
# sys.path.extend(['/home/palm/PycharmProjects/mmdetection'])
from mmdet.apis import inference_detector, init_detector, show_result_pyplot
from mmcv import Config
import cv2
import json
import os
if __name__ == '__main__':
filedir = '/media/palm/data/MicroAlgae/specificity'
out_path = '/media/palm/BiggerData/algea/predict_4/gfl_r50_kk_1'
cfg = Config.fromfile('/home/palm/PycharmProjects/pig/mmdetection/configs/detr/detr_r50_8x2_150e_coco.py')
if cfg.model.type == 'CascadeRCNN':
if cfg.model.backbone.depth == 50:
cfg.model.roi_head.bbox_head[0].num_classes = 2
cfg.model.roi_head.bbox_head[1].num_classes = 2
cfg.model.roi_head.bbox_head[2].num_classes = 2
elif cfg.model.type == 'FasterRCNN':
cfg.model.roi_head.bbox_head.num_classes = 2
else:
cfg.model.bbox_head.num_classes = 2
# Build the detector
model = init_detector(cfg, '/media/palm/BiggerData/algea/weights/detr_lab_4/epoch_30.pth', device='cuda')
os.makedirs(out_path, exist_ok=True)
for file in os.listdir(filedir):
filename = os.path.join(filedir, file)
# test a single image
result = inference_detector(model, filename)
# show the results
img = model.show_result(filename,
result,
score_thr=0.3, show=False)
# print(result)
cv2.imwrite(os.path.join(out_path,
file),
img)
# cv2.imshow(data['filename'], cv2.resize(img, None, None, 0.5, 0.5))
# cv2.waitKey()
# cv2.destroyAllWindows()
# show_result_pyplot(model, data['filename'], result, score_thr=0.3)
|
[
"palm22180@gmail.com"
] |
palm22180@gmail.com
|
4dc1285872e99f3f913862514b07801b3b130a0d
|
74d67ec9a962f8022822750b1e3552987371cde8
|
/mailhedgehog
|
fa0392a689fd8ddbfcd399c935ad7e514bdba1fc
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
linsomniac/mailhedgehog
|
b4305fd7c2242094f2a92776ab9a4b77c7ef06e1
|
74410a446c8e68582b40a4b00544a69f7687070b
|
refs/heads/master
| 2023-09-02T12:24:45.739018
| 2022-07-23T11:47:44
| 2022-07-23T11:47:44
| 219,825,941
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 3,059
|
#!/usr/bin/env python3
from quart import (
Quart, make_push_promise, url_for, websocket)
from pathlib import Path
from quart.json import dumps
from werkzeug.exceptions import NotFound
import asyncio
from aiosmtpd.smtp import SMTP
from functools import partial, wraps
from collections import deque
from mail import format_message
ConfigMaxMessages = 100
ConfigSmtpPort = 1025
ConfigHttpPort = 8025
ConfigHttpAddress = ''
ConfigDebug = True
# Generate with: openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
ConfigCertFile = None # 'cert.pem'
ConfigKeyFile = None # 'key.pem'
connected_websockets = set()
global_messages = deque(maxlen=ConfigMaxMessages)
app = Quart(__name__)
@app.before_serving
async def startup() -> None:
class SmtpHandler:
async def handle_DATA(self, server, session, envelope):
message = format_message(session, envelope)
global_messages.appendleft(message)
for queue in connected_websockets:
await queue.put(dumps(message))
return '250 OK'
loop = asyncio.get_event_loop()
app.smtp_server = loop.create_server(
partial(SMTP, SmtpHandler()), port=ConfigSmtpPort)
loop.create_task(app.smtp_server)
@app.after_serving
async def cleanup() -> None:
app.smtp_server.close()
@app.route('/')
async def index() -> str:
# Needs certfile and keyfile
await make_push_promise(url_for('static', filename='js/controllers.js'))
await make_push_promise(url_for('static', filename='js/strutil.js'))
await make_push_promise(url_for('static', filename='images/hog.png'))
await make_push_promise(url_for('static', filename='images/github.png'))
await make_push_promise(url_for('static', filename='css/style.css'))
return Path('templates/index.html').read_text()
@app.route('/api/v2/messages', methods=['GET'])
async def messages() -> dict:
return {
'count': len(global_messages),
'start': 0,
'total': len(global_messages),
'items': list(global_messages),
}
@app.route('/api/v1/messages', methods=['DELETE'])
async def delete_all_messages() -> str:
global_messages.clear()
return 'OK'
@app.route('/api/v1/messages/<msgid>', methods=['GET'])
async def message(msgid: str) -> deque:
for m in global_messages:
if m['ID'] == msgid:
return m
raise NotFound()
def collect_websocket(func):
@wraps(func)
async def wrapper(*args, **kwargs):
global connected_websockets
queue = asyncio.Queue()
connected_websockets.add(queue)
try:
return await func(queue, *args, **kwargs)
finally:
connected_websockets.remove(queue)
return wrapper
@app.websocket('/api/v2/websocket')
@collect_websocket
async def ws(queue):
while True:
data = await queue.get()
await websocket.send(data)
app.run(
port=ConfigHttpPort, host=ConfigHttpAddress, debug=ConfigDebug,
certfile=ConfigCertFile, keyfile=ConfigKeyFile)
|
[
"sean@realgo.com"
] |
sean@realgo.com
|
|
849028b81132c3eeeb6d9fcc5a34a436730b8181
|
6fa7f99d3d3d9b177ef01ebf9a9da4982813b7d4
|
/3eEjDZtxDtaiZccf9_3.py
|
0743435861b1029cea77a37dabee2c9a5b15ff36
|
[] |
no_license
|
daniel-reich/ubiquitous-fiesta
|
26e80f0082f8589e51d359ce7953117a3da7d38c
|
9af2700dbe59284f5697e612491499841a6c126f
|
refs/heads/master
| 2023-04-05T06:40:37.328213
| 2021-04-06T20:17:44
| 2021-04-06T20:17:44
| 355,318,759
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 119
|
py
|
def can_play(hand, face):
atts = sum([x.split() for x in hand],[])
return any([x in face.split() for x in atts])
|
[
"daniel.reich@danielreichs-MacBook-Pro.local"
] |
daniel.reich@danielreichs-MacBook-Pro.local
|
027c674f48b50f9a0abe849ebba84cf45c8f7966
|
32373e7de37092a101ad60d54b3f76dc7e730f80
|
/leetcode/122_BestTimetoBuyandSellStockII/main.py
|
08a7cc92b2eac3adb70ec173ca8d61b870b6b402
|
[] |
no_license
|
sauleddy/python_practice
|
1ddb3f0f23c4abcdeb8402918472fad97eac91f7
|
10c0311585e6daec87e89960484c0141c6a3c5cd
|
refs/heads/master
| 2021-01-19T05:02:57.686966
| 2017-06-20T06:51:05
| 2017-06-20T06:51:05
| 87,409,325
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 514
|
py
|
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
profit = 0
if len(prices) == 0:
return profit
price_buy = prices[0]
for idx in range(1, len(prices)):
if prices[idx] < price_buy:
price_buy = prices[idx]
elif prices[idx] > price_buy:
profit += prices[idx] - price_buy
price_buy = prices[idx]
return profit
|
[
"sauleddy38@gmail.com"
] |
sauleddy38@gmail.com
|
27b6925987b91c6dfc9f722599ac790738e7beef
|
9dee30da6cdf6baabdd7f8c872ecd101fd963707
|
/Python Bot/botpackage/SQLighter.py
|
5f765421a47ec251990abd0f711676ac2bf30de2
|
[] |
no_license
|
GreatSoulSam/PythonlibPublic
|
c0661b2a7059381fa98fe6ada15c848fdfea838b
|
474ee183e00ead9c0284f7e1be0372134c9914fb
|
refs/heads/master
| 2020-05-26T22:46:09.463205
| 2019-05-24T10:39:05
| 2019-05-24T10:39:05
| 188,403,393
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 813
|
py
|
# -*- coding: utf-8 -*-
import sqlite3
class SQLighter:
def __init__(self, database):
self.connection = sqlite3.connect(database)
self.cursor = self.connection.cursor()
def select_all(self):
""" get all the strings """
with self.connection:
return self.cursor.execute('SELECT * FROM music').fetchall()
def select_single(self, rownum):
""" get string by rownum """
with self.connection:
return self.cursor.execute('SELECT * FROM music WHERE id = ?', (rownum,)).fetchall()[0]
def count_rows(self):
with self.connection:
result = self.cursor.execute('SELECT * FROM music').fetchall()
return len(result)
def close(self):
""" disconnect from DB """
self.connection.close()
|
[
"noreply@github.com"
] |
GreatSoulSam.noreply@github.com
|
71de6dd2732dce2f4d92b5949d5ffe36419fdf70
|
268424c19feb5c4b6a3f53d901a7f8560556dd24
|
/tests/test_data/test_pipelines/test_augmentations/test_color.py
|
f8d267ba0122dbc2e40c8963770714d48baed556
|
[
"Apache-2.0"
] |
permissive
|
ZJU-lishuang/mmaction2
|
b1ec4f395934071e8efd7c851bd43b21ecae2bea
|
dc46505319968eff0123eb5abb811969042377c5
|
refs/heads/master
| 2023-06-02T21:33:18.043709
| 2021-03-29T01:45:53
| 2021-03-29T01:45:53
| 334,845,651
| 3
| 0
|
Apache-2.0
| 2021-06-04T01:15:29
| 2021-02-01T05:54:35
|
Python
|
UTF-8
|
Python
| false
| false
| 2,872
|
py
|
import numpy as np
from mmcv.utils import assert_dict_has_keys
from numpy.testing import assert_array_equal
from mmaction.datasets.pipelines import ColorJitter
class TestColor:
def test_color_jitter(self):
imgs = list(
np.random.randint(0, 255, size=(3, 112, 112, 3), dtype=np.uint8))
results = dict(imgs=imgs)
eig_val = np.array([55.46, 4.794, 1.148], dtype=np.float32)
eig_vec = np.array([[-0.5675, 0.7192, 0.4009],
[-0.5808, -0.0045, -0.8140],
[-0.5836, -0.6948, 0.4203]],
dtype=np.float32)
color_jitter = ColorJitter()
assert_array_equal(color_jitter.eig_val, eig_val)
assert_array_equal(color_jitter.eig_vec, eig_vec)
assert color_jitter.alpha_std == 0.1
assert color_jitter.color_space_aug is False
color_jitter_results = color_jitter(results)
target_keys = [
'imgs', 'eig_val', 'eig_vec', 'alpha_std', 'color_space_aug'
]
assert assert_dict_has_keys(color_jitter_results, target_keys)
assert np.shape(color_jitter_results['imgs']) == (3, 112, 112, 3)
assert_array_equal(color_jitter_results['eig_val'], eig_val)
assert_array_equal(color_jitter_results['eig_vec'], eig_vec)
assert color_jitter_results['alpha_std'] == 0.1
assert color_jitter_results['color_space_aug'] is False
custom_eig_val = np.ones(3, )
custom_eig_vec = np.ones((3, 3))
imgs = list(
np.random.randint(0, 255, size=(3, 64, 80, 3), dtype=np.uint8))
results = dict(imgs=imgs)
custom_color_jitter = ColorJitter(True, 0.5, custom_eig_val,
custom_eig_vec)
assert_array_equal(color_jitter.eig_val, eig_val)
assert_array_equal(color_jitter.eig_vec, eig_vec)
assert custom_color_jitter.alpha_std == 0.5
assert custom_color_jitter.color_space_aug is True
custom_color_jitter_results = custom_color_jitter(results)
assert np.shape(custom_color_jitter_results['imgs']) == (3, 64, 80, 3)
assert_array_equal(custom_color_jitter_results['eig_val'],
custom_eig_val)
assert_array_equal(custom_color_jitter_results['eig_vec'],
custom_eig_vec)
assert custom_color_jitter_results['alpha_std'] == 0.5
assert custom_color_jitter_results['color_space_aug'] is True
color_jitter = ColorJitter()
assert repr(color_jitter) == (f'{color_jitter.__class__.__name__}('
f'color_space_aug={False}, '
f'alpha_std={0.1}, '
f'eig_val={eig_val}, '
f'eig_vec={eig_vec})')
|
[
"noreply@github.com"
] |
ZJU-lishuang.noreply@github.com
|
cec6b0f8b9886ccad6305b02bf7b8bc1c41b854f
|
360ae1188ad79e71ccc72da0b9ae709bda678f91
|
/ryu/tests/mininet/l3/icmp/test_icmp.py
|
090f83e5e0641407bb768be3a2f6be651f758f78
|
[
"Apache-2.0"
] |
permissive
|
faucetsdn/ryu
|
47b3523e7ccb381f3bdf2877a3f9f01cb1876054
|
d6cda4f427ff8de82b94c58aa826824a106014c2
|
refs/heads/master
| 2023-09-05T06:37:21.991029
| 2022-06-09T23:09:40
| 2022-06-09T23:09:40
| 2,945,007
| 385
| 215
|
Apache-2.0
| 2022-11-13T10:50:25
| 2011-12-09T03:43:50
|
Python
|
UTF-8
|
Python
| false
| false
| 2,993
|
py
|
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
import struct
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller import dpset
from ryu.controller.handler import MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_2
from ryu.lib.mac import haddr_to_str
LOG = logging.getLogger(__name__)
class RunTestMininet(app_manager.RyuApp):
_CONTEXTS = {'dpset': dpset.DPSet}
OFP_VERSIONS = [ofproto_v1_2.OFP_VERSION]
def __init__(self, *args, **kwargs):
super(RunTestMininet, self).__init__(*args, **kwargs)
def _add_flow(self, dp, match, actions):
inst = [dp.ofproto_parser.OFPInstructionActions(
dp.ofproto.OFPIT_APPLY_ACTIONS, actions)]
mod = dp.ofproto_parser.OFPFlowMod(
dp, cookie=0, cookie_mask=0, table_id=0,
command=dp.ofproto.OFPFC_ADD, idle_timeout=0, hard_timeout=0,
priority=0xff, buffer_id=0xffffffff,
out_port=dp.ofproto.OFPP_ANY, out_group=dp.ofproto.OFPG_ANY,
flags=0, match=match, instructions=inst)
dp.send_msg(mod)
def _define_flow(self, dp):
in_port = 1
out_port = 2
# port:1 -> port:2
match = dp.ofproto_parser.OFPMatch()
match.set_in_port(in_port)
actions = [dp.ofproto_parser.OFPActionOutput(out_port, 0)]
self._add_flow(dp, match, actions)
# port:1 -> port:2
match = dp.ofproto_parser.OFPMatch()
match.set_in_port(out_port)
actions = [dp.ofproto_parser.OFPActionOutput(in_port, 0)]
self._add_flow(dp, match, actions)
@set_ev_cls(dpset.EventDP, dpset.DPSET_EV_DISPATCHER)
def handler_datapath(self, ev):
if ev.enter:
self._define_flow(ev.dp)
@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
def packet_in_handler(self, ev):
msg = ev.msg
dst, src, eth_type = struct.unpack_from('!6s6sH', buffer(msg.data), 0)
in_port = msg.match.fields[0].value
LOG.info("----------------------------------------")
LOG.info("* PacketIn")
LOG.info("in_port=%d, eth_type: %s", in_port, hex(eth_type))
LOG.info("packet reason=%d buffer_id=%d", msg.reason, msg.buffer_id)
LOG.info("packet in datapath_id=%s src=%s dst=%s",
msg.datapath.id, haddr_to_str(src), haddr_to_str(dst))
|
[
"fujita.tomonori@lab.ntt.co.jp"
] |
fujita.tomonori@lab.ntt.co.jp
|
4df575023b8e54111d00897e90771b8c44f96543
|
de2a1c34675e9c499ef965e8e2443139566d1be0
|
/modulos/SauceNAO.py
|
470dc0cd53daf18a41d2bb8005dc719deb30cbe9
|
[] |
no_license
|
ChetAlv/Bo.py
|
743023dc100d9df70671a124c0160c179087f0a9
|
a56dc9285434da7a254e73c425c20c82c3266bc1
|
refs/heads/master
| 2023-04-09T06:06:03.783874
| 2021-04-06T01:15:35
| 2021-04-06T01:15:35
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 3,040
|
py
|
import os
import string
import random
import urllib
import tkinter
import requests
import youtube_dl
from dotenv import load_dotenv
from selenium import webdriver
from tkinter import filedialog
from selenium.webdriver.common.keys import Keys
load_dotenv()
#Variables
key = os.getenv('key')
TOKEN = os.getenv('TOKEN')
def SearchSauceNAO():
root = tkinter.Tk()
root.withdraw()
pimg = filedialog.askopenfilename()
driver = webdriver.Chrome('chromedriver.exe')
driver.get('https://saucenao.com/')
img_upload = driver.find_elements_by_xpath("//input[@type='file']")
img_upload[0].send_keys(pimg)
search = driver.find_element_by_xpath("//input[@id='searchButton']")
search.click()
print('Cargando imagenes similares')
def Shortpy(short):
print(short)
alias = input('Ingresa alias - ')
url = urllib.parse.quote(f'{short}')
name = f'{alias}'
r = requests.get('http://cutt.ly/api/api.php?key={}&short={}&name={}'.format(key, url, name))
data = r.json()["url"]
if data["status"] == 7:
sl = data["shortLink"]
print("Link Acortado:", sl)
else:
print("[!] Error Acortando el Link:", data)
def Password():
print('~~ Menรบ ~~')
print('1. Alfabeto')
print('2. Mayรบsculas')
print('3. Minรบsculas')
print('4. Nรบmeros')
print('5. Alfanumรฉrico')
print('6. Alfanumรฉrico y Sรญmbolos')
s = ''
mn = input('Ingresa parametros: ')
afn = mn.split()
m = int(afn[0])
try:
n = int(afn[1])
except IndexError:
n = 8
if m == 1:
c = list(string.ascii_letters)
elif m == 2:
c = list(string.ascii_uppercase)
elif m == 3:
c = list(string.ascii_lowercase)
elif m == 4:
c = list(string.digits)
elif m == 5:
c = list(string.hexdigits)
elif m == 6:
c = list(string.printable)
c = c[:-6]
for i in range(n):
s += random.choice(c)
print('Tu contraseรฑa es:', s)
def mp3():
'''
Esto es para pedir la direcciรณn absoluta de una carpeta
import tkinter
from tkinter import filedialog
root = tkinter.Tk()
root.withdraw()
op = filedialog.askdirectory()
'''
# Pedimos la URL de input al usuario
#input_url = input('Ingrese la URL del video que desea convertir: ')
url = input('Ingresa URL - ')
# Obtenemos el titulo del video
video_info = youtube_dl.YoutubeDL().extract_info(url=url, download=False)
video_title = video_info['title']
# Setear las opciones para la descarga del video
opciones = {
'format': 'bestaudio/best',
'outtmpl': f'C:/Users/sayu/Downloads/Music/{video_title}.mp3', # Seteamos la ubicaciรณn deseada
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
# Descargar el Video
with youtube_dl.YoutubeDL(opciones) as ydl:
ydl.download([url])
|
[
"67601252+TaprisSugarbell@users.noreply.github.com"
] |
67601252+TaprisSugarbell@users.noreply.github.com
|
0e1eb896261970a1c2b8f39bd74c654d59cf3c3a
|
42586ca701998599c90a2b52049a31942cd54c3c
|
/Nina/calendr/urls.py
|
085a94df9f930d348f38c948b4db8b67b8112ebd
|
[] |
no_license
|
alicanyagmur/yagmur
|
c776d4aff28103177ea946f50b20a72961e8b3fb
|
9b36fefc8d0d9ea2410203f3dafe398d13f7f7df
|
refs/heads/master
| 2022-12-15T13:21:59.909168
| 2019-02-21T16:42:04
| 2019-02-21T16:42:04
| 171,907,278
| 0
| 0
| null | 2022-11-22T03:26:27
| 2019-02-21T16:34:08
|
Python
|
UTF-8
|
Python
| false
| false
| 137
|
py
|
from django.conf.urls import url
from .views import *
app_name ="calendr"
urlpatterns=[
url(r'',Calendar_View, name='calendar'),
]
|
[
"can_cyborg@hotmail.com"
] |
can_cyborg@hotmail.com
|
60cbd112540dea4a2802be9f51b8bfc86bc742d4
|
2c34c5fece6c900cdc396dc04eefbba46724754c
|
/cloudkitpy/database.py
|
482867baab02aac256fb34f0a704ba7d16b1e967
|
[
"MIT"
] |
permissive
|
yz/CloudKitPy
|
da646a15f6794e6188825821a4fc4fca7f51b660
|
e26eea1207845b62e20fbc514ebba4edc3efd087
|
refs/heads/master
| 2021-09-23T12:12:20.036871
| 2018-09-22T18:54:13
| 2018-09-22T18:54:13
| 271,097,279
| 0
| 0
|
MIT
| 2020-06-09T19:58:32
| 2020-06-09T19:58:32
| null |
UTF-8
|
Python
| false
| false
| 12,564
|
py
|
#
# database.py
# CloudKitPy
#
# Created by James Barrow on 28/04/2016.
# Copyright (c) 2016 James Barrow - Pig on a Hill Productions.
#
# !/usr/bin/env python
from datatypes import Record
from datatypes import Zone
from request import Request
from helpers import parse
class Database:
__logger = None
container = None
database_type = None
def __init__(
self,
container,
database_type,
logger=None
):
self.__logger = logger
self.container = container
self.database_type = database_type
# Accessing Records
def save_records(
self,
records,
auto_fetch=False,
force=False,
options=None
):
"""Save records to the database."""
# https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/ModifyRecords/ModifyRecords.html#//apple_ref/doc/uid/TP40015240-CH2-SW9
operations = self.__create_modify_operations(
records,
auto_fetch,
force
)
payload = {
'operations': operations,
}
if options is not None:
payload.update(options)
result = Request.perform_request(
'POST',
self.container,
self.database_type,
'records/modify',
payload,
logger=self.__logger
)
if result.is_success is True:
objects = []
objects_json = parse(result.value, 'records')
for object_json in objects_json:
objects.append(Record(object_json))
result.value = objects
return result
def __create_modify_operations(self, records, auto_fetch, force):
operations = []
for record in records:
operation_type = None
if force is True:
operation_type = 'forceUpdate'
elif record.record_change_tag is not None:
operation_type = 'update'
elif record.record_type is not None:
operation_type = 'create'
elif auto_fetch is True:
# Fetch, and if record is returned,
# append the change tag and update
fetch_record_dict = {
'recordName': record.record_name,
'desiredKeys': None
}
fetched_record = self.fetch_records([fetch_record_dict])
if fetched_record is not None:
operation_type = 'update'
record.record_change_tag = fetched_record.record_change_tag
else:
print """Record doesn't already exist and is
missing a record type!"""
if operation_type is not None:
operation = {
'operationType': operation_type,
'record': record.json()
}
operations.append(operation)
return operations
def fetch_records(
self,
records=None,
record_type=None,
record_names=None,
references=None,
options=None
):
"""Fetch one or more records."""
# https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/LookupRecords/LookupRecords.html#//apple_ref/doc/uid/TP40015240-CH6-SW2
json_records = self.__create_fetch_json_records(
records,
record_type,
record_names,
references
)
payload = {
'records': json_records,
}
if options is not None:
payload.update(options)
result = Request.perform_request(
'POST',
self.container,
self.database_type,
'records/lookup',
payload,
logger=self.__logger
)
if result.is_success is True:
objects = []
objects_json = parse(result.value, 'records')
for object_json in objects_json:
objects.append(Record(object_json))
result.value = objects
return result
def __create_fetch_json_records(
self,
records=None,
record_type=None,
record_names=None,
references=None
):
json_records = []
# Create JSON for records
if records is not None:
for record in records:
json_records.append(record.json())
# Create JSON for record names
if record_names is not None:
for record_name in record_names:
record = Record()
record.record_type = record_type
record.record_name = record_name
json_records.append(record.json())
# Create JSON for record names
if references is not None:
for reference in references:
record = Record()
record_name = reference.record_name
if record_name is not None and len(record_name) > 0:
record.record_name = record_name
json_records.append(record.json())
return json_records
def delete_records(self, records, force=False, options=None):
"""Delete one or more records."""
# https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/ModifyRecords/ModifyRecords.html#//apple_ref/doc/uid/TP40015240-CH2-SW9
operation_type = 'delete'
if force is True:
operation_type = 'forceDelete'
operations = []
for record in records:
operation = {
'operationType': operation_type,
'record': record.json()
}
operations.append(operation)
payload = {
'operations': operations,
}
if options is not None:
payload.update(options)
result = Request.perform_request(
'POST',
self.container,
self.database_type,
'records/modify',
payload,
logger=self.__logger
)
if result.is_success is True:
objects = []
objects_json = parse(result.value, 'records')
for object_json in objects_json:
objects.append(Record(object_json))
result.value = objects
return result
def perform_query(self, query, continuation_marker=None, options=None):
"""Fetch records using a query."""
# https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/QueryingRecords/QueryingRecords.html#//apple_ref/doc/uid/TP40015240-CH5-SW4
payload = {
'query': query.json(),
}
if continuation_marker is not None:
if options is None:
options = {}
options['continuationMarker'] = continuation_marker
if options is not None:
payload.update(options)
result = Request.perform_request(
'POST',
self.container,
self.database_type,
'records/query',
payload,
logger=self.__logger
)
if result.is_success is True:
objects = []
objects_json = parse(result.value, 'records')
for object_json in objects_json:
objects.append(Record(object_json))
continuation_marker = parse(result.value, 'continuationMarker')
result.value = (objects, continuation_marker)
return result
# Syncing Records
def fetch_changed_records(self, zone_id, options=None):
"""Fetch changed records in a given custom zone."""
# https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/ChangeRecords/ChangeRecords.html#//apple_ref/doc/uid/TP40015240-CH7-SW1
if self.database_type == 'private':
return None
payload = {
'zoneID': zone_id,
}
if options is not None:
payload.update(options)
result = Request.perform_request(
'POST',
self.container,
'private',
'records/changes',
payload,
logger=self.__logger
)
if result.is_success is True:
objects = []
objects_json = parse(result.value, 'records')
for object_json in objects_json:
objects.append(Record(object_json))
more_coming = parse(result.value, 'moreComing')
reverse = parse(result.value, 'reverse')
sync_token = parse(result.value, 'syncToken')
result.value = (objects, more_coming, reverse, sync_token)
return result
# Accessing Record Zones
def save_record_zones(self, zone_ids):
"""Create one or more zones in the database."""
# https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/ModifyZones/ModifyZones.html#//apple_ref/doc/uid/TP40015240-CH10-SW1
return self.__modify_record_zones(zone_ids, 'create')
def fetch_record_zones(self, zones):
"""Fetch one or more zones."""
# https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/GettingZonesbyIdentifier/GettingZonesbyIdentifier.html#//apple_ref/doc/uid/TP40015240-CH22-SW1
zones_json = []
for zone in zones:
zones_json.append(zone.json())
payload = {
'zones': zones_json,
}
result = Request.perform_request(
'POST',
self.container,
self.database_type,
'zones/lookup',
payload,
logger=self.__logger
)
if result.is_success is True:
objects = []
objects_json = parse(result.value, 'zones')
for object_json in objects_json:
objects.append(Zone(object_json))
result.value = objects
return result
def fetch_all_record_zones(self):
"""Fetch all zones in the database."""
# https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/GettingAllZones/GettingAllZones.html#//apple_ref/doc/uid/TP40015240-CH21-SW3
result = Request.perform_request(
'GET',
self.container,
self.database_type,
'zones/list',
logger=self.__logger
)
if result.is_success is True:
zones = []
objects_json = parse(result.value, 'zones')
for object_json in objects_json:
zones.append(Zone(object_json))
if len(zones) > 0:
result.value = self.fetch_record_zones(zones)
else:
result.value = []
return result
def delete_record_zones(self, zone_ids):
"""Delete the specified zones."""
# https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/ModifyZones/ModifyZones.html#//apple_ref/doc/uid/TP40015240-CH10-SW1
return self.__modify_record_zones(zone_ids, 'delete')
def __modify_record_zones(self, zone_ids, operation_type):
# https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/ModifyZones/ModifyZones.html#//apple_ref/doc/uid/TP40015240-CH10-SW1
operations = []
for zone_id in zone_ids:
operation = {
'operationType': operation_type,
'zone': zone_id.json()
}
operations.append(operation)
payload = {
'operations': operations,
}
result = Request.perform_request(
'POST',
self.container,
self.database_type,
'zones/modify',
payload,
logger=self.__logger
)
if result.is_success is True:
objects = []
objects_json = parse(result.value, 'zones')
for object_json in objects_json:
objects.append(Zone(object_json))
result.value = objects
return result
|
[
"baza207@me.com"
] |
baza207@me.com
|
18b42f59eae9ea56b47d87de64f8a422960691cc
|
f824e7a172d136e738c0a64e9e3db98a69943a75
|
/backend/alembic/versions/4b783bcaba87_.py
|
4e02be0357546ad9cefa517ef0e55598c8e85223
|
[] |
no_license
|
aurthurm/fastapi-playground
|
23c685e598aa935389dc76d94c3a0b303409f075
|
f1e57cba7596b36dcc0739bc048ec72a4fe9a704
|
refs/heads/master
| 2023-05-21T22:43:40.414435
| 2020-08-01T14:46:30
| 2020-08-01T14:46:30
| 262,516,194
| 0
| 0
| null | 2021-06-11T18:06:43
| 2020-05-09T07:36:10
|
Python
|
UTF-8
|
Python
| false
| false
| 859
|
py
|
"""empty message
Revision ID: 4b783bcaba87
Revises: a79a697b53ad
Create Date: 2020-04-09 14:44:18.115115
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4b783bcaba87'
down_revision = 'a79a697b53ad'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('digitalcontent', sa.Column('product_variant_id', sa.Integer(), nullable=True))
op.create_foreign_key(None, 'digitalcontent', 'productvariant', ['product_variant_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'digitalcontent', type_='foreignkey')
op.drop_column('digitalcontent', 'product_variant_id')
# ### end Alembic commands ###
|
[
"aurthurmusendame@gmail.com"
] |
aurthurmusendame@gmail.com
|
911c908e590e7be6bef9855fd19303469f64601e
|
d1a9e6ae51257311b4058898eafff2c2ed4ba480
|
/algorithms/hard/RegularExpressionMatching.py
|
013ff4db4f1661ecfff2c112520c224cc3e7130f
|
[] |
no_license
|
cguerramain/leetcode
|
e7e35c7097a39dca9369dc43b3334a0970fb7105
|
fdaecec281e854ffd15828bc30f6062b61db34d4
|
refs/heads/master
| 2021-10-10T10:29:01.872876
| 2019-01-09T14:09:44
| 2019-01-09T14:09:44
| 107,736,274
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 142
|
py
|
class Solution:
def isMatch(self, s, p):
"""
:type s: str
:type p: str
:rtype: bool
"""
|
[
"cguerramain@gmail.com"
] |
cguerramain@gmail.com
|
4c22b52076c8127259f440a494d1fd520ba4a170
|
8fc8c93b4c9da256b15825b44fc4f7e7ee302e99
|
/M1_dictator/models.py
|
1413e19472b5eb71031dc9b95a1567520998f3a0
|
[] |
no_license
|
cessuser/cheating_entitlement_die_roll
|
d22ec5a459f9bc236498c2ecc03278d03334f9c0
|
520911d84953263e9cb864af4caf42075193dff9
|
refs/heads/master
| 2020-04-03T14:54:44.121367
| 2018-11-02T11:34:39
| 2018-11-02T11:34:39
| 155,341,440
| 0
| 1
| null | 2018-11-01T12:51:35
| 2018-10-30T07:20:08
|
HTML
|
UTF-8
|
Python
| false
| false
| 1,277
|
py
|
from otree.api import (
models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer,
Currency as c, currency_range
)
import random
doc = """
One player decides how to divide a certain amount between himself and the other
player.
See: Kahneman, Daniel, Jack L. Knetsch, and Richard H. Thaler. "Fairness
and the assumptions of economics." Journal of business (1986):
S285-S300.
"""
class Constants(BaseConstants):
name_in_url = 'M1_dictator'
players_per_group = 2
num_rounds = 1
instructions_template = 'M1_dictator/Instructions.html'
# Initial amount allocated to the dictator
endowment = c(1000)
class Subsession(BaseSubsession):
pass
class Group(BaseGroup):
kept = models.IntegerField(min=0, max=Constants.endowment, label='decision')
test = models.IntegerField(widget=widgets.TextInput )
def set_payoffs(self):
p1 = self.get_player_by_id(1)
p2 = self.get_player_by_id(2)
p1.payoff = self.kept
p2.payoff = Constants.endowment - self.kept
p1.participant.vars['M1_payoff'] = p1.payoff + c(p1.dice_value * 100)
p2.participant.vars['M1_payoff'] = p2.payoff + c(p2.dice_value * 100)
class Player(BasePlayer):
dice_value = models.IntegerField(min=1, max=6)
|
[
"d84chen@uwaterloo.com"
] |
d84chen@uwaterloo.com
|
7b37c16cdd2008cc9fbdeb30bb5cfe971c27bdb7
|
cea30aead7f0b529ee072c1bcab2896777e1408d
|
/PreprocessingCropsData/venv/Lib/site-packages/sklearn/model_selection/_search_successive_halving.py
|
0b3046b5dbc21dc906f28f9f0c5d4fa1674cd89a
|
[] |
no_license
|
pgj9702/FarmSolution
|
3730ab3ca983b335ed48a60935c5fa6e3983cbb1
|
a8cacc45b8519e79b51ab65b9539a01f5006e64f
|
refs/heads/master
| 2023-03-30T15:41:10.312044
| 2021-03-31T08:47:23
| 2021-03-31T08:47:23
| 334,019,778
| 0
| 1
| null | 2021-02-22T09:32:57
| 2021-01-29T02:52:46
|
Python
|
UTF-8
|
Python
| false
| false
| 40,368
|
py
|
from math import ceil, floor, log
from abc import abstractmethod
from numbers import Integral
import numpy as np
from ._search import _check_param_grid
from ._search import BaseSearchCV
from . import ParameterGrid, ParameterSampler
from ..utils.validation import _num_samples
from ..base import is_classifier
from ._split import check_cv, _yields_constant_splits
from ..utils import resample
__all__ = ['HalvingGridSearchCV', 'HalvingRandomSearchCV']
class _SubsampleMetaSplitter:
"""Splitter that subsamples a given fraction of the dataset"""
def __init__(self, *, base_cv, fraction, subsample_test, random_state):
self.base_cv = base_cv
self.fraction = fraction
self.subsample_test = subsample_test
self.random_state = random_state
def split(self, X, y, groups=None):
for train_idx, test_idx in self.base_cv.split(X, y, groups):
train_idx = resample(
train_idx, replace=False, random_state=self.random_state,
n_samples=int(self.fraction * train_idx.shape[0])
)
if self.subsample_test:
test_idx = resample(
test_idx, replace=False, random_state=self.random_state,
n_samples=int(self.fraction * test_idx.shape[0])
)
yield train_idx, test_idx
def _refit_callable(results):
# Custom refit callable to return the index of the best candidate. We want
# the best candidate out of the last iteration. By default BaseSearchCV
# would return the best candidate out of all iterations.
last_iter = np.max(results['iter'])
last_iter_indices = np.flatnonzero(results['iter'] == last_iter)
best_idx = np.argmax(results['mean_test_score'][last_iter_indices])
return last_iter_indices[best_idx]
def _top_k(results, k, itr):
# Return the best candidates of a given iteration
iteration, mean_test_score, params = (
np.asarray(a) for a in (results['iter'],
results['mean_test_score'],
results['params'])
)
iter_indices = np.flatnonzero(iteration == itr)
sorted_indices = np.argsort(mean_test_score[iter_indices])
return np.array(params[iter_indices][sorted_indices[-k:]])
class BaseSuccessiveHalving(BaseSearchCV):
"""Implements successive halving.
Ref:
Almost optimal exploration in multi-armed bandits, ICML 13
Zohar Karnin, Tomer Koren, Oren Somekh
"""
def __init__(self, estimator, *, scoring=None,
n_jobs=None, refit=True, cv=5, verbose=0, random_state=None,
error_score=np.nan, return_train_score=True,
max_resources='auto', min_resources='exhaust',
resource='n_samples', factor=3, aggressive_elimination=False):
refit = _refit_callable if refit else False
super().__init__(estimator, scoring=scoring,
n_jobs=n_jobs, refit=refit, cv=cv,
verbose=verbose,
error_score=error_score,
return_train_score=return_train_score)
self.random_state = random_state
self.max_resources = max_resources
self.resource = resource
self.factor = factor
self.min_resources = min_resources
self.aggressive_elimination = aggressive_elimination
def _check_input_parameters(self, X, y, groups):
if self.scoring is not None and not (isinstance(self.scoring, str)
or callable(self.scoring)):
raise ValueError('scoring parameter must be a string, '
'a callable or None. Multimetric scoring is not '
'supported.')
# We need to enforce that successive calls to cv.split() yield the same
# splits: see https://github.com/scikit-learn/scikit-learn/issues/15149
if not _yields_constant_splits(self._checked_cv_orig):
raise ValueError(
"The cv parameter must yield consistent folds across "
"calls to split(). Set its random_state to an int, or set "
"shuffle=False."
)
if (self.resource != 'n_samples'
and self.resource not in self.estimator.get_params()):
raise ValueError(
f'Cannot use resource={self.resource} which is not supported '
f'by estimator {self.estimator.__class__.__name__}'
)
if (isinstance(self.max_resources, str) and
self.max_resources != 'auto'):
raise ValueError(
"max_resources must be either 'auto' or a positive integer"
)
if self.max_resources != 'auto' and (
not isinstance(self.max_resources, Integral) or
self.max_resources <= 0):
raise ValueError(
"max_resources must be either 'auto' or a positive integer"
)
if self.min_resources not in ('smallest', 'exhaust') and (
not isinstance(self.min_resources, Integral) or
self.min_resources <= 0):
raise ValueError(
"min_resources must be either 'smallest', 'exhaust', "
"or a positive integer "
"no greater than max_resources."
)
if isinstance(self, HalvingRandomSearchCV):
if self.min_resources == self.n_candidates == 'exhaust':
# for n_candidates=exhaust to work, we need to know what
# min_resources is. Similarly min_resources=exhaust needs to
# know the actual number of candidates.
raise ValueError(
"n_candidates and min_resources cannot be both set to "
"'exhaust'."
)
if self.n_candidates != 'exhaust' and (
not isinstance(self.n_candidates, Integral) or
self.n_candidates <= 0):
raise ValueError(
"n_candidates must be either 'exhaust' "
"or a positive integer"
)
self.min_resources_ = self.min_resources
if self.min_resources_ in ('smallest', 'exhaust'):
if self.resource == 'n_samples':
n_splits = self._checked_cv_orig.get_n_splits(X, y, groups)
# please see https://gph.is/1KjihQe for a justification
magic_factor = 2
self.min_resources_ = n_splits * magic_factor
if is_classifier(self.estimator):
n_classes = np.unique(y).shape[0]
self.min_resources_ *= n_classes
else:
self.min_resources_ = 1
# if 'exhaust', min_resources_ might be set to a higher value later
# in _run_search
self.max_resources_ = self.max_resources
if self.max_resources_ == 'auto':
if not self.resource == 'n_samples':
raise ValueError(
"max_resources can only be 'auto' if resource='n_samples'")
self.max_resources_ = _num_samples(X)
if self.min_resources_ > self.max_resources_:
raise ValueError(
f'min_resources_={self.min_resources_} is greater '
f'than max_resources_={self.max_resources_}.'
)
def fit(self, X, y=None, groups=None, **fit_params):
"""Run fit with all sets of parameters.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Training vector, where n_samples is the number of samples and
n_features is the number of features.
y : array-like, shape (n_samples,) or (n_samples, n_output), optional
Target relative to X for classification or regression;
None for unsupervised learning.
groups : array-like of shape (n_samples,), default=None
Group labels for the samples used while splitting the dataset into
train/test set. Only used in conjunction with a "Group" :term:`cv`
instance (e.g., :class:`~sklearn.model_selection.GroupKFold`).
**fit_params : dict of string -> object
Parameters passed to the ``fit`` method of the estimator
"""
self._checked_cv_orig = check_cv(
self.cv, y, classifier=is_classifier(self.estimator))
self._check_input_parameters(
X=X,
y=y,
groups=groups,
)
self._n_samples_orig = _num_samples(X)
super().fit(X, y=y, groups=None, **fit_params)
# Set best_score_: BaseSearchCV does not set it, as refit is a callable
self.best_score_ = (
self.cv_results_['mean_test_score'][self.best_index_])
return self
def _run_search(self, evaluate_candidates):
candidate_params = self._generate_candidate_params()
if self.resource != 'n_samples' and any(
self.resource in candidate for candidate in candidate_params):
# Can only check this now since we need the candidates list
raise ValueError(
f"Cannot use parameter {self.resource} as the resource since "
"it is part of the searched parameters."
)
# n_required_iterations is the number of iterations needed so that the
# last iterations evaluates less than `factor` candidates.
n_required_iterations = 1 + floor(log(len(candidate_params),
self.factor))
if self.min_resources == 'exhaust':
# To exhaust the resources, we want to start with the biggest
# min_resources possible so that the last (required) iteration
# uses as many resources as possible
last_iteration = n_required_iterations - 1
self.min_resources_ = max(
self.min_resources_,
self.max_resources_ // self.factor**last_iteration
)
# n_possible_iterations is the number of iterations that we can
# actually do starting from min_resources and without exceeding
# max_resources. Depending on max_resources and the number of
# candidates, this may be higher or smaller than
# n_required_iterations.
n_possible_iterations = 1 + floor(log(
self.max_resources_ // self.min_resources_, self.factor))
if self.aggressive_elimination:
n_iterations = n_required_iterations
else:
n_iterations = min(n_possible_iterations, n_required_iterations)
if self.verbose:
print(f'n_iterations: {n_iterations}')
print(f'n_required_iterations: {n_required_iterations}')
print(f'n_possible_iterations: {n_possible_iterations}')
print(f'min_resources_: {self.min_resources_}')
print(f'max_resources_: {self.max_resources_}')
print(f'aggressive_elimination: {self.aggressive_elimination}')
print(f'factor: {self.factor}')
self.n_resources_ = []
self.n_candidates_ = []
for itr in range(n_iterations):
power = itr # default
if self.aggressive_elimination:
# this will set n_resources to the initial value (i.e. the
# value of n_resources at the first iteration) for as many
# iterations as needed (while candidates are being
# eliminated), and then go on as usual.
power = max(
0,
itr - n_required_iterations + n_possible_iterations
)
n_resources = int(self.factor**power * self.min_resources_)
# guard, probably not needed
n_resources = min(n_resources, self.max_resources_)
self.n_resources_.append(n_resources)
n_candidates = len(candidate_params)
self.n_candidates_.append(n_candidates)
if self.verbose:
print('-' * 10)
print(f'iter: {itr}')
print(f'n_candidates: {n_candidates}')
print(f'n_resources: {n_resources}')
if self.resource == 'n_samples':
# subsampling will be done in cv.split()
cv = _SubsampleMetaSplitter(
base_cv=self._checked_cv_orig,
fraction=n_resources / self._n_samples_orig,
subsample_test=True,
random_state=self.random_state
)
else:
# Need copy so that the n_resources of next iteration does
# not overwrite
candidate_params = [c.copy() for c in candidate_params]
for candidate in candidate_params:
candidate[self.resource] = n_resources
cv = self._checked_cv_orig
more_results = {'iter': [itr] * n_candidates,
'n_resources': [n_resources] * n_candidates}
results = evaluate_candidates(candidate_params, cv,
more_results=more_results)
n_candidates_to_keep = ceil(n_candidates / self.factor)
candidate_params = _top_k(results, n_candidates_to_keep, itr)
self.n_remaining_candidates_ = len(candidate_params)
self.n_required_iterations_ = n_required_iterations
self.n_possible_iterations_ = n_possible_iterations
self.n_iterations_ = n_iterations
@abstractmethod
def _generate_candidate_params(self):
pass
class HalvingGridSearchCV(BaseSuccessiveHalving):
"""Search over specified parameter values with successive halving.
The search strategy starts evaluating all the candidates with a small
amount of resources and iteratively selects the best candidates, using
more and more resources.
Read more in the :ref:`User guide <successive_halving_user_guide>`.
.. note::
This estimator is still **experimental** for now: the predictions
and the API might change without any deprecation cycle. To use it,
you need to explicitly import ``enable_halving_search_cv``::
>>> # explicitly require this experimental feature
>>> from sklearn.experimental import enable_halving_search_cv # noqa
>>> # now you can import normally from model_selection
>>> from sklearn.model_selection import HalvingGridSearchCV
Parameters
----------
estimator : estimator object.
This is assumed to implement the scikit-learn estimator interface.
Either estimator needs to provide a ``score`` function,
or ``scoring`` must be passed.
param_grid : dict or list of dictionaries
Dictionary with parameters names (string) as keys and lists of
parameter settings to try as values, or a list of such
dictionaries, in which case the grids spanned by each dictionary
in the list are explored. This enables searching over any sequence
of parameter settings.
factor : int or float, default=3
The 'halving' parameter, which determines the proportion of candidates
that are selected for each subsequent iteration. For example,
``factor=3`` means that only one third of the candidates are selected.
resource : ``'n_samples'`` or str, default='n_samples'
Defines the resource that increases with each iteration. By default,
the resource is the number of samples. It can also be set to any
parameter of the base estimator that accepts positive integer
values, e.g. 'n_iterations' or 'n_estimators' for a gradient
boosting estimator. In this case ``max_resources`` cannot be 'auto'
and must be set explicitly.
max_resources : int, default='auto'
The maximum amount of resource that any candidate is allowed to use
for a given iteration. By default, this is set to ``n_samples`` when
``resource='n_samples'`` (default), else an error is raised.
min_resources : {'exhaust', 'smallest'} or int, default='exhaust'
The minimum amount of resource that any candidate is allowed to use
for a given iteration. Equivalently, this defines the amount of
resources `r0` that are allocated for each candidate at the first
iteration.
- 'smallest' is a heuristic that sets `r0` to a small value:
- ``n_splits * 2`` when ``resource='n_samples'`` for a regression
problem
- ``n_classes * n_splits * 2`` when ``resource='n_samples'`` for a
classification problem
- ``1`` when ``resource != 'n_samples'``
- 'exhaust' will set `r0` such that the **last** iteration uses as
much resources as possible. Namely, the last iteration will use the
highest value smaller than ``max_resources`` that is a multiple of
both ``min_resources`` and ``factor``. In general, using 'exhaust'
leads to a more accurate estimator, but is slightly more time
consuming.
Note that the amount of resources used at each iteration is always a
multiple of ``min_resources``.
aggressive_elimination : bool, default=False
This is only relevant in cases where there isn't enough resources to
reduce the remaining candidates to at most `factor` after the last
iteration. If ``True``, then the search process will 'replay' the
first iteration for as long as needed until the number of candidates
is small enough. This is ``False`` by default, which means that the
last iteration may evaluate more than ``factor`` candidates. See
:ref:`aggressive_elimination` for more details.
cv : int, cross-validation generator or iterable, default=5
Determines the cross-validation splitting strategy.
Possible inputs for cv are:
- integer, to specify the number of folds in a `(Stratified)KFold`,
- :term:`CV splitter`,
- An iterable yielding (train, test) splits as arrays of indices.
For integer/None inputs, if the estimator is a classifier and ``y`` is
either binary or multiclass, :class:`StratifiedKFold` is used. In all
other cases, :class:`KFold` is used.
Refer :ref:`User Guide <cross_validation>` for the various
cross-validation strategies that can be used here.
.. note::
Due to implementation details, the folds produced by `cv` must be
the same across multiple calls to `cv.split()`. For
built-in `scikit-learn` iterators, this can be achieved by
deactivating shuffling (`shuffle=False`), or by setting the
`cv`'s `random_state` parameter to an integer.
scoring : string, callable, or None, default=None
A single string (see :ref:`scoring_parameter`) or a callable
(see :ref:`scoring`) to evaluate the predictions on the test set.
If None, the estimator's score method is used.
refit : bool, default=True
If True, refit an estimator using the best found parameters on the
whole dataset.
The refitted estimator is made available at the ``best_estimator_``
attribute and permits using ``predict`` directly on this
``HalvingGridSearchCV`` instance.
error_score : 'raise' or numeric
Value to assign to the score if an error occurs in estimator fitting.
If set to 'raise', the error is raised. If a numeric value is given,
FitFailedWarning is raised. This parameter does not affect the refit
step, which will always raise the error. Default is ``np.nan``
return_train_score : bool, default=False
If ``False``, the ``cv_results_`` attribute will not include training
scores.
Computing training scores is used to get insights on how different
parameter settings impact the overfitting/underfitting trade-off.
However computing the scores on the training set can be computationally
expensive and is not strictly required to select the parameters that
yield the best generalization performance.
random_state : int, RandomState instance or None, default=None
Pseudo random number generator state used for subsampling the dataset
when `resources != 'n_samples'`. Ignored otherwise.
Pass an int for reproducible output across multiple function calls.
See :term:`Glossary <random_state>`.
n_jobs : int or None, default=None
Number of jobs to run in parallel.
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
for more details.
verbose : int
Controls the verbosity: the higher, the more messages.
Attributes
----------
n_resources_ : list of int
The amount of resources used at each iteration.
n_candidates_ : list of int
The number of candidate parameters that were evaluated at each
iteration.
n_remaining_candidates_ : int
The number of candidate parameters that are left after the last
iteration. It corresponds to `ceil(n_candidates[-1] / factor)`
max_resources_ : int
The maximum number of resources that any candidate is allowed to use
for a given iteration. Note that since the number of resources used
at each iteration must be a multiple of ``min_resources_``, the
actual number of resources used at the last iteration may be smaller
than ``max_resources_``.
min_resources_ : int
The amount of resources that are allocated for each candidate at the
first iteration.
n_iterations_ : int
The actual number of iterations that were run. This is equal to
``n_required_iterations_`` if ``aggressive_elimination`` is ``True``.
Else, this is equal to ``min(n_possible_iterations_,
n_required_iterations_)``.
n_possible_iterations_ : int
The number of iterations that are possible starting with
``min_resources_`` resources and without exceeding
``max_resources_``.
n_required_iterations_ : int
The number of iterations that are required to end up with less than
``factor`` candidates at the last iteration, starting with
``min_resources_`` resources. This will be smaller than
``n_possible_iterations_`` when there isn't enough resources.
cv_results_ : dict of numpy (masked) ndarrays
A dict with keys as column headers and values as columns, that can be
imported into a pandas ``DataFrame``. It contains many informations for
analysing the results of a search.
Please refer to the :ref:`User guide<successive_halving_cv_results>`
for details.
best_estimator_ : estimator or dict
Estimator that was chosen by the search, i.e. estimator
which gave highest score (or smallest loss if specified)
on the left out area_data. Not available if ``refit=False``.
best_score_ : float
Mean cross-validated score of the best_estimator.
best_params_ : dict
Parameter setting that gave the best results on the hold out area_data.
best_index_ : int
The index (of the ``cv_results_`` arrays) which corresponds to the best
candidate parameter setting.
The dict at ``search.cv_results_['params'][search.best_index_]`` gives
the parameter setting for the best model, that gives the highest
mean score (``search.best_score_``).
scorer_ : function or a dict
Scorer function used on the held out area_data to choose the best
parameters for the model.
n_splits_ : int
The number of cross-validation splits (folds/iterations).
refit_time_ : float
Seconds used for refitting the best model on the whole dataset.
This is present only if ``refit`` is not False.
See Also
--------
:class:`HalvingRandomSearchCV`:
Random search over a set of parameters using successive halving.
Notes
-----
The parameters selected are those that maximize the score of the held-out
area_data, according to the scoring parameter.
Examples
--------
>>> from sklearn.preprocessing_datasets import load_iris
>>> from sklearn.ensemble import RandomForestClassifier
>>> from sklearn.experimental import enable_halving_search_cv # noqa
>>> from sklearn.model_selection import HalvingGridSearchCV
...
>>> X, y = load_iris(return_X_y=True)
>>> clf = RandomForestClassifier(random_state=0)
...
>>> param_grid = {"max_depth": [3, None],
... "min_samples_split": [5, 10]}
>>> search = HalvingGridSearchCV(clf, param_grid, resource='n_estimators',
... max_resources=10,
... random_state=0).fit(X, y)
>>> search.best_params_ # doctest: +SKIP
{'max_depth': None, 'min_samples_split': 10, 'n_estimators': 9}
"""
_required_parameters = ["estimator", "param_grid"]
def __init__(self, estimator, param_grid, *,
factor=3, resource='n_samples', max_resources='auto',
min_resources='exhaust', aggressive_elimination=False,
cv=5, scoring=None, refit=True, error_score=np.nan,
return_train_score=True, random_state=None, n_jobs=None,
verbose=0):
super().__init__(estimator, scoring=scoring,
n_jobs=n_jobs, refit=refit, verbose=verbose, cv=cv,
random_state=random_state, error_score=error_score,
return_train_score=return_train_score,
max_resources=max_resources, resource=resource,
factor=factor, min_resources=min_resources,
aggressive_elimination=aggressive_elimination)
self.param_grid = param_grid
_check_param_grid(self.param_grid)
def _generate_candidate_params(self):
return ParameterGrid(self.param_grid)
class HalvingRandomSearchCV(BaseSuccessiveHalving):
"""Randomized search on hyper parameters.
The search strategy starts evaluating all the candidates with a small
amount of resources and iteratively selects the best candidates, using more
and more resources.
The candidates are sampled at random from the parameter space and the
number of sampled candidates is determined by ``n_candidates``.
Read more in the :ref:`User guide<successive_halving_user_guide>`.
.. note::
This estimator is still **experimental** for now: the predictions
and the API might change without any deprecation cycle. To use it,
you need to explicitly import ``enable_halving_search_cv``::
>>> # explicitly require this experimental feature
>>> from sklearn.experimental import enable_halving_search_cv # noqa
>>> # now you can import normally from model_selection
>>> from sklearn.model_selection import HalvingRandomSearchCV
Parameters
----------
estimator : estimator object.
This is assumed to implement the scikit-learn estimator interface.
Either estimator needs to provide a ``score`` function,
or ``scoring`` must be passed.
param_distributions : dict
Dictionary with parameters names (string) as keys and distributions
or lists of parameters to try. Distributions must provide a ``rvs``
method for sampling (such as those from scipy.stats.distributions).
If a list is given, it is sampled uniformly.
n_candidates : int, default='exhaust'
The number of candidate parameters to sample, at the first
iteration. Using 'exhaust' will sample enough candidates so that the
last iteration uses as many resources as possible, based on
`min_resources`, `max_resources` and `factor`. In this case,
`min_resources` cannot be 'exhaust'.
factor : int or float, default=3
The 'halving' parameter, which determines the proportion of candidates
that are selected for each subsequent iteration. For example,
``factor=3`` means that only one third of the candidates are selected.
resource : ``'n_samples'`` or str, default='n_samples'
Defines the resource that increases with each iteration. By default,
the resource is the number of samples. It can also be set to any
parameter of the base estimator that accepts positive integer
values, e.g. 'n_iterations' or 'n_estimators' for a gradient
boosting estimator. In this case ``max_resources`` cannot be 'auto'
and must be set explicitly.
max_resources : int, default='auto'
The maximum number of resources that any candidate is allowed to use
for a given iteration. By default, this is set ``n_samples`` when
``resource='n_samples'`` (default), else an error is raised.
min_resources : {'exhaust', 'smallest'} or int, default='smallest'
The minimum amount of resource that any candidate is allowed to use
for a given iteration. Equivalently, this defines the amount of
resources `r0` that are allocated for each candidate at the first
iteration.
- 'smallest' is a heuristic that sets `r0` to a small value:
- ``n_splits * 2`` when ``resource='n_samples'`` for a regression
problem
- ``n_classes * n_splits * 2`` when ``resource='n_samples'`` for a
classification problem
- ``1`` when ``resource != 'n_samples'``
- 'exhaust' will set `r0` such that the **last** iteration uses as
much resources as possible. Namely, the last iteration will use the
highest value smaller than ``max_resources`` that is a multiple of
both ``min_resources`` and ``factor``. In general, using 'exhaust'
leads to a more accurate estimator, but is slightly more time
consuming. 'exhaust' isn't available when `n_candidates='exhaust'`.
Note that the amount of resources used at each iteration is always a
multiple of ``min_resources``.
aggressive_elimination : bool, default=False
This is only relevant in cases where there isn't enough resources to
reduce the remaining candidates to at most `factor` after the last
iteration. If ``True``, then the search process will 'replay' the
first iteration for as long as needed until the number of candidates
is small enough. This is ``False`` by default, which means that the
last iteration may evaluate more than ``factor`` candidates. See
:ref:`aggressive_elimination` for more details.
cv : int, cross-validation generator or an iterable, default=5
Determines the cross-validation splitting strategy.
Possible inputs for cv are:
- integer, to specify the number of folds in a `(Stratified)KFold`,
- :term:`CV splitter`,
- An iterable yielding (train, test) splits as arrays of indices.
For integer/None inputs, if the estimator is a classifier and ``y`` is
either binary or multiclass, :class:`StratifiedKFold` is used. In all
other cases, :class:`KFold` is used.
Refer :ref:`User Guide <cross_validation>` for the various
cross-validation strategies that can be used here.
.. note::
Due to implementation details, the folds produced by `cv` must be
the same across multiple calls to `cv.split()`. For
built-in `scikit-learn` iterators, this can be achieved by
deactivating shuffling (`shuffle=False`), or by setting the
`cv`'s `random_state` parameter to an integer.
scoring : string, callable, or None, default=None
A single string (see :ref:`scoring_parameter`) or a callable
(see :ref:`scoring`) to evaluate the predictions on the test set.
If None, the estimator's score method is used.
refit : bool, default=True
If True, refit an estimator using the best found parameters on the
whole dataset.
The refitted estimator is made available at the ``best_estimator_``
attribute and permits using ``predict`` directly on this
``HalvingRandomSearchCV`` instance.
error_score : 'raise' or numeric
Value to assign to the score if an error occurs in estimator fitting.
If set to 'raise', the error is raised. If a numeric value is given,
FitFailedWarning is raised. This parameter does not affect the refit
step, which will always raise the error. Default is ``np.nan``
return_train_score : bool, default=False
If ``False``, the ``cv_results_`` attribute will not include training
scores.
Computing training scores is used to get insights on how different
parameter settings impact the overfitting/underfitting trade-off.
However computing the scores on the training set can be computationally
expensive and is not strictly required to select the parameters that
yield the best generalization performance.
random_state : int, RandomState instance or None, default=None
Pseudo random number generator state used for subsampling the dataset
when `resources != 'n_samples'`. Also used for random uniform
sampling from lists of possible values instead of scipy.stats
distributions.
Pass an int for reproducible output across multiple function calls.
See :term:`Glossary <random_state>`.
n_jobs : int or None, default=None
Number of jobs to run in parallel.
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
for more details.
verbose : int
Controls the verbosity: the higher, the more messages.
Attributes
----------
n_resources_ : list of int
The amount of resources used at each iteration.
n_candidates_ : list of int
The number of candidate parameters that were evaluated at each
iteration.
n_remaining_candidates_ : int
The number of candidate parameters that are left after the last
iteration. It corresponds to `ceil(n_candidates[-1] / factor)`
max_resources_ : int
The maximum number of resources that any candidate is allowed to use
for a given iteration. Note that since the number of resources used at
each iteration must be a multiple of ``min_resources_``, the actual
number of resources used at the last iteration may be smaller than
``max_resources_``.
min_resources_ : int
The amount of resources that are allocated for each candidate at the
first iteration.
n_iterations_ : int
The actual number of iterations that were run. This is equal to
``n_required_iterations_`` if ``aggressive_elimination`` is ``True``.
Else, this is equal to ``min(n_possible_iterations_,
n_required_iterations_)``.
n_possible_iterations_ : int
The number of iterations that are possible starting with
``min_resources_`` resources and without exceeding
``max_resources_``.
n_required_iterations_ : int
The number of iterations that are required to end up with less than
``factor`` candidates at the last iteration, starting with
``min_resources_`` resources. This will be smaller than
``n_possible_iterations_`` when there isn't enough resources.
cv_results_ : dict of numpy (masked) ndarrays
A dict with keys as column headers and values as columns, that can be
imported into a pandas ``DataFrame``. It contains many informations for
analysing the results of a search.
Please refer to the :ref:`User guide<successive_halving_cv_results>`
for details.
best_estimator_ : estimator or dict
Estimator that was chosen by the search, i.e. estimator
which gave highest score (or smallest loss if specified)
on the left out area_data. Not available if ``refit=False``.
best_score_ : float
Mean cross-validated score of the best_estimator.
best_params_ : dict
Parameter setting that gave the best results on the hold out area_data.
best_index_ : int
The index (of the ``cv_results_`` arrays) which corresponds to the best
candidate parameter setting.
The dict at ``search.cv_results_['params'][search.best_index_]`` gives
the parameter setting for the best model, that gives the highest
mean score (``search.best_score_``).
scorer_ : function or a dict
Scorer function used on the held out area_data to choose the best
parameters for the model.
n_splits_ : int
The number of cross-validation splits (folds/iterations).
refit_time_ : float
Seconds used for refitting the best model on the whole dataset.
This is present only if ``refit`` is not False.
See Also
--------
:class:`HalvingGridSearchCV`:
Search over a grid of parameters using successive halving.
Notes
-----
The parameters selected are those that maximize the score of the held-out
area_data, according to the scoring parameter.
Examples
--------
>>> from sklearn.preprocessing_datasets import load_iris
>>> from sklearn.ensemble import RandomForestClassifier
>>> from sklearn.experimental import enable_halving_search_cv # noqa
>>> from sklearn.model_selection import HalvingRandomSearchCV
>>> from scipy.stats import randint
...
>>> X, y = load_iris(return_X_y=True)
>>> clf = RandomForestClassifier(random_state=0)
>>> np.random.seed(0)
...
>>> param_distributions = {"max_depth": [3, None],
... "min_samples_split": randint(2, 11)}
>>> search = HalvingRandomSearchCV(clf, param_distributions,
... resource='n_estimators',
... max_resources=10,
... random_state=0).fit(X, y)
>>> search.best_params_ # doctest: +SKIP
{'max_depth': None, 'min_samples_split': 10, 'n_estimators': 9}
"""
_required_parameters = ["estimator", "param_distributions"]
def __init__(self, estimator, param_distributions, *,
n_candidates='exhaust', factor=3, resource='n_samples',
max_resources='auto', min_resources='smallest',
aggressive_elimination=False, cv=5, scoring=None,
refit=True, error_score=np.nan, return_train_score=True,
random_state=None, n_jobs=None, verbose=0):
super().__init__(estimator, scoring=scoring,
n_jobs=n_jobs, refit=refit, verbose=verbose, cv=cv,
random_state=random_state, error_score=error_score,
return_train_score=return_train_score,
max_resources=max_resources, resource=resource,
factor=factor, min_resources=min_resources,
aggressive_elimination=aggressive_elimination)
self.param_distributions = param_distributions
self.n_candidates = n_candidates
def _generate_candidate_params(self):
n_candidates_first_iter = self.n_candidates
if n_candidates_first_iter == 'exhaust':
# This will generate enough candidate so that the last iteration
# uses as much resources as possible
n_candidates_first_iter = (
self.max_resources_ // self.min_resources_)
return ParameterSampler(self.param_distributions,
n_candidates_first_iter,
random_state=self.random_state)
|
[
"cao147147@naver.com"
] |
cao147147@naver.com
|
16d91fbc3374f016bc52a16e1e68608bbefcffbc
|
556e88a954cf031460ea7fdf3791eb968ca4fbdd
|
/fluent_python/chapter_17/ch17_flags_threadpool2.py
|
0373d3477801877b0d8723964f6ae65bbb1fa6e3
|
[] |
no_license
|
feng-hui/python_books_examples
|
c696243fcb8305be495f44d1a88a02e7f906b7bd
|
e38542db7be927cdaa5d85317a58a13b3a13ae25
|
refs/heads/master
| 2022-03-07T00:37:29.311687
| 2019-09-28T15:15:20
| 2019-09-28T15:15:20
| 122,941,867
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,158
|
py
|
#!/usr/bin/python3
# -*- coding:utf-8 -*-
# @author FH
# @email: capricorn1203@126.com
# @time: 2019/2/27 11:02
from concurrent import futures
from chapter_17.ch17_flags import save_flag, main, get_flag, get_one, show
MAX_WORKERS = 20
def download_one(*args):
url, default1, default2 = args[0]
print('>>>>>>request url:{url}, default param1:{default1}, default param2:{default2}'.format(
url=url,
default1=default1,
default2=default2
))
img = get_one(url)
file_name = url.split('/')[-1]
show(file_name)
save_flag(img, file_name)
def download_many(url_list):
params = ((url, 'default1', 'default2') for url in url_list)
workers = min(MAX_WORKERS, len(url_list))
with futures.ThreadPoolExecutor(max_workers=workers) as executor:
executor.map(download_one, params)
if __name__ == "__main__":
f_n = __file__.split('/')[-1]
print('>>>>>> [{}] Start scrawling page...'.format(f_n))
img_urls = get_flag()
print('>>>>>> [{}] Start downloading pictures by thread pool...'.format(f_n))
main(download_many, img_urls)
print('>>>>>> [{}] Download End...'.format(f_n))
|
[
"982698913@qq.com"
] |
982698913@qq.com
|
4367544d277d03c63b6dfb05308f5866f37a0e5c
|
69016961d556c1a8b67f0e23991f3a4b4df2a3ae
|
/tests/test_verify.py
|
2e3c79ae197357ffe9715689e21c9e8bec4d8132
|
[] |
no_license
|
huonfraser/cutting_problem
|
4d41b456b669b5472e0ade5b7cca67f07b22c500
|
4d767da24715d4dc13b2735f7e528cf4a4a59d9c
|
refs/heads/master
| 2022-12-07T12:19:17.555562
| 2020-08-21T04:31:39
| 2020-08-21T04:31:39
| 281,576,014
| 0
| 1
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 531
|
py
|
from main import *
sol1 = Solution([
("a",0,0,4,4),
("b",5,5,4,4)
])
#correct
sol2 = Solution([
("a",0,0,4,4),
("b",0,0,4,4)
])
#correct
sol3 = Solution([
("a",0,0,4,4),
("b",1,1,2,2)
])
#correct
sol4 = Solution([
("a",0,0,4,4),
("b",3,3,5,5)
])
#correct
sol5 = Solution([
("a",0,0,4,4),
("b",0,5,5,5)
])
#correct
sol6 = Solution([
("a",0,0,4,4),
("b",5,0,5,5)
])
#correct
sol7 = Solution(
[
("a",0,0,2,2),
("b",2,2,2,2)
]
)
print(sol7.verify())
|
[
"huon.fraser@gmail.com"
] |
huon.fraser@gmail.com
|
00d1fd2f84a95e4df20a1149dd9187052f3cb68c
|
711756b796d68035dc6a39060515200d1d37a274
|
/output_cog/optimized_37599.py
|
5c18316aac1805f55a0ec0ed775451d82de1a1e1
|
[] |
no_license
|
batxes/exocyst_scripts
|
8b109c279c93dd68c1d55ed64ad3cca93e3c95ca
|
a6c487d5053b9b67db22c59865e4ef2417e53030
|
refs/heads/master
| 2020-06-16T20:16:24.840725
| 2016-11-30T16:23:16
| 2016-11-30T16:23:16
| 75,075,164
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 10,844
|
py
|
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_sets={}
surf_sets={}
if "Cog2_GFPN" not in marker_sets:
s=new_marker_set('Cog2_GFPN')
marker_sets["Cog2_GFPN"]=s
s= marker_sets["Cog2_GFPN"]
mark=s.place_marker((615.889, 517.362, 661.457), (0.89, 0.1, 0.1), 18.4716)
if "Cog2_0" not in marker_sets:
s=new_marker_set('Cog2_0')
marker_sets["Cog2_0"]=s
s= marker_sets["Cog2_0"]
mark=s.place_marker((589.553, 518.364, 599.565), (0.89, 0.1, 0.1), 17.1475)
if "Cog2_1" not in marker_sets:
s=new_marker_set('Cog2_1')
marker_sets["Cog2_1"]=s
s= marker_sets["Cog2_1"]
mark=s.place_marker((543.246, 524.396, 531.703), (0.89, 0.1, 0.1), 17.1475)
if "Cog2_GFPC" not in marker_sets:
s=new_marker_set('Cog2_GFPC')
marker_sets["Cog2_GFPC"]=s
s= marker_sets["Cog2_GFPC"]
mark=s.place_marker((510.055, 603.216, 642.489), (0.89, 0.1, 0.1), 18.4716)
if "Cog2_Anch" not in marker_sets:
s=new_marker_set('Cog2_Anch')
marker_sets["Cog2_Anch"]=s
s= marker_sets["Cog2_Anch"]
mark=s.place_marker((460.646, 502.769, 356.072), (0.89, 0.1, 0.1), 18.4716)
if "Cog3_GFPN" not in marker_sets:
s=new_marker_set('Cog3_GFPN')
marker_sets["Cog3_GFPN"]=s
s= marker_sets["Cog3_GFPN"]
mark=s.place_marker((589.093, 510.398, 624.243), (1, 1, 0), 18.4716)
if "Cog3_0" not in marker_sets:
s=new_marker_set('Cog3_0')
marker_sets["Cog3_0"]=s
s= marker_sets["Cog3_0"]
mark=s.place_marker((589.152, 509.934, 625.147), (1, 1, 0.2), 17.1475)
if "Cog3_1" not in marker_sets:
s=new_marker_set('Cog3_1')
marker_sets["Cog3_1"]=s
s= marker_sets["Cog3_1"]
mark=s.place_marker((577.95, 510.659, 650.585), (1, 1, 0.2), 17.1475)
if "Cog3_2" not in marker_sets:
s=new_marker_set('Cog3_2')
marker_sets["Cog3_2"]=s
s= marker_sets["Cog3_2"]
mark=s.place_marker((550.736, 505.584, 654.951), (1, 1, 0.2), 17.1475)
if "Cog3_3" not in marker_sets:
s=new_marker_set('Cog3_3')
marker_sets["Cog3_3"]=s
s= marker_sets["Cog3_3"]
mark=s.place_marker((560.673, 482.669, 667.832), (1, 1, 0.2), 17.1475)
if "Cog3_4" not in marker_sets:
s=new_marker_set('Cog3_4')
marker_sets["Cog3_4"]=s
s= marker_sets["Cog3_4"]
mark=s.place_marker((541.175, 473.309, 685.769), (1, 1, 0.2), 17.1475)
if "Cog3_5" not in marker_sets:
s=new_marker_set('Cog3_5')
marker_sets["Cog3_5"]=s
s= marker_sets["Cog3_5"]
mark=s.place_marker((535.858, 450.113, 670.888), (1, 1, 0.2), 17.1475)
if "Cog3_GFPC" not in marker_sets:
s=new_marker_set('Cog3_GFPC')
marker_sets["Cog3_GFPC"]=s
s= marker_sets["Cog3_GFPC"]
mark=s.place_marker((615.383, 512.11, 635.141), (1, 1, 0.4), 18.4716)
if "Cog3_Anch" not in marker_sets:
s=new_marker_set('Cog3_Anch')
marker_sets["Cog3_Anch"]=s
s= marker_sets["Cog3_Anch"]
mark=s.place_marker((460.01, 383.97, 705.076), (1, 1, 0.4), 18.4716)
if "Cog4_GFPN" not in marker_sets:
s=new_marker_set('Cog4_GFPN')
marker_sets["Cog4_GFPN"]=s
s= marker_sets["Cog4_GFPN"]
mark=s.place_marker((431.444, 396.542, 505.38), (0, 0, 0.8), 18.4716)
if "Cog4_0" not in marker_sets:
s=new_marker_set('Cog4_0')
marker_sets["Cog4_0"]=s
s= marker_sets["Cog4_0"]
mark=s.place_marker((431.444, 396.542, 505.38), (0, 0, 0.8), 17.1475)
if "Cog4_1" not in marker_sets:
s=new_marker_set('Cog4_1')
marker_sets["Cog4_1"]=s
s= marker_sets["Cog4_1"]
mark=s.place_marker((459.399, 403.751, 503.542), (0, 0, 0.8), 17.1475)
if "Cog4_2" not in marker_sets:
s=new_marker_set('Cog4_2')
marker_sets["Cog4_2"]=s
s= marker_sets["Cog4_2"]
mark=s.place_marker((485.722, 415.165, 507.162), (0, 0, 0.8), 17.1475)
if "Cog4_3" not in marker_sets:
s=new_marker_set('Cog4_3')
marker_sets["Cog4_3"]=s
s= marker_sets["Cog4_3"]
mark=s.place_marker((508.883, 429.567, 516.783), (0, 0, 0.8), 17.1475)
if "Cog4_4" not in marker_sets:
s=new_marker_set('Cog4_4')
marker_sets["Cog4_4"]=s
s= marker_sets["Cog4_4"]
mark=s.place_marker((530.654, 442.015, 531.184), (0, 0, 0.8), 17.1475)
if "Cog4_5" not in marker_sets:
s=new_marker_set('Cog4_5')
marker_sets["Cog4_5"]=s
s= marker_sets["Cog4_5"]
mark=s.place_marker((549.041, 454.338, 549.866), (0, 0, 0.8), 17.1475)
if "Cog4_6" not in marker_sets:
s=new_marker_set('Cog4_6')
marker_sets["Cog4_6"]=s
s= marker_sets["Cog4_6"]
mark=s.place_marker((559.46, 470.668, 571.516), (0, 0, 0.8), 17.1475)
if "Cog4_GFPC" not in marker_sets:
s=new_marker_set('Cog4_GFPC')
marker_sets["Cog4_GFPC"]=s
s= marker_sets["Cog4_GFPC"]
mark=s.place_marker((327.519, 367.207, 618.373), (0, 0, 0.8), 18.4716)
if "Cog4_Anch" not in marker_sets:
s=new_marker_set('Cog4_Anch')
marker_sets["Cog4_Anch"]=s
s= marker_sets["Cog4_Anch"]
mark=s.place_marker((791.455, 584.989, 544.277), (0, 0, 0.8), 18.4716)
if "Cog5_GFPN" not in marker_sets:
s=new_marker_set('Cog5_GFPN')
marker_sets["Cog5_GFPN"]=s
s= marker_sets["Cog5_GFPN"]
mark=s.place_marker((565.743, 483.248, 537.031), (0.3, 0.3, 0.3), 18.4716)
if "Cog5_0" not in marker_sets:
s=new_marker_set('Cog5_0')
marker_sets["Cog5_0"]=s
s= marker_sets["Cog5_0"]
mark=s.place_marker((565.743, 483.248, 537.031), (0.3, 0.3, 0.3), 17.1475)
if "Cog5_1" not in marker_sets:
s=new_marker_set('Cog5_1')
marker_sets["Cog5_1"]=s
s= marker_sets["Cog5_1"]
mark=s.place_marker((543.038, 495.921, 549.744), (0.3, 0.3, 0.3), 17.1475)
if "Cog5_2" not in marker_sets:
s=new_marker_set('Cog5_2')
marker_sets["Cog5_2"]=s
s= marker_sets["Cog5_2"]
mark=s.place_marker((527.27, 518.069, 560.053), (0.3, 0.3, 0.3), 17.1475)
if "Cog5_3" not in marker_sets:
s=new_marker_set('Cog5_3')
marker_sets["Cog5_3"]=s
s= marker_sets["Cog5_3"]
mark=s.place_marker((529.376, 546.47, 553.432), (0.3, 0.3, 0.3), 17.1475)
if "Cog5_GFPC" not in marker_sets:
s=new_marker_set('Cog5_GFPC')
marker_sets["Cog5_GFPC"]=s
s= marker_sets["Cog5_GFPC"]
mark=s.place_marker((592.395, 570.742, 658.508), (0.3, 0.3, 0.3), 18.4716)
if "Cog5_Anch" not in marker_sets:
s=new_marker_set('Cog5_Anch')
marker_sets["Cog5_Anch"]=s
s= marker_sets["Cog5_Anch"]
mark=s.place_marker((470.483, 534.202, 443.664), (0.3, 0.3, 0.3), 18.4716)
if "Cog6_GFPN" not in marker_sets:
s=new_marker_set('Cog6_GFPN')
marker_sets["Cog6_GFPN"]=s
s= marker_sets["Cog6_GFPN"]
mark=s.place_marker((580.472, 540.224, 616.171), (0.21, 0.49, 0.72), 18.4716)
if "Cog6_0" not in marker_sets:
s=new_marker_set('Cog6_0')
marker_sets["Cog6_0"]=s
s= marker_sets["Cog6_0"]
mark=s.place_marker((580.45, 540.288, 616.214), (0.21, 0.49, 0.72), 17.1475)
if "Cog6_1" not in marker_sets:
s=new_marker_set('Cog6_1')
marker_sets["Cog6_1"]=s
s= marker_sets["Cog6_1"]
mark=s.place_marker((556.35, 535.113, 602.734), (0.21, 0.49, 0.72), 17.1475)
if "Cog6_2" not in marker_sets:
s=new_marker_set('Cog6_2')
marker_sets["Cog6_2"]=s
s= marker_sets["Cog6_2"]
mark=s.place_marker((558.405, 507.338, 606.458), (0.21, 0.49, 0.72), 17.1475)
if "Cog6_3" not in marker_sets:
s=new_marker_set('Cog6_3')
marker_sets["Cog6_3"]=s
s= marker_sets["Cog6_3"]
mark=s.place_marker((553.397, 480.647, 613.105), (0.21, 0.49, 0.72), 17.1475)
if "Cog6_4" not in marker_sets:
s=new_marker_set('Cog6_4')
marker_sets["Cog6_4"]=s
s= marker_sets["Cog6_4"]
mark=s.place_marker((544.822, 453.993, 612.07), (0.21, 0.49, 0.72), 17.1475)
if "Cog6_5" not in marker_sets:
s=new_marker_set('Cog6_5')
marker_sets["Cog6_5"]=s
s= marker_sets["Cog6_5"]
mark=s.place_marker((545.872, 439.615, 635.968), (0.21, 0.49, 0.72), 17.1475)
if "Cog6_6" not in marker_sets:
s=new_marker_set('Cog6_6')
marker_sets["Cog6_6"]=s
s= marker_sets["Cog6_6"]
mark=s.place_marker((560.753, 432.359, 658.211), (0.21, 0.49, 0.72), 17.1475)
if "Cog6_GFPC" not in marker_sets:
s=new_marker_set('Cog6_GFPC')
marker_sets["Cog6_GFPC"]=s
s= marker_sets["Cog6_GFPC"]
mark=s.place_marker((612.19, 447.824, 591.131), (0.21, 0.49, 0.72), 18.4716)
if "Cog6_Anch" not in marker_sets:
s=new_marker_set('Cog6_Anch')
marker_sets["Cog6_Anch"]=s
s= marker_sets["Cog6_Anch"]
mark=s.place_marker((503.353, 421.072, 723.074), (0.21, 0.49, 0.72), 18.4716)
if "Cog7_GFPN" not in marker_sets:
s=new_marker_set('Cog7_GFPN')
marker_sets["Cog7_GFPN"]=s
s= marker_sets["Cog7_GFPN"]
mark=s.place_marker((623.658, 483.506, 564.155), (0.7, 0.7, 0.7), 18.4716)
if "Cog7_0" not in marker_sets:
s=new_marker_set('Cog7_0')
marker_sets["Cog7_0"]=s
s= marker_sets["Cog7_0"]
mark=s.place_marker((605.66, 503.369, 565.488), (0.7, 0.7, 0.7), 17.1475)
if "Cog7_1" not in marker_sets:
s=new_marker_set('Cog7_1')
marker_sets["Cog7_1"]=s
s= marker_sets["Cog7_1"]
mark=s.place_marker((565.163, 544.288, 571.009), (0.7, 0.7, 0.7), 17.1475)
if "Cog7_2" not in marker_sets:
s=new_marker_set('Cog7_2')
marker_sets["Cog7_2"]=s
s= marker_sets["Cog7_2"]
mark=s.place_marker((524.301, 584.298, 576.458), (0.7, 0.7, 0.7), 17.1475)
if "Cog7_GFPC" not in marker_sets:
s=new_marker_set('Cog7_GFPC')
marker_sets["Cog7_GFPC"]=s
s= marker_sets["Cog7_GFPC"]
mark=s.place_marker((581.141, 621.035, 620.039), (0.7, 0.7, 0.7), 18.4716)
if "Cog7_Anch" not in marker_sets:
s=new_marker_set('Cog7_Anch')
marker_sets["Cog7_Anch"]=s
s= marker_sets["Cog7_Anch"]
mark=s.place_marker((426.069, 608.872, 551.634), (0.7, 0.7, 0.7), 18.4716)
if "Cog8_0" not in marker_sets:
s=new_marker_set('Cog8_0')
marker_sets["Cog8_0"]=s
s= marker_sets["Cog8_0"]
mark=s.place_marker((617.979, 482.296, 596.649), (1, 0.5, 0), 17.1475)
if "Cog8_1" not in marker_sets:
s=new_marker_set('Cog8_1')
marker_sets["Cog8_1"]=s
s= marker_sets["Cog8_1"]
mark=s.place_marker((590.628, 484.951, 589.457), (1, 0.5, 0), 17.1475)
if "Cog8_2" not in marker_sets:
s=new_marker_set('Cog8_2')
marker_sets["Cog8_2"]=s
s= marker_sets["Cog8_2"]
mark=s.place_marker((572.957, 501.899, 574.542), (1, 0.5, 0), 17.1475)
if "Cog8_3" not in marker_sets:
s=new_marker_set('Cog8_3')
marker_sets["Cog8_3"]=s
s= marker_sets["Cog8_3"]
mark=s.place_marker((574.964, 514.42, 548.66), (1, 0.5, 0), 17.1475)
if "Cog8_4" not in marker_sets:
s=new_marker_set('Cog8_4')
marker_sets["Cog8_4"]=s
s= marker_sets["Cog8_4"]
mark=s.place_marker((575.809, 533.766, 527.347), (1, 0.5, 0), 17.1475)
if "Cog8_5" not in marker_sets:
s=new_marker_set('Cog8_5')
marker_sets["Cog8_5"]=s
s= marker_sets["Cog8_5"]
mark=s.place_marker((572.066, 550.889, 504.741), (1, 0.5, 0), 17.1475)
if "Cog8_GFPC" not in marker_sets:
s=new_marker_set('Cog8_GFPC')
marker_sets["Cog8_GFPC"]=s
s= marker_sets["Cog8_GFPC"]
mark=s.place_marker((598.717, 525.543, 576.514), (1, 0.6, 0.1), 18.4716)
if "Cog8_Anch" not in marker_sets:
s=new_marker_set('Cog8_Anch')
marker_sets["Cog8_Anch"]=s
s= marker_sets["Cog8_Anch"]
mark=s.place_marker((545.488, 575.573, 431.175), (1, 0.6, 0.1), 18.4716)
for k in surf_sets.keys():
chimera.openModels.add([surf_sets[k]])
|
[
"batxes@gmail.com"
] |
batxes@gmail.com
|
9f660e4b51dcbfd8dc0034c7966e4022a7020c52
|
fab0793df2a8f3ef36cd4b1139f5df848190938f
|
/generate_python_from_graph.py
|
ab190faa924e83de133403d4c4c4c014ff4b10fd
|
[
"Apache-2.0"
] |
permissive
|
chapellegrini/pvnn
|
eee93529a58b2a99687e8d911e546179be8f8d7a
|
0ccd8b57a106d5e3f801da696ae4290ea940c6a5
|
refs/heads/master
| 2020-04-22T16:18:15.390971
| 2019-02-13T12:35:52
| 2019-02-13T12:35:52
| 170,503,702
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 5,411
|
py
|
#!/usr/bin/env python3
# This file contains the function generate_python_from_graph, which can be used
# to generate Python code describing a Keras model. The graph is composed of
# imbricated Python dict and describes how the different layers of the Keras
# model are linked.
# A Graph class will be defined for the next version of this project, these
# functions will be part of it. Most of the algorithmic work is already done.
def node_name(graph, node):
"""Returns the name given to the node in the generated Python code"""
if graph[node]['data']['title'] == 'Input':
return 'input_' + node
elif graph[node]['data']['title'] == 'Output':
return 'output_' + node
else:
return 'layer_' + node
def generate_tuple(param):
tuple_string = '('
for value in param:
if(type(value) == str):
tuple_string += '\'' + value + '\','
elif(type(value) == list):
tuple_string += generate_tuple(value) + ','
else:
tuple_string += str(value) + ','
tuple_string += ')'
return tuple_string
def generate_python_from_node(graph, node):
"""Return a string containing Python instructions to add the node.
Options are set to defaults for now, only 3 layer types are used.
"""
rs = node_name(graph, node) + ' = '
if graph[node]['data']['title'] == 'Output':
return ''
else:
rs += 'keras.layers.'
rs += graph[node]['data']['title']
rs += '('
param_string = ''
for param, value in graph[node]['data']['param'].items():#insecure?
if(type(value) == str):
param_string += param + '=\'' + value + '\','
elif(type(value) == list):
param_string += param + '=' + generate_tuple(value) + ','
else:
param_string += param + '=' + str(value) + ','
rs += param_string[:-1]
rs += ')'
if len(graph[node]['sources']) > 0:
rs += '('
if len(graph[node]['sources']) == 1:
rs += node_name(graph, graph[node]['sources'][0])
elif len(graph[node]['sources']) > 1:
rs += '['
for s in graph[node]['sources'][:-1]:
rs += node_name(graph, s) + ','
rs += node_name(graph, graph[node]['sources'][-1])
rs += ']'
rs += ')'
rs += '\n'
print(rs)
return rs
def find_inputs(graph):
"""Return a list of the different inputs"""
inputs = []
for node, value in graph.items():
if value['data']['title'] == 'Input':
inputs += [node]
return inputs
def find_outputs(graph):
"""Return a list of the different outputs"""
outputs = []
for node, value in graph.items():
if value['data']['title'] == 'Output':
outputs += [node]
return outputs
def create_treatment_list(graph):
"""Build a treatment list from a graph
The list contains the nodes that will be used to generate Python code in the
right order so that every input of a Keras layer is already defined.
"""
list = []
def add_node_to_list(node, list):
"""Adds the node and his targets to the list.
Adds the node only if all his sources are already added. Otherwise,
it waits for another call of this function to add the node. That way,
each node is added only once, and the Keras layers will be generated in
the correct order.
"""
for s in graph[node]['sources']:
if not graph[s]['treated']:
return False
list += [node]
graph[node]['treated'] = True
for t in graph[node]['targets']:
add_node_to_list(t, list)
for i in find_inputs(graph):
add_node_to_list(i, list)
return list
def generate_model_function(graph):
"""Generate the line responsible for the Keras Model instanciation"""
rs = 'model = keras.models.Model(inputs='
inputs = find_inputs(graph)
if len(inputs) == 1:
rs += node_name(graph, inputs[0])
elif len(inputs) > 1:
rs += '['
for input in inputs[:-1]:
rs += node_name(graph, input)+', '
rs += node_name(graph, inputs[-1])+']'
rs += ', outputs='
output_layers = find_outputs(graph)
outputs = []
for output_layer in output_layers:
outputs += graph[output_layer]['sources']
if len(outputs) == 1:
rs += node_name(graph, outputs[0])
elif len(outputs) > 1:
rs += '['
for output in outputs[:-1]:
rs += node_name(graph, output)+', '
rs += node_name(graph, outputs[-1])+']'
rs += ')\n'
return rs
def generate_python_from_graph(graph):
"""Generate a Python function which makes a Keras model
The dict contains all the nodes for a graph, their sources, targets, and
data. This function returns a string containing a Python function which
generates a functional Keras model. The layer options are not yet
implemented.
"""
rs = 'import keras\n'
rs += '\n'
rs += 'def build_model():\n'
list = create_treatment_list(graph)
for node in list:
python_line = generate_python_from_node(graph, node)
if python_line != '':
rs += ' ' + python_line
rs += ' ' + generate_model_function(graph)
rs += ' ' + 'return model' + '\n'
return rs
|
[
"charles.pellegrini@etu.u-bordeaux.fr"
] |
charles.pellegrini@etu.u-bordeaux.fr
|
0ce730577d2cffb3ebf369c965ad960ee3b48f06
|
4ad4af2cf431a08c35b0d6a1cee2eafd797902ac
|
/code/modelPredict/img2map5011_02_d2_48.py
|
ef07dd0cb3309e58065ed9791f0f26a16853ea91
|
[
"CC0-1.0"
] |
permissive
|
karenthchen/Association-between-three-dimensional-urban-form-and-depression
|
2b1084ace840f77ca6081a23f69da71578683715
|
c52c01daf8f41f79e66c2f60a40473f0f1d035d6
|
refs/heads/main
| 2023-06-08T13:47:11.488031
| 2023-05-25T02:07:09
| 2023-05-25T02:07:09
| 334,077,167
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,437
|
py
|
# @Date: 2019-05-13
# @Email: thc@envs.au.dk Tzu-Hsin Karen Chen
# @Last modified time: 2020-10-07
import sys
sys.path.insert(0, '/home/xx02tmp/code3/model')
sys.path.insert(0, '/home/xx02tmp/code3/dataPrepare')
import deepLabV3_ as DNN
import numpy as np
import time
from keras.models import load_model
import h5py
import os
import glob2
import scipy.io as sio
from img2mapC import img2mapC
from keras import backend as K
import os
import tensorflow as tf
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
config = tf.ConfigProto()
#config.gpu_options.per_process_gpu_memory_fraction = 0.8
config.gpu_options.allow_growth = True
session = tf.Session(config=config)
#image patch
fileD='/home/xx02tmp/image/to run49/'
#model path
modelPath='/home/xx02tmp/results/50/deep2/m4_11_02_48_s2a124/'
nn=0# model id
patch_shape = (48, 48, 6)
step=patch_shape[0]
batchS=8#8
#saved weights
modelName = modelPath +"0.0002_"+str(nn)+"_"+str(batchS)+"weights.best.hdf5"
#modelName = modelPath +"0.0001_"+str(nn)+"_"+str(batchS)+"weights.best.hdf5"
#modelName = modelPath +"epo_{epoch:02d}_0.0002_0_8model.final.hdf5"
###
params = {'dim_x': patch_shape[0],
'dim_y': patch_shape[1],
'dim_z': patch_shape[2],
'step': step,
'Bands': [0,1,2,3,4,5],#
'scale':1.0,
'isSeg':1, # if no downsampling to the image, the corner coordinates should kept the same
'nanValu':999,
'dim_x_img': patch_shape[0],#the actuall extracted image patch
'dim_y_img': patch_shape[1]}
cities = ['summerrs2014_segA150sd']
MapfileD=modelPath+'LczMap/'
if not os.path.exists(MapfileD):
os.makedirs(MapfileD)
#for idCity in [0]:
for idCity in np.arange(len(cities)):
if nn==0:#
model = DNN.deepLabV3_(input_shape=patch_shape, out_shape=(48, 48), classes=3, midBlocks=4, atrous_rates = (1, 2, 4), entry_block3_stride = (1,1,2))
if nn==1:#
model = DNN.deepLabV3_(input_shape=patch_shape, out_shape=(48, 48), classes=3, midBlocks=4, atrous_rates = (1, 2, 4), entry_block3_stride = (1,1,3))
model.load_weights(modelName, by_name=False)
print(modelName)
print(params['Bands'])
img2mapCLass=img2mapC(**params);
files=[fileD+cities[idCity]+'.tif']
print(files)
mapFile = MapfileD+cities[idCity]+'_'+ str(nn)+"_"+str(batchS)
img2mapCLass.img2Bdetection_ovlp([files[0]], model, mapFile, out=1, nn=nn) #making prediction here
|
[
"noreply@github.com"
] |
karenthchen.noreply@github.com
|
e39cb59eb8a4b09a595fca572020afe4bb7d0e9e
|
5a52ccea88f90dd4f1acc2819997fce0dd5ffb7d
|
/alipay/aop/api/response/KoubeiCateringDishGroupQueryResponse.py
|
f6bad0bc1d4d12e9097d0a1d2d7de2186586d80d
|
[
"Apache-2.0"
] |
permissive
|
alipay/alipay-sdk-python-all
|
8bd20882852ffeb70a6e929038bf88ff1d1eff1c
|
1fad300587c9e7e099747305ba9077d4cd7afde9
|
refs/heads/master
| 2023-08-27T21:35:01.778771
| 2023-08-23T07:12:26
| 2023-08-23T07:12:26
| 133,338,689
| 247
| 70
|
Apache-2.0
| 2023-04-25T04:54:02
| 2018-05-14T09:40:54
|
Python
|
UTF-8
|
Python
| false
| false
| 1,157
|
py
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.KbdishGroupInfo import KbdishGroupInfo
class KoubeiCateringDishGroupQueryResponse(AlipayResponse):
def __init__(self):
super(KoubeiCateringDishGroupQueryResponse, self).__init__()
self._kb_dish_group_list = None
@property
def kb_dish_group_list(self):
return self._kb_dish_group_list
@kb_dish_group_list.setter
def kb_dish_group_list(self, value):
if isinstance(value, list):
self._kb_dish_group_list = list()
for i in value:
if isinstance(i, KbdishGroupInfo):
self._kb_dish_group_list.append(i)
else:
self._kb_dish_group_list.append(KbdishGroupInfo.from_alipay_dict(i))
def parse_response_content(self, response_content):
response = super(KoubeiCateringDishGroupQueryResponse, self).parse_response_content(response_content)
if 'kb_dish_group_list' in response:
self.kb_dish_group_list = response['kb_dish_group_list']
|
[
"liuqun.lq@alibaba-inc.com"
] |
liuqun.lq@alibaba-inc.com
|
d864f2371aede5f33d0259429937cf36aa1ac4a4
|
30e2a85fc560165a16813b0486a862317c7a486a
|
/base_tutorial/bin/blank.py
|
e51fd9189c59b405f9351fd455566fd9d34c24ae
|
[] |
no_license
|
muryliang/python_prac
|
2f65b6fdb86c3b3a44f0c6452a154cd497eb2d01
|
0301e8f523a2e31e417fd99a968ad8414e9a1e08
|
refs/heads/master
| 2021-01-21T11:03:48.397178
| 2017-09-18T04:13:27
| 2017-09-18T04:13:27
| 68,801,688
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 358
|
py
|
import fileinput, re
fieldpattern = r'\[(.+?)\]'
pattern = re.compile(fieldpattern)
scope = {}
def replacement(match):
group = match.group(1)
try:
return str(eval(group, scope))
except SyntaxError:
exec group in scope
return ""
lines = ''
for line in fileinput.input():
lines += line.replace('\n','')
print pattern.sub(replacement, lines),
|
[
"muryliang@gmail.com"
] |
muryliang@gmail.com
|
ebafdf61c318fe7412527063fbac64be2ed4fea3
|
bec13bdc2d1a3696436bc7f534d0db23a1e6cdbe
|
/douban/settings.py
|
7c9bd6de7b5dc5de02407f7a6485261cb1b283e8
|
[] |
no_license
|
w77996/DoubanSpider
|
fde873725b50ca096404219bdbe6ae4fc652e8f9
|
a7a9f5b159e046a25e5ec954287a50a20c48ee41
|
refs/heads/master
| 2020-03-23T13:13:21.645095
| 2018-07-19T16:37:29
| 2018-07-19T16:37:29
| 141,606,688
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 3,237
|
py
|
# -*- coding: utf-8 -*-
# Scrapy settings for douban project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://doc.scrapy.org/en/latest/topics/settings.html
# https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
BOT_NAME = 'douban'
SPIDER_MODULES = ['douban.spiders']
NEWSPIDER_MODULE = 'douban.spiders'
USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50'
# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'douban (+http://www.yourdomain.com)'
# Obey robots.txt rules
ROBOTSTXT_OBEY = False
# Configure maximum concurrent requests performed by Scrapy (default: 16)
#CONCURRENT_REQUESTS = 32
# Configure a delay for requests for the same website (default: 0)
# See https://doc.scrapy.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#DOWNLOAD_DELAY = 3
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN = 16
#CONCURRENT_REQUESTS_PER_IP = 16
# Disable cookies (enabled by default)
#COOKIES_ENABLED = False
# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED = False
# Override the default request headers:
#DEFAULT_REQUEST_HEADERS = {
# 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
# 'Accept-Language': 'en',
#}
# Enable or disable spider middlewares
# See https://doc.scrapy.org/en/latest/topics/spider-middleware.html
#SPIDER_MIDDLEWARES = {
# 'douban.middlewares.DoubanSpiderMiddleware': 543,
#}
# Enable or disable downloader middlewares
# See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html
DOWNLOADER_MIDDLEWARES = {
# 'douban.middlewares.DoubanDownloaderMiddleware': 543,
'douban.middlewares.my_proxy': 543,
}
# Enable or disable extensions
# See https://doc.scrapy.org/en/latest/topics/extensions.html
#EXTENSIONS = {
# 'scrapy.extensions.telnet.TelnetConsole': None,
#}
# Configure item pipelines
# See https://doc.scrapy.org/en/latest/topics/item-pipeline.html
#ITEM_PIPELINES = {
# 'douban.pipelines.DoubanPipeline': 300,
#}
# Enable and configure the AutoThrottle extension (disabled by default)
# See https://doc.scrapy.org/en/latest/topics/autothrottle.html
#AUTOTHROTTLE_ENABLED = True
# The initial download delay
#AUTOTHROTTLE_START_DELAY = 5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY = 60
# The average number of requests Scrapy should be sending in parallel to
# each remote server
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG = False
# Enable and configure HTTP caching (disabled by default)
# See https://doc.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED = True
#HTTPCACHE_EXPIRATION_SECS = 0
#HTTPCACHE_DIR = 'httpcache'
#HTTPCACHE_IGNORE_HTTP_CODES = []
#HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
|
[
"912513404@qq.com"
] |
912513404@qq.com
|
7c305b6de14de72442620cd8a53b49727259c35c
|
105cea794f718d34d0c903f1b4b111fe44018d0e
|
/content/test/gpu/gpu_tests/gpu_helper_unittest.py
|
3940e4b2b763fecbce12831e5ba254417ec89eeb
|
[
"BSD-3-Clause"
] |
permissive
|
blueboxd/chromium-legacy
|
27230c802e6568827236366afe5e55c48bb3f248
|
e6d16139aaafff3cd82808a4660415e762eedf12
|
refs/heads/master.lion
| 2023-08-12T17:55:48.463306
| 2023-07-21T22:25:12
| 2023-07-21T22:25:12
| 242,839,312
| 164
| 12
|
BSD-3-Clause
| 2022-03-31T17:44:06
| 2020-02-24T20:44:13
| null |
UTF-8
|
Python
| false
| false
| 20,339
|
py
|
#!/usr/bin/env vpython3
# Copyright 2022 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import unittest
from unittest import mock
import dataclasses # Built-in, but pylint gives an ordering false positive.
from gpu_tests import common_typing as ct
from gpu_tests import gpu_helper
from telemetry.internal.platform import gpu_info
# pylint: disable=too-many-arguments
def CreateGpuDeviceDict(vendor_id: Optional[int] = None,
device_id: Optional[int] = None,
sub_sys_id: Optional[int] = None,
revision: Optional[int] = None,
vendor_string: Optional[str] = None,
device_string: Optional[str] = None,
driver_vendor: Optional[str] = None,
driver_version: Optional[str] = None
) -> Dict[str, Union[str, int]]:
return {
'vendor_id':
vendor_id or 0,
'device_id':
device_id or 0,
'sub_sys_id':
sub_sys_id or 0,
'revision':
revision or 0,
'vendor_string':
'vendor_string' if vendor_string is None else vendor_string,
'device_string':
'device_string' if device_string is None else device_string,
'driver_vendor':
'driver_vendor' if driver_vendor is None else driver_vendor,
'driver_version':
'driver_version' if driver_version is None else driver_version,
}
# pylint: enable=too-many-arguments
@dataclasses.dataclass
class TagHelperTestCase():
"""Struct-like class for defining a tag helper test case."""
expected_result: Any
device_dict: Dict[str, Union[str, int]] = ct.EmptyDict()
aux_attributes: Dict[str, Any] = ct.EmptyDict()
feature_status: Dict[str, str] = ct.EmptyDict()
extra_browser_args: List[str] = ct.EmptyList()
class TagHelpersUnittest(unittest.TestCase):
def runTagHelperTestWithIndex(
self, tc: TagHelperTestCase,
test_method: Callable[[Optional[gpu_info.GPUInfo], int], Any]) -> None:
"""Helper method for running a single tag helper test case w/ index."""
info = gpu_info.GPUInfo([CreateGpuDeviceDict(**tc.device_dict)],
tc.aux_attributes, tc.feature_status, None)
self.assertEqual(test_method(info, 0), tc.expected_result)
def runTagHelperTest(self, tc: TagHelperTestCase,
test_method: Callable[[Optional[gpu_info.GPUInfo]], Any]
) -> None:
"""Helper method for running a single tag helper test case w/o index."""
info = gpu_info.GPUInfo([CreateGpuDeviceDict(**tc.device_dict)],
tc.aux_attributes, tc.feature_status, None)
self.assertEqual(test_method(info), tc.expected_result)
def runTagHelperTestWithBrowserArgs(
self, tc: TagHelperTestCase,
test_method: Callable[[Optional[gpu_info.GPUInfo], List[str]], Any]
) -> None:
"""Helper method for running a tag helper test case w/ browser args."""
info = gpu_info.GPUInfo([CreateGpuDeviceDict(**tc.device_dict)],
tc.aux_attributes, tc.feature_status, None)
self.assertEqual(test_method(info, tc.extra_browser_args),
tc.expected_result)
def testGetGpuVendorString(self) -> None:
"""Tests all code paths for the GetGpuVendorString() method."""
cases = [
# Explicit ID -> AMD.
TagHelperTestCase(
'amd', {
'vendor_id': 0x1002,
'device_string': 'ANGLE (ANGLE gpu, 1, 2)',
'vendor_string': 'Vendor_gpu 1 2'
}),
# Explicit ID -> Intel.
TagHelperTestCase(
'intel', {
'vendor_id': 0x8086,
'device_string': 'ANGLE (ANGLE gpu, 1, 2)',
'vendor_string': 'Vendor_gpu 1 2'
}),
# Explicit ID -> NVIDIA.
TagHelperTestCase(
'nvidia', {
'vendor_id': 0x10DE,
'device_string': 'ANGLE (ANGLE gpu, 1, 2)',
'vendor_string': 'Vendor_gpu 1 2'
}),
# ANGLE vendor string.
TagHelperTestCase(
'angle gpu', {
'device_string': 'ANGLE (ANGLE gpu, 1, 2)',
'vendor_string': 'Vendor_gpu 1 2'
}),
# Vendor string.
TagHelperTestCase('vendor_gpu', {'vendor_string': 'Vendor_gpu 1 2'}),
# Defined info but unknown.
TagHelperTestCase('unknown_gpu', {'vendor_string': ''}),
]
for tc in cases:
self.runTagHelperTestWithIndex(tc, gpu_helper.GetGpuVendorString)
# Undefined info.
self.assertEqual(gpu_helper.GetGpuVendorString(None, 0), 'unknown_gpu')
def testGetGpuDeviceId(self) -> None:
"""Tests all code paths for the GetGpuDeviceId() method."""
cases = [
# Explicit device.
TagHelperTestCase(0xFFFF, {
'device_id': 0xFFFF,
'device_string': 'ANGLE (Vendor, Device, Driver)'
}),
# ANGLE device string.
TagHelperTestCase('Device',
{'device_string': 'ANGLE (Vendor, Device, Driver)'}),
# Device string.
TagHelperTestCase('Some device', {'device_string': 'Some device'}),
]
for tc in cases:
self.runTagHelperTestWithIndex(tc, gpu_helper.GetGpuDeviceId)
# Undefined info.
self.assertEqual(gpu_helper.GetGpuDeviceId(None, 0), 0)
def testIntelMasks(self) -> None:
"""Tests the masking methods for determining Intel generation."""
# Sample of real IDs taken from
# https://dgpu-docs.intel.com/devices/hardware-table.html
# Note that 12th gen is referred to as "Xe" or "XeHPG.
gen_9_ids = {0x1923, 0x3184, 0x3EA4, 0x591C, 0x5A85, 0x9BC8}
# 0x4F and 0xA7-prefixed samples missing since none were listed.
gen_12_ids = {0x4C8A, 0x9A40, 0x4905, 0x4680, 0x5690}
for pci_id in gen_9_ids:
self.assertTrue(gpu_helper.IsIntelGen9(pci_id))
self.assertFalse(gpu_helper.IsIntelGen12(pci_id))
for pci_id in gen_12_ids:
self.assertTrue(gpu_helper.IsIntelGen12(pci_id))
self.assertFalse(gpu_helper.IsIntelGen9(pci_id))
def testGetGpuDriverVendor(self) -> None:
"""Tests all code paths for the GetGpuDriverVendor() method."""
# Explicit vendor.
self.runTagHelperTest(
TagHelperTestCase('vendor', {'driver_vendor': 'vendor'}),
gpu_helper.GetGpuDriverVendor)
# Undefined info.
self.assertEqual(gpu_helper.GetGpuDriverVendor(None), None)
def testGetGpuDriverVersion(self) -> None:
"""Tests all code paths for the GetGpuDriverVersion() method."""
# Explicit version.
self.runTagHelperTest(
TagHelperTestCase('Some version', {'driver_version': 'Some version'}),
gpu_helper.GetGpuDriverVersion)
# Undefined info.
self.assertEqual(gpu_helper.GetGpuDriverVersion(None), None)
def testGetANGLERenderer(self) -> None:
"""Tests all code paths for the GetANGLERenderer() method."""
cases = [
# No aux attributes.
TagHelperTestCase('angle-disabled'),
# Non-ANGLE renderer.
TagHelperTestCase('angle-disabled',
aux_attributes={'gl_renderer': 'renderer'}),
# D3D11.
TagHelperTestCase('angle-d3d11',
aux_attributes={'gl_renderer': 'ANGLE Direct3D11'}),
# D3D9.
TagHelperTestCase('angle-d3d9',
aux_attributes={'gl_renderer': 'ANGLE Direct3D9'}),
# OpenGL ES.
TagHelperTestCase('angle-opengles',
aux_attributes={'gl_renderer': 'ANGLE OpenGL ES'}),
# OpenGL.
TagHelperTestCase('angle-opengl',
aux_attributes={'gl_renderer': 'ANGLE OpenGL'}),
# Metal.
TagHelperTestCase('angle-metal',
aux_attributes={'gl_renderer': 'ANGLE Metal'}),
# SwiftShader, explicitly test that it's chosen over Vulkan.
TagHelperTestCase(
'angle-swiftshader',
aux_attributes={'gl_renderer': 'ANGLE Vulkan SwiftShader'}),
# Vulkan.
TagHelperTestCase('angle-vulkan',
aux_attributes={'gl_renderer': 'ANGLE Vulkan'}),
]
for tc in cases:
self.runTagHelperTest(tc, gpu_helper.GetANGLERenderer)
# Undefined info.
self.assertEqual(gpu_helper.GetANGLERenderer(None), 'angle-disabled')
def testGetCommandDecoder(self) -> None:
"""Tests all code paths for the GetcommandDecoder() method."""
cases = [
# No aux attributes.
TagHelperTestCase('no_passthrough'),
# Validating.
TagHelperTestCase('no_passthrough',
aux_attributes={'passthrough_cmd_decoder': False}),
# Passthrough.
TagHelperTestCase('passthrough',
aux_attributes={'passthrough_cmd_decoder': True}),
]
for tc in cases:
self.runTagHelperTest(tc, gpu_helper.GetCommandDecoder)
# Undefined info.
self.assertEqual(gpu_helper.GetCommandDecoder(None), 'no_passthrough')
def testGetSkiaRenderer(self) -> None:
"""Tests all code paths for the GetSkiaRenderer() method."""
cases = [
# No feature status.
TagHelperTestCase('renderer-software',
extra_browser_args=['--enable-features=SkiaDawn']),
# No GPU Compositing.
TagHelperTestCase('renderer-software',
feature_status={'gpu_compositing': 'disabled'},
extra_browser_args=['--enable-features=SkiaDawn']),
# No renderer.
TagHelperTestCase('renderer-software',
feature_status={'gpu_compositing': 'enabled'}),
# Skia Dawn.
TagHelperTestCase('renderer-skia-dawn',
feature_status={
'gpu_compositing': 'enabled',
'vulkan': 'enabled_on',
'opengl': 'enabled_on'
},
extra_browser_args=['--enable-features=SkiaDawn']),
# Vulkan Skia Renderer.
TagHelperTestCase('renderer-skia-vulkan',
feature_status={
'gpu_compositing': 'enabled',
'vulkan': 'enabled_on',
'opengl': 'enabled_on'
}),
# GL Skia Renderer.
TagHelperTestCase('renderer-skia-gl',
feature_status={
'gpu_compositing': 'enabled',
'vulkan': 'enabled_off',
'opengl': 'enabled_on'
}),
]
for tc in cases:
self.runTagHelperTestWithBrowserArgs(tc, gpu_helper.GetSkiaRenderer)
# Undefined info.
self.assertEqual(
gpu_helper.GetSkiaRenderer(None, ['--enable-features=SkiaDawn']),
'renderer-software')
def testGetDisplayServer(self) -> None:
"""Tests all code paths for the GetDisplayServer() method."""
with mock.patch('sys.platform', 'linux2'):
# Remote platforms.
for browser_type in gpu_helper.REMOTE_BROWSER_TYPES:
self.assertEqual(gpu_helper.GetDisplayServer(browser_type), None)
# X.
with mock.patch.dict('os.environ', {}, clear=True):
self.assertEqual(gpu_helper.GetDisplayServer(''), 'display-server-x')
# Wayland.
with mock.patch.dict('os.environ', {'WAYLAND_DISPLAY': '1'}, clear=True):
self.assertEqual(gpu_helper.GetDisplayServer(''),
'display-server-wayland')
with mock.patch('sys.platform', 'win32'):
self.assertEqual(gpu_helper.GetDisplayServer(''), None)
def testGetOOPCanvasStatus(self) -> None:
"""Tests all the code paths for the GetOOPCanvasStatus() method."""
cases = [
# No feature status.
TagHelperTestCase('no-oop-c'),
# Feature status off.
TagHelperTestCase(
'no-oop-c',
feature_status={'canvas_oop_rasterization': 'enabled_off'}),
# Feature status on.
TagHelperTestCase(
'oop-c', feature_status={'canvas_oop_rasterization': 'enabled_on'}),
]
for tc in cases:
self.runTagHelperTest(tc, gpu_helper.GetOOPCanvasStatus)
# Undefined info.
self.assertEqual(gpu_helper.GetOOPCanvasStatus(None), 'no-oop-c')
def testGetAsanStatus(self) -> None:
"""Tests all code paths for the GetAsanStatus() method."""
cases = [
# No aux attributes.
TagHelperTestCase('no-asan'),
# Built without ASan.
TagHelperTestCase('no-asan', aux_attributes={'is_asan': False}),
# Built with ASan.
TagHelperTestCase('asan', aux_attributes={'is_asan': True}),
]
for tc in cases:
self.runTagHelperTest(tc, gpu_helper.GetAsanStatus)
# Undefined info.
self.assertEqual(gpu_helper.GetAsanStatus(None), 'no-asan')
def testGetTargetCpuStatus(self) -> None:
"""Tests all code paths for the GetTargetCpuStatus() method."""
cases = [
# No aux attributes.
TagHelperTestCase('target-cpu-unknown'),
# Target CPU specified.
TagHelperTestCase('target-cpu-32',
aux_attributes={'target_cpu_bits': 32}),
]
for tc in cases:
self.runTagHelperTest(tc, gpu_helper.GetTargetCpuStatus)
# Undefined info.
self.assertEqual(gpu_helper.GetTargetCpuStatus(None), 'target-cpu-unknown')
def testGetClangCoverage(self) -> None:
"""Tests all code paths for the GetClangCoverage() method."""
cases = [
# No aux attributes.
TagHelperTestCase('no-clang-coverage'),
# Built without Clang coverage.
TagHelperTestCase('no-clang-coverage',
aux_attributes={'is_clang_coverage': False}),
# Built with Clang coverage.
TagHelperTestCase('clang-coverage',
aux_attributes={'is_clang_coverage': True}),
]
for tc in cases:
self.runTagHelperTest(tc, gpu_helper.GetClangCoverage)
# Undefined info.
self.assertEqual(gpu_helper.GetClangCoverage(None), 'no-clang-coverage')
class ReplaceTagsUnittest(unittest.TestCase):
def testSubstringReplacement(self) -> None:
tags = ['some_tag', 'some-nvidia-corporation', 'another_tag']
self.assertEqual(gpu_helper.ReplaceTags(tags),
['some_tag', 'some-nvidia', 'another_tag'])
def testRegexReplacement(self) -> None:
tags = [
'some_tag',
'google-Vulkan-1.3.0-(SwiftShader-Device-(LLVM-10.0.0)-(0x0000C0DE))',
'another_tag'
]
self.assertEqual(gpu_helper.ReplaceTags(tags),
['some_tag', 'google-vulkan', 'another_tag'])
class EvaluateVersionComparisonUnittest(unittest.TestCase):
def testWindowsIntelUncomparableVersions(self) -> None:
"""Tests Windows Intel comparison when versions cannot be compared."""
non_ne_operations = ('eq', 'ge', 'gt', 'le', 'lt')
# Versions should only be comparable with 4 elements.
self.assertTrue(
gpu_helper.EvaluateVersionComparison('1.2.3', 'ne', '1.2.3', 'win',
'intel'))
for op in non_ne_operations:
self.assertFalse(
gpu_helper.EvaluateVersionComparison('1.2.3', op, '1.2.3', 'win',
'intel'))
self.assertTrue(
gpu_helper.EvaluateVersionComparison('1.2.3.4.5', 'ne', '1.2.3.4.5',
'win', 'intel'))
for op in non_ne_operations:
self.assertFalse(
gpu_helper.EvaluateVersionComparison('1.2.3.4.5', op, '1.2.3.4.5',
'win', 'intel'))
def testWindowsIntelOnlyLastTwoPartsUsed(self) -> None:
"""Tests that only the last two version parts are used on Windows Intel."""
self.assertTrue(
gpu_helper.EvaluateVersionComparison('1.2.3.4', 'eq', '2.3.3.4', 'win',
'intel'))
self.assertFalse(
gpu_helper.EvaluateVersionComparison('1.2.3.4', 'eq', '2.3.5.4', 'win',
'intel'))
def testInvalidOperation(self) -> None:
"""Tests that an error is raised when using an invalid operation."""
with self.assertRaisesRegex(Exception, 'Invalid operation: foo'):
gpu_helper.EvaluateVersionComparison('1.2.3.4', 'foo', '2.3.4.5')
def testEqual(self) -> None:
"""Tests that equality operations work as expected."""
eq_operations = ('eq', 'ge', 'le')
for op in eq_operations:
# Purely numerical.
self.assertTrue(
gpu_helper.EvaluateVersionComparison('1.2.3.4', op, '1.2.3.4'))
# Numerical + suffix.
self.assertTrue(
gpu_helper.EvaluateVersionComparison('1a.2b.3c.4a', op,
'1a.2b.3c.4a'))
# Mismatched length implies 0.
self.assertTrue(gpu_helper.EvaluateVersionComparison(
'1.2.0.0', op, '1.2'))
self.assertTrue(gpu_helper.EvaluateVersionComparison(
'1.2', op, '1.2.0.0'))
# Failure to parse gets skipped unless in the reference version.
self.assertTrue(
gpu_helper.EvaluateVersionComparison('1.2..4', op, '1.2.3.4'))
with self.assertRaises(AssertionError):
gpu_helper.EvaluateVersionComparison('1.2.3.4', op, '1.2..4')
def testNotEqual(self) -> None:
"""Tests that the not equal operation works as expected."""
true_cases = (
# Purely numerical.
('1.2.3.4', '1.2.3'),
('1.2.3', '1.2.3.4'),
# Same suffix, different numerical.
('2a.2b.3c.4d', '1a.2b.3c.4d'),
('1a.3b.3c.4d', '1a.2b.3c.4d'),
('1a.2b.4c.4d', '1a.2b.3c.4d'),
('1a.2b.3c.5d', '1a.2b.3c.4d'),
# Same numerical, different suffix.
('1b.2b.3c.4d', '1a.2b.3c.4d'),
('1a.2c.3c.4d', '1a.2b.3c.4d'),
('1a.2b.3d.4d', '1a.2b.3c.4d'),
('1a.2b.3c.4e', '1a.2b.3c.4d'),
)
false_cases = (
# Numerical.
('1.2.3.4', '1.2.3.4'),
# Numerical + suffix.
('1a.2b.3c.4d', '1a.2b.3c.4d'),
)
for left, right in true_cases:
self.assertTrue(gpu_helper.EvaluateVersionComparison(left, 'ne', right))
self.assertTrue(gpu_helper.EvaluateVersionComparison(right, 'ne', left))
for left, right in false_cases:
self.assertFalse(gpu_helper.EvaluateVersionComparison(left, 'ne', right))
self.assertFalse(gpu_helper.EvaluateVersionComparison(right, 'ne', left))
def testGreater(self) -> None:
"""Tests that greater operations work as expected."""
gt_operations = ('gt', 'ge')
for op in gt_operations:
for left, right in GetGreaterTestCases():
self.assertTrue(gpu_helper.EvaluateVersionComparison(left, op, right))
self.assertFalse(gpu_helper.EvaluateVersionComparison(right, op, left))
def testLess(self) -> None:
"""Tests that less operations work as expected."""
lt_operations = ('lt', 'le')
for op in lt_operations:
# Less than test cases are simply the inverse of greater than test cases,
# so just reverse the order.
for right, left in GetGreaterTestCases():
self.assertTrue(gpu_helper.EvaluateVersionComparison(left, op, right))
self.assertFalse(gpu_helper.EvaluateVersionComparison(right, op, left))
def GetGreaterTestCases() -> Tuple[Tuple[str, str], ...]:
return (
# Purely numerical.
('2.2.3.4', '1.2.3.4'),
('1.3.3.4', '1.2.3.4'),
('1.2.4.4', '1.2.3.4'),
('1.2.3.5', '1.2.3.4'),
# Same suffix, different numerical.
('2a.2b.3c.4d', '1a.2b.3c.4d'),
('1a.3b.3c.4d', '1a.2b.3c.4d'),
('1a.2b.4c.4d', '1a.2b.3c.4d'),
('1a.2b.3c.5d', '1a.2b.3c.4d'),
# Same numerical, different suffix.
('1b.2b.3c.4d', '1a.2b.3c.4d'),
('1a.2c.3c.4d', '1a.2b.3c.4d'),
('1a.2b.3d.4d', '1a.2b.3c.4d'),
('1a.2b.3c.4e', '1a.2b.3c.4d'),
)
if __name__ == '__main__':
unittest.main(verbosity=2)
|
[
"chromium-scoped@luci-project-accounts.iam.gserviceaccount.com"
] |
chromium-scoped@luci-project-accounts.iam.gserviceaccount.com
|
af51e1938928df157b56eed4bc25ac66db6ad429
|
e5516a7d7cb1deb2d33c771d4a49a1081f183d2e
|
/Item.py
|
fbd884ea8b9d43c39bcddf068e3937902ceeefb3
|
[] |
no_license
|
RDinary/python_06_20
|
14159e9c316902706ef994575521648329d727b6
|
457b6a17f1578817f157b0fa2150a23746d00481
|
refs/heads/master
| 2022-12-29T13:41:21.840415
| 2020-10-13T17:26:14
| 2020-10-13T17:26:14
| 280,805,415
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 752
|
py
|
class Item:
"""
item class docstring
"""
def __init__(self, name, price, code):
self.__name = name
self.__price = price
self.__code = code
def PrintInfo(self):
print(f"Item name: {self.__name}, price: {self.__price}, Code: {self.__code}")
def __str__(self):
return "__str__"
# return f"Item name: {self.__name}, price: {self.__price}, Code: {self.__code}"
def rename(self, newname):
self.__name = newname
item1 = Item("milk", 5, 2901290)
item2 = Item("mask", 15, 00000000)
item1.PrintInfo()
item2.PrintInfo()
item2.rename("KN95")
item2.PrintInfo()
item1.rename("low fat milk")
item1.PrintInfo()
print(item1)
print(1 + 2)
print("1" + "2")
print(type(item2))
|
[
"rafidinary@gmail.com"
] |
rafidinary@gmail.com
|
58bcb8470d8abc6848e6fa72b64cb30fcbfe3bab
|
2dbb46a9cb019d594a234b1b97eb281534e0e8a6
|
/Testes/aula18b.py
|
79148b9108fa1a16a4dd785f3b148707e2de48d3
|
[] |
no_license
|
Omupadh/python3
|
70110500773ad64d5197c66364311fee2ad507ec
|
ff2b0ddf2f61e85158f88db65d71da408d2c1e87
|
refs/heads/master
| 2022-05-28T12:35:00.765736
| 2020-04-22T02:07:21
| 2020-04-22T02:07:21
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 695
|
py
|
galera = list()
dado = list()
maior = menor = 0
for c in range(0, 3):
dado.append(str(input('Nome: ')))
dado.append(int(input('Idade: ')))
galera.append(dado[:])
dado.clear()
print(galera)
for p in galera:
if p[1] >= 21:
print(f'{p[0]} รฉ maior de idade.')
maior += 1
else:
print(f'{p[0]} รฉ menor de idade.')
menor += 1
if menor == 1 and maior == 1:
print(f'Temos {menor} menor e {maior} maior de idade.')
elif menor == 1:
print(f'Temos {menor} menor e {maior} maiores de idade.')
elif maior == 1:
print(f'Temos {menor} menores e {maior} maior de idade.')
else:
print(f'Temos {menor} menores e {maior} maiores de idade.')
|
[
"wellingtonfernandesbarbosa@github.com"
] |
wellingtonfernandesbarbosa@github.com
|
3ef3aefb59ef658888ff3710fca6f446525d756d
|
1a59a9076c1e9f1eb98e24ff41a4c1c95e2b353e
|
/xcp2k/classes/_force_eval3.py
|
e4dfe4c107b7e2331214ff5bb7cf2430ac8c3fe7
|
[] |
no_license
|
Roolthasiva/xcp2k
|
66b2f30ebeae1a946b81f71d22f97ea4076e11dc
|
fc3b5885503c6f6dc549efeb4f89f61c8b6b8242
|
refs/heads/master
| 2022-12-23T06:03:14.033521
| 2020-10-07T08:01:48
| 2020-10-07T08:01:48
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,041
|
py
|
from xcp2k.inputsection import InputSection
from xcp2k.classes._external_potential1 import _external_potential1
from xcp2k.classes._rescale_forces1 import _rescale_forces1
from xcp2k.classes._mixed1 import _mixed1
from xcp2k.classes._embed1 import _embed1
from xcp2k.classes._dft1 import _dft1
from xcp2k.classes._mm1 import _mm1
from xcp2k.classes._qmmm1 import _qmmm1
from xcp2k.classes._eip1 import _eip1
from xcp2k.classes._bsse1 import _bsse1
from xcp2k.classes._subsys1 import _subsys1
from xcp2k.classes._properties1 import _properties1
from xcp2k.classes._print68 import _print68
class _force_eval3(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Method = None
self.Stress_tensor = None
self.Embed = None
self.EXTERNAL_POTENTIAL_list = []
self.RESCALE_FORCES = _rescale_forces1()
self.MIXED = _mixed1()
self.EMBED = _embed1()
self.DFT = _dft1()
self.MM = _mm1()
self.QMMM = _qmmm1()
self.EIP = _eip1()
self.BSSE = _bsse1()
self.SUBSYS = _subsys1()
self.PROPERTIES = _properties1()
self.PRINT = _print68()
self._name = "FORCE_EVAL"
self._keywords = {'Method': 'METHOD', 'Stress_tensor': 'STRESS_TENSOR', 'Embed': 'EMBED'}
self._subsections = {'RESCALE_FORCES': 'RESCALE_FORCES', 'MIXED': 'MIXED', 'EMBED': 'EMBED', 'DFT': 'DFT', 'MM': 'MM', 'QMMM': 'QMMM', 'EIP': 'EIP', 'BSSE': 'BSSE', 'SUBSYS': 'SUBSYS', 'PROPERTIES': 'PROPERTIES', 'PRINT': 'PRINT'}
self._repeated_subsections = {'EXTERNAL_POTENTIAL': '_external_potential1'}
self._attributes = ['EXTERNAL_POTENTIAL_list']
def EXTERNAL_POTENTIAL_add(self, section_parameters=None):
new_section = _external_potential1()
if section_parameters is not None:
if hasattr(new_section, 'Section_parameters'):
new_section.Section_parameters = section_parameters
self.EXTERNAL_POTENTIAL_list.append(new_section)
return new_section
|
[
"xingwang1991@gmail.com"
] |
xingwang1991@gmail.com
|
03329e1fb649b7a1fb2c803af174392096217444
|
ca208cc7081fe039dca0ae52d1463b1c1786e492
|
/Unit_2/weekend.py
|
1cfe25b538c4b0f1bffa1ff4cd3e0b62d3f8be6f
|
[] |
no_license
|
gmandolesi/cs101
|
945238afd2036fced9e8fe92aac06840a8512f2b
|
eb30f8f2e86ef4749fb79bf2e1cc4af9a6b9621a
|
refs/heads/master
| 2021-05-12T02:29:40.573094
| 2018-01-26T19:36:09
| 2018-01-26T19:36:09
| 117,589,622
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 329
|
py
|
# Define a procedure weekend which takes a string as its input, and
# returns the boolean True if it's 'Saturday' or 'Sunday' and False otherwise.
def weekend(day):
return (day == 'Saturday') or (day == 'Sunday')
print weekend('Monday')
#>>> False
print weekend('Saturday')
#>>> True
print weekend('July')
#>>> False
|
[
"gium.terra@gmail.com"
] |
gium.terra@gmail.com
|
86f4e828682884ebe25304658f8724564cd1c8c3
|
78003b40022490f27e59ce9d748257b548ef853e
|
/Target.py
|
502b6bccc80aa9a2ee4bc4d60e730f06dbb6faea
|
[] |
no_license
|
jvickroy/wb_demo
|
3ac36f7c76d999e9f96436a08d2d6461564d017b
|
30c33631b9550a41b06bfe2dc14db3969f3f8bc2
|
refs/heads/master
| 2021-01-10T09:35:07.356216
| 2015-11-27T17:22:51
| 2015-11-27T17:22:51
| 46,992,037
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 13,547
|
py
|
'''
CONTENTS
components implementing a Target device interface with a Wise Ball
NOTES
* This module must be executing on the Target machine to be directed by a Wise Ball.
* This module may be imported (e.g., for unit testing) or run as a script from a command line.
* If run as a command-line script (see __main__ at the bottom), it provides an interface to
receive and respond to Wise Ball directives.
AUTHOR
jgv.home@gmail.com
'''
# standard Python packages ...
import logging, os, socket, Tkinter
from threading import Thread
# generic extensions to standard Python ...
import pyautogui # https://pyautogui.readthedocs.org/en/latest/ -- mouse control
from traits.api import Constant, HasTraits, Instance, Property, Range, String # http://www.lfd.uci.edu/~gohlke/pythonlibs/#ets
from traits.api import cached_property, undefined
# application-specific Python modules ...
from utils import SHOW_SIGNATURE, WITHDRAW_SIGNATURE, Directive, Mouse, multi_method
DEVICE = socket.gethostname()
class NoTransmission (Exception) : pass
class PartialTransmission (Exception) : pass
class Monitor (HasTraits):
""" Target device monitor screen """
width = Constant (value=pyautogui.size()[0], desc='monitor width (pixels)')
height = Constant (value=pyautogui.size()[1], desc='monitor width (pixels)')
def __str__ (self):
return '{}(width:{}, height:{})'.format (self.__class__.__name__, self.width, self.height)
class Receiver (HasTraits):
""" Target device component that receives Wise Ball Directives """
# externally-specified parameters ...
port = Range (low=3000, high=5000, value=undefined, exclude_low=False, exclude_high=False, desc='socket communications port number')
timeout = Range (low=0, high=10, value=3.0, exclude_low=False, exclude_high=False, desc='max time (secs) for completion of socket communique -- `None` (as long as needed) is typical for operational use')
# internally-managed parameters ...
listener = Instance (socket._socketobject, desc='monitor of contacts on `port`')
transmission = Directive
log = Instance (logging.Logger, factory=logging.getLogger, args=('Receiver',))
def start (self):
self.listener = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
self.listener.bind ((DEVICE, self.port)) # host='localhost' does not work -- at least when the transmitter is on the same machine
self.listener.settimeout (self.timeout)
self.listener.listen(5) # await sender contacts (5 is backlog limit)
self.log.info (' awaiting contacts on port %d', self.port)
def stop (self):
if not self.listener : return
try:
# self.listener.shutdown (socket.SHUT_RDWR) ... raises: socket error [Errno 10057] A request to send or receive data was disallowed ...
self.listener.close()
except socket.error as details:
self.log.info (' did not cleanly close its listener :: %s', details)
del self.listener
self.log.info (' stopped')
def receive (self):
"""
PURPOSE
receive a single data transmission from another (Wise Ball or Target) device
PARAMETERS
* none
RETURNS
* nothing
SIDE-EFFECTS
* `self.transmission` is reset.
* Messages may be logged.
NOTES
* This method may be used inside a (threaded) loop in order to receive on-demand transmissions.
* See: http://code.activestate.com/recipes/408859-socketrecv-three-ways-to-turn-it-into-recvall/
"""
del self.transmission
alldata = list()
try:
receiver, sender = self.listener.accept()
except socket.timeout as details:
self.log.debug (' no contacts in %.1f seconds', self.timeout)
else:
self.log.debug (' contacted by %s', sender)
receiver.settimeout (self.timeout)
while True:
try:
data = receiver.recv (1024)
self.log.debug (' received <%s> character transmission from %s', data, sender)
if not data: break
alldata.append (data)
except socket.timeout as details:
raise PartialTransmission (' data transmission, from {}, not completed in {} seconds'.format(sender,self.timeout))
try:
receiver.shutdown (socket.SHUT_RDWR)
receiver.close()
except socket.error as details:
self.log.warning (' did not cleanly close connection with %s :: %s', sender,details)
if not alldata : raise NoTransmission ('no transmission received in {} seconds'.format(self.timeout))
self.transmission = ''.join(alldata)
def __del__ (self):
self.stop()
def __str__ (self):
return '{0}(port={1},timeout={2})'.format (self.__class__.__name__, self.port, self.timeout)
class Signature (HasTraits):
color = String (desc='color name')
width = Property (depends_on='image', desc='image width (pixels)')
height = Property (depends_on='image', desc='image height (pixels)')
display = Instance (Tkinter.Tk , desc='graphics rendering engine')
thread = Instance (Thread , desc='`display` thread showing `image`')
# internally-managed parameters ...
log = log = Instance (logging.Logger, factory=logging.getLogger, args=('Signature',))
@staticmethod
def is_relevant (directive):
return isinstance (directive, str) and directive in (SHOW_SIGNATURE, WITHDRAW_SIGNATURE)
@staticmethod
def is_show (directive):
return isinstance (directive, str) and directive == SHOW_SIGNATURE
@staticmethod
def is_withdraw (directive):
return isinstance (directive, str) and directive == WITHDRAW_SIGNATURE
process = multi_method.dispatcher()
@multi_method.procedure (process, lambda *args, **kwargs : args[0].is_show(args[1]))
def process (self, directive):
self.show()
@multi_method.procedure (process, lambda *args, **kwargs : args[0].is_withdraw(args[1]))
def process (self, directive):
self.remove()
@multi_method.procedure (process, lambda *args, **kwargs : not args[0].is_relevant(args[1]))
def process (self, directive):
self.log.debug (' ignoring <%s> directive :: not relevant', str(directive))
show = multi_method.dispatcher()
@multi_method.procedure (show, lambda *args, **kwargs : not args[0].display)
def show (self):
self.log.debug (' processing request to show %s', self)
self.display = Tkinter.Tk()
self.display.overrideredirect (True)
self.display.title ('{} Identification Signature'.format(DEVICE))
self.display['bg'] = self.color
width, height = self.display.winfo_screenwidth(), self.display.winfo_screenheight()
self.display.geometry ("%dx%d+0+0" % (width, height))
self.display.focus_set()
#self.display.bind ('<Escape>', lambda event: event.widget.quit())
self.thread = Thread (target=self.display.mainloop, name='{} ID Signature'.format(DEVICE))
self.thread.start()
@multi_method.procedure (show, lambda *args, **kwargs : args[0].display)
def show (self):
self.log.debug (' request to show %s ignored :: presently being displayed', self)
remove = multi_method.dispatcher()
@multi_method.procedure (remove, lambda *args, **kwargs : args[0].display)
def remove (self):
self.log.debug (' processing request to remove %s', self)
try:
self.display.destroy()
except Tkinter.TclError as details:
if not str(details).endswith('application has been destroyed') : self.log.warning (' closing window :: %s',details)
del self.display
del self.thread
@multi_method.procedure (remove, lambda *args, **kwargs : not args[0].display)
def remove (self):
self.log.debug (' request to remove %s ignored :: not presently being displayed', self)
@cached_property
def _get_width (self):
return self.image.width()
@cached_property
def _get_height (self):
return self.image.height()
def __del__ (self):
self.remove()
def __str__ (self):
return '{}(name:{})'.format (self.__class__.__name__, self.color)
class Target (HasTraits):
# externally-specified parameters ...
name = Constant (value=DEVICE, desc='target machine name on local network')
signature = Instance (Signature, desc='Target color signature for identification by Wise Ball')
monitor = Instance (Monitor , desc='Target screen')
receiver = Instance (Receiver , desc='receiver of Wise Ball directives')
directive = Directive
# internally-managed parameters ...
mouse = Instance (Mouse , factory=Mouse , args=())
log = Instance (logging.Logger, factory=logging.getLogger, args=(name.default_value,))
@classmethod
def create (_self_, settings):
section = 'Target <:> {}'.format(DEVICE) # [Section] name suffix (after <:>) assumed to be the machine name on local network
assert settings.has_section (section), '{} Section not found in configuration file'.format(section)
port = settings.getint (section, 'port')
color = settings.get (section, 'color')
signature = Signature (color=color) # creating `image` instance prior to Tkinter.Tk instance creation raises: "RuntimeError: Too early to create image"
monitor = Monitor ()
receiver = Receiver (port=port)
parameters = dict (zip (('signature','monitor','receiver'),(signature,monitor,receiver)))
return _self_ (**parameters)
def start (self):
self.receiver.start()
self.signature.show()
def stop (self):
self.receiver.stop()
self.signature.remove()
def execute (self):
try:
self.receiver.receive()
except NoTransmission as details:
self.signature.show()
else:
self.directive = self.receiver.transmission
if self.mouse.is_relevant (self.directive):
self.signature.remove() # never display signature if mouse directives are being received
self.mouse.process (self.directive)
else:
self.signature.process (self.directive)
def __str__ (self):
return '{}({}, {})'.format(self.__class__.__name__, self.name, str(self.signature))
if __name__ == '__main__':
'''
PURPOSE
present an interface to receive and respond to the following Wise Ball directives:
- mouse pointer positioning
- mouse button press/release
- color signature display/withdraw (facilitate identification by a Wise Ball)
NOTES
* Execute one of the following commands:
> python Target.py --help
> python Target.py -h
from a shell window to display a brief description of the command-line parameters.
* If not deployed on a Microsoft OS, with win32con (http://sourceforge.net/projects/pywin32/files/pywin32/) installed,
script termination from the keyboard is disabled. OpenCV (cv2) has a cross-platform keyboard interface, but a
requirement is to avoid installation of OpenCV on target machines.
'''
# standard Python packages ...
from argparse import ArgumentParser
from ConfigParser import SafeConfigParser
import sys
# generic extensions to standard Python ...
if sys.platform == 'win32': from win32con import VK_ESCAPE # [MS Windows Specific] [Esc] key -- VK is virtual key :: http://sourceforge.net/projects/pywin32/files/pywin32/
# application-specific Python modules ...
from utils import Keyboard # [MS Windows-specific]
parser = ArgumentParser() # commandline arguments parser
parser.add_argument ('--verbosity' , type=str, default='low' , help='logging verbosity', choices=('low','medium','high'))
parser.add_argument ('--configfile', type=str, default='WiseBall.ini', help='configuration file name')
parser.add_argument ('--stopkey' , type=str, default='Esc' , help='STOP execution key')
arguments = parser.parse_args()
stopkey = VK_ESCAPE if arguments.stopkey == 'Esc' else ord (arguments.stopkey)
verbosity = dict (low=logging.WARN, medium=logging.INFO, high=logging.DEBUG)
logging.basicConfig (level=verbosity[arguments.verbosity])
# logging.basicConfig (filename='{}.log'.format(DEVICE), filemode='w', verbosity[arguments.verbosity])
log = logging.getLogger (DEVICE)
log.info (' started')
try:
configuration = SafeConfigParser()
configuration.readfp (open(arguments.configfile))
target = Target.create (configuration)
target.start()
except (AssertionError,) as details:
log.error (' %s',details)
else:
while not Keyboard.pressed (stopkey):
try:
target.execute()
except (AssertionError, PartialTransmission) as details:
log.warning (' %s',details)
else:
pass # TBD log.info (## ???)
target.stop()
finally:
log.info (' stopped')
logging.shutdown()
|
[
"jgv.home@gmail.com"
] |
jgv.home@gmail.com
|
0598e820cc0b9669f34ba3a24e337e1736714ad9
|
839aa2696f888cbe966f94614e11d8962cc27c74
|
/utils/comparison.py
|
bd22d54f79eca55b2849a01fcc63cfa909619b4f
|
[] |
no_license
|
jiehanzheng/rpi_intercom
|
dfb254ecd42b12252c099ad036691982f1073931
|
5ec9109504f78afc8b30c26cc83d518a91967dc5
|
refs/heads/master
| 2016-09-08T01:29:46.455086
| 2013-02-22T06:48:06
| 2013-02-22T06:48:06
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 4,281
|
py
|
from __future__ import division
from fft import fft_freq_intensity
from debug import indented_print
from numpy import searchsorted
import scipy.weave as weave
import time
import os.path
#
# SIMILARITY SCALE
#
# threshold
# |
# [---------|----|----]
# 0 0.5 1
# diff neutral identical
#
point_score_struct_c = r"""
typedef struct {
float weighted_score;
float weight;
} score_info;
"""
with open(os.path.join(os.path.dirname(__file__), 'cpp/point_score.cpp'), 'r') as f:
point_score_c = f.read()
with open(os.path.join(os.path.dirname(__file__), 'cpp/fft_similarity.cpp'), 'r') as f:
fft_similarity_c = f.read()
with open(os.path.join(os.path.dirname(__file__), 'cpp/max_slice_tree_score.cpp'), 'r') as f:
max_slice_tree_score_c = f.read()
with open(os.path.join(os.path.dirname(__file__), 'cpp/fft_freq_intensity.cpp'), 'r') as f:
fft_freq_intensity_c = f.read()
def find_out_which_peer_this_guy_mentioned(guy, peers, slice_comparison_lookup, callback):
"""Returns the best guess and our confidence"""
best_peer = None
best_peer_confidence = 0
for peer in peers:
# print len(peer.audio), "in tmpl and", len(guy), "in sample"
similarity = max_slice_tree_score(guy, peer.audio,
fft_similarity_lookup_tbl=slice_comparison_lookup)
if similarity >= best_peer_confidence:
best_peer_confidence = similarity
best_peer = peer
callback(best_peer, best_peer_confidence)
def listen_for_over(callback):
pass
def fft_similarity_conservative(sample_freq, sample_intensity,
tmpl_freq, tmpl_intensity,
intensity_threshold=20):
"""Do FFT both ways and return the minimum value to be conservative"""
return min(
fft_similarity(sample_freq[:],sample_intensity[:], tmpl_freq[:],tmpl_intensity[:],
intensity_threshold),
fft_similarity(tmpl_freq[:],tmpl_intensity[:], sample_freq[:],sample_intensity[:],
intensity_threshold))
def fft_similarity(sample_freq, sample_intensity,
tmpl_freq, tmpl_intensity,
intensity_threshold=20):
# remove unnecessary elements to avoid N^2 useless calculations
# >7000, wastes ~15000^2 comparisons, doesnt cause index to shift
sample_freq = sample_freq[:searchsorted(sample_freq, 7000)]
tmpl_freq = tmpl_freq[:searchsorted(tmpl_freq, 7000)]
# <70, wastes 4900 comparisons, but how much does it cost to find index and slice?
# TODO
return weave.inline(r"""
return_val = Py_BuildValue("f", fft_similarity(sample_freq,
sample_intensity, tmpl_freq,
tmpl_intensity,
intensity_threshold));
""",
['sample_freq', 'sample_intensity', 'tmpl_freq', 'tmpl_intensity',
'intensity_threshold'],
support_code=point_score_struct_c + point_score_c + fft_similarity_c,
# force=1,
verbose=2)
def max_slice_tree_score(sample, tmpl, sample_index=0, tmpl_index=0,
cumulative_score=0, try_history=[],
fft_similarity_lookup_tbl={}):
weave.inline("""
max_slice_tree_score(sample, tmpl,
sample_index, tmpl_index,
cumulative_score, try_history,
fft_similarity_lookup_tbl);
""",
['sample', 'tmpl', 'sample_index', 'tmpl_index',
'cumulative_score', 'try_history', 'fft_similarity_lookup_tbl'],
support_code=point_score_struct_c + point_score_c + fft_freq_intensity_c + fft_similarity_c + max_slice_tree_score_c,
define_macros=[('DEBUG', None)],
include_dirs=[os.path.join(os.path.dirname(__file__), 'cpp')],
sources=['utils/cpp/kiss_fftr.c', 'utils/cpp/kiss_fft.c'],
force=1,
verbose=2)
# # at the bottom of the tree
# if stay_score is None and adv_score is None:
# return cumulative_score/len(try_history)
# # # DEBUG
# # indented_print(len(try_history)-1, "-> max =", max(stay_score, adv_score))
# return max(stay_score, adv_score)
|
[
"zheng@jiehan.org"
] |
zheng@jiehan.org
|
adf80b4e1e26080d320e64858cb973ab476c4628
|
c427d9142df033af2b509412153dae35706ede61
|
/detection/craft_text_detector/craft_text_detector/eval/__init__.py
|
b71260322656e4ffb7842d02030a5977cf73fa64
|
[
"MIT"
] |
permissive
|
brahimbellahcen/ocr_toolkit
|
0b68776fe20b05f48807f856fffac752e3e08e66
|
b4516d4193132eb48f821926dd6ef5d368f53899
|
refs/heads/master
| 2022-11-13T10:21:14.083497
| 2020-06-26T15:31:38
| 2020-06-26T15:31:38
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 721
|
py
|
try:
import rrc_evaluation_funcs
import script
except:
try:
from eval import rrc_evaluation_funcs
from eval import script
except:
try:
from craft_text_detector.eval import rrc_evaluation_funcs
from craft_text_detector.eval import script
except:
try:
from craft_text_detector.craft_text_detector.eval import rrc_evaluation_funcs
from craft_text_detector.craft_text_detector.eval import script
except:
from detection.craft_text_detector.craft_text_detector.eval import rrc_evaluation_funcs
from detection.craft_text_detector.craft_text_detector.eval import script
|
[
"selcukcaglar08@gmail.com"
] |
selcukcaglar08@gmail.com
|
ba2be74df812806361df907c90b182548df94a3a
|
eb61a8f58b7e46264a5762173a48bc3564cad301
|
/register/views.py
|
a2308fbe0fed5b850d893a717644fc64f6ba4757
|
[] |
no_license
|
arunnK/NITH-Registration-Portal
|
cbdad9ca2e155c97eeb635516f8415c4ccf0f2f0
|
72b77c388f866ef2961162744f69f7133e09e5a5
|
refs/heads/master
| 2020-12-24T21:28:16.815876
| 2016-04-29T20:39:53
| 2016-04-29T20:39:53
| 57,408,185
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 13,279
|
py
|
from django.shortcuts import render,render_to_response,redirect
from django.http import HttpResponse,HttpResponseRedirect
from django.template import Template,Context
from django.template.loader import get_template
from django.core.exceptions import ObjectDoesNotExist
#import pymysql as MySQLdb
#from django.shortcuts import render_to_response
from django.template import RequestContext
from register.models import *
from django.core.urlresolvers import reverse
#these are import to get default
from django.contrib.auth import authenticate,login,logout
from django.contrib.auth.decorators import login_required #login_required used to limiting access to login user
#User models store the username,password or emailid
from django.contrib.auth.models import User
from .printing import MyPrint
from io import BytesIO
from django.contrib.admin.views.decorators import staff_member_required
from django.db import IntegrityError
from datetime import date
# Create your views here.
login_error=""
register_error=""
pay_error=""
def index(request):
if not request.user.is_authenticated():
return render_to_response("index.html",context_instance=RequestContext(request))
else:
username=request.user.username
if(username=="admin"):
logout(request)
return render_to_response("index.html",context_instance=RequestContext(request))
else:
return HttpResponseRedirect(reverse('register:home',args=(username,)))
def login_view(request):
global login_error
if not request.user.is_authenticated():
context={'error_message':login_error}
login_error=""
return render(request,"login.html",context)
else:
username=request.user.username
return HttpResponseRedirect(reverse('register:home',args=(username,)))
def register(request):
global register_error
context={'error_message':register_error}
register_error=""
return render(request,"register.html", context)
def home(request,username):
if request.user.is_authenticated():
name=request.user.registeredclass.name
try:
rollno=request.user.username
feedetail.objects.get(rollno=rollno)
return HttpResponseRedirect(reverse('register:step2',args=(username,)))
except ObjectDoesNotExist:
try:
fee=request.session['tution_fee']
obj=feeinfo.objects.get(id=request.session['fee_id'])
year_sem=obj.year_sem
except KeyError:
fee=""
year_sem=""
return render(request,"home.html",{"username":name,"year_sem":year_sem,"Amount":fee})
else:
return redirect('/login.html')
def registered(request):
global register_error
photo=request.POST.get('photo','')
name=request.POST.get('name','')
dob=request.POST.get('dob','')
fname=request.POST.get('fname','')
email_id=request.POST.get('email','')
pass1=request.POST.get('pass1','')
rollno_v=request.POST.get('rollno','')
phone=request.POST.get('phn','')
branch_v=request.POST.get('branch','')
address_v=request.POST.get('address','')
pincode_v=request.POST.get('pincode','')
try:
User.objects.create_user(rollno_v,email_id,pass1)
userobj=User.objects.get(username=rollno_v)
o=registeredclass (user=userobj,name=name,branch=branch_v,mobile=phone,address=address_v,pincode=pincode_v,dob=dob,fathername=fname,photo=photo)
o.save()
library_obj=library_due(user=userobj,rollno=rollno_v)
library_obj.save()
return redirect("/login.html")
except IntegrityError as e:
try:
User.objects.get(emain_id=email)
register_error="use another email"
except:
register_error="Roll No. exist"
return redirect('/register.html')
#return render_to_response("f.html", context_instance=RequestContext(request))
def logincheck(request):
global login_error
username=request.POST.get('roll','')
password=request.POST.get('pass','')
user=authenticate(username=username,password=password)
if user is not None:
if user.is_active:
login(request,user)
return HttpResponseRedirect(reverse('register:home',args=(username,)))
else:
#return a diable account message
login_error="your account is dissable"
return redirect('/login.html')
#return render(request,'login.html',{'error_message':'your account is dissable'})
else :
#return invalid user name or password
login_error="invalid username or password"
#return render(request,'login.html',{'error_message':})
return redirect('/login.html')
def my_logout(request,username):
logout(request)
#redirect to success page
return redirect('/login.html')
#return render_to_response("logout.html",context_instance=RequestContext(request))
def getfee(request,username): #display the tution fee
if request.user.is_authenticated():
year=request.POST.get("year",'')
#semester=request.POST.get("semester",'')
obj=feeinfo.objects.get(year_sem=year)
fee=obj.fee
request.session['tution_fee']=obj.fee
request.session['fee_id']=obj.id
request.session['year_sem']=obj.year_sem
username=request.user.registeredclass.name
return HttpResponseRedirect(reverse('register:home',args=(username,)))
#return render(request,"fee.html",{"year":year,"fee": fee})
else :
return redirect('/login.html')
def pay1(request,username): #display tution fee payment page
global pay_error
if request.user.is_authenticated():
try: #TO check that page is requested from valid url or not
obj=feedetail.objects.get(rollno=username)
return render_to_response("page_except.html",context_instance=RequestContext(request))
except ObjectDoesNotExist:
try:
request.session['fee_id']
context={'error_message':pay_error}
pay_error=""
return render(request,"pay1.html",context)
except KeyError:
return HttpResponseRedirect(reverse('register:home',args=(username,)))
else:
return redirect('/login.html')
def pay1check(request,username): #pay1check used to validation of card and store information in feedetail tabel
global pay_error
if request.user.is_authenticated():
card=request.POST.get("cno",'')
month=request.POST.get("month",'')
year=request.POST.get("year",'')
cvv=request.POST.get("cvv",'')
try:
card_obj=card_detail.objects.get(cardno=card)
if (month==card_obj.month and year==card_obj.year and cvv==card_obj.cvv):
fee_id=request.session["fee_id"]
feeinfo_obj=feeinfo.objects.get(id=fee_id)
paid_amount=feeinfo_obj.fee
rollno=request.user.username
name=request.user.registeredclass.name
year_sem=request.session['year_sem']
paid_user=feedetail(user=request.user,time=date.today(),year_sem=year_sem,feeid=fee_id,rollno=rollno,name=name,Amount=paid_amount)
paid_user.save()
return HttpResponseRedirect(reverse('register:step2',args=(username,)))
else:
pay_error="invalid detail"
return HttpResponseRedirect(reverse('register:pay1',args=(username,)))
except ObjectDoesNotExist:
pay_error="Invalid card"
return HttpResponseRedirect(reverse('register:pay1',args=(username,)))
else:
return redirect('/login.html')
def step2(request,username):
if request.user.is_authenticated():
name=request.user.registeredclass.name
try:
rollno=request.user.username
hostel_fee_detail.objects.get(rollno=rollno)
return HttpResponseRedirect(reverse('register:step3',args=(username,)))
except ObjectDoesNotExist:
try:
fee=request.session['hostel_fee']
obj=hostel_fee_info.objects.get(id=request.session['hostel_fee_id'])
hostel=obj.hostel
except KeyError:
fee=""
hostel=""
#try:
# rollno=request.user.username
# feedetail.objects.get(rollno=rollno)
# return HttpResponseRedirect(reverse('register:pay1success',args=(username,)))
#except ObjectDoesNotExist:
return render(request,"step2.html",{"username":name,"Hostel":hostel,"Amount":fee})
else:
return redirect('/login.html')
def hostel_getfee(request,username): #display the hostel fee
if request.user.is_authenticated():
hostel=request.POST.get("hostel",'')
if hostel=="":
request.session['hostel_fee']=""
else:
obj=hostel_fee_info.objects.get(hostel=hostel)
request.session['hostel_fee']=obj.fee
request.session['hostel_fee_id']=obj.id
request.session['hostel']=obj.hostel
#username=request.user.registeredclass.name
#books=request.user.registeredclass.books
return HttpResponseRedirect(reverse('register:step2',args=(username,)))
else:
return redirect('/login.html')
def pay2(request,username): #display tution fee payment page
global pay_error
if request.user.is_authenticated():
try: #TO check that page is requested from valid url or not
obj=hostel_fee_detail.objects.get(rollno=username)
return render_to_response("page_except.html",context_instance=RequestContext(request))
except ObjectDoesNotExist:
try:
request.session['hostel_fee_id']
context={'error_message':pay_error}
pay_error=""
return render(request,"pay2.html",context)
except KeyError:
return HttpResponseRedirect(reverse('register:step2',args=(username,)))
else:
return redirect('/login.html')
def pay2check(request,username): #pay1check used to validation of card and store information in feedetail tabel
global pay_error
if request.user.is_authenticated():
card=request.POST.get("cno",'')
month=request.POST.get("month",'')
year=request.POST.get("year",'')
cvv=request.POST.get("cvv",'')
try:
card_obj=card_detail.objects.get(cardno=card)
if (month==card_obj.month and year==card_obj.year and cvv==card_obj.cvv):
hostel_fee_id=request.session["hostel_fee_id"]
hostel_fee_info_obj=hostel_fee_info.objects.get(id=hostel_fee_id)
paid_amount=hostel_fee_info_obj.fee
rollno=request.user.username
hostel=request.session['hostel']
name=request.user.registeredclass.name
paid_user=hostel_fee_detail(user=request.user,time=date.today(),feeid=hostel_fee_id,hostel=hostel,rollno=rollno,name=name,Amount=paid_amount)
paid_user.save()
return HttpResponseRedirect(reverse('register:step3',args=(username,)))
else:
pay_error="invalid detail"
return HttpResponseRedirect(reverse('register:pay2',args=(username,)))
except ObjectDoesNotExist:
pay_error="invalid card"
return HttpResponseRedirect(reverse('register:pay2',args=(username,)))
else:
return redirect('/login.html')
def step3(request,username):
if request.user.is_authenticated():
name=request.user.registeredclass.name
books=request.user.library_due.books
rollno=request.user.username
due=request.user.library_due.due
flag=request.user.library_due.flag
if books==0:
if flag==0:
if due==0:
pay="proceed"
else:
pay="pay"
o=library_due.objects.get(rollno=rollno)
o.flag=1
o.save()
return render(request,"step3.html",{"username":name,"books":books,"Amount":due,"pay":pay})
else:
return HttpResponseRedirect(reverse('register:thanks',args=(username,)))
else:
return render(request,"step3_b.html",{"username":name,"books":books})
#try:
# rollno=request.user.username
# feedetail.objects.get(rollno=rollno)
# return HttpResponseRedirect(reverse('register:pay1success',args=(username,)))
#except ObjectDoesNotExist:
else:
return redirect('/login.html')
def pay3(request,username): #display tution fee payment page
global pay_error
if request.user.is_authenticated():
due=request.user.library_due.due
if due==0:
return HttpResponseRedirect(reverse('register:thanks',args=(username,)))
else:
context={'error_message':pay_error}
pay_error=""
return render(request,"pay3.html",context)
else:
return redirect('/login.html')
def pay3check(request,username): #pay1check used to validation of card and store information in feedetail tabel
global pay_error
if request.user.is_authenticated():
card=request.POST.get("cno",'')
month=request.POST.get("month",'')
year=request.POST.get("year",'')
cvv=request.POST.get("cvv",'')
try:
card_obj=card_detail.objects.get(cardno=card)
if (month==card_obj.month and year==card_obj.year and cvv==card_obj.cvv):
rollno=request.user.username
obj=library_due.objects.get(rollno=rollno)
obj.due=0
obj.save()
return HttpResponseRedirect(reverse('register:thanks',args=(username,)))
else:
pay_error="invalid detail"
return HttpResponseRedirect(reverse('register:pay3',args=(username,)))
except ObjectDoesNotExist:
pay_error="invalid card"
return HttpResponseRedirect(reverse('register:pay3',args=(username,)))
else:
return redirect('/login.html')
def thanks(request,username):
if request.user.is_authenticated():
name=request.user.registeredclass.name
o=request.user.feedetail
o.flag=1
o.save()
return render(request,"thanks.html",{'username':name})
else:
return redirect('/login.html')
def print_users(request,username):
# Create the HttpResponse object with the appropriate PDF headers.
response = HttpResponse(content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename=reg.pdf'
buffer = BytesIO()
report = MyPrint(buffer, 'Letter')
pdf = report.print_canvas(request.user)
response.write(pdf)
return response
def subjects_de(request,username):
fee_id=request.session['fee_id']
branch=request.user.registeredclass.branch
obj=feeinfo.objects.get(id=fee_id)
def submit(request):
o=feedetail.objects.filter(flag=1)
return render(request,"submissions.html",{"student":o})
|
[
"arunkumar7617@gmail.com"
] |
arunkumar7617@gmail.com
|
8aba9ca1e4da7c24f26513af5b6842a13da3a87e
|
cf43ef276007d94736180bf049ba1893430f5f14
|
/tushare-data/__init__.py
|
1e2037df39a889c9ac252c55511d96df9db50dba
|
[] |
no_license
|
AISelf/RLearning
|
16f6061e564ca566188133241ca6a4cad0b13df8
|
32ceb17a12e84e4e1b89242c3aa4d5f76973ed33
|
refs/heads/master
| 2020-08-03T22:22:26.299094
| 2020-01-16T11:16:46
| 2020-01-16T11:16:46
| 211,903,353
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 147
|
py
|
"""
-*- coding:utf-8 -*-
@Author : liaoyu
@Contact : doitliao@126.com
@File : __init__.py.py
@Time : 2020/1/11 01:44
@Desc :
"""
|
[
"doitliao@126.com"
] |
doitliao@126.com
|
85ae90d01ea5b65cc72d34a2175ebc71c8f8af6e
|
72167bc16ffc678e5270dc83000013158d69aaf1
|
/Chapter08/8.2.2pets.py
|
d766616967d211c42ec41bbeb0f94da523b2aa81
|
[] |
no_license
|
OSYouth/PythonCrashCourse
|
6e37b53b5a83705db3366543b9ab80ef5dd4e3b7
|
bbb88a087f489baa535d2b1477c08d023ae5b913
|
refs/heads/master
| 2021-08-22T17:35:27.702205
| 2021-04-16T13:01:16
| 2021-04-16T13:01:16
| 249,334,439
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 274
|
py
|
def describe_pet(animal_type, pet_name):
"""ๆพ็คบๅฎ ็ฉ็ไฟกๆฏ"""
print("\nI have a " + animal_type + ".")
print("My " + animal_type + "'s name is " + pet_name.title() + ".")
describe_pet(pet_name='harry', animal_type='hamster')
describe_pet('dog', 'willie')
|
[
"benleolee@163.com"
] |
benleolee@163.com
|
2d77e8146d2dc6536f7aa74fdd65755882cfc7c8
|
219c123c7630e7b3783743d3a1bf2ee6f753e702
|
/lastadata_json.py
|
5eea72421859bd92ba3ac30dfde44757df487058
|
[] |
no_license
|
CitiCup-Lokout/crawling
|
dd02493bb14452b617fdae4dd941e0dcb845e36f
|
939f7a493afa6b46df7f638398db35c2133c7d21
|
refs/heads/master
| 2020-07-26T08:16:05.426720
| 2019-09-15T15:21:16
| 2019-09-15T15:21:16
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,255
|
py
|
import json
import csv
import time
import datetime
import os
import schedule
def job():
file = open('D:\class\B\lastdata.json','r',encoding='utf-8')
uid = 0
#i=0
for line in file.readlines():
b = json.loads(line)
print(b)
#i+=1
author = b['Author']
print(author)
# if(author=='VIC56_CC'):
# print(i,author)
uidfile = open('id.csv', 'r', encoding='utf-8')
csvreader = csv.reader(uidfile)
for Id_line in csvreader:
if(Id_line[1].split()[0] == author):
print("yes")
#print(i)
uid = Id_line[0].split(' ')[0]
#print(uid)
break
try:
print(uid)
except:
continue
#print(line)
out = open('D:\class\B\LastdataClassify\\test\{}.json'.format(uid), 'a', encoding='utf-8')
print(line,file=out)
out.close
file.close()
Time=datetime.datetime.now().strftime('%Y-%m-%d')
os.rename("D:\class\B\lastdata.json","D:\class\B\\"+Time+"_lastdata.json")
if __name__ == '__main__':
schedule.every().day.at("21:00:00").do(job)
while True:
schedule.run_pending()
time.sleep(1)
|
[
"liys1@shanghaitech.edu.cn"
] |
liys1@shanghaitech.edu.cn
|
05c4b3c150c65cdcb953356e33cfd8ddee230196
|
1c27cb992f8b3e3f360c6289a43a1503ea0442fd
|
/ua/univer/base/day6/hw06oop/examples/cellphone.py
|
f9b5b3f1a849adedfc8adb7aa9940a6e51388fc0
|
[] |
no_license
|
supportaps/python050920
|
45351b0180b144b9e336468cc3bc09796c10ed5d
|
c4ace87aac1694199ed27e93b8e56c99a3f2a206
|
refs/heads/master
| 2023-01-08T17:02:20.120871
| 2020-11-07T00:20:14
| 2020-11-07T00:20:14
| 294,874,814
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 542
|
py
|
class CellPhone:
def __init__(self, manufact, model, price):
self.manufact = manufact
self.model = model
self.retail_price = price
def set_manufact(self, manufact):
self.manufact = manufact
def set_model(self, model):
self.model = model
def set_retail_price(self, price):
self.retail_price = price
def get_manufact(self):
return self.manufact
def get_model(self):
return self.model
def get_retail_price(self):
return self.retail_price
|
[
"Rvanuyked@gmail"
] |
Rvanuyked@gmail
|
b7077c4681a24c0e67f35634283cf47fe482f686
|
450dd2480e7889c56f78b47d6d96b86007d6fcb0
|
/config.py
|
9f7d78c00069831547be94a9b032f00952f2c73e
|
[
"MIT"
] |
permissive
|
Yusuke-Ikezaki/Capsule-DQN
|
51a6b2ca70d38b41f0bade3cca31b6d44d51bc7c
|
021ef0d50f6802d078126dc0d8f034581ff16e1c
|
refs/heads/master
| 2022-12-06T23:05:08.736233
| 2021-05-29T08:29:29
| 2021-05-29T08:29:29
| 124,066,901
| 0
| 1
|
MIT
| 2022-11-21T23:25:24
| 2018-03-06T11:13:36
|
Python
|
UTF-8
|
Python
| false
| false
| 1,770
|
py
|
import tensorflow as tf
flags = tf.app.flags
############################
# hyper parameters #
############################
flags.DEFINE_integer("batch_size", 32, "batch size")
flags.DEFINE_integer("height", 84, "frame height")
flags.DEFINE_integer("width", 84, "frame width")
flags.DEFINE_integer("state_length", 4, "length of state")
flags.DEFINE_integer("action_repeat", 4, "number of skip frame")
flags.DEFINE_integer("replay_start_size", 10000, "replay start size")
flags.DEFINE_integer("decay", 500000, "epsilon decay")
flags.DEFINE_float("max_epsilon", 1.0, "maximum epsilon")
flags.DEFINE_float("min_epsilon", 0.1, "minimum epsilon")
flags.DEFINE_float("eta", 0.00025, "learning rate")
flags.DEFINE_float("gamma", 0.99, "discount rate")
flags.DEFINE_integer("episode", 500, "episode length")
flags.DEFINE_integer("train_freq", 4, "frequence of updating network")
flags.DEFINE_integer("sync_freq", 10000, "frequence of target nets update")
flags.DEFINE_integer("N", 50000, "memory size")
flags.DEFINE_integer("routing_iters", 3, "number of iterations in routing algorithm")
############################
# environment setting #
############################
flags.DEFINE_string("env", "Pong-v0", "OpenAI Gym environment name")
flags.DEFINE_boolean("is_training", True, "training mode")
flags.DEFINE_boolean("render", True, "render")
flags.DEFINE_boolean("save", True, "save learned model")
flags.DEFINE_integer("save_freq", 10000, "frequence of saving params")
flags.DEFINE_integer("eval_freq", 10, "frequence of evaluation")
flags.DEFINE_boolean("restore", True, "restore model")
flags.DEFINE_string("stored_path", "./checkpoint/", "path for stored model")
flags.DEFINE_string("log_dir", "./summary/", "path for summary file")
cfg = flags.FLAGS
|
[
"yusuke@ikezakiyuusukenoMacBook.local"
] |
yusuke@ikezakiyuusukenoMacBook.local
|
f03f4893235bf29361fd2e74c6e54b99df98759d
|
6c53a6492aa575fb418c500a3a8c48abebc79ee6
|
/demos/ascii.py
|
5687563f1adfe01efb44ba66e2be05e18d18c18f
|
[] |
no_license
|
whitegreyblack/ecs
|
151ee9ddab197c0e7350dbe989f0b898a340bfe8
|
509c9b0e549f084dc6e94713b141164f790bafd8
|
refs/heads/master
| 2021-07-02T07:05:37.447551
| 2020-08-11T19:43:06
| 2020-08-11T19:43:06
| 194,711,319
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 354
|
py
|
import curses
def main(screen):
l = 6
i, j = 0, 0
h, w = screen.getmaxyx()
for c in range(32, 1500):
screen.insstr(j, l * i, f"{c} {chr(c)}")
i += 1
if w - l * i < l:
j += 1
i = 0
if j == h:
break
screen.getch()
if __name__ == "__main__":
curses.wrapper(main)
|
[
"sangwoowhang@gmail.com"
] |
sangwoowhang@gmail.com
|
d1fcf5737ecca1834ba0214e7333f09caf1f7342
|
8e8feed8f2f954d50246b3b3bdda3667ba5d2ce9
|
/cogdl/models/agc/agc.py
|
e937d6319e06797bfd2952846f84700b0d494dbb
|
[
"MIT"
] |
permissive
|
Shiguang-Guo/cogdl
|
fc1349dfb71088412e1aad411b98c41f3718c9e6
|
b43a2ca5518180dbe7d24e27711efa7d7a6f2610
|
refs/heads/master
| 2023-03-26T22:51:59.394423
| 2021-03-26T13:10:19
| 2021-03-26T13:10:19
| 331,220,319
| 0
| 0
|
MIT
| 2021-03-26T13:10:20
| 2021-01-20T06:58:30
|
Python
|
UTF-8
|
Python
| false
| false
| 1,054
|
py
|
import torch
import torch.nn
import torch.nn.functional as F
from .. import BaseModel, register_model
from cogdl.trainers.agc_trainer import AGCTrainer
@register_model("agc")
class AGC(BaseModel):
r"""The AGC model from the `"Attributed Graph Clustering via Adaptive Graph Convolution"
<https://arxiv.org/abs/1906.01210>`_ paper
Args:
num_clusters (int) : Number of clusters.
max_iter (int) : Max iteration to increase k
"""
@staticmethod
def add_args(parser):
parser.add_argument("--max-iter", type=int, default=60)
@classmethod
def build_model_from_args(cls, args):
return cls(args.num_clusters, args.max_iter)
def __init__(self, num_clusters, max_iter):
super(AGC, self).__init__()
self.num_clusters = num_clusters
self.max_iter = max_iter
self.k = 0
self.features_matrix = None
def get_trainer(self, task, args):
return AGCTrainer
def get_features(self, data):
return self.features_matrix.detach().cpu()
|
[
"noreply@github.com"
] |
Shiguang-Guo.noreply@github.com
|
c14a540935eec953b1f921fd894a573d2d512db7
|
e4cae3759a053ca88a936e87e3329aec203608db
|
/sdk/eventgrid/azure-eventgrid/azure/eventgrid/_publisher_client.py
|
06cda52dc996b7722da385b52223310db27dbdea
|
[
"LicenseRef-scancode-generic-cla",
"LGPL-2.1-or-later",
"MIT"
] |
permissive
|
a-santamaria/azure-sdk-for-python
|
c9413858747ccfcec2fbbefd50922c515cb4f634
|
9dec418ad621ac75f217e56e901f15b6624800b0
|
refs/heads/master
| 2022-05-19T00:01:07.604118
| 2021-02-01T22:52:25
| 2021-02-01T22:52:25
| 202,599,021
| 0
| 0
|
MIT
| 2019-08-15T19:22:33
| 2019-08-15T19:22:32
| null |
UTF-8
|
Python
| false
| false
| 5,807
|
py
|
#
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typing import TYPE_CHECKING, cast, Dict, List, Any, Union
from azure.core.tracing.decorator import distributed_trace
from azure.core.pipeline.policies import (
RequestIdPolicy,
HeadersPolicy,
RedirectPolicy,
RetryPolicy,
ContentDecodePolicy,
CustomHookPolicy,
NetworkTraceLoggingPolicy,
ProxyPolicy,
DistributedTracingPolicy,
HttpLoggingPolicy,
UserAgentPolicy
)
from ._models import CloudEvent, EventGridEvent, CustomEvent
from ._helpers import (
_get_endpoint_only_fqdn,
_get_authentication_policy,
_is_cloud_event,
_is_eventgrid_event,
_eventgrid_data_typecheck
)
from ._generated._event_grid_publisher_client import EventGridPublisherClient as EventGridPublisherClientImpl
from ._policies import CloudEventDistributedTracingPolicy
from ._version import VERSION
from ._generated.models import CloudEvent as InternalCloudEvent
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import AzureKeyCredential, AzureSasCredential
SendType = Union[
CloudEvent,
EventGridEvent,
CustomEvent,
Dict,
List[CloudEvent],
List[EventGridEvent],
List[CustomEvent],
List[Dict]
]
ListEventType = Union[
List[CloudEvent],
List[EventGridEvent],
List[CustomEvent],
List[Dict]
]
class EventGridPublisherClient(object):
"""EventGrid Python Publisher Client.
:param str endpoint: The topic endpoint to send the events to.
:param credential: The credential object used for authentication which
implements SAS key authentication or SAS token authentication.
:type credential: ~azure.core.credentials.AzureKeyCredential or ~azure.core.credentials.AzureSasCredential
"""
def __init__(self, endpoint, credential, **kwargs):
# type: (str, Union[AzureKeyCredential, AzureSasCredential], Any) -> None
endpoint = _get_endpoint_only_fqdn(endpoint)
self._endpoint = endpoint
self._client = EventGridPublisherClientImpl(
policies=EventGridPublisherClient._policies(credential, **kwargs),
**kwargs
)
@staticmethod
def _policies(credential, **kwargs):
# type: (Union[AzureKeyCredential, AzureSasCredential], Any) -> List[Any]
auth_policy = _get_authentication_policy(credential)
sdk_moniker = 'eventgrid/{}'.format(VERSION)
policies = [
RequestIdPolicy(**kwargs),
HeadersPolicy(**kwargs),
UserAgentPolicy(sdk_moniker=sdk_moniker, **kwargs),
ProxyPolicy(**kwargs),
ContentDecodePolicy(**kwargs),
RedirectPolicy(**kwargs),
RetryPolicy(**kwargs),
auth_policy,
CustomHookPolicy(**kwargs),
NetworkTraceLoggingPolicy(**kwargs),
DistributedTracingPolicy(**kwargs),
CloudEventDistributedTracingPolicy(),
HttpLoggingPolicy(**kwargs)
]
return policies
@distributed_trace
def send(self, events, **kwargs):
# type: (SendType, Any) -> None
"""Sends event data to topic hostname specified during client initialization.
Multiple events can be published at once by seding a list of events. It is very
inefficient to loop the send method for each event instead of just using a list
and we highly recommend against it.
:param events: A list of CloudEvent/EventGridEvent/CustomEvent to be sent.
:type events: SendType
:keyword str content_type: The type of content to be used to send the events.
Has default value "application/json; charset=utf-8" for EventGridEvents,
with "cloudevents-batch+json" for CloudEvents
:rtype: None
:raises: :class:`ValueError`, when events do not follow specified SendType.
"""
if not isinstance(events, list):
events = cast(ListEventType, [events])
if isinstance(events[0], CloudEvent) or _is_cloud_event(events[0]):
try:
events = [cast(CloudEvent, e)._to_generated(**kwargs) for e in events] # pylint: disable=protected-access
except AttributeError:
pass # means it's a dictionary
kwargs.setdefault("content_type", "application/cloudevents-batch+json; charset=utf-8")
return self._client.publish_cloud_event_events(
self._endpoint,
cast(List[InternalCloudEvent], events),
**kwargs
)
kwargs.setdefault("content_type", "application/json; charset=utf-8")
if isinstance(events[0], EventGridEvent) or _is_eventgrid_event(events[0]):
for event in events:
_eventgrid_data_typecheck(event)
elif isinstance(events[0], CustomEvent):
events = [dict(e) for e in events] # type: ignore
return self._client.publish_custom_event_events(self._endpoint, cast(List, events), **kwargs)
def close(self):
# type: () -> None
"""Close the :class:`~azure.eventgrid.EventGridPublisherClient` session.
"""
return self._client.close()
def __enter__(self):
# type: () -> EventGridPublisherClient
self._client.__enter__() # pylint:disable=no-member
return self
def __exit__(self, *args):
# type: (*Any) -> None
self._client.__exit__(*args) # pylint:disable=no-member
|
[
"noreply@github.com"
] |
a-santamaria.noreply@github.com
|
0e00d8db4d2ec316eafd7e6c4cad662cef300f1f
|
1bac741026062dd19082b2ba74547d8e0219a900
|
/prove/web09_flask_server.py
|
fb858e6dd8a4b396e7b8781fec0a9a39d4e31b54
|
[] |
no_license
|
FrancescoDattrino/corso_ml_python_youtube_pollo
|
997587afd9d43193ca1e3be965c491dbd2f5c811
|
5502f9607d6caaf9cbbe87fd9cce6755174a8aae
|
refs/heads/master
| 2022-12-24T02:20:17.895592
| 2020-09-24T12:19:22
| 2020-09-24T12:19:22
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,538
|
py
|
from flask import Flask, request, jsonify
from joblib import load
import pandas as pd
app = Flask(__name__)
# hello world, metodo GET
@app.route('/', methods=['GET'])
def index():
response = jsonify({
'message': 'Ciao Polletto!'
})
return response
# hello world, POSTare dati
@app.route('/parrot', methods=['POST'])
def parrot():
payload = request.json
print(payload)
return jsonify({
'received': payload
})
@app.route('/sentiment', methods=['POST'])
def sentiment():
payload = request.json
print(payload)
X = [payload['sentence']]
print(X)
pred = sentiment_pipeline.predict(X)
print(pred)
prob = sentiment_pipeline.predict_proba(X)
classes = sentiment_pipeline['model'].classes_
nice_prob = dict( zip(classes, prob[0].tolist()) )
print(classes, prob, nice_prob)
return jsonify({
'sentence' : payload['sentence'],
'predictions' : pred[0].tolist(),
'probability' : nice_prob
})
@app.route('/bikes', methods=['POST'])
def bikes():
payload = request.json
print(payload)
X = pd.DataFrame(payload) # se รจ uno solo, [payload]
print(X)
pred = bike_pipeline.predict(X)
print(pred)
return jsonify({
'predictions' : pred.tolist()
})
if __name__ == '__main__':
sentiment_pipeline = load('../sentiment_pipeline.joblib')
bike_pipeline = load('../bikes_pipeline.joblib')
# inizialmente solo run dell'app
app.run(debug=True, port=2228) # live reloading!
|
[
"piero.savastano@gmail.com"
] |
piero.savastano@gmail.com
|
892e735d32b9844125ab9cb2279098d2d52effd6
|
45ff4530ab7b6b407f779cb4311e0f2b71eb9a10
|
/ozgun-repo/src/my_functions_classes.py
|
1b5eb236f9e3819e12ff91590263d192c59c20ec
|
[
"MIT"
] |
permissive
|
OzgunBu/EDGAR
|
45f80af2ed03515f93b78c5d4f76c37c369d3472
|
65f51df11f5ec3abb13d422f9119f6a1605f77a8
|
refs/heads/master
| 2020-03-08T20:18:31.469722
| 2018-04-06T15:41:46
| 2018-04-06T15:41:46
| 128,378,726
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 12,893
|
py
|
"""
Created on Thu Apr 5 12:56:57 2018
@author: bursaliogluozgun
"""
def main():
print('This file has necessary functions and class definitions for sessionization.py')
print('list of functions and class: ')
print("""
def reading_row(row_str):\n
def strip_date_time(date_str,time_str):\n
def strip_date_time(date_str,time_str):\n
def write_to_output_file(SortedSessions,fo):\n
def pop_expired(ActiveSessions,current_moment,inactivity_duration,pop_all=False):\n
def embed_last_entry_to_ActiveSessions(ActiveSessions,ip_str,moment,line_number):\n
def clean_expired_sessions(ActiveSessions,current_moment,inactivity_duration,fo,pop_all=False):\n
def Input_Output_file_operations(inactivity_filename,output_filename,log_filename):\n
class Session(object):\n""")
import datetime
#==================================================================================================================
#==================================================================================================================
# FUNCTIONS
#______________________________________________________________________________________________________________________
def reading_row(row_str):
"""
input: string of the corresponding row
output: dictionary with keys ip, date, time. These are the only things we need from a row.
For the purposes of this challenge, below are the data fields you'll want to pay attention to from the SEC weblogs:
ip: identifies the IP address of the device requesting the data. While the SEC anonymizes the last three digits, it uses a consistent formula that allows you to assume that any two ip fields with the duplicate values are referring to the same IP address
date: date of the request (yyyy-mm-dd)
time: time of the request (hh:mm:ss)
cik: SEC Central Index Key
accession: SEC document accession number
extention: Value that helps determine the document being requested
"""
words = row_str.split(',')
ip = words[0]
date = words[1] # yyyy-mm-dd TODO: we can check the format of this for each row
time = words[2] # hh:mm:ss TODO: we can check the format of this for each row
# zone = words[3] #not useful
#cik = words[4] # any request (not necessarily unique) is counted as one, so I conclude that we do not need these fields
#accession = words[5] # any request (not necessarily unique) is counted as one, so I conclude that we do not need these fields
#extention = words[6] # any request (not necessarily unique) is counted as one, so I conclude that we do not need these fields
#code = words[7] #not useful
#size = words[8] #not useful
#idx = words[9] #not useful
#norefer = words[10] #not useful
#noagent = words[11] #not useful
#find = words[12] #not useful
#crawler = words[13] #not useful
#browser = words[14] #not useful
#print(' ip: {}\n date: {}\n time: {}\n zone: {}\n cik: {}\n accession: {}\n extention: {}\n code: {}\n size: {}\n idx: {}\n norefer: {}\n noagent: {}\n find: {}\n crawler: {}\n browser: {}\n'.format(*words))
#For the purposes of this challenge, you can assume the combination of
#cik, accession and extention fields uniquely identifies a single web page document request.
#aRequest = cik+accession+extention # any request (not necessarily unique) is counted as one, so I conclude that we do not need these fields
#row = (ip,date,time,aRequest)
row = {'ip':ip,'date':date,'time':time} #,'aRequest':aRequest}
return row
#______________________________________________________________________________________________________________________
def strip_date_time(date_str,time_str):
"""
input: date and time strings from the row
output: create a datetime object (moment) and also a list repressentation (as_a_list)
source: https://docs.python.org/2/library/datetime.html
https://stackoverflow.com/questions/1345827/how-do-i-find-the-time-difference-between-two-datetime-objects-in-python
sample input format: date_str = '2017-06-30' time_str = '00:00:01'
"""
skip_row = False
moment = None
as_a_list = None
try:
parts = date_str.split('-')
as_a_list = []
for part in parts:
as_a_list.append(int(part))
parts = time_str.split(':')
for part in parts:
as_a_list.append(int(part))
moment = datetime.datetime(*as_a_list)
except:
print('Bad formatted date / time, skipping the row')
skip_row = True
return moment,skip_row,as_a_list
#______________________________________________________________________________________________________________________
def write_to_output_file(SortedSessions,fo):
"""
input: SortedSessions (List of sessions), fo (output file)
task: writing to the output file
"""
for item in SortedSessions:
fo.write((item.__str__())+'\n')
print(item)
#______________________________________________________________________________________________________________________
def pop_expired(ActiveSessions,current_moment,inactivity_duration,pop_all=False):
"""
input:ActiveSessions(dictionary of sessions),current_moment (datetime),inactivity_duration (int),pop_all(bool)
pop_all: when this is True, all of the elements in the ActiveSessions dictionary are popped regardless of time.
We use this for the end of the log file.
output: FinishedSession (a list of finished sessions)
"""
FinishedSession = []
ActiveSessions2 = ActiveSessions.copy()
for ID in ActiveSessions2:
session = ActiveSessions2[ID]
if ((inactivity_duration)<(current_moment-session.momentLR).total_seconds()) or pop_all:
#pop this session to the FinishedSession list
expired_session = ActiveSessions.pop(ID)
FinishedSession.append(expired_session)
return FinishedSession
#______________________________________________________________________________________________________________________
def embed_last_entry_to_ActiveSessions(ActiveSessions,ip_str,moment,line_number):
"""
input: ActiveSessions (dictionary of sessions),ip_str (str),moment (datetime),line_number(int))
output: ActiveSessions (dictionary of sessions)
either a new key added or an old one is updated with this new request
"""
if ip_str in ActiveSessions:
ActiveSessions[ip_str].update(moment)
else:
session= Session(line_number,moment,ip_str)
ActiveSessions[ip_str] = session
return ActiveSessions
#______________________________________________________________________________________________________________________
def clean_expired_sessions(ActiveSessions,current_moment,inactivity_duration,fo,pop_all=False):
"""
input:ActiveSessions(dictionary of sessions),current_moment (datetime),inactivity_duration (int),fo(output file),pop_all(bool)
pop_all: when this is True, all of the elements in the ActiveSessions dictionary are popped regardless of time.
We use this for the end of the log file.
Task: writign the newly finished sessions to the output file
output: None
"""
#pop the expired sessions into FinishedSession List
FinishedSession = pop_expired(ActiveSessions,current_moment,inactivity_duration,pop_all)
if len(FinishedSession)>0:
SortedSessions = sorted(FinishedSession)
write_to_output_file(SortedSessions,fo)
#______________________________________________________________________________________________________________________
def Input_Output_file_operations(inactivity_filename,output_filename,log_filename):
"""
- This function opens and closes inactivity_filename
- This function creates / clears the output_filename
- This function opens and closes log_filename to check if the file can be open
"""
log_file_error = False
inactivity_file_error = False
output_file_error = False
try:
#open and closing the log file
flog = open(log_filename,'r')
flog.close()
except IOError:
print('Cannot open '+log_filename)
log_file_error = True
try:
#reading the inactivity file
f = open(inactivity_filename,'r')
except IOError:
print('Cannot open '+inactivity_filename)
inactivity_file_error = True
else:
inactivity_duration = int(f.readline().rstrip())
print( '\n inactivity_duration is ',inactivity_duration,'seconds.')
f.close()
if (inactivity_duration<1) or (inactivity_duration>86400):
raise Exception ('not a valid inactivity duration. Check the inactivity_filename, valid range: [1,2, .. 86400]')
try:
#creating the output file
#making sure I have an empty file each time.
open(output_filename, 'w').close()
fo = open(output_filename,'a') #we will close it at the end of main.
except IOError:
print('Cannot open'+output_filename)
output_file_error = True
if log_file_error or inactivity_file_error or output_file_error:
raise Exception('log_file_error:{}, inactivity_file_error:{}, output_file_error: {}'.format(log_file_error,inactivity_file_error,output_file_error))
else:
return inactivity_duration, fo
#==================================================================================================================
#==================================================================================================================
# CLASSES
#______________________________________________________________________________________________________________________
class Session(object):
"""
- A Session object has the following attributes:
- moment of the first request: momentFR (datetime object)
- moment of the last request: momentLR (datetime object)
- request counter: requestCounter (int)
- line number: lineNumber (int)
- session duration: Duration (int)
- sort method __lt__
- ID: ID (str)
- print method __str__
"""
def __init__(self,line,moment,ip_str):
"""
input: line(int), moment (datetime), ip_str (str)
"""
assert type(moment) is datetime.datetime, 'moment problem'
assert type(line) is int, 'line problem'
assert type(ip_str) is str, 'ip_str problem'
self.momentFR = moment
self.momentLR = moment
self.requestCounter = 1
self.lineNumber = line
self.Duration = 1
self.ID = ip_str
def update(self,moment):
"""
input: moment
task: modify an entry using last information. Increase its requestCounter, update its momentLR and its duration
"""
self.requestCounter +=1
self.momentLR = moment
self.Duration = int((self.momentLR-self.momentFR).total_seconds())+1
def __lt__(self,other):
"""returns boolean regarding the comparison between two session in terms of which one should be written to
the output file first. Sessions are first compared according to their moments, earlier moment means 'smaller'
session. If moments are equal, smaller line number means 'smaller' session
"""
earlier_moment = (self.momentFR < other.momentFR) #boolean
earlier_line_same_moment = ((self.momentFR == other.momentFR) and self.lineNumber<other.lineNumber) #boolean
return earlier_moment or earlier_line_same_moment
def __str__(self):
"""Returns a string representation of self:
We might use this for printing into the output file:
- self.ID: IP address of the user exactly as found in log.csv
- self.momentFR: date and time of the first webpage request in the session (yyyy-mm-dd hh:mm:ss)
- self.momentLR: date and time of the last webpage request in the session (yyyy-mm-dd hh:mm:ss)
- self.Duration: duration of the session in seconds
- self.requestCounter: count of webpage requests during the session
moment1.isoformat(' ')
ex: 101.81.133.jja,2017-06-30 00:00:00,2017-06-30 00:00:00,1,1
"""
return self.ID+','+self.momentFR.isoformat(' ')+','+self.momentLR.isoformat(' ')+','+str(self.Duration)+','+str(self.requestCounter)
#==================================================================================================================
if __name__== "__main__":
main()
|
[
"noreply@github.com"
] |
OzgunBu.noreply@github.com
|
21acba8bfe3790d5c45c89447ceb513470c9f81b
|
7cf75e1473d3c64b93110eb27c32c442027d43bb
|
/polls/migrations/0001_initial.py
|
260408428f95fedb6ace3561bf7479766364bcab
|
[] |
no_license
|
xxglwt/untitled9
|
e78c4f747d7e78cc799c4264c19547022aa05a6e
|
f5ed19a646e6a45dc7f70a2807f513a08186465b
|
refs/heads/master
| 2022-12-10T19:45:49.131721
| 2020-06-23T12:18:55
| 2020-06-23T12:18:55
| 239,277,406
| 0
| 0
| null | 2022-12-08T06:21:20
| 2020-02-09T09:25:40
|
Python
|
UTF-8
|
Python
| false
| false
| 1,074
|
py
|
# Generated by Django 2.2.7 on 2019-12-06 22:46
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Question',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('question_text', models.CharField(max_length=500)),
('pub_date', models.DateTimeField(verbose_name='date published')),
],
),
migrations.CreateModel(
name='Choice',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('choice_text', models.CharField(max_length=200)),
('vote', models.IntegerField(default=0)),
('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='polls.Question')),
],
),
]
|
[
"381722463@qq.com"
] |
381722463@qq.com
|
dca96220010cb7f6f960dc57e2b76741f0826601
|
7a08b33d53e4c606b9ac3d2bc6689aacc7ddd0ac
|
/calculate_brine_salinity.py
|
7e9e72305977b0bec508b318a9fc4d9fd2ce47d0
|
[] |
no_license
|
bowmanlab/sea_ice_brine_salinity
|
f4bc464bc50aa6eaa7c4ddcff36cdb8ac9241c99
|
28611ad0924db342debcda8eebe990cbfbf58b6a
|
refs/heads/master
| 2020-04-29T04:25:23.398846
| 2019-03-17T12:46:51
| 2019-03-17T12:46:51
| 175,846,521
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 4,238
|
py
|
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 25 07:33:02 2011
@author: Jeff
This script calculates brine salinity and the concentration factor for ice
between 0 and -30 according to the equations of cox and weeks. If volume to add
is negative, do not add any melt solution and disregard dilution factor
in log sheet.
Before using this program you will need to change the output directory to one
that exists on your machine and input the salinity of your melting solution
(S_brine). The program will tell you what volume to add to reach your desired
final salinity or an isohaline melt. Simply follow the prompts.
You will receive this information and more in a log sheet in the directory
you specified. Log output is in order time, sample ID, T, S, M, in situ
brine salinity, in situ concentration factor, ice volume (melted), brine
volume added, dilution factor.
To run the program you should have python installed. Place this file with
your other executables and execute from command line, or place in any directory,
navigate to it from command line, and execute.
"""
from time import localtime, strftime
S_brine=250 #salinity of brine used for melting
output_file='/Users/Jeff/Documents/deming_lab/Antarctica/sample_volumes_test.txt'
print("your currently selected brine salinity is", S_brine)
print("your output file is", output_file)
## Gather some information from the user.
print("Enter T")
T=float(input('T=')) #temp
print("Enter bulk salinity")
S=float(input('S=')) #bulk salinity of ice
print("Enter sample mass in kg")
M=float(input('Mass=')) #sample mass
print("Enter sample ID")
sample_ID=(input('Sample ID=')) #input the ID of the sample
## Determine brine salinity for temperature indicated.
if 0>T>=-2:
brine_salinity=-3.9921-22.7*T-1.0015*pow(T,2)-0.019956*pow(T,3)
elif -2>T>-23:
brine_salinity=-3.9921-22.7*T-1.0015*pow(T,2)-0.019956*pow(T,3)
elif T<=-23:
brine_salinity=206.24-1.8907*T-0.060868*pow(T,2)-0.001024*pow(T,3)
## Determine target salinity, either user defined or isohaline.
print_out = True
print("Enter target salinity, enter iso for isohaline melt")
S_target=input('target salinity=')
if S_target=="iso":
S_target=brine_salinity
else:
S_target=float(S_target)
if 0>T>=-2:
density_ice=0.917-0.0001403*T
V_ice=M*density_ice
F_1=0.041221-18.407*T+0.58402*pow(T,2)+0.21454*pow(T,3)
F_2=0.090312-0.016111*T+0.00012291*pow(T,2)+0.00013603*pow(T,3)
brine_volume=S*density_ice/(F_1-(S-density_ice*F_2)) #in situ brine volume
conc_factor=1/brine_volume
brine_salinity=-3.9921-22.7*T-1.0015*pow(T,2)-0.019956*pow(T,3)
V_brine=(V_ice*(S-S_target))/(S_target-S_brine) #volume of melting brine added
dilution_factor=(V_brine+V_ice)/V_ice
time=strftime("%d %b %Y %H:%M:%S", localtime())
elif -2>T>-23:
density_ice=0.917-0.0001403*T
V_ice=M*density_ice
F_1=-4.732-22.45*T-0.6397*pow(T,2)-0.01074*pow(T,3)
F_2=0.090312-0.016111*T+0.00012291*pow(T,2)+0.00013603*pow(T,3)
brine_volume=S*density_ice/(F_1-(S-density_ice*F_2))
conc_factor=1/brine_volume
brine_salinity=-3.9921-22.7*T-1.0015*pow(T,2)-0.019956*pow(T,3)
V_brine=(V_ice*(S-S_target))/(S_target-S_brine) #volume of melting brine added
dilution_factor=(V_brine+V_ice)/V_ice
time=strftime("%d %b %Y %H:%M:%S", localtime())
elif T<=-23:
density_ice=0.917-0.0001403*T
V_ice=M*density_ice
F_1=9899+1309*T+55.27*pow(T,2)+0.716*pow(T,3)
F_2=8.547+1.089*T+0.04518*pow(T,2)+0.0005819*pow(T,3)
brine_volume=S*density_ice/(F_1-(S-density_ice*F_2))
conc_factor=1/brine_volume
brine_salinity=206.24-1.8907*T-0.060868*pow(T,2)-0.001024*pow(T,3)
V_brine=(V_ice*(S-S_target))/(S_target-S_brine) #volume of melting brine added
dilution_factor=(V_brine+V_ice)/V_ice
time=strftime("%d %b %Y %H:%M:%S", localtime())
else:
print("Temperature is out of range")
print_out = False
if print_out == True:
with open(output_file, 'a') as file_out:
print("brine salinity is", brine_salinity)
print("add", V_brine, "L to reach", S_target, "ppt in final melt")
print(time, sample_ID, T, S, M, brine_salinity, conc_factor, V_ice, V_brine, dilution_factor, file=file_out)
|
[
"jsbowman@ucsd.edu"
] |
jsbowman@ucsd.edu
|
5286536f733b38fd2e2db5d62212384ad2124e93
|
82ac6a6463addf573510799a62ed7b96ee6b6b32
|
/apps/blog/migrations/0014_auto_20210926_1102.py
|
21a68cc8f25c61e94bfb035df8f9c1acc35e0ef9
|
[] |
no_license
|
bakiev05/final_food_blog
|
f5f6c72d3a9b8b933f1a9da0ef701a5ce9ba7950
|
6de287a19e06906c6a044dd4e1d1fce282852446
|
refs/heads/master
| 2023-08-22T20:38:25.525343
| 2021-09-27T17:33:06
| 2021-09-27T17:33:06
| 407,099,391
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 682
|
py
|
# Generated by Django 3.2.7 on 2021-09-26 11:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0013_auto_20210926_1053'),
]
operations = [
migrations.RemoveField(
model_name='recipevideo',
name='recipe',
),
migrations.AddField(
model_name='recipe',
name='video',
field=models.FileField(blank=True, null=True, upload_to='videos/', verbose_name='video'),
),
migrations.DeleteModel(
name='Like',
),
migrations.DeleteModel(
name='RecipeVideo',
),
]
|
[
"aziz.hadj1212@gmail.com"
] |
aziz.hadj1212@gmail.com
|
156f165239216d02dc7411d00ba19b5440a54e95
|
ffb712c0448306a9341850d76cf3a3db1d34fd09
|
/PythonBรกsico/for-objetos.py
|
bc6ca00e629048a6bf16aca548f97c1b6cb29039
|
[] |
no_license
|
gabrielos307/Python2020-2
|
64f9ea171efc5786547e67a46b3ee17c1efe213d
|
b55e1767e8f3210ab9066fec94cbadeac278cb8b
|
refs/heads/master
| 2020-12-04T10:15:46.439825
| 2020-01-10T00:26:32
| 2020-01-10T00:26:32
| 231,724,323
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 686
|
py
|
#Programa con for que recorra 4 objetos
cadena ="Clase de python grupo 2"
lista = [1,2,3,4,5,6,7,8]
tupla = (1,2,3,4)
diccionario = {1:"uno",2:"dos",3:"tres"}
#Imprime la cadena
for i in cadena:
print(i)
print()
#Imprime tupla
for i in tupla:
print(i)
print()
#Imprime lista
for i in lista:
print(i)
print()
#Imprime diccionario
print("Empieza diccionario")
for i in diccionario:
print(i)
print()
#Imprime las llaves del diccionario
claves = diccionario.keys()
for i in claves:
print(i)
print()
#Imprime valores del diccionario
valores = diccionario.values()
for i in valores:
print(i)
print()
#Imprime clave-valor
coleccion = diccionario.items()
for i in coleccion:
print(i)
|
[
"gabrielos307@gmail.com"
] |
gabrielos307@gmail.com
|
c8d1c9625723650f8d2def3a6f1da833c44bc8da
|
3cb2408400525c63cf677be0b79910218142a0d1
|
/Advanced level/Advanced OOP/06. Polymorphism and Magic Methods - Lab + Ex/05.Vehicle.py
|
ef4050f43e41615fc7aeb98c678670e32f8d01dd
|
[] |
no_license
|
StefanDimitrovDimitrov/Python_Advanced
|
5eed83ba41a4726e8568054a637837db9f859323
|
87c6c13414cb92703bee33650a341d1a369b409b
|
refs/heads/main
| 2023-08-06T06:27:41.594009
| 2021-10-05T18:08:40
| 2021-10-05T18:08:40
| 312,846,355
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,470
|
py
|
from abc import ABC, abstractmethod
class Vehicle(ABC):
def __init__(self, fuel_quantity, fuel_consumption):
self.fuel_quantity = fuel_quantity
self.fuel_consumption = fuel_consumption
@abstractmethod
def drive(self, distance):
pass
@abstractmethod
def refuel(self, fuel):
pass
class Car(Vehicle):
def __init__(self, fuel_quantity, fuel_consumption):
super().__init__(fuel_quantity, fuel_consumption)
self.air_conditioners = 0.9
def drive(self, distance):
fuel_needed = distance * (self.fuel_consumption + self.air_conditioners)
if fuel_needed > self.fuel_quantity:
return
self.fuel_quantity -= fuel_needed
def refuel(self, fuel):
self.fuel_quantity += fuel
class Truck(Vehicle):
def __init__(self, fuel_quantity, fuel_consumption):
super().__init__(fuel_quantity, fuel_consumption)
self.air_conditioners = 1.6
def drive(self, distance):
fuel_needed = distance * (self.fuel_consumption + self.air_conditioners)
if fuel_needed > self.fuel_quantity:
return
self.fuel_quantity -= fuel_needed
def refuel(self, fuel):
self.fuel_quantity += fuel * 0.95
car = Car(20, 5)
car.drive(3)
print(car.fuel_quantity)
car.refuel(10)
print(car.fuel_quantity)
truck = Truck(100, 15)
truck.drive(5)
print(truck.fuel_quantity)
truck.refuel(50)
print(truck.fuel_quantity)
import unittest
class TestCar(unittest.TestCase):
def setUp(self):
self.car = Car(100, 2)
def test_drive_not_enough_fuel(self):
self.car.drive(40)
self.assertEqual(self.car.fuel_quantity, 100)
def test_drive_car_enough_fuel(self):
self.car.drive(10)
self.assertEqual(self.car.fuel_quantity, 71)
def test_refuel(self):
self.car.refuel(50)
self.assertEqual(self.car.fuel_quantity,150)
class TestTruck(unittest.TestCase):
def setUp(self):
self.truck = Truck(100, 6)
def test_drive_not_enough_fuel(self):
#ACT
self.truck.drive(40)
#accert
self.assertEqual(self.truck.fuel_quantity, 100)
def test_drive_truck_enough_fuel(self):
self.truck.drive(10)
self.assertEqual(self.truck.fuel_quantity, 24)
def test_refuel(self):
self.truck.refuel(50)
self.assertEqual(self.truck.fuel_quantity, 147.5)
if __name__ == "__main__":
unittest.main()
|
[
"54206891+StefanDimitrovDimitrov@users.noreply.github.com"
] |
54206891+StefanDimitrovDimitrov@users.noreply.github.com
|
77999c8acbc78c7b06db365d55901b9ba60abcff
|
23e3b4a21d3b0d14a81d328d65fa03d03f142585
|
/fizzCheck.py
|
d94f0f70306915457845dbec82071efe88fcd431
|
[] |
no_license
|
LoisCoulon/FizzBuzz
|
3d4aeed5cc16e9e27ef8e5245b0c76d90d9f5184
|
6fc07b7bc0ddfdaf495d165cf0adbc9b0dd9616c
|
refs/heads/main
| 2023-03-23T13:45:36.783230
| 2021-03-25T09:23:08
| 2021-03-25T09:23:08
| 349,106,988
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 475
|
py
|
class fizzChecker:
@staticmethod
def isCorrect(x):
if x <= 0:
raise(ArgumentError())
return False
elif (x%3) == 0 and (x%5 != 0):
return True
elif (x%5) == 0 and (x%3 != 0):
return True
elif (x%3 == 0) and (x%5 == 0):
return True
else:
return False
class ArgumentError(Exception):
def __init__(self):
super()
|
[
"flojuve@hotmail.fr"
] |
flojuve@hotmail.fr
|
67d22e7d7f3ea14b2c052e4b9386aed64c82c32d
|
e791715e85d6c503350736fbe63795dd7d19a0d6
|
/src/SRT2019/fusion/scripts/lidar_cam_fusion.py
|
b32fa91ecedff3cca19a95317d53fe8d6623af7f
|
[] |
no_license
|
SJTUSRT/SRT2019
|
463da86acccea65bf9330dfee498583a072bc832
|
2c28fbaffca7445764093f3b691d4ddd40c0f249
|
refs/heads/master
| 2023-02-01T18:51:18.555003
| 2020-12-17T07:16:56
| 2020-12-17T07:16:56
| 318,538,524
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 12,614
|
py
|
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#ๅฎไนไฝ้ๆปคๆณข็ฑปๅ่ฎก็ฎๆฌงๆฐ่ท็ฆป็ๅฝๆฐ
#ๅฎไน่ๅๆๅๅคดๅ้ท่พพไผ ๅ็ๅๅงไฟกๆฏ๏ผๅนถไปฅๆญคๆๆง่ฝฆ่พ่ฟ่ก็็ฑป
import rospy
import lidar2img
import numpy as np
from numpy import linalg as la
from fusion.msg import lidar3_single
from fusion.msg import lidar3_whole
from fusion.msg import imagel_single
from fusion.msg import imagel_whole
from fusion.msg import cone_pos
from fusion.msg import cone_pos_whole
from fusion.msg import Srt_Control
import get_target
import math
transf_x = 0.80
transf_y = 0.0
transf_z = -0.55
Threshold = 60
Dist_move = 1.0
L = 1.0 #wheelbase
Ld = 3.0 #the foresee distance
Stop_coef = 12
# ๅฎไนไบไธไธชไฝ้ๆปคๆณข็ฑป๏ผไฝฟ็จไธ้ถๆปๅๆปคๆณขๆณ่ฟ่กๅฎ็ฐ
class LowpassFilter():
#้ป่ฎค็ๆ้ ๅฝๆฐ๏ผไฝฟ็จtime_rate่ฟ่กๅๅงๅ
def __init__(self, time_rate):
self.__time_rate = time_rate #ๅจๆปๅ่กจ่พพๅผไธญไฝฟ็จ๏ผไธๆปๅ็็จๅบฆๆๅ
ณ
self.__output = 0.0 #่ฎฐๅฝๅฏไปฅ่พๅบ็ๆฐๆฎ
self.__state = 0.0 #ไธไธๆฌก็ๆปคๆณข็ปๆ
self.__input = 0.0 #ๆฌๆฌก็้ๆ ทๅผ
#ไปๅค้จไผ ๅ
ฅๆฐๆฎ๏ผ่ฎพ็ฝฎInputๅผ
def giveInput(self, external_input):
self.__input = external_input
#ๅฐinputไผ ้่ณstateๅoutputไธญ
def initiallize(self):
self.__state = self.__input
self.__output = self.__input
#ไฝ้ๆปคๆณขๆ ธๅฟๅฝๆฐ๏ผไฝฟ็จ็ฎๆณไธบไธ้ถๆปๅๆปคๆณขๆณ๏ผๆฌๆฌกๆปคๆณข็ปๆ=๏ผ1-a๏ผ*ๆฌๆฌก้ๆ ทๅผ+a*ไธๆฌกๆปคๆณข็ปๆ (aไธบไธไธช0-1ไน้ด็ๆฐ)
#ๆญคๅคtime_rate็ธๅฝไบไธๅผไธญ็1-a
def step(self):
#่ฅๆฌๆฌก้ๆ ทๅผไธไธๆฌกๆปคๆณข็ปๆๅทฎ่ท่ฟๅคง๏ผๅๅฟฝ็ฅๆฌๆฌก้ๆ ท็็ปๆ
if abs(self.__input - self.__state) > 2:
self.__input = self.__state
#ไฝฟ็จไธ่ฟฐๅ
ฌๅผ่ฎก็ฎๅบๆฌๆฌกๆปคๆณข็ปๆ๏ผๅนถ่ฎฐๅฝๅฐoutputๅstateไธญ
next_state = (1 - self.__time_rate) * self.__state + self.__time_rate * self.__input
self.__output = next_state
self.__state = next_state
#่ทๅพ่พๅบๅผ
def getOutput(self):
return self.__output
#ๅฎไนไบไธไธชtime_rateไธบ0.25็ไฝ้ๆปคๆณขๅจ
lp_filter = LowpassFilter(0.25)
#่ฎก็ฎๆฌงๆฐ่ท็ฆป๏ผไฝฟ็จnumpyไธญๆฑ่ๆฐ็ๅฝๆฐ่ฟ่ก็ญๅผ่ฎก็ฎ
def Euc_dist(pos_1,pos_2):
#ๅฝๆฐๅๅnp.linalg.norm(x, ord=None, axis=None, keepdims=False)
#่ฟๅๅผไธบไธไธชๆฐ๏ผๅๆฐไธญxไธบ็ฉ้ต๏ผordไธบ่ๆฐ็ฑปๅ๏ผ้ป่ฎค๏ผๅord=2๏ผไธบๅฏนๅนณๆนๅๅผๆ นๅท๏ผord=1ไธบ็ปๅฏนๅผไนๅ๏ผord=np.infไธบๆฑๅ
็ด ็ปๅฏนๅผๆๅคงๅผ
#axis๏ผๅค็็ฑปๅaxis=1่กจ็คบๆ่กๅ้ๅค็๏ผๆฑๅคไธช่กๅ้็่ๆฐ๏ผaxis=0่กจ็คบๆๅๅ้ๅค็๏ผๆฑๅคไธชๅๅ้็่ๆฐ๏ผaxis=None่กจ็คบ็ฉ้ต่ๆฐ(้ป่ฎคNone)
#keepding๏ผๆฏๅฆไฟๆ็ฉ้ต็ไบ็ปด็นๆง๏ผTrue่กจ็คบไฟๆ็ฉ้ต็ไบ็ปด็นๆง๏ผFalse็ธๅ(้ป่ฎคไธบFalse)
return la.norm(np.subtract(pos_1,pos_2))
#ๅฎไนๅจไบ็ปดๅพๅไธๆกถๆกฉ็็ฑป๏ผๅ
ถไธญuไธvๅๅซไปฃ่กจๅจไธคๅๆ ่ฝดไธ็ๆๅฝฑ
class cone_on_img():
def __init__(self, u, v):
self.u = u
self.v = v
#่ฏๅซๆกถๆกฉ่ฟ็จไธญ็ไฟกๆฏ่ๅ
class cone_fusion():
def __init__(self):
#ๆๅๆบๅ้ท่พพ็ๅๅงๅพๅๆฐๆฎ
self.lidar_raw = []
self.image_raw = []
#ไฟๅญไนๅๆฅๆถๅฐ็ๆๆไฟกๆฏ
self.previous_points = []
self.previous_target = []
self.use_previous = 0 #ๆฏๅฆๅจไฝฟ็จไนๅ็ไฟกๆฏ๏ผๅผไธบๆถ้ดๅทฎ
self.stop = 0 #ๆฏๅฆๆฅๆถๅฐๅๆญขไฟกๆฏ๏ผ1่กจ็คบๅๆญข
#ๅๅซๅฎไนๅค็ๆฃๆตๅฐ็ๆกถๆกฉ๏ผ็ฎๆ ็นไปฅๅๆงๅถไฟกๆฏ็่ฎข้
ๅจ
self.fusion_pub = rospy.Publisher("/cone_detected", cone_pos_whole, queue_size = 10)
self.target_pub = rospy.Publisher("/target_point",cone_pos,queue_size = 10)
self.control_pub = rospy.Publisher("/srt_control",Srt_Control,queue_size = 10)
#่ฟๅๆฐ็ปไธญๆๅฐๅ
็ด
def findMinI(self,l):
length = len(l)
mins = 0
mini = l[0]
for ii in range(1, length):
if mini > l[ii]:
mini = l[ii]
mins = ii
return mins
#ๅน้
ไฝ็ฝฎๅๆ ๏ผๅพๅฐๅฏนๅบ็้ข่ฒไฟกๆฏ
def match(self, u, v):
#numไธบimage_rawๅ่กจไธญๆๅไธไธชๅ
็ด ๏ผๅณๆๅ่ทๅพๅพๅไฟกๆฏ๏ผๅจๅ่กจไธญ็ไธๆ
num = len(self.image_raw) - 1
#image_lenไธบ้ท่พพๅพไธญๆ็ดขๅฐ็น็ไธชๆฐ
image_len = len(self.image_raw[num].image_points)
#็จไธ็ฉๅฝข่ๅดๅน้
ๅจ(u,v)้่ฟ็น๏ผๅณไธบๆกถๆกฉ๏ผ๏ผๅ
ถไธญThresholdไธบ่ๅด็ๆฐๅผ๏ผๅนถ่พๅบๅ
ถ้ข่ฒไฟกๆฏ
for ii in range(0, image_len):
#print(u, v)
#print(self.image_raw[num].image_points[ii].start_x, self.image_raw[num].image_points[ii].end_x, self.image_raw[num].image_points[ii].start_y, self.image_raw[num].image_points[ii].end_y)
if (v > self.image_raw[num].image_points[ii].start_x - Threshold) and (v < self.image_raw[num].image_points[ii].end_x + Threshold) and (u > self.image_raw[num].image_points[ii].start_y - Threshold) and (u < self.image_raw[num].image_points[ii].end_y + Threshold):
#print ("color == ")
#print (self.image_raw[num].image_points[ii].color)
return self.image_raw[num].image_points[ii].color
return "unknown"
def fusion(self, pose, dt):
num = len(self.image_raw) - 1
#dist = []
if num > -1:
u, v = lidar2img.lidar2img(pose.x, pose.y, pose.z)
jj = len(self.image_raw[num].image_points)
if jj != 0:
#for ii in range(0, jj):
#dist.append(self.Euc_dist(coneTmp, self.image_raw[num].image_points[jj - 1]))
#ii = self.findMinI(dist)
#coneไธบๅฏนcone_pos็ฑป็ๅฎไพๅ๏ผๅนถๅฏนๅ
ถ่ฟ่กๅฏนๅบไฟกๆฏ็่พๅ
ฅ
cone = cone_pos()
cone.x = pose.x
cone.y = pose.y
#cone.color = self.image_raw[num].image_points[ii].color
cone.color = self.match(u, v)
#ๆๅฐpose็ๅไฟกๆฏ
print ("pose x")
print pose.x
print ("pose y")
print pose.y
print ("pose z")
print pose.z
print ("pose color")
print cone.color
#ๅฐcone็ไฟกๆฏๆทปๅ ๅฐๅ่กจlidar_rawไธญ
self.lidar_raw.append(cone)
#ๆ นๆฎ็ฎๆ ็ไฝ็ฝฎไฟกๆฏ่ฎก็ฎ้ฉพ้ฉถ็ๆนๅผ๏ผๅ
ๆฌ่งๅบฆ๏ผ้ๅบฆ็ญ
def driving(self,target):
sin_alpha = target[1] / Ld #ๅ่ฟๆนๅๅ็ฎๆ ่ฟ็บฟ็ๅคน่ง
steer_angle = math.degrees(math.atan2(2*L*sin_alpha/Ld,1) ) #่ฝฌๅ่ง
linear_velocity = 0.5 #่ฝฎไธ้ๅบฆ
#่ฅไฝฟ็จ็ไธบไนๅ็ๆฐๆฎ๏ผไฟๆ็ด่กๅนถๅฐ้ๅบฆๆงๅถไธบ0.3
if self.use_previous > 0:
steer_angle = 0.0
linear_velocity = 0.3
#่ฅ่ฟ็ปญๅคๆฌกๆฒกๆ่ทๅพๆฐๆฐๆฎๆๆฅๆถๅฐๅๆญขๅฝไปค๏ผๅๆๆญฃ่งๅบฆๅๅๆญข
if self.use_previous > Stop_coef or (target[0] == 0 and target[1] == 0) or self.stop == 1:
steer_angle = 0.0
linear_velocity = 0.0
#ๅฐไฟกๆฏไผ ่พ่ณๆงๅถๆจกๅไธญ
control_param = Srt_Control()
control_param.linear_velocity = linear_velocity
control_param.steer_angle = steer_angle
#ๅจๅๅธๅจไธญๅๅธๆฐๆฎไฟกๆฏ
self.control_pub.publish(control_param)
#ๅฏนไบ้ท่พพไฟกๆฏ็callback
def lidar_callback(self, msg):
msgl = len(msg.lidar_points) #ๆฟๅ
้ท่พพ้้ๅฐ็น็ๆฐ้
if msgl != 0:
#ๆ นๆฎๆฟๅ
้ท่พพๅๆๅๆบๅจ็ฉบ้ดไธไฝ็ฝฎ็ๅทฎๅผ๏ผๅฏน้้ๅฐๆฐๆฎ็น่ฟ่กๅฏนๅบๅนณ็งป
for i in msg.lidar_points:
i.x += transf_x
i.y += transf_y
i.z += transf_z
#ๆดๆฐๆถ้ดๆณไฟกๆฏ(ๅณๆถ้ด)
time_stamp = msg.stamp
jj = len(self.image_raw) - 1
delta_t = 1.0
#ๆ็
ง่ทๅๅพๅไฟกๆฏ็ๆฐๆง้กบๅบ๏ผไปๆๆฐ็ๅผๅง้ๅ๏ผ็ดๅฐ่ทๅพ็ฌฌไธไธชๅจๅฝๅๆถ้ดไนๅ็ๅพๅไฟกๆฏ
while jj >= 0:
if time_stamp > self.image_raw[jj].stamp:
delta_t = time_stamp - self.image_raw[jj].stamp
break
jj = jj - 1
# ไธบไฟ่ฏๅ่กจไธญ่ณๅฐๅญๅจไธไธชๅ
็ด ๏ผไฟ็image_raw[jj]๏ผๅ ้คไธๆ ไธบ0ๅฐjj-1
del self.image_raw[0:jj]
#ๅฏนไบ้ท่พพไธญ็็น่ฟ่ก่ๅ
length_msg = len(msg.lidar_points)
for ii in range(0, length_msg):
self.fusion(msg.lidar_points[ii],delta_t)
kk = len(self.lidar_raw)#originally: kk = len(self.lidar_raw) - 1
length_prev = len(self.previous_points)
for jj in range(0,kk):
#่ฏฅ็นไธบไธๅจๆ็ดข่ๅดๅ
็็น
if self.lidar_raw[jj].color == "unknown":
for ll in range(0,length_prev):
#ๅฐ่ฏฅ็น็้ข่ฒไฟกๆฏๆดๆฐไธบ่ท็ฆปๅ
ถ่พ่ฟ็ไนๅๆๆไฟกๆฏ็น๏ผไปฅๆ้คๅถ็ถๆง
if Euc_dist(np.array([[self.lidar_raw[jj].x],[self.lidar_raw[jj].y]]),np.array([[self.previous_points[ll].x],[self.previous_points[ll].y]])) < Dist_move:
#print "change current"
#print self.lidar_raw[jj]
#print "to"
#print self.previous_points[ll]
self.lidar_raw[jj].color = self.previous_points[ll].color
break
self.previous_points = [] #ๆธ
็ฉบๅๆๆ็นๅ
#ๅฐ้ท่พพๅพไธญ็นๅกซๅ
ๅ
ฅๅๆๆ็นๅบๅไธญไปฅไพไธไธๆฌกไฝฟ็จ๏ผ่ฅๆ้ข่ฒไธบ'y'ๅๅๅบๅ่ฝฆๆไปค
for ii in range(0,kk):
self.previous_points.append(self.lidar_raw[ii])
if self.lidar_raw[ii].color == 'y':
self.stop = 1
cones_whole = cone_pos_whole(self.lidar_raw, time_stamp)
self.fusion_pub.publish(cones_whole)
print(cones_whole)
target_point = cone_pos() #่ทๅพๆกถๆกฉไฝ็ฝฎ
target = get_target.get_target(self.lidar_raw) #็ฎๆ ็น็ไฝ็ฝฎ
#่ฅๆๅฏนๅบไฝ็ฝฎไฟกๆฏ๏ผๅไฝฟ็จไฝ้ๆปคๆณขๅๆดๆฐ่ณๅๆๆ็นๅ่กจไธญ
if target[0] != -1:
'''
#add discrete low pass filter here
'''
lp_filter.giveInput(target[1])
lp_filter.step()
target[1] = lp_filter.getOutput()
self.use_previous = 0
self.previous_target = target
#่ฅๅฝๅๆชๆฃๆตๅฐ็ฎๆ ็น๏ผไฝฟ็จๆ่ฟไธๆฌกๆฃๆตๅฐ็็ฎๆ ๏ผๅนถๅฐๆถ้ดๅทฎ+1
else:
self.use_previous = self.use_previous + 1
target = self.previous_target
#ๆดๆฐไฝฟ็จ็ฎๆ ็น็ไฟกๆฏ
target_point.x = target[0]
target_point.y = target[1]
target_point.color ="unknown"
print "target"
print target
self.target_pub.publish(target_point) #ๅๅธ็ฎๆ ็น็ไฟกๆฏ
self.driving(target) #ๆ นๆฎ็ฎๆ ไฟกๆฏๆๆง่ฝฆ่พ่ฟ่ก็ๅๆฐ
del self.lidar_raw[0:kk] #ๆธ
็ฉบ้ท่พพๅพไฟกๆฏ
#ๅฏนไบๅพๅ็callback๏ผๅฐๅพๅไฟกๆฏไฟๅญ่ณimage_rawๅ่กจไธญ
def image_callback(self, msg):
#self.image_append(msg) originL version
self.image_raw.append(msg)
if __name__ == "__main__":
# ๅๅงๅไธไธชๅไธบfusion็่็น๏ผๅนถไธ่งๅฎไปฅๅ่ฅๅๅปบไบๅๅ่็น๏ผๆๅบๅทๆๅ
rospy.init_node("fusion", anonymous = True)
# ๅๅงๅ้ท่พพๅๆๅๅคดไฟกๆฏ่ๅ็ๅฏน่ฑก
Cone_fusion = cone_fusion()
# ็ปไฝ้ๆปคๆณขๅจๆไพๅๅง็ๅๆฐ
lp_filter.giveInput(0.0)
lp_filter.initiallize()
# ๅๅปบไธคไธช่ฎข้
ๅจ๏ผๅๅซๆฅๅๅค็้ท่พพๅๆๅๅคด็ไฟกๆฏ
rospy.Subscriber("/image_processed", imagel_whole, Cone_fusion.image_callback)
rospy.Subscriber("/lidar_processed", lidar3_whole, Cone_fusion.lidar_callback)
rospy.spin()
|
[
"johnjackal@sjtu.edu.cn"
] |
johnjackal@sjtu.edu.cn
|
a08745cbc5ab323032e8fd0dc796a911af41abd4
|
b447fb38001b0fc228010f45d94a12bf1ed34ae5
|
/venv/Scripts/easy_install-3.6-script.py
|
9ef6818c5b21bbd7355d8b885abc5163e5199704
|
[] |
no_license
|
cforgeyj/fest_db
|
94bb26c8adb269ae5a430debb2bfd9c3ac5210d5
|
cc8fbb383eeca629d3b2887398344052518b828f
|
refs/heads/master
| 2020-06-20T20:15:54.341952
| 2019-07-16T17:01:40
| 2019-07-16T17:01:40
| 197,233,852
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 460
|
py
|
#!C:\Users\charl\PycharmProjects\festivals\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==40.8.0','console_scripts','easy_install-3.6'
__requires__ = 'setuptools==40.8.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('setuptools==40.8.0', 'console_scripts', 'easy_install-3.6')()
)
|
[
"cforgeyj@ucsd.edu"
] |
cforgeyj@ucsd.edu
|
42311741715181ad2c8f884bda05b2b4f5443e54
|
e72331dea0c3a18bf5d750274dfd06e5c1d7c409
|
/divisors.py
|
ff7bb255313a50a8714477546850a9a1f6a8ed52
|
[] |
no_license
|
darkeclipz/code-collection
|
73e922919a5262fcf46aa14340add6afd8875523
|
b176eb04f556cdb5d41f3f05c7970897615a34f3
|
refs/heads/master
| 2020-03-27T15:14:22.912525
| 2018-12-31T11:27:49
| 2018-12-31T11:27:49
| 146,705,807
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 435
|
py
|
import math
# Returns all the divisors for a number x, including x.
# e.g divisors(1001) = [1, 7, 11, 13, 77, 91, 143, 1001]
def divisors(x):
result = []
limit = math.ceil(math.sqrt(x))
for i in range(1, limit+1):
if x % i == 0:
if x / i == i:
result.append(i)
else:
result.append(i)
result.append(x//i)
return sorted(list(set(result)))
|
[
"larsrotgers@gmail.com"
] |
larsrotgers@gmail.com
|
1e0d9024bc03220f6aa14ebcc2b4484a68e55ef8
|
00fde49c9ff92fa74718c5937aa73ad88df1ef8c
|
/ccti/trees_and_graphs/diamond_path_finder.py
|
013d9ebebddeb301f34eba4c94ec976c3f016354
|
[] |
no_license
|
manish-jain-py/general_programs
|
60355cb5bbdbfe4586d2f70ab51b64f9c786ed9d
|
0da199eab29b4f6fce2385a2d56dd49b2f2cde76
|
refs/heads/master
| 2021-01-18T17:31:41.221341
| 2017-05-22T16:10:18
| 2017-05-22T16:10:18
| 86,805,893
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,373
|
py
|
from graph import Graph
def DFS(current_vertex, g, all_paths=[]):
if not hasattr(current_vertex, 'parent'):
current_vertex.parent = None
if len(current_vertex.get_all_neighbors()) == 0:
ones, path = traverse(current_vertex)
all_paths.append((ones, path))
for neighbor in current_vertex.get_all_neighbors():
neighbor_vertex = g.get_vertex(neighbor)
neighbor_vertex.parent = current_vertex
DFS(neighbor_vertex, g)
return all_paths
def traverse(node):
ones = 0
path = []
while node:
path.append(node.id)
ones += node.value
node = node.parent
path.reverse()
return ones, path
n = [[0, 1, -1, 0], [1, 0, 1, -1], [1, 1, 0, 1], [0, 1, 0, 0]]
g = Graph()
row = len(n); col = len(n)
for i in range(row):
for j in range(col):
if n[i][j] != -1:
vertex = g.add_vertex((i,j))
vertex.value = n[i][j]
for v in g.get_all_vertices():
main_vertex = v
i,j = v.id
if i+1 < row:
child = g.get_vertex((i+1,j))
if child:
main_vertex.add_neighbor(child)
if j+1 < col:
child = g.get_vertex((i, j+1))
if child:
main_vertex.add_neighbor(child)
for v in g.get_all_vertices():
v.visited = False
start = g.get_vertex((0,0))
all_paths = DFS(start,g)
print len(all_paths)
|
[
"manishjain.py@gmail.com"
] |
manishjain.py@gmail.com
|
64e0129ae0203ae2ead43235c189ef996a351d50
|
44eb44c067dd3259dea8e236b1f5c7c4c33f0e27
|
/prepare_classification_counties_israel2.py
|
e15aec54e2c471d407d50c864b8f9d95a5c31fb4
|
[] |
no_license
|
TrevorWinstral/classification
|
233633320837546943bb15f93f0b1afc0d9a5376
|
07fbde8dcfc2981bafba06fb2efc49644daa2449
|
refs/heads/master
| 2022-12-21T03:54:05.810938
| 2020-10-02T17:40:52
| 2020-10-02T17:40:52
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 8,702
|
py
|
1;95;0c
#/Users/olgabuchel/Downloads/28_day.csv - last 28 days
#OBJECTID Place ืชืืจืื ืฉืขืืช ืฉืืืื x y
#1276117 ืคืื ืกืงืจ - ืืจืื ืืงืฆืืขื - ืฉืืจืืชื ืืจืืืืช ืืืืืช - ืจืืฉืื ืืฆืืื 28/6/2020 08:00 - 10:30 34.80713460000000 31.968514200000100
#/Users/olgabuchel/Downloads/IRSL.csv - historical dates grouped
# City Population as of 2018 Number of tests so far Verified patients discovered so far Number of recoverers The growth rate of verified patients in the last 3 days The number of verified patients added in the last 3 days Actual morbidity rate ** per 100,000 dates
#https://imoh.maps.arcgis.com/apps/webappviewer/index.html?id=20ded58639ff4d47a2e2e36af464c36e&locale=he&/
#/Users/olgabuchel/Downloads/coordinates.csv
#prepare_classification_counties_israel2.py
#'IL': ('Israel', (34.2654333839, 29.5013261988, 35.8363969256, 33.2774264593)),
import csv
import json
#/Users/olgabuchel/Downloads/gridtest (1).json
#create a dictionary of names and coordinates. Coords are in 28 days
#add coordinates to the historical data
#{'type': 'GeometryCollection', 'geometries': [{'type': 'MultiLineString', 'coordinates':
ffs={}
ffs["type"]="FeatureCollection"
ffs["features"]=[]
with open('/Users/olgabuchel/Downloads/gridtest (1).json', 'r') as jsonfile:
data=json.load(jsonfile)
ind=0
for item in data["geometries"][0]["coordinates"]:
feature={}
feature["type"]="Feature"
feature["geometry"]={"type":"Polygon","coordinates":[item]}
feature["properties"]={"name":"feature_"+str(ind)}
#print(feature)
ffs["features"].append(feature)
ind+=1
print(ffs)
with open('grid_israel.json', 'w') as jsonfile:
json.dump(ffs,jsonfile)
coords={}
with open('/Users/olgabuchel/Downloads/28_day.csv', 'r') as csvfile:
spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in spamreader:
if row[1] not in list(coords.keys()):
coords[row[1]]=[row[4],row[5]]
#print(coords)
''''
import json
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
#from prep_canada_data import stage_latest
date_of_analysis='7/11/20'
df = pd.read_csv('/Users/olgabuchel/Downloads/14_day.csv')
print(list(df.columns))
print(df[list(df.columns)[1]])
print(df[list(df.columns)[2]])
print(df[list(df.columns)[4]])
print(df[list(df.columns)[5]])
df2=df.groupby([list(df.columns)[1],list(df.columns)[2],list(df.columns)[4],list(df.columns)[5]]).count().reset_index()
#print(df2)
df4=pd.pivot_table(df2,index=[list(df.columns)[2]],columns=list(df.columns)[1],values=["OBJECTID"],aggfunc=np.sum)
output_directory = 'output_israel'
os.makedirs(output_directory + '/classification', exist_ok=True)
e_dataframe0=df2
ids = list(df4.columns)[3:]
#list(df2.Place.unique())
recs = list(df4.columns)[3:]
#list(df2.Place.unique())
#print(df2.index)
# stage latest Canada HR-level data for later processing
#latest_ca_df = stage_latest()
#print(latest_ca_df)
#assert latest_ca_df.index.names == ['Combined_Key']
#print(latest_ca_df)
#e_dataframe0 = e_dataframe.drop(columns=['UID','iso2','iso3','code3','FIPS','Admin2','Province_State','Country_Region','Lat','Long_'])
e_dataframe1 = df4
#pd.pivot_table(df4,index=["dates"],columns='Combined_Key',values=["Confirmed Cases Count"],aggfunc=np.sum).fillna(0)
#print(e_dataframe1)
#print(ids)
#print(recs)
def add_day_columns(df):
"""Add columns Elapsed_days, Decimals, Day_Year to df."""
dats = list(df.index)
#print(dats)
dats2 = []
decimals = []
elapsed_days = []
ind = 35
for el in dats:
dats2.append(ind)
dec = 2020 + (ind / 366)
elapsed_days.append(ind - 20)
decimals.append(dec)
ind += 1
df.insert(0, "Day_Year", dats2, True)
df.insert(0, "Decimals", decimals, True)
df.insert(0, "Elapsed_days", elapsed_days, True)
add_day_columns(e_dataframe1)
#print(e_dataframe1)
if False:
# show intermediate result and abortthe script right here
print(e_dataframe1.iloc[10:, :5])
import sys
sys.exit(0)
tim = list(df[list(df.columns)[2]].unique())
print(tim)
tim.pop(0)
ind4 = 0
aar = []
aar1 = []
counties = list(df4.columns)[3:]
print(counties)
#e_dataframe1.columns[3:]
def compute_original_values(values):
result = []
ind3 = 0
for e in values:
if ind3 < num_rows - 1:
result.append(int(values[ind3 + 1]) - int(e))
else:
print("")
#result.append(result[-1])
ind3 += 1
return result
def interpolate(y):
ind = 0
y1 = []
for el in y:
if ind >= 1 and ind <= len(y) - 2:
y0 = (int(y[ind + 1]) - int(y[ind - 1])) / 2
y1.append(y0)
elif ind == 0:
y0 = (int(y[ind + 1]) - int(el)) / 2
y1.append(y0)
else:
y0 = (int(el) - int(y[ind - 1])) / 2
y1.append(y0)
ind += 1
return y1
def classify(ratio, recent_mean, threshold):
color = None
if ratio >= 0.79:
if recent_mean >= threshold:
color = "red"
else:
color = "green"
elif ratio <= 0.1:
if recent_mean >= threshold:
color = "yellow"
else:
color = "green"
elif ratio >= 0.4 and ratio < 0.79:
if recent_mean >= threshold:
color = "orange"
else:
color = "green"
elif ratio > 0.1 and ratio < 0.4:
if recent_mean >= threshold:
color = "yellow"
else:
color = "green"
assert color is not None
return color
print(df4.columns)
for name in counties:
name0=name[1]
#print(name)
values = e_dataframe1[name].fillna(0).cumsum()
#print(values)
num_rows = len(values)
y50 = values[-12:]
#print(y50)
y5 = [y - values[len(values)-12] for y in y50]
y = values
original_values = compute_original_values(values)
#print(original_values)
x = e_dataframe1[e_dataframe1.columns[0]]
y1 = interpolate(y)
print(x,y1)
x2 = x[6:]
tim2 = tim[3 : -4]
#print(tim2)
y3 = pd.DataFrame(y1, columns=["a"]).rolling(window=7).mean()['a'].to_list()[6:]
ys = y3[-12:]
xs = x[-9:-4] # last 24 days
ind2 = 0
start = []
start2 = []
if int(np.max(y)) > 0:
vv = [int(x) for x in y.to_list() if x != min(y3)]
start.append(y.to_list().index(vv[0]))
else:
start.append(0)
threshold = 1
if len(start) > 0:
max0 = np.max(y3)
min0 = np.min(ys)
recent_mean0=0
if max0 > 0:
ratio = y3[-1] / max0
recent_mean = int(np.mean(original_values[-11:]))
recent_mean0 += recent_mean
#if recent_mean > threshold:
color = classify(ratio, recent_mean, threshold)
#else:
# color = "green"
else:
#print(name,y3)
ratio=0
color="darkseagreen"
print(name[1],color,ratio,recent_mean0,int(max(y5)))#,str(ids[recs.index(name)]["Combined_Key"]))
print(y5)
print(y3)
print(y)
plt.title(name[1])
plt.plot(x2,y3,color=color)
plt.savefig(name[1]+".png")
plt.show()
try:
with open(output_directory + '/classification/data_counties_'+str(ids[recs.index(name)])+'.json', 'w') as outfile:
json.dump({"dates":tim2,"max_14": int(max(y5)-min(y5)),"max":int(max(y)),"value":y3,"time":tim,"original_values":original_values},outfile)
#aar.append({"color":color,"province":name.split(",")[0],"country":name.split(",")[1],"id":"new_id_"+str(ind4),"value1":ratio, "dates":tim2,"value":y3})
aar1.append({"n":name,"id":ids[recs.index(name)],"v":ratio,"c":color,"max":int(max(y5)-min(y5)),"t":int(max(y))})
except:
continue
ind4+=1
# with open('classification/data_counties.json', 'w') as outfile:
# json.dump(aar,outfile)
print(aar1)
aar1[0]["date"]=date_of_analysis
# this file is used by the map
with open(output_directory + '/classification/classification_ids_counties2.json', 'w') as outfile:
json.dump(aar1, outfile)
'''
|
[
"obuchel@gmail.com"
] |
obuchel@gmail.com
|
e87335a5e1e515ee0574295d3f565c3773ddbdbb
|
948e042e887bc7d82d718fc92430c49236e4d47c
|
/Vestigium.py
|
9b23e76bdcbf43e91091d452b20e20a4f0e51c2b
|
[
"MIT"
] |
permissive
|
namanadlakha3/Google-CodeJam2020
|
49e79b917e2a43a6d15b03be43bbbdc30d19114d
|
aa9cd41f4dbd5c43eb7eaec857147baa39f73224
|
refs/heads/master
| 2021-05-22T20:44:07.412079
| 2020-07-15T17:41:30
| 2020-07-15T17:41:30
| 253,087,598
| 1
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 815
|
py
|
def solve():
n = int(input())
arr = []
for i in range(n):
arr.append([int(j) for j in input().split()])
#print(
diag = 0
col = 0
row = 0
for i in range(n):
c = []
r = []
cf = 0
rf = 0
for j in range(n):
if arr[i][j] in r:
rf = 1
else:
r.append(arr[i][j])
if arr[j][i] in c:
cf = 1
else:
c.append(arr[j][i])
if i==j:
diag += arr[i][j]
col += cf
row += rf
c.clear()
r.clear()
return "{} {} {}".format(diag, row, col)
t = int(input())
for i in range(1, t+1):
s = solve()
print("Case #{}: {}".format(i, s))
|
[
"noreply@github.com"
] |
namanadlakha3.noreply@github.com
|
b904f7456130b6f56a2a6f651ad92d169445449e
|
bcd7a9851566f7b4f3a6db973fad012356a3065a
|
/test/test-smoothpolyline.py
|
411a16936c6ac96d550ffd836a14d02cd7d219b9
|
[
"BSD-3-Clause"
] |
permissive
|
WojciechMula/canvas2svg
|
a61f83914417b754815f65fdc7ae0a4c4c85c665
|
c711a8ebc04269cf79f8c669cb842794361b3f9c
|
refs/heads/master
| 2023-06-20T17:21:52.007919
| 2020-12-23T11:13:21
| 2020-12-23T11:13:21
| 11,618,088
| 44
| 19
|
BSD-3-Clause
| 2020-12-23T11:13:22
| 2013-07-23T20:14:14
|
Python
|
UTF-8
|
Python
| false
| false
| 399
|
py
|
from framework import *
root.title("Smoothed polyline test ($Revision: 1.4 $)")
n = 50
k1 = 3
k2 = 10
for i in xrange(n):
k = randint(k1, k2)
p = []
for j in xrange(k):
p.append(coord())
p.append(coord())
item = canv.create_line(*p)
canv.itemconfigure(item, smooth="1",
fill=random_color(),
width=randint(1,3))
thread.start_new_thread(test, (canv, __file__, True))
root.mainloop()
|
[
"wojtek@a13746d7-5020-4d46-8679-245a07f888a7"
] |
wojtek@a13746d7-5020-4d46-8679-245a07f888a7
|
b2fc79e5c34dabc3eb6432156aaa5db3953e2e27
|
9cde4277a63fc7b499f2097f0560c1958ba9716c
|
/productos/migrations/0003_auto_20190130_1937.py
|
882efd0e7359e9264b35bed26b8feb2e2c350f77
|
[] |
no_license
|
Rob866/store
|
fa510157c82d80b4ab879de64206147cd513a793
|
35515f2d5dd1509763ba0af21a8f835c5c38125e
|
refs/heads/master
| 2020-04-20T03:00:44.979279
| 2019-02-04T03:39:55
| 2019-02-04T03:39:55
| 168,586,063
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 413
|
py
|
# Generated by Django 2.1.5 on 2019-01-31 02:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('productos', '0002_auto_20190130_1931'),
]
operations = [
migrations.AlterField(
model_name='producto',
name='almacen',
field=models.DecimalField(decimal_places=0, max_digits=100),
),
]
|
[
"juanrob_10@hotmail.com"
] |
juanrob_10@hotmail.com
|
50ea5569b4f6c39bfafd90f2e64f364a29e4cbb8
|
c328756875ef4aff7a856a5ca107ce89aa5bcccf
|
/2. Funรงรตes/Exercรญcios/ex5.py
|
09dc38e12972fc52cbf3f32b832a58ad311a0b40
|
[] |
no_license
|
alanraso/IntroProg2018
|
517a4d66d2b8c3a7bb690ca873b3af75ec61565b
|
41f912a86460ee2ad03ff0c4edd49d67ef684248
|
refs/heads/master
| 2021-05-12T03:12:15.204120
| 2019-12-07T12:02:25
| 2019-12-07T12:02:25
| 117,610,479
| 0
| 0
| null | 2020-07-16T16:39:34
| 2018-01-16T00:29:50
|
Python
|
UTF-8
|
Python
| false
| false
| 186
|
py
|
def imprime_separando(palavra, delimitador, n):
padrao = palavra + delimitador
print(padrao * (n - 1) + palavra)
imprime_separando('Ola', '/', 4)
imprime_separando('Pรฃo', ',', 10)
|
[
"alan.raso@taqtile.com.br"
] |
alan.raso@taqtile.com.br
|
75c8f17a496d97f2ad1087f1572e83261238cfd0
|
0a1d4fa6bb64048caa986a100aa2d096f0e14a3c
|
/src/test/__init__.py
|
b636fe6de8d226e6e61785e292b02bbf1d49caa2
|
[] |
no_license
|
OneTesseractInMultiverse/heimdall
|
bcc3ebd4b20ac02a56b7e6c8748edc39af55548d
|
83f6a7a89cb7e66d33d186c03e75d9f69b934571
|
refs/heads/master
| 2022-06-08T20:25:51.855787
| 2019-10-05T14:28:12
| 2019-10-05T14:28:12
| 181,356,419
| 0
| 0
| null | 2022-05-25T02:21:21
| 2019-04-14T19:08:29
|
Python
|
UTF-8
|
Python
| false
| false
| 90
|
py
|
from test.unit.application_model_tests import *
from test.unit.model_base_tests import *
|
[
"pedro@subvertic.com"
] |
pedro@subvertic.com
|
f93e3e19816bde47f346c7c6cb6eb8a12013242f
|
7241e5063a08c9fc0759f255d6cd7e9f8a1b47fb
|
/bingo/migrations/0003_gamecard_player_name.py
|
8095b47ef469092cccebfbe3ebecc1ee31b39165
|
[] |
no_license
|
jaohara/django-bingo
|
0ecc027babbe8031aa3a77611f4b7bd915cef01b
|
44114fd424fbc83df41b3d2b087ca9808b4cb047
|
refs/heads/master
| 2021-07-21T16:00:35.251972
| 2017-11-01T02:03:51
| 2017-11-01T02:03:51
| 108,764,667
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 472
|
py
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-31 21:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bingo', '0002_auto_20171031_2132'),
]
operations = [
migrations.AddField(
model_name='gamecard',
name='player_name',
field=models.CharField(default='Player', max_length=64),
),
]
|
[
"johnoharaa@gmail.com"
] |
johnoharaa@gmail.com
|
35a662d6bf38cd638f7b66e2f1223823ae0163dc
|
a5a88e0347ffbf04b43939f16f9eecccb90f7826
|
/read_bson.py
|
34967d5fb6817b1c40085ee0674ccba823ee5bd7
|
[] |
no_license
|
xyyimian/pic-multi-classification
|
9da14273234c7cfa7b825b59e6abd2c029e84ae7
|
6d410dd82a038fe7f7fda228652a9e7429445039
|
refs/heads/master
| 2021-04-30T11:09:54.104299
| 2018-02-13T06:52:39
| 2018-02-13T06:52:39
| 121,348,400
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 2,758
|
py
|
# This program should be run in Python 3 environment.
# Using following command to install necessary libs if you find libs lack.
#
# $ sudo apt-get install python3-pip
# $ sudo pip3 install numpy
# $ sudo pip3 install pandas
# $ sudo pip3 install matplotlib
# $ sudo pip3 install sklearn
# $ sudo pip3 install scikit-image
# $ sudo pip3 install tensorflow The lib we get from http://www.tensorfly.cn/ only be supported in Python 2.7, we need to get the version which is supported in python 3.
# $ sudo pip3 install pymongo We should get the pymongo lib but not the bson lib.DON'T USE COMMAND $ sudo pip3 install bson !
import pylab #This lib is used to show the picture.If you only use `plt.imshow(picture)` python3 won't show the picture
import warnings
import io, bson
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import tensorflow as tf
import matplotlib.pyplot as plt
from skimage.data import imread # or, whatever image library you prefer
from sklearn import preprocessing
from subprocess import check_output
#Output the files in the catagory
print(check_output(["ls", "./input"]).decode("utf8"))
#Ignore Warnings
warnings.filterwarnings("ignore")
# Simple data processing
data = bson.decode_file_iter(open('./input/train_example.bson', 'rb'))
# read bson file into pandas DataFrame
with open('./input/train_example.bson','rb') as b:
df = pd.DataFrame(bson.decode_all(b.read()))
#Get shape of first image
for e, pic in enumerate(df['imgs'][0]):
picture = imread(io.BytesIO(pic['picture']))
pix_x,pix_y,rgb = picture.shape
n = len(df.index) #cols of data in train set
X_ids = np.zeros((n,1)).astype(int)
Y = np.zeros((n,1)).astype(int) #category_id for each row
X_images = np.zeros((n,pix_x,pix_y,rgb)) #m images are 180 by 180 by 3
i = 0
for c, d in enumerate(data):
X_ids[i] = d['_id']
Y[i] = d['category_id']
for e, pic in enumerate(d['imgs']):
picture = imread(io.BytesIO(pic['picture']))
X_images[i] = picture #add only the last image
plt.imshow(picture)
pylab.show()
i+=1
#full list of classes
df_categories = pd.read_csv('./input/category_names.csv', index_col='category_id')
category_classes = df_categories.index.values
category_classes = category_classes.reshape(category_classes.shape[0],1)
#using a label encoder, and binarizer to convert all unique category_ids to have a column for each class
le = preprocessing.LabelEncoder()
lb = preprocessing.LabelBinarizer()
le.fit(df_categories.index.values)
y_encoded = le.transform(Y)
lb.fit(y_encoded)
Y_flat = lb.transform(y_encoded)
print(Y_flat)
#redimension X for our model
X_flat = X_images.reshape(X_images.shape[0], -1)
|
[
"xyyimian@mail.ustc.edu.cn"
] |
xyyimian@mail.ustc.edu.cn
|
7957ae5457e5eac169067b4b4f9210c44a8b4164
|
1033efc84545929981720aceb5f18f7033728b20
|
/model.py
|
dc12921643929236ca33a30a79085f6dbede0345
|
[] |
no_license
|
kodark/image_style_transfer_telegram_bot
|
1a3707353b6b5e76eeac1ca3e159bfe56f40af6d
|
f20d3aa9fc030f0b9f7bb641b0d5b103e3a818aa
|
refs/heads/master
| 2021-01-01T02:40:47.829672
| 2020-02-08T14:44:13
| 2020-02-08T14:44:13
| 239,145,827
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 7,885
|
py
|
from PIL import Image
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision.transforms as transforms
import torchvision.models as models
import copy
import config
import os.path
class StyleTransferModel:
def __init__(self):
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
if torch.cuda.is_available():
print('YES! CUDA!')
else:
print('CPU, just CPU')
if not os.path.exists(config.path_cached_nn):
create_cached_truncated_neural_network()
self.cnn = torch.load(config.path_cached_nn).to(self.device).eval()
self.content_layers = ['conv_4']
self.style_layers = ['conv_1', 'conv_2', 'conv_3', 'conv_4', 'conv_5']
self.normalization_mean = torch.tensor([0.485, 0.456, 0.406]).to(self.device)
self.normalization_std = torch.tensor([0.229, 0.224, 0.225]).to(self.device)
self.unloader = transforms.ToPILImage()
self.normalization = Normalization(self.normalization_mean, self.normalization_std).to(self.device)
self.img_size = config.img_size
self.loader = transforms.Compose([
transforms.Resize(self.img_size),
transforms.CenterCrop(self.img_size),
transforms.ToTensor()])
def get_input_optimizer(self, input_img):
optimizer = optim.LBFGS([input_img.requires_grad_()])
return optimizer
def set_style_model_and_losses(self, style_img, content_img):
cnn = copy.deepcopy(self.cnn)
content_losses = []
style_losses = []
model = nn.Sequential(self.normalization)
i = 0
for layer in cnn.children():
if isinstance(layer, nn.Conv2d):
i += 1
name = 'conv_{}'.format(i)
elif isinstance(layer, nn.ReLU):
name = 'relu_{}'.format(i)
layer = nn.ReLU(inplace=False)
elif isinstance(layer, nn.MaxPool2d):
name = 'pool_{}'.format(i)
elif isinstance(layer, nn.BatchNorm2d):
name = 'bn_{}'.format(i)
else:
raise RuntimeError('Unrecognized layer: {}'.format(layer.__class__.__name__))
model.add_module(name, layer)
if name in self.content_layers:
# add content loss:
target = model(content_img).detach()
content_loss = ContentLoss(target)
model.add_module("content_loss_{}".format(i), content_loss)
content_losses.append(content_loss)
if name in self.style_layers:
# add style loss:
target_feature = model(style_img).detach()
style_loss = StyleLoss(target_feature)
model.add_module("style_loss_{}".format(i), style_loss)
style_losses.append(style_loss)
for i in range(len(model) - 1, -1, -1):
if isinstance(model[i], ContentLoss) or isinstance(model[i], StyleLoss):
break
model = model[:(i + 1)]
self.model = model
self.style_losses = style_losses
self.content_losses = content_losses
def run_style_transfer(self, content_img, style_img, num_steps=100, style_weight=100000, content_weight=1):
"""Run the style transfer."""
input_img = content_img.clone()
print('Building the style transfer model..')
self.set_style_model_and_losses(style_img, content_img)
optimizer = self.get_input_optimizer(input_img)
print('Optimizing..')
run = [0]
while run[0] <= num_steps:
def closure():
input_img.data.clamp_(0, 1)
optimizer.zero_grad()
self.model(input_img)
style_score = 0
content_score = 0
for sl in self.style_losses:
style_score += sl.loss
for cl in self.content_losses:
content_score += cl.loss
style_score *= style_weight
content_score *= content_weight
loss = style_score + content_score
loss.backward()
run[0] += 1
if config.show_learning_history and run[0] % 10 == 0:
print("run {}:".format(run))
print('Style Loss : {:4f} Content Loss: {:4f}'.format(
style_score.item(), content_score.item()))
print()
return style_score + content_score
optimizer.step(closure)
# a last correction...
input_img.data.clamp_(0, 1)
return input_img
def transfer_style(self, content_img_stream, style_img_stream):
content_img = self.process_image(content_img_stream)
style_img = self.process_image(style_img_stream)
image = self.run_style_transfer(content_img, style_img).cpu().clone()
image = image.squeeze(0) # ััะฝะบัะธั ะดะปั ะพััะธัะพะฒะบะธ ะธะทะพะฑัะฐะถะตะฝะธั
image = self.unloader(image)
return image
def process_image(self, img_stream):
image = Image.open(img_stream)
image = self.loader(image).unsqueeze(0)
return image.to(self.device, torch.float)
class ContentLoss(nn.Module):
def __init__(self, target,):
super(ContentLoss, self).__init__()
self.target = target.detach()
self.loss = F.mse_loss(self.target, self.target)
def forward(self, input_tensor):
self.loss = F.mse_loss(input_tensor, self.target)
return input_tensor
def gram_matrix(input):
batch_size, h, w, f_map_num = input.size()
features = input.view(batch_size * h, w * f_map_num)
G = torch.mm(features, features.t())
return G.div(batch_size * h * w * f_map_num)
def create_cached_truncated_neural_network():
cnn = models.vgg19(pretrained=True).features.eval()
model = nn.Sequential()
i = 0
for layer in cnn.children():
if isinstance(layer, nn.Conv2d):
i += 1
name = 'conv_{}'.format(i)
elif isinstance(layer, nn.ReLU):
name = 'relu_{}'.format(i)
layer = nn.ReLU(inplace=False)
elif isinstance(layer, nn.MaxPool2d):
name = 'pool_{}'.format(i)
elif isinstance(layer, nn.BatchNorm2d):
name = 'bn_{}'.format(i)
else:
raise RuntimeError('Unrecognized layer: {}'.format(layer.__class__.__name__))
model.add_module(name, layer)
for i, (x, y) in enumerate(model.named_children()):
if x == 'conv_5':
break
model = model[:(i + 1)]
torch.save(model, config.path_cached_nn)
class StyleLoss(nn.Module):
def __init__(self, target_feature):
super(StyleLoss, self).__init__()
self.target = gram_matrix(target_feature).detach()
self.loss = F.mse_loss(self.target, self.target)
def forward(self, input_tensor):
G = gram_matrix(input_tensor)
self.loss = F.mse_loss(G, self.target)
return input_tensor
class Normalization(nn.Module):
def __init__(self, mean, std):
super(Normalization, self).__init__()
# .view the mean and std to make them [C x 1 x 1] so that they can
# directly work with image Tensor of shape [B x C x H x W].
# B is batch size. C is number of channels. H is height and W is width.
self.mean = torch.tensor(mean).view(-1, 1, 1)
self.std = torch.tensor(std).view(-1, 1, 1)
def forward(self, img):
return (img - self.mean) / self.std
|
[
"great4120@gmail.com"
] |
great4120@gmail.com
|
ae5c6a377b82aa09d3393d6b2c6b701b50278f2a
|
6834627827d03f0028f0d8726068a6411bf0ae6d
|
/Kattis/r2.py
|
e989a9d58a277c7253f43056ef38748571d696f4
|
[] |
no_license
|
dimkary/Python-tests
|
a5a45b2649d3a019f60e7103b715df59263a3bb9
|
6a2a7a2509842a3620fe69664daf9760039074ac
|
refs/heads/master
| 2022-06-08T03:01:12.652345
| 2022-03-31T19:10:57
| 2022-03-31T19:10:57
| 163,187,661
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 218
|
py
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 20 09:49:20 2018
@author: karips
Solves the "R2" Kattis problem
"""
x = input().split(' ')
nums = [int(i) for i in x]
print((2*nums[-1]-nums[0]))
|
[
"dim.karypidis@outlook.com"
] |
dim.karypidis@outlook.com
|
8bb379d11a3411155e7b40d777e9af4823fa0df1
|
d4e7c48b90ba568e20daec7ee5039b23ad34bb12
|
/caseblocks/caseblocks/items.py
|
a0a62837c28fe1906fd2f5d11c1e373c5b3e3495
|
[] |
no_license
|
adilmahmood1/crawler
|
b9686c39c3a14425e13bb7762658b22569c83f60
|
425748488c17cea1d4a0a220de26a7e7ff5d3560
|
refs/heads/master
| 2020-03-22T03:55:19.621410
| 2018-07-02T15:39:13
| 2018-07-02T15:39:13
| 139,460,500
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 273
|
py
|
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class CaseblocksItem(scrapy.Item):
url = scrapy.Field()
title = scrapy.Field()
http = scrapy.Field()
|
[
"noreply@github.com"
] |
adilmahmood1.noreply@github.com
|
61498a70f59c0545f12fe742f156499fa47625d5
|
1521b0e3e761852552a751f9e4364a36653ce148
|
/networking/convertip2.py
|
89bf5ca10262d00568cb1beec5a00e36602941e6
|
[] |
no_license
|
tritech-cyber/python2019
|
f94a8427267b9f08f8fcb4e30d521dea3c9cb9fc
|
76e318728a4367675f1fa2824daf79a57721891f
|
refs/heads/master
| 2022-12-25T16:03:52.383101
| 2020-10-05T16:51:05
| 2020-10-05T16:51:05
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 588
|
py
|
ipv4 = [0,0,0,0]
nmask = 0
subs =""
print ("Input an ip as follows 192.168.1.1/24")
ipraw = input("ip: ")
#print (ipraw)
#print(len(ipraw))
print("**************************\n")
# notdot 0 is false and 1 is true
gotchar = 0
octcount = 0
charcount = 0
for x in range(0, len(ipraw)):
print (ipraw[x])
if (ipraw[charcount] != "."):
nodot = 1
else:
nodot = 0
if (nodot == 1):
subs = subs + ipraw[charcount]
charcount = charcount + 1
else:
charcount = 0
print(int(subs))
#ipv4[octcount] = int(subs)
#print(ipv4[octcount])
octcount = octcount + 1
|
[
"noreply@github.com"
] |
tritech-cyber.noreply@github.com
|
cbe334660fabae7316d950f6276c1c219087511c
|
afc38ccc3dcbb04b0df89cc52efbc9649f861de4
|
/get_rooms.py
|
afdce09b46143bf851898129ff57c39fa10d3d25
|
[] |
no_license
|
epieye/flare
|
068bf14cb841c19903c0cd6651d576376af9a662
|
40374d55be6837a7d5f5ea4cad9b4d894010a715
|
refs/heads/master
| 2020-04-25T17:49:13.968780
| 2019-02-27T22:29:31
| 2019-02-27T22:29:31
| 172,962,444
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 342
|
py
|
import requests
import json
import yaml
url = 'https://api.ciscospark.com/v1/rooms'
token = open("creds.yaml", "r")
headers = {"Authorization": "Bearer %s" % yaml.load(token)[1] }
response = requests.get(url, headers=headers)
rooms = json.loads(response.text)['items']
i = 0
while i < len(rooms):
print rooms[i]['title']
i += 1
|
[
"warren@ourzoo.us"
] |
warren@ourzoo.us
|
452416bb3f0ef99cc783d4b3f65c50976e98d578
|
0e9d821eb2f647701b835d229c0a0387ab67ad03
|
/myenv/bin/easy_install
|
69ffc0736026364a5669860b359352c774684ffe
|
[] |
no_license
|
gastonparis/my-first-blog
|
f3b49a2913a9ae916c49da750217f7d1177dc8bf
|
ff823f894ac635cde4eb533b256cb43615f4e0ef
|
refs/heads/master
| 2020-06-15T13:31:51.565852
| 2019-07-10T19:53:14
| 2019-07-10T19:53:14
| 195,313,725
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 273
|
#!/home/gaston/Documentos/djangogirls/myenv/bin/python3.6
# -*- coding: utf-8 -*-
import re
import sys
from setuptools.command.easy_install import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
|
[
"gastonparis@gmail.com"
] |
gastonparis@gmail.com
|
|
6472147862d210a24ccc41e062213c8846a45d25
|
2f0e329081cc2282a6a75b56ba4660f777cc3131
|
/test/Job_test.py
|
cc72e0c2a34118df901f5009b21f2ca81edf5391
|
[] |
no_license
|
changhuan1994/AdvanceAutoFix
|
ad3ca391c5158276d65d5b9bb4c75c497d4a20cf
|
b9f755278fa3bc6c85c7b5cbd50fb65f6128fb02
|
refs/heads/master
| 2020-12-21T11:29:09.873775
| 2020-01-28T05:13:20
| 2020-01-28T05:13:20
| 236,418,515
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 1,495
|
py
|
import unittest
from AAP1.Job import Job
#Tests User
#Author Trey EllisS
class JobTests(unittest.TestCase):
def testJobCreation(self):
test_job = Job(1, 1, "Customer's car Address", "Help Me", 2, "Greg", "Windshield Wiper Replacement")
self.assertEqual( Job.get_job_id( test_job ) , 1)
print("Result was : " + str(test_job.job_id))
print("Result expected : 1")
self.assertEqual(Job.get_job_type_id(test_job) , 1)
print("Result was : " + str(test_job.job_type_id))
print("Result expected : 1")
self.assertEqual(Job.get_address(test_job) , "Customer's car Address")
print("Result was : " + str(test_job.address))
print("Result expected : Customer's car Address")
self.assertEqual(Job.get_details(test_job) , "Help Me")
print("Result was : " + str(test_job.details))
print("Result expected : Help Me")
self.assertEqual(Job.get_cus_id(test_job) , 2)
print("Result was : " + str(test_job.cus_id))
print("Result expected : 2")
self.assertEqual(Job.get_customer_name(test_job) , "Greg")
print("Result was : " + str(test_job.customer_name))
print("Result expected : Greg")
self.assertEqual(Job.get_job_type_name(test_job) , "Windshield Wiper Replacement")
print("Result was : " + str(test_job.job_type_name))
print("Result expected : Windshield Wiper Replacement")
if __name__ == '__main__':
unittest.main()
|
[
"hchang15@ncsu.edu"
] |
hchang15@ncsu.edu
|
41631dfd02440edb2b30006366e0e4b7f107feee
|
acb5b498b65fcead4b4b97c2a73bc10d09b74ed7
|
/build/lib/DeltaPI/AutoDiff/AutoDiff_Tests/All_derivatives.py
|
3e88a2efc8c7f3f355ee39ff61c04958adbc4a07
|
[
"MIT"
] |
permissive
|
IACS-CS-207-FantasticFour/cs207-FinalProject
|
5e62feb8c0313c4da4278e8d802ced30ff474c47
|
3e916af3f1a38fe919a27eff014bb5ab6ee1bb74
|
refs/heads/master
| 2022-12-10T11:42:05.086011
| 2021-09-09T20:25:06
| 2021-09-09T20:25:06
| 216,193,376
| 1
| 1
|
MIT
| 2022-12-08T07:00:20
| 2019-10-19T11:09:47
|
Python
|
UTF-8
|
Python
| false
| false
| 3,592
|
py
|
from AutoDiff import AutoDiff
import numpy as np
def all_derivatives(func, in_vars, point):
'''
Function that calculates the value of the input function at the input point and all its partial derivatives
:params func: (function) function to evaluate whose input is a list of variables
in_vars: (list) list of variables to use when calculating the values of the input function
point: (list) list of values of each input variable at the input point
:returns: out_val (scalar) the value of the input function at the input point
out_dervs (numpy array , 1 dimensional) an array of the 1st derivative values of each input variable
at the input point
:dependencies: requires class AutoDiff from module AutoDiff, package numpy imported ad np
Example:
def func(vars):
return vars[0]**2 + vars[1]**2
a, b = all_derivatives(func, ['x','y'], [3,2])
print(a, b)
13.0, [6.0, 4.0]
'''
auto_diff_vars = [] # list to hold AutoDiff objects, one for each var in in_vars
out_dervs =[] # list to hold derivative values, one for each var in in_vars
# Make AutoDiff objects
for var, pt in zip(in_vars, point):
var = AutoDiff(pt, 0)
auto_diff_vars.append(var)
# Calculate the value of func at the input point
f = func(auto_diff_vars)
out_val = f.val
# Calculate the partial derivatives of func at the input point
# Go through AutoDiff objects in auto_diff_vars
# and during each pass change the derv value of 1 variable to 1, while others are held at 0
# and calculate the partial derivative
for i in range(len(auto_diff_vars)):
auto_diff_vars[i].derv = 1
f = func(auto_diff_vars)
out_dervs.append(f.derv)
auto_diff_vars[i].derv = 0
return out_val, np.array(out_dervs)
def vector_func_all_derivatives(functions, in_vars, point):
'''
Function that calculates the value of all input functions at the input point and all their partial derivatives
producing a numpy array of output values and a numpy 2D array (matrix) of partial derivatives, the Jacobian
:params func: (functions) list of function to evaluate whose input is a list of variables
in_vars: (list) list of variables to use when calculating the values of the input functions
point: (list) list of values of each input variable at the input point
:returns: out_vals (numpy array 1 dimensional) the values of the input functions at the input point
out_dervs_matrix (numpy array 2 dimensional) a matrix of the 1st derivative values of each input variable
at the input point, the Jacobian.
:dependencies: requires class AutoDiff from module AutoDiff, function all_derivatives from this module,
All_derivatives, and the package numpy imported as np
Example:
def func1(vars):
return vars[0]**2 + vars[1]**2
def func2(vars):
return vars[0]**2*vars[1]**2
a, b = vector_func_all_derivatives([func1,func2] , ['x','y'], [3,2])
print(a, b)
[13. 36.] [[ 6. 4.], [24. 36.]]
'''
out_vals = []
out_dervs_matrix =[]
# for each function in functions list
# run all_derivatives and store output
for func in functions:
val, dervs = all_derivatives(func, in_vars, point)
out_vals.append(val)
out_dervs_matrix.append(dervs)
return np.array(out_vals), np.array(out_dervs_matrix)
|
[
"daniel_cox@g.harvard.edu"
] |
daniel_cox@g.harvard.edu
|
6b86d99b9ab66f3f98480428ed4b1cdb5b9e1a68
|
bfbe8a27ce6f46a7f2d03731b1de1e80cc6056c9
|
/projects/inflearn/python_algorithm/algorithm_practice_basic.py
|
03a5b5d0c00d7f3674249116b5c4116b12cda5f9
|
[] |
no_license
|
paige0701/algorithms-and-more
|
95175a18fd9d4a41659c50e3c5e314fe2bb23b8b
|
763a4009f8fa87c24552b5e77375c72896672b58
|
refs/heads/master
| 2021-06-11T04:19:29.559758
| 2021-04-07T11:29:01
| 2021-04-07T11:29:01
| 184,376,577
| 0
| 0
| null | null | null | null |
UTF-8
|
Python
| false
| false
| 6,132
|
py
|
class One:
# K๋ฒ์งธ ์ฝ์ ํ์ด
# ๋ ๊ฐ์ ์์ฐ์ N๊ณผ K๊ฐ ์ฃผ์ด์ก์ ๋ N์ ์ฝ์๋ค ์ค K ๋ฒ์งธ๋ก ์์ ์๋ฅผ ์ถ๋ ฅํ๋ผ
# K ๋ฒ์งธ๋ก ์์ ์๊ฐ ์๋ค๋ฉด -1๋ฅผ ๋ฆฌํดํ๋ค.
@staticmethod
def find_kth_divisor(n, k):
result = []
for i in range(1, n+1):
if n % i == 0:
result.append(i)
return -1 if len(result) < k else result[k - 1]
@staticmethod
def find_kth_divisor_2(n, k):
cnt = 0
for i in range(1, n+1):
if n % i == 0:
cnt += 1
if cnt == k:
return i
else:
return -1
class Two:
@staticmethod
def find_kth_smallest_number():
import sys
sys.stdin = open('k_th_smallest_number.txt', 'rt')
T = int(input())
for i in range(T):
n, s, e, k = map(int, input().split())
li = list(map(int, input().split()))
sorted_arr = sorted(li[s-1:e])
print(i+1, sorted_arr[k-1])
class Three:
@staticmethod
def find_kth_biggest_number():
"""
1๋ถํฐ 100์ฌ์์ ์์ฐ์๊ฐ ์ ํ N์ฅ์ ์นด๋๋ฅผ ๊ฐ์ง๊ณ ์๊ณ , ๊ฑฐ๊ธฐ์ 3์ฅ์ ๋ฝ์์
๊ทธ์ ํฉ์ ๊ธฐ๋กํ๊ณ ๊ทธ๊ฒ์ ์ ๋ ฌํด์ K๋ฒ์งธ ํฐ ๊ฐ์ ์ฐพ๋ ๊ฒ์ด๋ค..
"""
import sys
sys.stdin = open('kth_biggest_number.txt', 'rt')
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = set() # set์ ์ด์ฉํ ์ค๋ณต ์ ๊ฑฐ
for i in range(n):
for j in range(i+1, n):
for m in range(j+1, n):
s.add(a[i]+a[j]+a[m])
res = list(s)
res.sort(reverse=True)
print(res[k-1])
class Four:
@staticmethod
def find_rep_value():
import math
a = [65, 73, 66, 87, 92, 67, 55, 79, 75, 80]
ave = math.ceil(sum(a)/10)
min = 2147000000
score = 0
result = 0
for i, v in enumerate(a):
tmp = abs(v-ave)
if tmp < min:
min = tmp
score = v
result = i + 1
elif tmp == min:
if v > score:
score = v
result = i+1
print(ave, result)
class Five:
@staticmethod
def find_biggest_sum_from_two_dices():
n, m = 4, 6
d = {}
for i in range(1, n+1):
for j in range(1, m+1):
if i+j not in d:
d[i+j] = 1
else:
d[i+j] += 1
m = max(d.items(), key=lambda x: x[1])[1]
for i in d.items():
if i[1] == m:
print(i[0], end=' ')
print()
class Six:
@staticmethod
def digit_sum(num):
result = 0
"""
for i in str(num):
result += int(i)
return result
"""
# ์๋ฆฟ์ ๋ํ๋ ๋ฒ!!!!!!!!!!!!!!!!!!
# not changing number to string than int again
while num > 0:
result = num % 10
num = num//10
return result
def get_biggest_number_from_digit_sum(self):
import sys
sys.stdin = open('digit_sum.txt', 'rt')
n = input()
li = list(map(int, input().split()))
max = 0
for i in li:
tot = self.digit_sum(i)
if tot > max:
tot = max
res = i
""" How i did it !"""
# print(n, li)
# result = {}
# for i in li:
# result[i] = self.digit_sum(i)
# r = max(result.items(), key=lambda x: x[1])
# return r[1]
return res
class Seven:
@staticmethod
def is_prime(n):
result = True
if n < 2:
return False
if n == 2 or n == 3:
return result
for i in range(2, n): # m//2+1 ๊น์ง ํด๋ ๋จ!
if n % i == 0:
result = False
break
return result
def get_total_prime_numbers(self, num):
result = 0
for i in range(2, num+1):
if self.is_prime(i):
result += 1
print(result)
class Eight:
@staticmethod
def reverse(n):
return int(str(n)[::-1])
@staticmethod
def print_number_if_prime(n):
seven = Seven()
if seven.is_prime(n):
print(n)
class Nine:
def get_input(self):
res = 0
import sys
sys.stdin = open('nine_dice.txt', 'rt')
n = input()
for i in range(int(n)):
tmp = input().split()
tmp.sort()
a, b, c = map(int, tmp)
if a == b == c:
money = 10000 + a* 1000
elif a == b or a == c:
money = 1000 + a * 100
elif b == c:
money = 1000 + b * 100
else:
money = c * 100
if money > res:
res = money
return res
class Ten:
@staticmethod
def find_sum():
import sys
sys.stdin = open('ten.txt', 'rt')
n = int(input())
result = 0
add_on = 1
for i in list(map(int, input().split())):
if i == 1:
result += add_on
add_on += 1
elif i == 0:
add_on = 1
return result
if __name__ == '__main__':
one = One()
# print(one.find_kth_divisor_2(6, 5))
two = Two()
# two.find_kth_smallest_number()
three = Three()
# three.find_kth_biggest_number()
four = Four()
# four.find_rep_value()
five = Five()
# five.find_biggest_sum_from_two_dices()
six = Six()
# print(six.get_biggest_number_from_digit_sum())
seven = Seven()
# seven.get_total_prime_numbers(20)
eight = Eight()
# for i in [32, 55, 62, 3700, 250]:
# eight.print_number_if_prime(eight.reverse(i))
nine = Nine()
# print(nine.get_input())
ten = Ten()
print(ten.find_sum())
|
[
"paigechoi0701@gmail.com"
] |
paigechoi0701@gmail.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.