Obtém todos os gateways nat em um grupo de recursos.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways?api-version=2023-09-01
Parâmetros de URI
Nome |
Em |
Obrigatório |
Tipo |
Description |
resourceGroupName
|
path |
True
|
string
|
O nome do grupo de recursos.
|
subscriptionId
|
path |
True
|
string
|
As credenciais de assinatura que identificam exclusivamente a assinatura do Microsoft Azure. A ID da assinatura faz parte do URI para cada chamada de serviço.
|
api-version
|
query |
True
|
string
|
Versão de API do cliente.
|
Respostas
Nome |
Tipo |
Description |
200 OK
|
NatGatewayListResult
|
Solicitação bem-sucedida. A operação retorna uma lista de recursos do NatGateway.
|
Other Status Codes
|
CloudError
|
Resposta de erro que descreve por que a operação falhou.
|
Segurança
azure_auth
Fluxo OAuth2 do Azure Active Directory.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nome |
Description |
user_impersonation
|
representar sua conta de usuário
|
Exemplos
List nat gateways in resource group
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/natGateways?api-version=2023-09-01
/**
* Samples for NatGateways ListByResourceGroup.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayList.json
*/
/**
* Sample code: List nat gateways in resource group.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void listNatGatewaysInResourceGroup(com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getNatGateways().listByResourceGroup("rg1",
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-network
# USAGE
python nat_gateway_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = NetworkManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.nat_gateways.list(
resource_group_name="rg1",
)
for item in response:
print(item)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayList.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armnetwork_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v5"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayList.json
func ExampleNatGatewaysClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armnetwork.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewNatGatewaysClient().NewListPager("rg1", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.NatGatewayListResult = armnetwork.NatGatewayListResult{
// Value: []*armnetwork.NatGateway{
// {
// Name: to.Ptr("test-natGateway"),
// Type: to.Ptr("Microsoft.Network/natGateways"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/natGateway/test-natGateway"),
// Location: to.Ptr("westus"),
// Properties: &armnetwork.NatGatewayPropertiesFormat{
// IdleTimeoutInMinutes: to.Ptr[int32](5),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// PublicIPAddresses: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"),
// }},
// PublicIPPrefixes: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/PublicIpPrefix1"),
// }},
// Subnets: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"),
// }},
// },
// SKU: &armnetwork.NatGatewaySKU{
// Name: to.Ptr(armnetwork.NatGatewaySKUNameStandard),
// },
// },
// {
// Name: to.Ptr("test-natGateway2"),
// Type: to.Ptr("Microsoft.Network/natGateways"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/natGateway/test-natGateway2"),
// Location: to.Ptr("westus"),
// Properties: &armnetwork.NatGatewayPropertiesFormat{
// IdleTimeoutInMinutes: to.Ptr[int32](5),
// ProvisioningState: to.Ptr(armnetwork.ProvisioningStateSucceeded),
// PublicIPAddresses: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"),
// }},
// PublicIPPrefixes: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPPrefixes/PublicIpPrefix1"),
// }},
// Subnets: []*armnetwork.SubResource{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"),
// }},
// },
// SKU: &armnetwork.NatGatewaySKU{
// Name: to.Ptr(armnetwork.NatGatewaySKUNameStandard),
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { NetworkManagementClient } = require("@azure/arm-network");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets all nat gateways in a resource group.
*
* @summary Gets all nat gateways in a resource group.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayList.json
*/
async function listNatGatewaysInResourceGroup() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.natGateways.list(resourceGroupName)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Network;
using Azure.ResourceManager.Network.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Resources.Models;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayList.json
// this example is just showing the usage of "NatGateways_List" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this NatGatewayResource
NatGatewayCollection collection = resourceGroupResource.GetNatGateways();
// invoke the operation and iterate over the result
await foreach (NatGatewayResource item in collection.GetAllAsync())
{
// the variable item is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
NatGatewayData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"value": [
{
"name": "test-natGateway",
"sku": {
"name": "Standard"
},
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/natGateway/test-natGateway",
"location": "westus",
"properties": {
"idleTimeoutInMinutes": 5,
"provisioningState": "Succeeded",
"publicIpAddresses": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"
}
],
"publicIpPrefixes": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPPrefixes/PublicIpPrefix1"
}
],
"subnets": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"
}
]
},
"type": "Microsoft.Network/natGateways"
},
{
"name": "test-natGateway2",
"sku": {
"name": "Standard"
},
"id": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/natGateway/test-natGateway2",
"location": "westus",
"properties": {
"idleTimeoutInMinutes": 5,
"provisioningState": "Succeeded",
"publicIpAddresses": [
{
"id": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPAddresses/PublicIpAddress1"
}
],
"publicIpPrefixes": [
{
"id": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPPrefixes/PublicIpPrefix1"
}
],
"subnets": [
{
"id": "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1"
}
]
},
"type": "Microsoft.Network/natGateways"
}
]
}
Definições
CloudError
Uma resposta de erro do serviço.
CloudErrorBody
Uma resposta de erro do serviço.
Nome |
Tipo |
Description |
code
|
string
|
Um identificador para o erro. Os códigos são invariáveis e devem ser consumidos programaticamente.
|
details
|
CloudErrorBody[]
|
Uma lista de detalhes adicionais sobre o erro.
|
message
|
string
|
Uma mensagem que descreve o erro, destinada a ser adequada para exibição em uma interface do usuário.
|
target
|
string
|
O destino do erro específico. Por exemplo, o nome da propriedade em erro.
|
NatGateway
Recurso de Gateway da Nat.
Nome |
Tipo |
Description |
etag
|
string
|
Uma cadeia de caracteres exclusiva somente leitura que é alterada sempre que o recurso é atualizado.
|
id
|
string
|
ID do recurso.
|
location
|
string
|
Local do recurso.
|
name
|
string
|
Nome do recurso.
|
properties.idleTimeoutInMinutes
|
integer
|
O tempo limite ocioso do gateway nat.
|
properties.provisioningState
|
ProvisioningState
|
O estado de provisionamento do recurso de gateway da NAT.
|
properties.publicIpAddresses
|
SubResource[]
|
Uma matriz de endereços IP públicos associados ao recurso de gateway nat.
|
properties.publicIpPrefixes
|
SubResource[]
|
Uma matriz de prefixos ip públicos associados ao recurso de gateway nat.
|
properties.resourceGuid
|
string
|
A propriedade GUID do recurso do gateway da NAT.
|
properties.subnets
|
SubResource[]
|
Uma matriz de referências às sub-redes usando esse recurso de gateway nat.
|
sku
|
NatGatewaySku
|
O SKU do gateway nat.
|
tags
|
object
|
Marcas de recurso.
|
type
|
string
|
Tipo de recurso.
|
zones
|
string[]
|
Uma lista de zonas de disponibilidade que denotam a zona na qual o Gateway da Nat deve ser implantado.
|
NatGatewayListResult
Resposta para a chamada de serviço da API ListNatGateways.
Nome |
Tipo |
Description |
nextLink
|
string
|
A URL para obter o próximo conjunto de resultados.
|
value
|
NatGateway[]
|
Uma lista de Gateways nat existentes em um grupo de recursos.
|
NatGatewaySku
SKU do gateway nat.
NatGatewaySkuName
Nome do SKU do Gateway da Nat.
Nome |
Tipo |
Description |
Standard
|
string
|
|
ProvisioningState
O estado de provisionamento atual.
Nome |
Tipo |
Description |
Deleting
|
string
|
|
Failed
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|
SubResource
Referência a outro sub-recurso.
Nome |
Tipo |
Description |
id
|
string
|
ID do recurso.
|