Získá zadanou bránu nat v zadané skupině prostředků.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}?api-version=2023-09-01
With optional parameters:
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}?api-version=2023-09-01&$expand={$expand}
Parametry identifikátoru URI
Name |
V |
Vyžadováno |
Typ |
Description |
natGatewayName
|
path |
True
|
string
|
Název brány nat.
|
resourceGroupName
|
path |
True
|
string
|
Název skupiny prostředků.
|
subscriptionId
|
path |
True
|
string
|
Přihlašovací údaje předplatného, které jednoznačně identifikují předplatné Microsoft Azure. ID předplatného je součástí identifikátoru URI pro každé volání služby.
|
api-version
|
query |
True
|
string
|
Verze klientského rozhraní API
|
$expand
|
query |
|
string
|
Rozbalí odkazované prostředky.
|
Odpovědi
Name |
Typ |
Description |
200 OK
|
NatGateway
|
Žádost byla úspěšná. Operace vrátí výsledný prostředek NatGateway.
|
Other Status Codes
|
CloudError
|
Chybová odpověď popisující, proč operace selhala.
|
Zabezpečení
azure_auth
Tok Azure Active Directory OAuth2
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
zosobnění uživatelského účtu
|
Příklady
Get nat gateway
Sample Request
GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/natGateways/test-natGateway?api-version=2023-09-01
/**
* Samples for NatGateways GetByResourceGroup.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayGet.json
*/
/**
* Sample code: Get nat gateway.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getNatGateway(com.azure.resourcemanager.AzureResourceManager azure) {
azure.networks().manager().serviceClient().getNatGateways().getByResourceGroupWithResponse("rg1",
"test-natGateway", null, 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_get.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.get(
resource_group_name="rg1",
nat_gateway_name="test-natGateway",
)
print(response)
# x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayGet.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/NatGatewayGet.json
func ExampleNatGatewaysClient_Get() {
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)
}
res, err := clientFactory.NewNatGatewaysClient().Get(ctx, "rg1", "test-natGateway", &armnetwork.NatGatewaysClientGetOptions{Expand: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.NatGateway = armnetwork.NatGateway{
// Name: to.Ptr("test-natGateway"),
// Type: to.Ptr("Microsoft.Network/natGateways"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/natGateways/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),
// },
// }
}
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 the specified nat gateway in a specified resource group.
*
* @summary Gets the specified nat gateway in a specified resource group.
* x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayGet.json
*/
async function getNatGateway() {
const subscriptionId = process.env["NETWORK_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["NETWORK_RESOURCE_GROUP"] || "rg1";
const natGatewayName = "test-natGateway";
const credential = new DefaultAzureCredential();
const client = new NetworkManagementClient(credential, subscriptionId);
const result = await client.natGateways.get(resourceGroupName, natGatewayName);
console.log(result);
}
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;
// Generated from example definition: specification/network/resource-manager/Microsoft.Network/stable/2023-09-01/examples/NatGatewayGet.json
// this example is just showing the usage of "NatGateways_Get" 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 NatGatewayResource created on azure
// for more information of creating NatGatewayResource, please refer to the document of NatGatewayResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string natGatewayName = "test-natGateway";
ResourceIdentifier natGatewayResourceId = NatGatewayResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, natGatewayName);
NatGatewayResource natGateway = client.GetNatGatewayResource(natGatewayResourceId);
// invoke the operation
NatGatewayResource result = await natGateway.GetAsync();
// the variable result 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 = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
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
{
"name": "test-natGateway",
"sku": {
"name": "Standard"
},
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/natGateways/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"
}
Definice
CloudError
Chybová odpověď ze služby.
Name |
Typ |
Description |
error
|
CloudErrorBody
|
Text chyby cloudu
|
CloudErrorBody
Chybová odpověď ze služby.
Name |
Typ |
Description |
code
|
string
|
Identifikátor chyby. Kódy jsou invariantní a mají být využívány programově.
|
details
|
CloudErrorBody[]
|
Seznam dalších podrobností o chybě
|
message
|
string
|
Zpráva popisující chybu, která má být vhodná pro zobrazení v uživatelském rozhraní.
|
target
|
string
|
Cíl konkrétní chyby. Například název vlastnosti v chybě.
|
NatGateway
Prostředek služby Nat Gateway.
Name |
Typ |
Description |
etag
|
string
|
Jedinečný řetězec jen pro čtení, který se mění při každé aktualizaci prostředku.
|
id
|
string
|
ID prostředku.
|
location
|
string
|
Umístění prostředku.
|
name
|
string
|
Název prostředku.
|
properties.idleTimeoutInMinutes
|
integer
|
Časový limit nečinnosti brány nat.
|
properties.provisioningState
|
ProvisioningState
|
Stav zřizování prostředku služby NAT Gateway.
|
properties.publicIpAddresses
|
SubResource[]
|
Pole veřejných IP adres přidružených k prostředku nat Gateway.
|
properties.publicIpPrefixes
|
SubResource[]
|
Pole předpon veřejných IP adres přidružených k prostředku nat Gateway.
|
properties.resourceGuid
|
string
|
Vlastnost guid prostředku služby NAT Gateway
|
properties.subnets
|
SubResource[]
|
Pole odkazů na podsítě používající tento prostředek služby Nat Gateway.
|
sku
|
NatGatewaySku
|
Skladová položka služby Nat Gateway.
|
tags
|
object
|
Značky prostředků.
|
type
|
string
|
Typ prostředku.
|
zones
|
string[]
|
Seznam zón dostupnosti označující zónu, ve které se má služba Nat Gateway nasadit.
|
NatGatewaySku
Skladová položka služby Nat Gateway.
Name |
Typ |
Description |
name
|
NatGatewaySkuName
|
Název skladové položky Služby Nat Gateway.
|
NatGatewaySkuName
Název skladové položky Služby Nat Gateway.
Name |
Typ |
Description |
Standard
|
string
|
|
ProvisioningState
Aktuální stav zřizování.
Name |
Typ |
Description |
Deleting
|
string
|
|
Failed
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|
SubResource
Odkaz na jiný dílčí zdroj.
Name |
Typ |
Description |
id
|
string
|
ID prostředku.
|