Skip to main content

nat_gateways

Creates, updates, deletes, gets or lists a nat_gateways resource.

Overview​

Namenat_gateways
TypeResource
Idoci.network.nat_gateways

Fields​

The following fields are returned by SELECT queries:

The NAT gateway was retrieved.

NameDatatypeDescription
idstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the NAT gateway.
blockTrafficbooleanWhether the NAT gateway blocks traffic through it. The default is false. Example: true
compartmentIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment that contains the NAT gateway.
definedTagsobjectDefined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](/iaas/Content/General/Concepts/resourcetags.htm). Example: {"Operations": {"CostCenter": "42"}}
displayNamestringA user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
freeformTagsobjectFree-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](/iaas/Content/General/Concepts/resourcetags.htm). Example: {"Department": "Finance"}
lifecycleStatestringThe NAT gateway's current state. (PROVISIONING, AVAILABLE, TERMINATING, TERMINATED)
natIpstringThe IP address associated with the NAT gateway.
publicIpIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the public IP address associated with the NAT gateway.
routeTableIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the route table used by the NAT gateway. If you don't specify a route table here, the NAT gateway is created without an associated route table. The Networking service does NOT automatically associate the attached VCN's default route table with the NAT gateway.
timeCreatedstring (date-time)The date and time the NAT gateway was created, in the format defined by [RFC3339](https:​//tools.ietf.org/html/rfc3339). Example: 2016-08-25T21:10:29.600Z
vcnIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the VCN the NAT gateway belongs to.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectnatGatewayId, regionGets the specified NAT gateway's information.
listselectcompartmentId, regionvcnId, limit, page, displayName, sortBy, sortOrder, lifecycleStateLists the NAT gateways in the specified compartment. You may optionally specify a VCN OCID<br />to filter the results by VCN.<br />
createinsertregion, compartmentId, vcnIdopc-retry-tokenCreates a new NAT gateway for the specified VCN. You must also set up a route rule with the<br />NAT gateway as the rule's target. See [Route Table](#/en/iaas/latest/RouteTable/).<br />
updateupdatenatGatewayId, regionif-matchUpdates the specified NAT gateway.<br />
deletedeletenatGatewayId, regionif-matchDeletes the specified NAT gateway. The NAT gateway does not have to be disabled, but there<br />must not be a route rule that lists the NAT gateway as a target.<br /><br />This is an asynchronous operation. The NAT gateway's lifecycleState will change to<br />TERMINATING temporarily until the NAT gateway is completely removed.<br />
change_compartmentexecnatGatewayId, region, compartmentIdopc-request-id, opc-retry-tokenMoves a NAT gateway into a different compartment within the same tenancy. For information<br />about moving resources between compartments, see<br />[Moving Resources to a Different Compartment](/iaas/Content/Identity/Tasks/managingcompartments.htm#moveRes).<br />

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
compartmentIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment.
natGatewayIdstringThe NAT gateway's [OCID](/iaas/Content/General/Concepts/identifiers.htm).
regionstringOCI region identifier (e.g. us-ashburn-1, ap-sydney-1); resolves from OCI_REGION when not supplied in the query. (default: us-ashburn-1, x-stackQL-envVar: OCI_REGION)
displayNamestringA filter to return only resources that match the given display name exactly.
if-matchstringFor optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.
lifecycleStatestringA filter to return only resources that match the specified lifecycle state. The value is case insensitive.
limitintegerFor list pagination. The maximum number of results per page, or items to return in a paginated "List" call. For important details about how pagination works, see [List Pagination](/iaas/Content/API/Concepts/usingapi.htm#nine). Example: 50
opc-request-idstringUnique identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
opc-retry-tokenstringA token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).
pagestringFor list pagination. The value of the opc-next-page response header from the previous "List" call. For important details about how pagination works, see [List Pagination](/iaas/Content/API/Concepts/usingapi.htm#nine).
sortBystringThe field to sort by. You can provide one sort order (sortOrder). Default order for TIMECREATED is descending. Default order for DISPLAYNAME is ascending. The DISPLAYNAME sort order is case sensitive. Note: In general, some "List" operations (for example, ListInstances) let you optionally filter by availability domain if the scope of the resource type is within a single availability domain. If you call one of these "List" operations without specifying an availability domain, the resources are grouped by availability domain, then sorted.
sortOrderstringThe sort order to use, either ascending (ASC) or descending (DESC). The DISPLAYNAME sort order is case sensitive.
vcnIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the VCN.

SELECT examples​

Gets the specified NAT gateway's information.

SELECT
id,
blockTraffic,
compartmentId,
definedTags,
displayName,
freeformTags,
lifecycleState,
natIp,
publicIpId,
routeTableId,
timeCreated,
vcnId
FROM oci.network.nat_gateways
WHERE natGatewayId = '{{ natGatewayId }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples​

Creates a new NAT gateway for the specified VCN. You must also set up a route rule with the<br />NAT gateway as the rule's target. See [Route Table](#/en/iaas/latest/RouteTable/).<br />

INSERT INTO oci.network.nat_gateways (
blockTraffic,
compartmentId,
definedTags,
displayName,
freeformTags,
publicIpId,
routeTableId,
vcnId,
region,
opc-retry-token
)
SELECT
{{ blockTraffic }},
'{{ compartmentId }}' /* required */,
'{{ definedTags }}',
'{{ displayName }}',
'{{ freeformTags }}',
'{{ publicIpId }}',
'{{ routeTableId }}',
'{{ vcnId }}' /* required */,
'{{ region }}',
'{{ opc-retry-token }}'
RETURNING
id,
blockTraffic,
compartmentId,
definedTags,
displayName,
freeformTags,
lifecycleState,
natIp,
publicIpId,
routeTableId,
timeCreated,
vcnId
;

UPDATE examples​

Updates the specified NAT gateway.<br />

UPDATE oci.network.nat_gateways
SET
blockTraffic = {{ blockTraffic }},
definedTags = '{{ definedTags }}',
displayName = '{{ displayName }}',
freeformTags = '{{ freeformTags }}',
routeTableId = '{{ routeTableId }}'
WHERE
natGatewayId = '{{ natGatewayId }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match}}'
RETURNING
id,
blockTraffic,
compartmentId,
definedTags,
displayName,
freeformTags,
lifecycleState,
natIp,
publicIpId,
routeTableId,
timeCreated,
vcnId;

DELETE examples​

Deletes the specified NAT gateway. The NAT gateway does not have to be disabled, but there<br />must not be a route rule that lists the NAT gateway as a target.<br /><br />This is an asynchronous operation. The NAT gateway's lifecycleState will change to<br />TERMINATING temporarily until the NAT gateway is completely removed.<br />

DELETE FROM oci.network.nat_gateways
WHERE natGatewayId = '{{ natGatewayId }}' --required
AND region = '{{ region }}' --required
AND if-match = '{{ if-match }}'
;

Lifecycle Methods​

Moves a NAT gateway into a different compartment within the same tenancy. For information<br />about moving resources between compartments, see<br />[Moving Resources to a Different Compartment](/iaas/Content/Identity/Tasks/managingcompartments.htm#moveRes).<br />

EXEC oci.network.nat_gateways.change_compartment
@natGatewayId='{{ natGatewayId }}' --required,
@region='{{ region }}' --required,
@opc-request-id='{{ opc-request-id }}',
@opc-retry-token='{{ opc-retry-token }}'
@@json=
'{
"compartmentId": "{{ compartmentId }}"
}'
;