Создайте или обновите профиль диспетчера трафика.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}?api-version=2022-04-01
Параметры URI
Имя |
В |
Обязательно |
Тип |
Описание |
profileName
|
path |
True
|
string
|
Имя профиля диспетчера трафика.
|
resourceGroupName
|
path |
True
|
string
|
Имя группы ресурсов. Регистр букв в имени не учитывается.
|
subscriptionId
|
path |
True
|
string
|
Возвращает учетные данные подписки, которые уникально идентифицируют подписку Microsoft Azure. Идентификатор подписки формирует часть URI для каждого вызова службы.
|
api-version
|
query |
True
|
string
|
Версия API клиента.
|
Текст запроса
Имя |
Тип |
Описание |
id
|
string
|
Полный идентификатор ресурса для ресурса. Пример : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}
|
location
|
string
|
Регион Azure, в котором находится ресурс
|
name
|
string
|
Имя ресурса.
|
properties.allowedEndpointRecordTypes
|
AllowedEndpointRecordType[]
|
Список разрешенных типов записей конечной точки.
|
properties.dnsConfig
|
DnsConfig
|
Параметры DNS профиля диспетчера трафика.
|
properties.endpoints
|
Endpoint[]
|
Список конечных точек в профиле диспетчера трафика.
|
properties.maxReturn
|
integer
|
Максимальное количество конечных точек, возвращаемых для типа маршрутизации MultiValue.
|
properties.monitorConfig
|
MonitorConfig
|
Параметры мониторинга конечной точки профиля диспетчера трафика.
|
properties.profileStatus
|
ProfileStatus
|
Состояние профиля диспетчера трафика.
|
properties.trafficRoutingMethod
|
TrafficRoutingMethod
|
Метод маршрутизации трафика профиля диспетчера трафика.
|
properties.trafficViewEnrollmentStatus
|
TrafficViewEnrollmentStatus
|
Указывает, является ли представление трафика включенным или отключенным для профиля диспетчера трафика. Null, означает "Отключено". Включение этой функции приведет к увеличению стоимости профиля управления трафиком.
|
tags
|
object
|
Теги ресурсов.
|
type
|
string
|
Тип ресурса. Например, Microsoft.Network/trafficManagerProfiles.
|
Ответы
Имя |
Тип |
Описание |
200 OK
|
Profile
|
Созданный или обновленный профиль диспетчера трафика.
|
201 Created
|
Profile
|
Созданный или обновленный профиль диспетчера трафика.
|
Other Status Codes
|
CloudError
|
Ответ по умолчанию. Он будет десериализоваться согласно определению Error.
|
Безопасность
azure_auth
Поток OAuth2 в Azure Active Directory
Тип:
oauth2
Flow:
implicit
URL-адрес авторизации:
https://login.microsoftonline.com/common/oauth2/authorize
Области
Имя |
Описание |
user_impersonation
|
олицетворения учетной записи пользователя
|
Примеры
Profile-PUT-MultiValue
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1421/providers/Microsoft.Network/trafficmanagerprofiles/azsmnet6386?api-version=2022-04-01
{
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "MultiValue",
"dnsConfig": {
"relativeName": "azsmnet6386",
"ttl": 35
},
"monitorConfig": {
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx"
},
"trafficViewEnrollmentStatus": "Disabled",
"maxReturn": 2
},
"location": "global"
}
import com.azure.resourcemanager.trafficmanager.fluent.models.ProfileInner;
import com.azure.resourcemanager.trafficmanager.models.DnsConfig;
import com.azure.resourcemanager.trafficmanager.models.MonitorConfig;
import com.azure.resourcemanager.trafficmanager.models.MonitorProtocol;
import com.azure.resourcemanager.trafficmanager.models.ProfileStatus;
import com.azure.resourcemanager.trafficmanager.models.TrafficRoutingMethod;
import com.azure.resourcemanager.trafficmanager.models.TrafficViewEnrollmentStatus;
/**
* Samples for Profiles CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-MultiValue
* .json
*/
/**
* Sample code: Profile-PUT-MultiValue.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void profilePUTMultiValue(com.azure.resourcemanager.AzureResourceManager azure) {
azure.trafficManagerProfiles().manager().serviceClient().getProfiles().createOrUpdateWithResponse(
"azuresdkfornetautoresttrafficmanager1421", "azsmnet6386",
new ProfileInner().withLocation("global").withProfileStatus(ProfileStatus.ENABLED)
.withTrafficRoutingMethod(TrafficRoutingMethod.MULTI_VALUE)
.withDnsConfig(new DnsConfig().withRelativeName("azsmnet6386").withTtl(35L))
.withMonitorConfig(
new MonitorConfig().withProtocol(MonitorProtocol.HTTP).withPort(80L).withPath("/testpath.aspx"))
.withTrafficViewEnrollmentStatus(TrafficViewEnrollmentStatus.DISABLED).withMaxReturn(2L),
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.trafficmanager import TrafficManagerManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-trafficmanager
# USAGE
python profile_put_multi_value.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 = TrafficManagerManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.profiles.create_or_update(
resource_group_name="azuresdkfornetautoresttrafficmanager1421",
profile_name="azsmnet6386",
parameters={
"location": "global",
"properties": {
"dnsConfig": {"relativeName": "azsmnet6386", "ttl": 35},
"maxReturn": 2,
"monitorConfig": {"path": "/testpath.aspx", "port": 80, "protocol": "HTTP"},
"profileStatus": "Enabled",
"trafficRoutingMethod": "MultiValue",
"trafficViewEnrollmentStatus": "Disabled",
},
},
)
print(response)
# x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-MultiValue.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 armtrafficmanager_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trafficmanager/armtrafficmanager"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-MultiValue.json
func ExampleProfilesClient_CreateOrUpdate_profilePutMultiValue() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armtrafficmanager.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewProfilesClient().CreateOrUpdate(ctx, "azuresdkfornetautoresttrafficmanager1421", "azsmnet6386", armtrafficmanager.Profile{
Location: to.Ptr("global"),
Properties: &armtrafficmanager.ProfileProperties{
DNSConfig: &armtrafficmanager.DNSConfig{
RelativeName: to.Ptr("azsmnet6386"),
TTL: to.Ptr[int64](35),
},
MaxReturn: to.Ptr[int64](2),
MonitorConfig: &armtrafficmanager.MonitorConfig{
Path: to.Ptr("/testpath.aspx"),
Port: to.Ptr[int64](80),
Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
},
ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodMultiValue),
TrafficViewEnrollmentStatus: to.Ptr(armtrafficmanager.TrafficViewEnrollmentStatusDisabled),
},
}, 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.Profile = armtrafficmanager.Profile{
// Name: to.Ptr("azsmnet6386"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1421/providers/Microsoft.Network/trafficManagerProfiles/azsmnet6386"),
// Location: to.Ptr("global"),
// Properties: &armtrafficmanager.ProfileProperties{
// DNSConfig: &armtrafficmanager.DNSConfig{
// Fqdn: to.Ptr("azsmnet6386.tmpreview.watmtest.azure-test.net"),
// RelativeName: to.Ptr("azsmnet6386"),
// TTL: to.Ptr[int64](35),
// },
// Endpoints: []*armtrafficmanager.Endpoint{
// },
// MaxReturn: to.Ptr[int64](2),
// MonitorConfig: &armtrafficmanager.MonitorConfig{
// Path: to.Ptr("/testpath.aspx"),
// IntervalInSeconds: to.Ptr[int64](30),
// Port: to.Ptr[int64](80),
// ProfileMonitorStatus: to.Ptr(armtrafficmanager.ProfileMonitorStatusInactive),
// TimeoutInSeconds: to.Ptr[int64](10),
// ToleratedNumberOfFailures: to.Ptr[int64](3),
// Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
// },
// ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
// TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodMultiValue),
// TrafficViewEnrollmentStatus: to.Ptr(armtrafficmanager.TrafficViewEnrollmentStatusDisabled),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { TrafficManagerManagementClient } = require("@azure/arm-trafficmanager");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a Traffic Manager profile.
*
* @summary Create or update a Traffic Manager profile.
* x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-MultiValue.json
*/
async function profilePutMultiValue() {
const subscriptionId = process.env["TRAFFICMANAGER_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName =
process.env["TRAFFICMANAGER_RESOURCE_GROUP"] || "azuresdkfornetautoresttrafficmanager1421";
const profileName = "azsmnet6386";
const parameters = {
dnsConfig: { relativeName: "azsmnet6386", ttl: 35 },
location: "global",
maxReturn: 2,
monitorConfig: { path: "/testpath.aspx", port: 80, protocol: "HTTP" },
profileStatus: "Enabled",
trafficRoutingMethod: "MultiValue",
trafficViewEnrollmentStatus: "Disabled",
};
const credential = new DefaultAzureCredential();
const client = new TrafficManagerManagementClient(credential, subscriptionId);
const result = await client.profiles.createOrUpdate(resourceGroupName, profileName, parameters);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.TrafficManager.Models;
using Azure.ResourceManager.TrafficManager;
// Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-MultiValue.json
// this example is just showing the usage of "Profiles_CreateOrUpdate" 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 = "{subscription-id}";
string resourceGroupName = "azuresdkfornetautoresttrafficmanager1421";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this TrafficManagerProfileResource
TrafficManagerProfileCollection collection = resourceGroupResource.GetTrafficManagerProfiles();
// invoke the operation
string profileName = "azsmnet6386";
TrafficManagerProfileData data = new TrafficManagerProfileData()
{
ProfileStatus = TrafficManagerProfileStatus.Enabled,
TrafficRoutingMethod = TrafficRoutingMethod.MultiValue,
DnsConfig = new TrafficManagerDnsConfig()
{
RelativeName = "azsmnet6386",
Ttl = 35,
},
MonitorConfig = new TrafficManagerMonitorConfig()
{
Protocol = TrafficManagerMonitorProtocol.Http,
Port = 80,
Path = "/testpath.aspx",
},
TrafficViewEnrollmentStatus = TrafficViewEnrollmentStatus.Disabled,
MaxReturn = 2,
Location = new AzureLocation("global"),
};
ArmOperation<TrafficManagerProfileResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, profileName, data);
TrafficManagerProfileResource result = lro.Value;
// 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
TrafficManagerProfileData 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
Пример ответа
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1421/providers/Microsoft.Network/trafficManagerProfiles/azsmnet6386",
"name": "azsmnet6386",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "MultiValue",
"dnsConfig": {
"relativeName": "azsmnet6386",
"fqdn": "azsmnet6386.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "Inactive",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 30,
"toleratedNumberOfFailures": 3,
"timeoutInSeconds": 10
},
"trafficViewEnrollmentStatus": "Disabled",
"maxReturn": 2,
"endpoints": []
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1421/providers/Microsoft.Network/trafficManagerProfiles/azsmnet6386",
"name": "azsmnet6386",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "MultiValue",
"dnsConfig": {
"relativeName": "azsmnet6386",
"fqdn": "azsmnet6386.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "Inactive",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 30,
"toleratedNumberOfFailures": 3,
"timeoutInSeconds": 10
},
"trafficViewEnrollmentStatus": "Disabled",
"maxReturn": 2,
"endpoints": []
}
}
Profile-PUT-NoEndpoints
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1421/providers/Microsoft.Network/trafficmanagerprofiles/azsmnet6386?api-version=2022-04-01
{
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azsmnet6386",
"ttl": 35
},
"monitorConfig": {
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx"
}
},
"location": "global"
}
import com.azure.resourcemanager.trafficmanager.fluent.models.ProfileInner;
import com.azure.resourcemanager.trafficmanager.models.DnsConfig;
import com.azure.resourcemanager.trafficmanager.models.MonitorConfig;
import com.azure.resourcemanager.trafficmanager.models.MonitorProtocol;
import com.azure.resourcemanager.trafficmanager.models.ProfileStatus;
import com.azure.resourcemanager.trafficmanager.models.TrafficRoutingMethod;
/**
* Samples for Profiles CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-
* NoEndpoints.json
*/
/**
* Sample code: Profile-PUT-NoEndpoints.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void profilePUTNoEndpoints(com.azure.resourcemanager.AzureResourceManager azure) {
azure.trafficManagerProfiles().manager().serviceClient().getProfiles().createOrUpdateWithResponse(
"azuresdkfornetautoresttrafficmanager1421", "azsmnet6386",
new ProfileInner().withLocation("global").withProfileStatus(ProfileStatus.ENABLED)
.withTrafficRoutingMethod(TrafficRoutingMethod.PERFORMANCE)
.withDnsConfig(new DnsConfig().withRelativeName("azsmnet6386").withTtl(35L)).withMonitorConfig(
new MonitorConfig().withProtocol(MonitorProtocol.HTTP).withPort(80L).withPath("/testpath.aspx")),
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.trafficmanager import TrafficManagerManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-trafficmanager
# USAGE
python profile_put_no_endpoints.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 = TrafficManagerManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.profiles.create_or_update(
resource_group_name="azuresdkfornetautoresttrafficmanager1421",
profile_name="azsmnet6386",
parameters={
"location": "global",
"properties": {
"dnsConfig": {"relativeName": "azsmnet6386", "ttl": 35},
"monitorConfig": {"path": "/testpath.aspx", "port": 80, "protocol": "HTTP"},
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
},
},
)
print(response)
# x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-NoEndpoints.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 armtrafficmanager_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trafficmanager/armtrafficmanager"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-NoEndpoints.json
func ExampleProfilesClient_CreateOrUpdate_profilePutNoEndpoints() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armtrafficmanager.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewProfilesClient().CreateOrUpdate(ctx, "azuresdkfornetautoresttrafficmanager1421", "azsmnet6386", armtrafficmanager.Profile{
Location: to.Ptr("global"),
Properties: &armtrafficmanager.ProfileProperties{
DNSConfig: &armtrafficmanager.DNSConfig{
RelativeName: to.Ptr("azsmnet6386"),
TTL: to.Ptr[int64](35),
},
MonitorConfig: &armtrafficmanager.MonitorConfig{
Path: to.Ptr("/testpath.aspx"),
Port: to.Ptr[int64](80),
Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
},
ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodPerformance),
},
}, 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.Profile = armtrafficmanager.Profile{
// Name: to.Ptr("azsmnet6386"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1421/providers/Microsoft.Network/trafficManagerProfiles/azsmnet6386"),
// Location: to.Ptr("global"),
// Properties: &armtrafficmanager.ProfileProperties{
// DNSConfig: &armtrafficmanager.DNSConfig{
// Fqdn: to.Ptr("azsmnet6386.tmpreview.watmtest.azure-test.net"),
// RelativeName: to.Ptr("azsmnet6386"),
// TTL: to.Ptr[int64](35),
// },
// Endpoints: []*armtrafficmanager.Endpoint{
// },
// MonitorConfig: &armtrafficmanager.MonitorConfig{
// Path: to.Ptr("/testpath.aspx"),
// IntervalInSeconds: to.Ptr[int64](30),
// Port: to.Ptr[int64](80),
// ProfileMonitorStatus: to.Ptr(armtrafficmanager.ProfileMonitorStatusInactive),
// TimeoutInSeconds: to.Ptr[int64](10),
// ToleratedNumberOfFailures: to.Ptr[int64](3),
// Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
// },
// ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
// TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodPerformance),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { TrafficManagerManagementClient } = require("@azure/arm-trafficmanager");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a Traffic Manager profile.
*
* @summary Create or update a Traffic Manager profile.
* x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-NoEndpoints.json
*/
async function profilePutNoEndpoints() {
const subscriptionId = process.env["TRAFFICMANAGER_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName =
process.env["TRAFFICMANAGER_RESOURCE_GROUP"] || "azuresdkfornetautoresttrafficmanager1421";
const profileName = "azsmnet6386";
const parameters = {
dnsConfig: { relativeName: "azsmnet6386", ttl: 35 },
location: "global",
monitorConfig: { path: "/testpath.aspx", port: 80, protocol: "HTTP" },
profileStatus: "Enabled",
trafficRoutingMethod: "Performance",
};
const credential = new DefaultAzureCredential();
const client = new TrafficManagerManagementClient(credential, subscriptionId);
const result = await client.profiles.createOrUpdate(resourceGroupName, profileName, parameters);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.TrafficManager.Models;
using Azure.ResourceManager.TrafficManager;
// Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-NoEndpoints.json
// this example is just showing the usage of "Profiles_CreateOrUpdate" 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 = "{subscription-id}";
string resourceGroupName = "azuresdkfornetautoresttrafficmanager1421";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this TrafficManagerProfileResource
TrafficManagerProfileCollection collection = resourceGroupResource.GetTrafficManagerProfiles();
// invoke the operation
string profileName = "azsmnet6386";
TrafficManagerProfileData data = new TrafficManagerProfileData()
{
ProfileStatus = TrafficManagerProfileStatus.Enabled,
TrafficRoutingMethod = TrafficRoutingMethod.Performance,
DnsConfig = new TrafficManagerDnsConfig()
{
RelativeName = "azsmnet6386",
Ttl = 35,
},
MonitorConfig = new TrafficManagerMonitorConfig()
{
Protocol = TrafficManagerMonitorProtocol.Http,
Port = 80,
Path = "/testpath.aspx",
},
Location = new AzureLocation("global"),
};
ArmOperation<TrafficManagerProfileResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, profileName, data);
TrafficManagerProfileResource result = lro.Value;
// 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
TrafficManagerProfileData 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
Пример ответа
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1421/providers/Microsoft.Network/trafficManagerProfiles/azsmnet6386",
"name": "azsmnet6386",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azsmnet6386",
"fqdn": "azsmnet6386.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "Inactive",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 30,
"toleratedNumberOfFailures": 3,
"timeoutInSeconds": 10
},
"endpoints": []
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1421/providers/Microsoft.Network/trafficManagerProfiles/azsmnet6386",
"name": "azsmnet6386",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azsmnet6386",
"fqdn": "azsmnet6386.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "Inactive",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 30,
"toleratedNumberOfFailures": 3,
"timeoutInSeconds": 10
},
"endpoints": []
}
}
Profile-PUT-WithAliasing
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficmanagerprofiles/azuresdkfornetautoresttrafficmanager6192?api-version=2022-04-01
{
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azuresdkfornetautoresttrafficmanager6192",
"ttl": 35
},
"monitorConfig": {
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 10,
"timeoutInSeconds": 5,
"toleratedNumberOfFailures": 2
},
"allowedEndpointRecordTypes": [
"DomainName"
],
"endpoints": [
{
"name": "My external endpoint",
"type": "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
"properties": {
"target": "foobar.contoso.com",
"endpointStatus": "Enabled",
"endpointLocation": "North Europe"
}
}
]
},
"location": "global"
}
import com.azure.resourcemanager.trafficmanager.fluent.models.EndpointInner;
import com.azure.resourcemanager.trafficmanager.fluent.models.ProfileInner;
import com.azure.resourcemanager.trafficmanager.models.AllowedEndpointRecordType;
import com.azure.resourcemanager.trafficmanager.models.DnsConfig;
import com.azure.resourcemanager.trafficmanager.models.EndpointStatus;
import com.azure.resourcemanager.trafficmanager.models.MonitorConfig;
import com.azure.resourcemanager.trafficmanager.models.MonitorProtocol;
import com.azure.resourcemanager.trafficmanager.models.ProfileStatus;
import com.azure.resourcemanager.trafficmanager.models.TrafficRoutingMethod;
import java.util.Arrays;
/**
* Samples for Profiles CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-
* WithAliasing.json
*/
/**
* Sample code: Profile-PUT-WithAliasing.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void profilePUTWithAliasing(com.azure.resourcemanager.AzureResourceManager azure) {
azure.trafficManagerProfiles().manager().serviceClient().getProfiles().createOrUpdateWithResponse(
"azuresdkfornetautoresttrafficmanager2583", "azuresdkfornetautoresttrafficmanager6192",
new ProfileInner().withLocation("global").withProfileStatus(ProfileStatus.ENABLED)
.withTrafficRoutingMethod(TrafficRoutingMethod.PERFORMANCE)
.withDnsConfig(
new DnsConfig().withRelativeName("azuresdkfornetautoresttrafficmanager6192").withTtl(35L))
.withMonitorConfig(
new MonitorConfig().withProtocol(MonitorProtocol.HTTP).withPort(80L).withPath("/testpath.aspx")
.withIntervalInSeconds(10L).withTimeoutInSeconds(5L).withToleratedNumberOfFailures(2L))
.withEndpoints(Arrays.asList(new EndpointInner().withName("My external endpoint")
.withType("Microsoft.network/TrafficManagerProfiles/ExternalEndpoints")
.withTarget("foobar.contoso.com").withEndpointStatus(EndpointStatus.ENABLED)
.withEndpointLocation("North Europe")))
.withAllowedEndpointRecordTypes(Arrays.asList(AllowedEndpointRecordType.DOMAIN_NAME)),
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.trafficmanager import TrafficManagerManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-trafficmanager
# USAGE
python profile_put_with_aliasing.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 = TrafficManagerManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.profiles.create_or_update(
resource_group_name="azuresdkfornetautoresttrafficmanager2583",
profile_name="azuresdkfornetautoresttrafficmanager6192",
parameters={
"location": "global",
"properties": {
"allowedEndpointRecordTypes": ["DomainName"],
"dnsConfig": {"relativeName": "azuresdkfornetautoresttrafficmanager6192", "ttl": 35},
"endpoints": [
{
"name": "My external endpoint",
"properties": {
"endpointLocation": "North Europe",
"endpointStatus": "Enabled",
"target": "foobar.contoso.com",
},
"type": "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
}
],
"monitorConfig": {
"intervalInSeconds": 10,
"path": "/testpath.aspx",
"port": 80,
"protocol": "HTTP",
"timeoutInSeconds": 5,
"toleratedNumberOfFailures": 2,
},
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
},
},
)
print(response)
# x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithAliasing.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 armtrafficmanager_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trafficmanager/armtrafficmanager"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithAliasing.json
func ExampleProfilesClient_CreateOrUpdate_profilePutWithAliasing() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armtrafficmanager.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewProfilesClient().CreateOrUpdate(ctx, "azuresdkfornetautoresttrafficmanager2583", "azuresdkfornetautoresttrafficmanager6192", armtrafficmanager.Profile{
Location: to.Ptr("global"),
Properties: &armtrafficmanager.ProfileProperties{
AllowedEndpointRecordTypes: []*armtrafficmanager.AllowedEndpointRecordType{
to.Ptr(armtrafficmanager.AllowedEndpointRecordTypeDomainName)},
DNSConfig: &armtrafficmanager.DNSConfig{
RelativeName: to.Ptr("azuresdkfornetautoresttrafficmanager6192"),
TTL: to.Ptr[int64](35),
},
Endpoints: []*armtrafficmanager.Endpoint{
{
Name: to.Ptr("My external endpoint"),
Type: to.Ptr("Microsoft.network/TrafficManagerProfiles/ExternalEndpoints"),
Properties: &armtrafficmanager.EndpointProperties{
EndpointLocation: to.Ptr("North Europe"),
EndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),
Target: to.Ptr("foobar.contoso.com"),
},
}},
MonitorConfig: &armtrafficmanager.MonitorConfig{
Path: to.Ptr("/testpath.aspx"),
IntervalInSeconds: to.Ptr[int64](10),
Port: to.Ptr[int64](80),
TimeoutInSeconds: to.Ptr[int64](5),
ToleratedNumberOfFailures: to.Ptr[int64](2),
Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
},
ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodPerformance),
},
}, 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.Profile = armtrafficmanager.Profile{
// Name: to.Ptr("azuresdkfornetautoresttrafficmanager6192"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192"),
// Location: to.Ptr("global"),
// Properties: &armtrafficmanager.ProfileProperties{
// AllowedEndpointRecordTypes: []*armtrafficmanager.AllowedEndpointRecordType{
// to.Ptr(armtrafficmanager.AllowedEndpointRecordTypeDomainName)},
// DNSConfig: &armtrafficmanager.DNSConfig{
// Fqdn: to.Ptr("azuresdkfornetautoresttrafficmanager6192.tmpreview.watmtest.azure-test.net"),
// RelativeName: to.Ptr("azuresdkfornetautoresttrafficmanager6192"),
// TTL: to.Ptr[int64](35),
// },
// Endpoints: []*armtrafficmanager.Endpoint{
// {
// Name: to.Ptr("My external endpoint"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles/externalEndpoints"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192/externalEndpoints/My external endpoint"),
// Properties: &armtrafficmanager.EndpointProperties{
// CustomHeaders: []*armtrafficmanager.EndpointPropertiesCustomHeadersItem{
// {
// Name: to.Ptr("header-2"),
// Value: to.Ptr("value-2-overridden"),
// }},
// EndpointLocation: to.Ptr("North Europe"),
// EndpointMonitorStatus: to.Ptr(armtrafficmanager.EndpointMonitorStatusCheckingEndpoint),
// EndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),
// Priority: to.Ptr[int64](1),
// Target: to.Ptr("foobar.contoso.com"),
// Weight: to.Ptr[int64](1),
// },
// }},
// MonitorConfig: &armtrafficmanager.MonitorConfig{
// Path: to.Ptr("/testpath.aspx"),
// CustomHeaders: []*armtrafficmanager.MonitorConfigCustomHeadersItem{
// {
// Name: to.Ptr("header-1"),
// Value: to.Ptr("value-1"),
// },
// {
// Name: to.Ptr("header-2"),
// Value: to.Ptr("value-2"),
// }},
// IntervalInSeconds: to.Ptr[int64](10),
// Port: to.Ptr[int64](80),
// ProfileMonitorStatus: to.Ptr(armtrafficmanager.ProfileMonitorStatusCheckingEndpoints),
// TimeoutInSeconds: to.Ptr[int64](5),
// ToleratedNumberOfFailures: to.Ptr[int64](2),
// Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
// },
// ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
// TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodPerformance),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { TrafficManagerManagementClient } = require("@azure/arm-trafficmanager");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a Traffic Manager profile.
*
* @summary Create or update a Traffic Manager profile.
* x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithAliasing.json
*/
async function profilePutWithAliasing() {
const subscriptionId = process.env["TRAFFICMANAGER_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName =
process.env["TRAFFICMANAGER_RESOURCE_GROUP"] || "azuresdkfornetautoresttrafficmanager2583";
const profileName = "azuresdkfornetautoresttrafficmanager6192";
const parameters = {
allowedEndpointRecordTypes: ["DomainName"],
dnsConfig: {
relativeName: "azuresdkfornetautoresttrafficmanager6192",
ttl: 35,
},
endpoints: [
{
name: "My external endpoint",
type: "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
endpointLocation: "North Europe",
endpointStatus: "Enabled",
target: "foobar.contoso.com",
},
],
location: "global",
monitorConfig: {
path: "/testpath.aspx",
intervalInSeconds: 10,
port: 80,
timeoutInSeconds: 5,
toleratedNumberOfFailures: 2,
protocol: "HTTP",
},
profileStatus: "Enabled",
trafficRoutingMethod: "Performance",
};
const credential = new DefaultAzureCredential();
const client = new TrafficManagerManagementClient(credential, subscriptionId);
const result = await client.profiles.createOrUpdate(resourceGroupName, profileName, parameters);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.TrafficManager.Models;
using Azure.ResourceManager.TrafficManager;
// Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithAliasing.json
// this example is just showing the usage of "Profiles_CreateOrUpdate" 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 = "{subscription-id}";
string resourceGroupName = "azuresdkfornetautoresttrafficmanager2583";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this TrafficManagerProfileResource
TrafficManagerProfileCollection collection = resourceGroupResource.GetTrafficManagerProfiles();
// invoke the operation
string profileName = "azuresdkfornetautoresttrafficmanager6192";
TrafficManagerProfileData data = new TrafficManagerProfileData()
{
ProfileStatus = TrafficManagerProfileStatus.Enabled,
TrafficRoutingMethod = TrafficRoutingMethod.Performance,
DnsConfig = new TrafficManagerDnsConfig()
{
RelativeName = "azuresdkfornetautoresttrafficmanager6192",
Ttl = 35,
},
MonitorConfig = new TrafficManagerMonitorConfig()
{
Protocol = TrafficManagerMonitorProtocol.Http,
Port = 80,
Path = "/testpath.aspx",
IntervalInSeconds = 10,
TimeoutInSeconds = 5,
ToleratedNumberOfFailures = 2,
},
Endpoints =
{
new TrafficManagerEndpointData()
{
Target = "foobar.contoso.com",
EndpointStatus = TrafficManagerEndpointStatus.Enabled,
EndpointLocation = "North Europe",
Name = "My external endpoint",
ResourceType = new ResourceType("Microsoft.network/TrafficManagerProfiles/ExternalEndpoints"),
}
},
AllowedEndpointRecordTypes =
{
AllowedEndpointRecordType.DomainName
},
Location = new AzureLocation("global"),
};
ArmOperation<TrafficManagerProfileResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, profileName, data);
TrafficManagerProfileResource result = lro.Value;
// 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
TrafficManagerProfileData 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
Пример ответа
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192",
"name": "azuresdkfornetautoresttrafficmanager6192",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azuresdkfornetautoresttrafficmanager6192",
"fqdn": "azuresdkfornetautoresttrafficmanager6192.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "CheckingEndpoints",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 10,
"toleratedNumberOfFailures": 2,
"timeoutInSeconds": 5,
"customHeaders": [
{
"name": "header-1",
"value": "value-1"
},
{
"name": "header-2",
"value": "value-2"
}
]
},
"allowedEndpointRecordTypes": [
"DomainName"
],
"endpoints": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192/externalEndpoints/My external endpoint",
"name": "My external endpoint",
"type": "Microsoft.Network/trafficManagerProfiles/externalEndpoints",
"properties": {
"endpointStatus": "Enabled",
"endpointMonitorStatus": "CheckingEndpoint",
"target": "foobar.contoso.com",
"weight": 1,
"priority": 1,
"endpointLocation": "North Europe",
"customHeaders": [
{
"name": "header-2",
"value": "value-2-overridden"
}
]
}
}
]
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192",
"name": "azuresdkfornetautoresttrafficmanager6192",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azuresdkfornetautoresttrafficmanager6192",
"fqdn": "azuresdkfornetautoresttrafficmanager6192.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "CheckingEndpoints",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 10,
"toleratedNumberOfFailures": 2,
"timeoutInSeconds": 5,
"customHeaders": [
{
"name": "header-1",
"value": "value-1"
},
{
"name": "header-2",
"value": "value-2"
}
]
},
"allowedEndpointRecordTypes": [
"DomainName"
],
"endpoints": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192/externalEndpoints/My external endpoint",
"name": "My external endpoint",
"type": "Microsoft.Network/trafficManagerProfiles/externalEndpoints",
"properties": {
"endpointStatus": "Enabled",
"endpointMonitorStatus": "CheckingEndpoint",
"target": "foobar.contoso.com",
"weight": 1,
"priority": 1,
"endpointLocation": "North Europe",
"customHeaders": [
{
"name": "header-2",
"value": "value-2-overridden"
}
]
}
}
]
}
}
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficmanagerprofiles/azuresdkfornetautoresttrafficmanager6192?api-version=2022-04-01
{
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azuresdkfornetautoresttrafficmanager6192",
"ttl": 35
},
"monitorConfig": {
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 10,
"timeoutInSeconds": 5,
"toleratedNumberOfFailures": 2,
"customHeaders": [
{
"name": "header-1",
"value": "value-1"
},
{
"name": "header-2",
"value": "value-2"
}
],
"expectedStatusCodeRanges": [
{
"min": 200,
"max": 205
},
{
"min": 400,
"max": 410
}
]
},
"trafficViewEnrollmentStatus": "Disabled",
"endpoints": [
{
"name": "My external endpoint",
"type": "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
"properties": {
"target": "foobar.contoso.com",
"endpointStatus": "Enabled",
"endpointLocation": "North Europe",
"customHeaders": [
{
"name": "header-2",
"value": "value-2-overridden"
}
]
}
}
]
},
"location": "global"
}
import com.azure.resourcemanager.trafficmanager.fluent.models.EndpointInner;
import com.azure.resourcemanager.trafficmanager.fluent.models.ProfileInner;
import com.azure.resourcemanager.trafficmanager.models.DnsConfig;
import com.azure.resourcemanager.trafficmanager.models.EndpointPropertiesCustomHeadersItem;
import com.azure.resourcemanager.trafficmanager.models.EndpointStatus;
import com.azure.resourcemanager.trafficmanager.models.MonitorConfig;
import com.azure.resourcemanager.trafficmanager.models.MonitorConfigCustomHeadersItem;
import com.azure.resourcemanager.trafficmanager.models.MonitorConfigExpectedStatusCodeRangesItem;
import com.azure.resourcemanager.trafficmanager.models.MonitorProtocol;
import com.azure.resourcemanager.trafficmanager.models.ProfileStatus;
import com.azure.resourcemanager.trafficmanager.models.TrafficRoutingMethod;
import com.azure.resourcemanager.trafficmanager.models.TrafficViewEnrollmentStatus;
import java.util.Arrays;
/**
* Samples for Profiles CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-
* WithCustomHeaders.json
*/
/**
* Sample code: Profile-PUT-WithCustomHeaders.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void profilePUTWithCustomHeaders(com.azure.resourcemanager.AzureResourceManager azure) {
azure.trafficManagerProfiles().manager().serviceClient().getProfiles().createOrUpdateWithResponse(
"azuresdkfornetautoresttrafficmanager2583", "azuresdkfornetautoresttrafficmanager6192",
new ProfileInner().withLocation("global").withProfileStatus(ProfileStatus.ENABLED)
.withTrafficRoutingMethod(TrafficRoutingMethod.PERFORMANCE)
.withDnsConfig(
new DnsConfig().withRelativeName("azuresdkfornetautoresttrafficmanager6192").withTtl(35L))
.withMonitorConfig(
new MonitorConfig().withProtocol(MonitorProtocol.HTTP).withPort(80L).withPath("/testpath.aspx")
.withIntervalInSeconds(10L).withTimeoutInSeconds(5L).withToleratedNumberOfFailures(2L)
.withCustomHeaders(Arrays.asList(
new MonitorConfigCustomHeadersItem().withName("header-1").withValue("value-1"),
new MonitorConfigCustomHeadersItem().withName("header-2").withValue("value-2")))
.withExpectedStatusCodeRanges(
Arrays.asList(new MonitorConfigExpectedStatusCodeRangesItem().withMin(200).withMax(205),
new MonitorConfigExpectedStatusCodeRangesItem().withMin(400).withMax(410))))
.withEndpoints(Arrays.asList(new EndpointInner().withName("My external endpoint")
.withType("Microsoft.network/TrafficManagerProfiles/ExternalEndpoints")
.withTarget("foobar.contoso.com").withEndpointStatus(EndpointStatus.ENABLED)
.withEndpointLocation("North Europe")
.withCustomHeaders(Arrays.asList(new EndpointPropertiesCustomHeadersItem().withName("header-2")
.withValue("value-2-overridden")))))
.withTrafficViewEnrollmentStatus(TrafficViewEnrollmentStatus.DISABLED),
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.trafficmanager import TrafficManagerManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-trafficmanager
# USAGE
python profile_put_with_custom_headers.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 = TrafficManagerManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.profiles.create_or_update(
resource_group_name="azuresdkfornetautoresttrafficmanager2583",
profile_name="azuresdkfornetautoresttrafficmanager6192",
parameters={
"location": "global",
"properties": {
"dnsConfig": {"relativeName": "azuresdkfornetautoresttrafficmanager6192", "ttl": 35},
"endpoints": [
{
"name": "My external endpoint",
"properties": {
"customHeaders": [{"name": "header-2", "value": "value-2-overridden"}],
"endpointLocation": "North Europe",
"endpointStatus": "Enabled",
"target": "foobar.contoso.com",
},
"type": "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
}
],
"monitorConfig": {
"customHeaders": [
{"name": "header-1", "value": "value-1"},
{"name": "header-2", "value": "value-2"},
],
"expectedStatusCodeRanges": [{"max": 205, "min": 200}, {"max": 410, "min": 400}],
"intervalInSeconds": 10,
"path": "/testpath.aspx",
"port": 80,
"protocol": "HTTP",
"timeoutInSeconds": 5,
"toleratedNumberOfFailures": 2,
},
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"trafficViewEnrollmentStatus": "Disabled",
},
},
)
print(response)
# x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithCustomHeaders.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 armtrafficmanager_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trafficmanager/armtrafficmanager"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithCustomHeaders.json
func ExampleProfilesClient_CreateOrUpdate_profilePutWithCustomHeaders() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armtrafficmanager.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewProfilesClient().CreateOrUpdate(ctx, "azuresdkfornetautoresttrafficmanager2583", "azuresdkfornetautoresttrafficmanager6192", armtrafficmanager.Profile{
Location: to.Ptr("global"),
Properties: &armtrafficmanager.ProfileProperties{
DNSConfig: &armtrafficmanager.DNSConfig{
RelativeName: to.Ptr("azuresdkfornetautoresttrafficmanager6192"),
TTL: to.Ptr[int64](35),
},
Endpoints: []*armtrafficmanager.Endpoint{
{
Name: to.Ptr("My external endpoint"),
Type: to.Ptr("Microsoft.network/TrafficManagerProfiles/ExternalEndpoints"),
Properties: &armtrafficmanager.EndpointProperties{
CustomHeaders: []*armtrafficmanager.EndpointPropertiesCustomHeadersItem{
{
Name: to.Ptr("header-2"),
Value: to.Ptr("value-2-overridden"),
}},
EndpointLocation: to.Ptr("North Europe"),
EndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),
Target: to.Ptr("foobar.contoso.com"),
},
}},
MonitorConfig: &armtrafficmanager.MonitorConfig{
Path: to.Ptr("/testpath.aspx"),
CustomHeaders: []*armtrafficmanager.MonitorConfigCustomHeadersItem{
{
Name: to.Ptr("header-1"),
Value: to.Ptr("value-1"),
},
{
Name: to.Ptr("header-2"),
Value: to.Ptr("value-2"),
}},
ExpectedStatusCodeRanges: []*armtrafficmanager.MonitorConfigExpectedStatusCodeRangesItem{
{
Max: to.Ptr[int32](205),
Min: to.Ptr[int32](200),
},
{
Max: to.Ptr[int32](410),
Min: to.Ptr[int32](400),
}},
IntervalInSeconds: to.Ptr[int64](10),
Port: to.Ptr[int64](80),
TimeoutInSeconds: to.Ptr[int64](5),
ToleratedNumberOfFailures: to.Ptr[int64](2),
Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
},
ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodPerformance),
TrafficViewEnrollmentStatus: to.Ptr(armtrafficmanager.TrafficViewEnrollmentStatusDisabled),
},
}, 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.Profile = armtrafficmanager.Profile{
// Name: to.Ptr("azuresdkfornetautoresttrafficmanager6192"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192"),
// Location: to.Ptr("global"),
// Properties: &armtrafficmanager.ProfileProperties{
// DNSConfig: &armtrafficmanager.DNSConfig{
// Fqdn: to.Ptr("azuresdkfornetautoresttrafficmanager6192.tmpreview.watmtest.azure-test.net"),
// RelativeName: to.Ptr("azuresdkfornetautoresttrafficmanager6192"),
// TTL: to.Ptr[int64](35),
// },
// Endpoints: []*armtrafficmanager.Endpoint{
// {
// Name: to.Ptr("My external endpoint"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles/externalEndpoints"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192/externalEndpoints/My external endpoint"),
// Properties: &armtrafficmanager.EndpointProperties{
// CustomHeaders: []*armtrafficmanager.EndpointPropertiesCustomHeadersItem{
// {
// Name: to.Ptr("header-2"),
// Value: to.Ptr("value-2-overridden"),
// }},
// EndpointLocation: to.Ptr("North Europe"),
// EndpointMonitorStatus: to.Ptr(armtrafficmanager.EndpointMonitorStatusCheckingEndpoint),
// EndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),
// Priority: to.Ptr[int64](1),
// Target: to.Ptr("foobar.contoso.com"),
// Weight: to.Ptr[int64](1),
// },
// }},
// MonitorConfig: &armtrafficmanager.MonitorConfig{
// Path: to.Ptr("/testpath.aspx"),
// CustomHeaders: []*armtrafficmanager.MonitorConfigCustomHeadersItem{
// {
// Name: to.Ptr("header-1"),
// Value: to.Ptr("value-1"),
// },
// {
// Name: to.Ptr("header-2"),
// Value: to.Ptr("value-2"),
// }},
// IntervalInSeconds: to.Ptr[int64](10),
// Port: to.Ptr[int64](80),
// ProfileMonitorStatus: to.Ptr(armtrafficmanager.ProfileMonitorStatusCheckingEndpoints),
// TimeoutInSeconds: to.Ptr[int64](5),
// ToleratedNumberOfFailures: to.Ptr[int64](2),
// Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
// },
// ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
// TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodPerformance),
// TrafficViewEnrollmentStatus: to.Ptr(armtrafficmanager.TrafficViewEnrollmentStatusDisabled),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { TrafficManagerManagementClient } = require("@azure/arm-trafficmanager");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a Traffic Manager profile.
*
* @summary Create or update a Traffic Manager profile.
* x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithCustomHeaders.json
*/
async function profilePutWithCustomHeaders() {
const subscriptionId = process.env["TRAFFICMANAGER_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName =
process.env["TRAFFICMANAGER_RESOURCE_GROUP"] || "azuresdkfornetautoresttrafficmanager2583";
const profileName = "azuresdkfornetautoresttrafficmanager6192";
const parameters = {
dnsConfig: {
relativeName: "azuresdkfornetautoresttrafficmanager6192",
ttl: 35,
},
endpoints: [
{
name: "My external endpoint",
type: "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
customHeaders: [{ name: "header-2", value: "value-2-overridden" }],
endpointLocation: "North Europe",
endpointStatus: "Enabled",
target: "foobar.contoso.com",
},
],
location: "global",
monitorConfig: {
path: "/testpath.aspx",
customHeaders: [
{ name: "header-1", value: "value-1" },
{ name: "header-2", value: "value-2" },
],
expectedStatusCodeRanges: [
{ max: 205, min: 200 },
{ max: 410, min: 400 },
],
intervalInSeconds: 10,
port: 80,
timeoutInSeconds: 5,
toleratedNumberOfFailures: 2,
protocol: "HTTP",
},
profileStatus: "Enabled",
trafficRoutingMethod: "Performance",
trafficViewEnrollmentStatus: "Disabled",
};
const credential = new DefaultAzureCredential();
const client = new TrafficManagerManagementClient(credential, subscriptionId);
const result = await client.profiles.createOrUpdate(resourceGroupName, profileName, parameters);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.TrafficManager.Models;
using Azure.ResourceManager.TrafficManager;
// Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithCustomHeaders.json
// this example is just showing the usage of "Profiles_CreateOrUpdate" 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 = "{subscription-id}";
string resourceGroupName = "azuresdkfornetautoresttrafficmanager2583";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this TrafficManagerProfileResource
TrafficManagerProfileCollection collection = resourceGroupResource.GetTrafficManagerProfiles();
// invoke the operation
string profileName = "azuresdkfornetautoresttrafficmanager6192";
TrafficManagerProfileData data = new TrafficManagerProfileData()
{
ProfileStatus = TrafficManagerProfileStatus.Enabled,
TrafficRoutingMethod = TrafficRoutingMethod.Performance,
DnsConfig = new TrafficManagerDnsConfig()
{
RelativeName = "azuresdkfornetautoresttrafficmanager6192",
Ttl = 35,
},
MonitorConfig = new TrafficManagerMonitorConfig()
{
Protocol = TrafficManagerMonitorProtocol.Http,
Port = 80,
Path = "/testpath.aspx",
IntervalInSeconds = 10,
TimeoutInSeconds = 5,
ToleratedNumberOfFailures = 2,
CustomHeaders =
{
new TrafficManagerMonitorConfigCustomHeaderInfo()
{
Name = "header-1",
Value = "value-1",
},new TrafficManagerMonitorConfigCustomHeaderInfo()
{
Name = "header-2",
Value = "value-2",
}
},
ExpectedStatusCodeRanges =
{
new ExpectedStatusCodeRangeInfo()
{
Min = 200,
Max = 205,
},new ExpectedStatusCodeRangeInfo()
{
Min = 400,
Max = 410,
}
},
},
Endpoints =
{
new TrafficManagerEndpointData()
{
Target = "foobar.contoso.com",
EndpointStatus = TrafficManagerEndpointStatus.Enabled,
EndpointLocation = "North Europe",
CustomHeaders =
{
new TrafficManagerEndpointCustomHeaderInfo()
{
Name = "header-2",
Value = "value-2-overridden",
}
},
Name = "My external endpoint",
ResourceType = new ResourceType("Microsoft.network/TrafficManagerProfiles/ExternalEndpoints"),
}
},
TrafficViewEnrollmentStatus = TrafficViewEnrollmentStatus.Disabled,
Location = new AzureLocation("global"),
};
ArmOperation<TrafficManagerProfileResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, profileName, data);
TrafficManagerProfileResource result = lro.Value;
// 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
TrafficManagerProfileData 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
Пример ответа
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192",
"name": "azuresdkfornetautoresttrafficmanager6192",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azuresdkfornetautoresttrafficmanager6192",
"fqdn": "azuresdkfornetautoresttrafficmanager6192.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "CheckingEndpoints",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 10,
"toleratedNumberOfFailures": 2,
"timeoutInSeconds": 5,
"customHeaders": [
{
"name": "header-1",
"value": "value-1"
},
{
"name": "header-2",
"value": "value-2"
}
]
},
"trafficViewEnrollmentStatus": "Disabled",
"endpoints": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192/externalEndpoints/My external endpoint",
"name": "My external endpoint",
"type": "Microsoft.Network/trafficManagerProfiles/externalEndpoints",
"properties": {
"endpointStatus": "Enabled",
"endpointMonitorStatus": "CheckingEndpoint",
"target": "foobar.contoso.com",
"weight": 1,
"priority": 1,
"endpointLocation": "North Europe",
"customHeaders": [
{
"name": "header-2",
"value": "value-2-overridden"
}
]
}
}
]
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192",
"name": "azuresdkfornetautoresttrafficmanager6192",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azuresdkfornetautoresttrafficmanager6192",
"fqdn": "azuresdkfornetautoresttrafficmanager6192.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "CheckingEndpoints",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 10,
"toleratedNumberOfFailures": 2,
"timeoutInSeconds": 5,
"customHeaders": [
{
"name": "header-1",
"value": "value-1"
},
{
"name": "header-2",
"value": "value-2"
}
]
},
"trafficViewEnrollmentStatus": "Disabled",
"endpoints": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192/externalEndpoints/My external endpoint",
"name": "My external endpoint",
"type": "Microsoft.Network/trafficManagerProfiles/externalEndpoints",
"properties": {
"endpointStatus": "Enabled",
"endpointMonitorStatus": "CheckingEndpoint",
"target": "foobar.contoso.com",
"weight": 1,
"priority": 1,
"endpointLocation": "North Europe",
"customHeaders": [
{
"name": "header-2",
"value": "value-2-overridden"
}
]
}
}
]
}
}
Profile-PUT-WithEndpoints
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficmanagerprofiles/azuresdkfornetautoresttrafficmanager6192?api-version=2022-04-01
{
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azuresdkfornetautoresttrafficmanager6192",
"ttl": 35
},
"monitorConfig": {
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 10,
"timeoutInSeconds": 5,
"toleratedNumberOfFailures": 2
},
"endpoints": [
{
"name": "My external endpoint",
"type": "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
"properties": {
"target": "foobar.contoso.com",
"endpointStatus": "Enabled",
"endpointLocation": "North Europe"
}
}
]
},
"location": "global"
}
import com.azure.resourcemanager.trafficmanager.fluent.models.EndpointInner;
import com.azure.resourcemanager.trafficmanager.fluent.models.ProfileInner;
import com.azure.resourcemanager.trafficmanager.models.DnsConfig;
import com.azure.resourcemanager.trafficmanager.models.EndpointStatus;
import com.azure.resourcemanager.trafficmanager.models.MonitorConfig;
import com.azure.resourcemanager.trafficmanager.models.MonitorProtocol;
import com.azure.resourcemanager.trafficmanager.models.ProfileStatus;
import com.azure.resourcemanager.trafficmanager.models.TrafficRoutingMethod;
import java.util.Arrays;
/**
* Samples for Profiles CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-
* WithEndpoints.json
*/
/**
* Sample code: Profile-PUT-WithEndpoints.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void profilePUTWithEndpoints(com.azure.resourcemanager.AzureResourceManager azure) {
azure.trafficManagerProfiles().manager().serviceClient().getProfiles().createOrUpdateWithResponse(
"azuresdkfornetautoresttrafficmanager2583", "azuresdkfornetautoresttrafficmanager6192",
new ProfileInner().withLocation("global").withProfileStatus(ProfileStatus.ENABLED)
.withTrafficRoutingMethod(TrafficRoutingMethod.PERFORMANCE)
.withDnsConfig(
new DnsConfig().withRelativeName("azuresdkfornetautoresttrafficmanager6192").withTtl(35L))
.withMonitorConfig(
new MonitorConfig().withProtocol(MonitorProtocol.HTTP).withPort(80L).withPath("/testpath.aspx")
.withIntervalInSeconds(10L).withTimeoutInSeconds(5L).withToleratedNumberOfFailures(2L))
.withEndpoints(Arrays.asList(new EndpointInner().withName("My external endpoint")
.withType("Microsoft.network/TrafficManagerProfiles/ExternalEndpoints")
.withTarget("foobar.contoso.com").withEndpointStatus(EndpointStatus.ENABLED)
.withEndpointLocation("North Europe"))),
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.trafficmanager import TrafficManagerManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-trafficmanager
# USAGE
python profile_put_with_endpoints.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 = TrafficManagerManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.profiles.create_or_update(
resource_group_name="azuresdkfornetautoresttrafficmanager2583",
profile_name="azuresdkfornetautoresttrafficmanager6192",
parameters={
"location": "global",
"properties": {
"dnsConfig": {"relativeName": "azuresdkfornetautoresttrafficmanager6192", "ttl": 35},
"endpoints": [
{
"name": "My external endpoint",
"properties": {
"endpointLocation": "North Europe",
"endpointStatus": "Enabled",
"target": "foobar.contoso.com",
},
"type": "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
}
],
"monitorConfig": {
"intervalInSeconds": 10,
"path": "/testpath.aspx",
"port": 80,
"protocol": "HTTP",
"timeoutInSeconds": 5,
"toleratedNumberOfFailures": 2,
},
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
},
},
)
print(response)
# x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithEndpoints.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 armtrafficmanager_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trafficmanager/armtrafficmanager"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithEndpoints.json
func ExampleProfilesClient_CreateOrUpdate_profilePutWithEndpoints() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armtrafficmanager.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewProfilesClient().CreateOrUpdate(ctx, "azuresdkfornetautoresttrafficmanager2583", "azuresdkfornetautoresttrafficmanager6192", armtrafficmanager.Profile{
Location: to.Ptr("global"),
Properties: &armtrafficmanager.ProfileProperties{
DNSConfig: &armtrafficmanager.DNSConfig{
RelativeName: to.Ptr("azuresdkfornetautoresttrafficmanager6192"),
TTL: to.Ptr[int64](35),
},
Endpoints: []*armtrafficmanager.Endpoint{
{
Name: to.Ptr("My external endpoint"),
Type: to.Ptr("Microsoft.network/TrafficManagerProfiles/ExternalEndpoints"),
Properties: &armtrafficmanager.EndpointProperties{
EndpointLocation: to.Ptr("North Europe"),
EndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),
Target: to.Ptr("foobar.contoso.com"),
},
}},
MonitorConfig: &armtrafficmanager.MonitorConfig{
Path: to.Ptr("/testpath.aspx"),
IntervalInSeconds: to.Ptr[int64](10),
Port: to.Ptr[int64](80),
TimeoutInSeconds: to.Ptr[int64](5),
ToleratedNumberOfFailures: to.Ptr[int64](2),
Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
},
ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodPerformance),
},
}, 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.Profile = armtrafficmanager.Profile{
// Name: to.Ptr("azuresdkfornetautoresttrafficmanager6192"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192"),
// Location: to.Ptr("global"),
// Properties: &armtrafficmanager.ProfileProperties{
// DNSConfig: &armtrafficmanager.DNSConfig{
// Fqdn: to.Ptr("azuresdkfornetautoresttrafficmanager6192.tmpreview.watmtest.azure-test.net"),
// RelativeName: to.Ptr("azuresdkfornetautoresttrafficmanager6192"),
// TTL: to.Ptr[int64](35),
// },
// Endpoints: []*armtrafficmanager.Endpoint{
// {
// Name: to.Ptr("My external endpoint"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles/externalEndpoints"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192/externalEndpoints/My external endpoint"),
// Properties: &armtrafficmanager.EndpointProperties{
// EndpointLocation: to.Ptr("North Europe"),
// EndpointMonitorStatus: to.Ptr(armtrafficmanager.EndpointMonitorStatusCheckingEndpoint),
// EndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),
// Priority: to.Ptr[int64](1),
// Target: to.Ptr("foobar.contoso.com"),
// Weight: to.Ptr[int64](1),
// },
// }},
// MonitorConfig: &armtrafficmanager.MonitorConfig{
// Path: to.Ptr("/testpath.aspx"),
// IntervalInSeconds: to.Ptr[int64](10),
// Port: to.Ptr[int64](80),
// ProfileMonitorStatus: to.Ptr(armtrafficmanager.ProfileMonitorStatusCheckingEndpoints),
// TimeoutInSeconds: to.Ptr[int64](5),
// ToleratedNumberOfFailures: to.Ptr[int64](2),
// Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
// },
// ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
// TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodPerformance),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { TrafficManagerManagementClient } = require("@azure/arm-trafficmanager");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a Traffic Manager profile.
*
* @summary Create or update a Traffic Manager profile.
* x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithEndpoints.json
*/
async function profilePutWithEndpoints() {
const subscriptionId = process.env["TRAFFICMANAGER_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName =
process.env["TRAFFICMANAGER_RESOURCE_GROUP"] || "azuresdkfornetautoresttrafficmanager2583";
const profileName = "azuresdkfornetautoresttrafficmanager6192";
const parameters = {
dnsConfig: {
relativeName: "azuresdkfornetautoresttrafficmanager6192",
ttl: 35,
},
endpoints: [
{
name: "My external endpoint",
type: "Microsoft.network/TrafficManagerProfiles/ExternalEndpoints",
endpointLocation: "North Europe",
endpointStatus: "Enabled",
target: "foobar.contoso.com",
},
],
location: "global",
monitorConfig: {
path: "/testpath.aspx",
intervalInSeconds: 10,
port: 80,
timeoutInSeconds: 5,
toleratedNumberOfFailures: 2,
protocol: "HTTP",
},
profileStatus: "Enabled",
trafficRoutingMethod: "Performance",
};
const credential = new DefaultAzureCredential();
const client = new TrafficManagerManagementClient(credential, subscriptionId);
const result = await client.profiles.createOrUpdate(resourceGroupName, profileName, parameters);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.TrafficManager.Models;
using Azure.ResourceManager.TrafficManager;
// Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithEndpoints.json
// this example is just showing the usage of "Profiles_CreateOrUpdate" 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 = "{subscription-id}";
string resourceGroupName = "azuresdkfornetautoresttrafficmanager2583";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this TrafficManagerProfileResource
TrafficManagerProfileCollection collection = resourceGroupResource.GetTrafficManagerProfiles();
// invoke the operation
string profileName = "azuresdkfornetautoresttrafficmanager6192";
TrafficManagerProfileData data = new TrafficManagerProfileData()
{
ProfileStatus = TrafficManagerProfileStatus.Enabled,
TrafficRoutingMethod = TrafficRoutingMethod.Performance,
DnsConfig = new TrafficManagerDnsConfig()
{
RelativeName = "azuresdkfornetautoresttrafficmanager6192",
Ttl = 35,
},
MonitorConfig = new TrafficManagerMonitorConfig()
{
Protocol = TrafficManagerMonitorProtocol.Http,
Port = 80,
Path = "/testpath.aspx",
IntervalInSeconds = 10,
TimeoutInSeconds = 5,
ToleratedNumberOfFailures = 2,
},
Endpoints =
{
new TrafficManagerEndpointData()
{
Target = "foobar.contoso.com",
EndpointStatus = TrafficManagerEndpointStatus.Enabled,
EndpointLocation = "North Europe",
Name = "My external endpoint",
ResourceType = new ResourceType("Microsoft.network/TrafficManagerProfiles/ExternalEndpoints"),
}
},
Location = new AzureLocation("global"),
};
ArmOperation<TrafficManagerProfileResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, profileName, data);
TrafficManagerProfileResource result = lro.Value;
// 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
TrafficManagerProfileData 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
Пример ответа
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192",
"name": "azuresdkfornetautoresttrafficmanager6192",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azuresdkfornetautoresttrafficmanager6192",
"fqdn": "azuresdkfornetautoresttrafficmanager6192.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "CheckingEndpoints",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 10,
"toleratedNumberOfFailures": 2,
"timeoutInSeconds": 5
},
"endpoints": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192/externalEndpoints/My external endpoint",
"name": "My external endpoint",
"type": "Microsoft.Network/trafficManagerProfiles/externalEndpoints",
"properties": {
"endpointStatus": "Enabled",
"endpointMonitorStatus": "CheckingEndpoint",
"target": "foobar.contoso.com",
"weight": 1,
"priority": 1,
"endpointLocation": "North Europe"
}
}
]
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192",
"name": "azuresdkfornetautoresttrafficmanager6192",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azuresdkfornetautoresttrafficmanager6192",
"fqdn": "azuresdkfornetautoresttrafficmanager6192.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "CheckingEndpoints",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 10,
"toleratedNumberOfFailures": 2,
"timeoutInSeconds": 5
},
"endpoints": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager2583/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager6192/externalEndpoints/My external endpoint",
"name": "My external endpoint",
"type": "Microsoft.Network/trafficManagerProfiles/externalEndpoints",
"properties": {
"endpointStatus": "Enabled",
"endpointMonitorStatus": "CheckingEndpoint",
"target": "foobar.contoso.com",
"weight": 1,
"priority": 1,
"endpointLocation": "North Europe"
}
}
]
}
}
Profile-PUT-WithNestedEndpoints
Образец запроса
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myresourcegroup/providers/Microsoft.Network/trafficmanagerprofiles/parentprofile?api-version=2022-04-01
{
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Priority",
"dnsConfig": {
"relativeName": "parentprofile",
"ttl": 35
},
"monitorConfig": {
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 10,
"timeoutInSeconds": 5,
"toleratedNumberOfFailures": 2
},
"endpoints": [
{
"name": "MyFirstNestedEndpoint",
"type": "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
"properties": {
"target": "firstnestedprofile.tmpreview.watmtest.azure-test.net",
"endpointStatus": "Enabled",
"weight": 1,
"priority": 1,
"minChildEndpoints": 2,
"minChildEndpointsIPv4": 1,
"minChildEndpointsIPv6": 2
}
},
{
"name": "MySecondNestedEndpoint",
"type": "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
"properties": {
"target": "secondnestedprofile.tmpreview.watmtest.azure-test.net",
"endpointStatus": "Enabled",
"weight": 1,
"priority": 2,
"minChildEndpoints": 2,
"minChildEndpointsIPv4": 2,
"minChildEndpointsIPv6": 1
}
}
]
},
"location": "global"
}
import com.azure.resourcemanager.trafficmanager.fluent.models.EndpointInner;
import com.azure.resourcemanager.trafficmanager.fluent.models.ProfileInner;
import com.azure.resourcemanager.trafficmanager.models.DnsConfig;
import com.azure.resourcemanager.trafficmanager.models.EndpointStatus;
import com.azure.resourcemanager.trafficmanager.models.MonitorConfig;
import com.azure.resourcemanager.trafficmanager.models.MonitorProtocol;
import com.azure.resourcemanager.trafficmanager.models.ProfileStatus;
import com.azure.resourcemanager.trafficmanager.models.TrafficRoutingMethod;
import java.util.Arrays;
/**
* Samples for Profiles CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-
* WithNestedEndpoints.json
*/
/**
* Sample code: Profile-PUT-WithNestedEndpoints.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void profilePUTWithNestedEndpoints(com.azure.resourcemanager.AzureResourceManager azure) {
azure.trafficManagerProfiles().manager().serviceClient().getProfiles()
.createOrUpdateWithResponse("myresourcegroup", "parentprofile",
new ProfileInner().withLocation("global").withProfileStatus(ProfileStatus.ENABLED)
.withTrafficRoutingMethod(TrafficRoutingMethod.PRIORITY)
.withDnsConfig(
new DnsConfig().withRelativeName("parentprofile").withTtl(35L))
.withMonitorConfig(new MonitorConfig().withProtocol(MonitorProtocol.HTTP).withPort(80L)
.withPath("/testpath.aspx").withIntervalInSeconds(
10L)
.withTimeoutInSeconds(5L).withToleratedNumberOfFailures(2L))
.withEndpoints(Arrays.asList(
new EndpointInner().withName("MyFirstNestedEndpoint")
.withType("Microsoft.Network/trafficManagerProfiles/nestedEndpoints")
.withTarget("firstnestedprofile.tmpreview.watmtest.azure-test.net")
.withEndpointStatus(EndpointStatus.ENABLED).withWeight(1L).withPriority(1L)
.withMinChildEndpoints(2L).withMinChildEndpointsIPv4(1L).withMinChildEndpointsIPv6(2L),
new EndpointInner().withName("MySecondNestedEndpoint")
.withType("Microsoft.Network/trafficManagerProfiles/nestedEndpoints")
.withTarget("secondnestedprofile.tmpreview.watmtest.azure-test.net")
.withEndpointStatus(EndpointStatus.ENABLED).withWeight(1L).withPriority(2L)
.withMinChildEndpoints(2L).withMinChildEndpointsIPv4(2L).withMinChildEndpointsIPv6(1L))),
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.trafficmanager import TrafficManagerManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-trafficmanager
# USAGE
python profile_put_with_nested_endpoints.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 = TrafficManagerManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.profiles.create_or_update(
resource_group_name="myresourcegroup",
profile_name="parentprofile",
parameters={
"location": "global",
"properties": {
"dnsConfig": {"relativeName": "parentprofile", "ttl": 35},
"endpoints": [
{
"name": "MyFirstNestedEndpoint",
"properties": {
"endpointStatus": "Enabled",
"minChildEndpoints": 2,
"minChildEndpointsIPv4": 1,
"minChildEndpointsIPv6": 2,
"priority": 1,
"target": "firstnestedprofile.tmpreview.watmtest.azure-test.net",
"weight": 1,
},
"type": "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
},
{
"name": "MySecondNestedEndpoint",
"properties": {
"endpointStatus": "Enabled",
"minChildEndpoints": 2,
"minChildEndpointsIPv4": 2,
"minChildEndpointsIPv6": 1,
"priority": 2,
"target": "secondnestedprofile.tmpreview.watmtest.azure-test.net",
"weight": 1,
},
"type": "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
},
],
"monitorConfig": {
"intervalInSeconds": 10,
"path": "/testpath.aspx",
"port": 80,
"protocol": "HTTP",
"timeoutInSeconds": 5,
"toleratedNumberOfFailures": 2,
},
"profileStatus": "Enabled",
"trafficRoutingMethod": "Priority",
},
},
)
print(response)
# x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithNestedEndpoints.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 armtrafficmanager_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trafficmanager/armtrafficmanager"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithNestedEndpoints.json
func ExampleProfilesClient_CreateOrUpdate_profilePutWithNestedEndpoints() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armtrafficmanager.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewProfilesClient().CreateOrUpdate(ctx, "myresourcegroup", "parentprofile", armtrafficmanager.Profile{
Location: to.Ptr("global"),
Properties: &armtrafficmanager.ProfileProperties{
DNSConfig: &armtrafficmanager.DNSConfig{
RelativeName: to.Ptr("parentprofile"),
TTL: to.Ptr[int64](35),
},
Endpoints: []*armtrafficmanager.Endpoint{
{
Name: to.Ptr("MyFirstNestedEndpoint"),
Type: to.Ptr("Microsoft.Network/trafficManagerProfiles/nestedEndpoints"),
Properties: &armtrafficmanager.EndpointProperties{
EndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),
MinChildEndpoints: to.Ptr[int64](2),
MinChildEndpointsIPv4: to.Ptr[int64](1),
MinChildEndpointsIPv6: to.Ptr[int64](2),
Priority: to.Ptr[int64](1),
Target: to.Ptr("firstnestedprofile.tmpreview.watmtest.azure-test.net"),
Weight: to.Ptr[int64](1),
},
},
{
Name: to.Ptr("MySecondNestedEndpoint"),
Type: to.Ptr("Microsoft.Network/trafficManagerProfiles/nestedEndpoints"),
Properties: &armtrafficmanager.EndpointProperties{
EndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),
MinChildEndpoints: to.Ptr[int64](2),
MinChildEndpointsIPv4: to.Ptr[int64](2),
MinChildEndpointsIPv6: to.Ptr[int64](1),
Priority: to.Ptr[int64](2),
Target: to.Ptr("secondnestedprofile.tmpreview.watmtest.azure-test.net"),
Weight: to.Ptr[int64](1),
},
}},
MonitorConfig: &armtrafficmanager.MonitorConfig{
Path: to.Ptr("/testpath.aspx"),
IntervalInSeconds: to.Ptr[int64](10),
Port: to.Ptr[int64](80),
TimeoutInSeconds: to.Ptr[int64](5),
ToleratedNumberOfFailures: to.Ptr[int64](2),
Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
},
ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodPriority),
},
}, 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.Profile = armtrafficmanager.Profile{
// Name: to.Ptr("parentprofile"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myresourcegroup/providers/Microsoft.Network/trafficManagerProfiles/parentprofile"),
// Location: to.Ptr("global"),
// Properties: &armtrafficmanager.ProfileProperties{
// DNSConfig: &armtrafficmanager.DNSConfig{
// Fqdn: to.Ptr("parentprofile.tmpreview.watmtest.azure-test.net"),
// RelativeName: to.Ptr("parentprofile"),
// TTL: to.Ptr[int64](35),
// },
// Endpoints: []*armtrafficmanager.Endpoint{
// {
// Name: to.Ptr("MyFirstNestedEndpoint"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles/nestedEndpoints"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myresourcegroup/providers/Microsoft.Network/trafficManagerProfiles/parentprofile/nestedEndpoints/MyFirstNestedEndpoint"),
// Properties: &armtrafficmanager.EndpointProperties{
// EndpointMonitorStatus: to.Ptr(armtrafficmanager.EndpointMonitorStatusCheckingEndpoint),
// EndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),
// MinChildEndpoints: to.Ptr[int64](2),
// MinChildEndpointsIPv4: to.Ptr[int64](1),
// MinChildEndpointsIPv6: to.Ptr[int64](2),
// Priority: to.Ptr[int64](1),
// Target: to.Ptr("firstnestedprofile.tmpreview.watmtest.azure-test.net"),
// Weight: to.Ptr[int64](1),
// },
// },
// {
// Name: to.Ptr("MySecondNestedEndpoint"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles/nestedEndpoints"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myresourcegroup/providers/Microsoft.Network/trafficManagerProfiles/parentprofile/nestedEndpoints/MySecondNestedEndpoint"),
// Properties: &armtrafficmanager.EndpointProperties{
// EndpointMonitorStatus: to.Ptr(armtrafficmanager.EndpointMonitorStatusCheckingEndpoint),
// EndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),
// MinChildEndpoints: to.Ptr[int64](2),
// MinChildEndpointsIPv4: to.Ptr[int64](2),
// MinChildEndpointsIPv6: to.Ptr[int64](1),
// Priority: to.Ptr[int64](1),
// Target: to.Ptr("secondnestedprofile.tmpreview.watmtest.azure-test.net"),
// Weight: to.Ptr[int64](1),
// },
// }},
// MonitorConfig: &armtrafficmanager.MonitorConfig{
// Path: to.Ptr("/testpath.aspx"),
// IntervalInSeconds: to.Ptr[int64](10),
// Port: to.Ptr[int64](80),
// ProfileMonitorStatus: to.Ptr(armtrafficmanager.ProfileMonitorStatusCheckingEndpoints),
// TimeoutInSeconds: to.Ptr[int64](5),
// ToleratedNumberOfFailures: to.Ptr[int64](2),
// Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
// },
// ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
// TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodPriority),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { TrafficManagerManagementClient } = require("@azure/arm-trafficmanager");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a Traffic Manager profile.
*
* @summary Create or update a Traffic Manager profile.
* x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithNestedEndpoints.json
*/
async function profilePutWithNestedEndpoints() {
const subscriptionId = process.env["TRAFFICMANAGER_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["TRAFFICMANAGER_RESOURCE_GROUP"] || "myresourcegroup";
const profileName = "parentprofile";
const parameters = {
dnsConfig: { relativeName: "parentprofile", ttl: 35 },
endpoints: [
{
name: "MyFirstNestedEndpoint",
type: "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
endpointStatus: "Enabled",
minChildEndpoints: 2,
minChildEndpointsIPv4: 1,
minChildEndpointsIPv6: 2,
priority: 1,
target: "firstnestedprofile.tmpreview.watmtest.azure-test.net",
weight: 1,
},
{
name: "MySecondNestedEndpoint",
type: "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
endpointStatus: "Enabled",
minChildEndpoints: 2,
minChildEndpointsIPv4: 2,
minChildEndpointsIPv6: 1,
priority: 2,
target: "secondnestedprofile.tmpreview.watmtest.azure-test.net",
weight: 1,
},
],
location: "global",
monitorConfig: {
path: "/testpath.aspx",
intervalInSeconds: 10,
port: 80,
timeoutInSeconds: 5,
toleratedNumberOfFailures: 2,
protocol: "HTTP",
},
profileStatus: "Enabled",
trafficRoutingMethod: "Priority",
};
const credential = new DefaultAzureCredential();
const client = new TrafficManagerManagementClient(credential, subscriptionId);
const result = await client.profiles.createOrUpdate(resourceGroupName, profileName, parameters);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.TrafficManager.Models;
using Azure.ResourceManager.TrafficManager;
// Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-PUT-WithNestedEndpoints.json
// this example is just showing the usage of "Profiles_CreateOrUpdate" 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 = "{subscription-id}";
string resourceGroupName = "myresourcegroup";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this TrafficManagerProfileResource
TrafficManagerProfileCollection collection = resourceGroupResource.GetTrafficManagerProfiles();
// invoke the operation
string profileName = "parentprofile";
TrafficManagerProfileData data = new TrafficManagerProfileData()
{
ProfileStatus = TrafficManagerProfileStatus.Enabled,
TrafficRoutingMethod = TrafficRoutingMethod.Priority,
DnsConfig = new TrafficManagerDnsConfig()
{
RelativeName = "parentprofile",
Ttl = 35,
},
MonitorConfig = new TrafficManagerMonitorConfig()
{
Protocol = TrafficManagerMonitorProtocol.Http,
Port = 80,
Path = "/testpath.aspx",
IntervalInSeconds = 10,
TimeoutInSeconds = 5,
ToleratedNumberOfFailures = 2,
},
Endpoints =
{
new TrafficManagerEndpointData()
{
Target = "firstnestedprofile.tmpreview.watmtest.azure-test.net",
EndpointStatus = TrafficManagerEndpointStatus.Enabled,
Weight = 1,
Priority = 1,
MinChildEndpoints = 2,
MinChildEndpointsIPv4 = 1,
MinChildEndpointsIPv6 = 2,
Name = "MyFirstNestedEndpoint",
ResourceType = new ResourceType("Microsoft.Network/trafficManagerProfiles/nestedEndpoints"),
},new TrafficManagerEndpointData()
{
Target = "secondnestedprofile.tmpreview.watmtest.azure-test.net",
EndpointStatus = TrafficManagerEndpointStatus.Enabled,
Weight = 1,
Priority = 2,
MinChildEndpoints = 2,
MinChildEndpointsIPv4 = 2,
MinChildEndpointsIPv6 = 1,
Name = "MySecondNestedEndpoint",
ResourceType = new ResourceType("Microsoft.Network/trafficManagerProfiles/nestedEndpoints"),
}
},
Location = new AzureLocation("global"),
};
ArmOperation<TrafficManagerProfileResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, profileName, data);
TrafficManagerProfileResource result = lro.Value;
// 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
TrafficManagerProfileData 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
Пример ответа
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myresourcegroup/providers/Microsoft.Network/trafficManagerProfiles/parentprofile",
"name": "parentprofile",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Priority",
"dnsConfig": {
"relativeName": "parentprofile",
"fqdn": "parentprofile.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "CheckingEndpoints",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 10,
"toleratedNumberOfFailures": 2,
"timeoutInSeconds": 5
},
"endpoints": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myresourcegroup/providers/Microsoft.Network/trafficManagerProfiles/parentprofile/nestedEndpoints/MyFirstNestedEndpoint",
"name": "MyFirstNestedEndpoint",
"type": "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
"properties": {
"endpointStatus": "Enabled",
"endpointMonitorStatus": "CheckingEndpoint",
"target": "firstnestedprofile.tmpreview.watmtest.azure-test.net",
"weight": 1,
"priority": 1,
"minChildEndpoints": 2,
"minChildEndpointsIPv4": 1,
"minChildEndpointsIPv6": 2
}
},
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myresourcegroup/providers/Microsoft.Network/trafficManagerProfiles/parentprofile/nestedEndpoints/MySecondNestedEndpoint",
"name": "MySecondNestedEndpoint",
"type": "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
"properties": {
"endpointStatus": "Enabled",
"endpointMonitorStatus": "CheckingEndpoint",
"target": "secondnestedprofile.tmpreview.watmtest.azure-test.net",
"weight": 1,
"priority": 1,
"minChildEndpoints": 2,
"minChildEndpointsIPv4": 2,
"minChildEndpointsIPv6": 1
}
}
]
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myresourcegroup/providers/Microsoft.Network/trafficManagerProfiles/parentprofile",
"name": "parentprofile",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Priority",
"dnsConfig": {
"relativeName": "parentprofile",
"fqdn": "parentprofile.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "CheckingEndpoints",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 10,
"toleratedNumberOfFailures": 2,
"timeoutInSeconds": 5
},
"endpoints": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myresourcegroup/providers/Microsoft.Network/trafficManagerProfiles/parentprofile/nestedEndpoints/MyFirstNestedEndpoint",
"name": "MyFirstNestedEndpoint",
"type": "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
"properties": {
"endpointStatus": "Enabled",
"endpointMonitorStatus": "CheckingEndpoint",
"target": "firstnestedprofile.tmpreview.watmtest.azure-test.net",
"weight": 1,
"priority": 1,
"minChildEndpoints": 2,
"minChildEndpointsIPv4": 1,
"minChildEndpointsIPv6": 2
}
},
{
"id": "/subscriptions/{subscription-id}/resourceGroups/myresourcegroup/providers/Microsoft.Network/trafficManagerProfiles/parentprofile/nestedEndpoints/MySecondNestedEndpoint",
"name": "MySecondNestedEndpoint",
"type": "Microsoft.Network/trafficManagerProfiles/nestedEndpoints",
"properties": {
"endpointStatus": "Enabled",
"endpointMonitorStatus": "CheckingEndpoint",
"target": "secondnestedprofile.tmpreview.watmtest.azure-test.net",
"weight": 1,
"priority": 1,
"minChildEndpoints": 2,
"minChildEndpointsIPv4": 2,
"minChildEndpointsIPv6": 1
}
}
]
}
}
Определения
Имя |
Описание |
AllowedEndpointRecordType
|
Допустимые типы записей DNS для этого профиля.
|
AlwaysServe
|
Если включен параметр Always Serve, проверка работоспособности конечной точки будет отключена, а конечные точки будут включены в метод маршрутизации трафика.
|
CloudError
|
Ошибка, возвращенная Resource Manager Azure
|
CloudErrorBody
|
Содержимое ошибки, возвращаемой Resource Manager Azure
|
CustomHeaders
|
Список настраиваемых заголовков.
|
DnsConfig
|
Класс, содержащий параметры DNS в профиле диспетчера трафика.
|
Endpoint
|
Класс, представляющий конечную точку диспетчера трафика.
|
EndpointMonitorStatus
|
Состояние мониторинга конечной точки.
|
EndpointStatus
|
Состояние конечной точки. Если конечная точка включена, то она проверяется на работоспособность и включается в метод маршрутизации трафика.
|
ExpectedStatusCodeRanges
|
Список ожидаемых диапазонов кодов состояния.
|
MonitorConfig
|
Класс, содержащий параметры мониторинга конечных точек в профиле диспетчера трафика.
|
MonitorProtocol
|
Протокол (HTTP, HTTPS или TCP), используемый для проверки работоспособности конечной точки.
|
Profile
|
Класс, представляющий профиль диспетчера трафика.
|
ProfileMonitorStatus
|
Состояние мониторинга на уровне профиля диспетчера трафика.
|
ProfileStatus
|
Состояние профиля диспетчера трафика.
|
Subnets
|
Список подсетей, IP-адресов и (или) диапазонов адресов, сопоставленных с этой конечной точкой при использовании метода маршрутизации трафика "Подсеть". Пустой список будет соответствовать всем диапазонам, не охватываемым другими конечными точками.
|
TrafficRoutingMethod
|
Метод маршрутизации трафика профиля диспетчера трафика.
|
TrafficViewEnrollmentStatus
|
Указывает, является ли представление трафика включенным или отключенным для профиля диспетчера трафика. Null, означает "Отключено". Включение этой функции приведет к увеличению стоимости профиля управления трафиком.
|
AllowedEndpointRecordType
Допустимые типы записей DNS для этого профиля.
Имя |
Тип |
Описание |
Any
|
string
|
|
DomainName
|
string
|
|
IPv4Address
|
string
|
|
IPv6Address
|
string
|
|
AlwaysServe
Если включен параметр Always Serve, проверка работоспособности конечной точки будет отключена, а конечные точки будут включены в метод маршрутизации трафика.
Имя |
Тип |
Описание |
Disabled
|
string
|
|
Enabled
|
string
|
|
CloudError
Ошибка, возвращенная Resource Manager Azure
CloudErrorBody
Содержимое ошибки, возвращаемой Resource Manager Azure
Имя |
Тип |
Описание |
code
|
string
|
Код ошибки
|
details
|
CloudErrorBody[]
|
Сведения об ошибке
|
message
|
string
|
Сообщение об ошибке
|
target
|
string
|
Целевой объект ошибки
|
Список настраиваемых заголовков.
Имя |
Тип |
Описание |
name
|
string
|
Имя заголовка.
|
value
|
string
|
Значение заголовка.
|
DnsConfig
Класс, содержащий параметры DNS в профиле диспетчера трафика.
Имя |
Тип |
Описание |
fqdn
|
string
|
Полное доменное имя (FQDN) профиля диспетчера трафика. Он формируется из объединения RelativeName с доменом DNS, используемым диспетчером трафика Azure.
|
relativeName
|
string
|
Относительное DNS-имя, предоставленное этим профилем диспетчера трафика. Это значение объединяется с DNS-именем домена, с помощью которого диспетчер трафика Azure формирует полное доменное имя профиля.
|
ttl
|
integer
|
Срок жизни DNS (TTL), в секундах. Это сообщает локальным сопоставителям DNS и DNS-клиентам, как долго кэшировать ответы DNS, предоставляемые этим профилем диспетчера трафика.
|
Endpoint
Класс, представляющий конечную точку диспетчера трафика.
Имя |
Тип |
Описание |
id
|
string
|
Полный идентификатор ресурса для ресурса. Пример : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}
|
name
|
string
|
Имя ресурса.
|
properties.alwaysServe
|
AlwaysServe
|
Если включен параметр Always Serve, проверка работоспособности конечной точки будет отключена, а конечные точки будут включены в метод маршрутизации трафика.
|
properties.customHeaders
|
CustomHeaders[]
|
Список настраиваемых заголовков.
|
properties.endpointLocation
|
string
|
Указывает расположение внешних или вложенных конечных точек при использовании метода маршрутизации трафика "Производительность".
|
properties.endpointMonitorStatus
|
EndpointMonitorStatus
|
Состояние мониторинга конечной точки.
|
properties.endpointStatus
|
EndpointStatus
|
Состояние конечной точки. Если конечная точка включена, то она проверяется на работоспособность и включается в метод маршрутизации трафика.
|
properties.geoMapping
|
string[]
|
Список стран или регионов, сопоставленных с этой конечной точкой при использовании метода маршрутизации трафика "Географический". Полный список допустимых значений см. в географической документации по диспетчеру трафика.
|
properties.minChildEndpoints
|
integer
|
Минимальное количество конечных точек, которые должны быть доступны в дочернем профиле, чтобы родительский профиль считался доступным. Применимо только к конечной точке типа NestedEndpoints.
|
properties.minChildEndpointsIPv4
|
integer
|
Минимальное количество конечных точек IPv4 (запись DNS типа A), которые должны быть доступны в дочернем профиле, чтобы родительский профиль считался доступным. Применимо только к конечной точке типа NestedEndpoints.
|
properties.minChildEndpointsIPv6
|
integer
|
Минимальное количество конечных точек IPv6 (тип записи DNS AAAA), которые должны быть доступны в дочернем профиле, чтобы родительский профиль считался доступным. Применимо только к конечной точке типа NestedEndpoints.
|
properties.priority
|
integer
|
Приоритет этой конечной точки при использовании метода маршрутизации трафика "Приоритет". Возможные значения — от 1 до 1000, а более низкие — более высокий приоритет. Этот параметр является необязательным. Если он указывается, то должен указываться во всех конечных точках, и никакие две конечные точки не могут иметь одинаковый приоритет.
|
properties.subnets
|
Subnets[]
|
Список подсетей, IP-адресов и (или) диапазонов адресов, сопоставленных с этой конечной точкой при использовании метода маршрутизации трафика "Подсеть". Пустой список будет соответствовать всем диапазонам, не охватываемым другими конечными точками.
|
properties.target
|
string
|
Полное DNS-имя или IP-адрес конечной точки. Диспетчер трафика возвращает это значение в DNS-ответы для направления трафика в эту конечную точку.
|
properties.targetResourceId
|
string
|
URI ресурса Azure конечной точки. Неприменимо к конечным точкам типа ExternalEndpoints.
|
properties.weight
|
integer
|
Вес этой конечной точки при использовании метода маршрутизации трафика с взвешанным значением. Возможные значения : от 1 до 1000.
|
type
|
string
|
Тип ресурса. Например, Microsoft.Network/trafficManagerProfiles.
|
EndpointMonitorStatus
Состояние мониторинга конечной точки.
Имя |
Тип |
Описание |
CheckingEndpoint
|
string
|
|
Degraded
|
string
|
|
Disabled
|
string
|
|
Inactive
|
string
|
|
Online
|
string
|
|
Stopped
|
string
|
|
Unmonitored
|
string
|
|
EndpointStatus
Состояние конечной точки. Если конечная точка включена, то она проверяется на работоспособность и включается в метод маршрутизации трафика.
Имя |
Тип |
Описание |
Disabled
|
string
|
|
Enabled
|
string
|
|
ExpectedStatusCodeRanges
Список ожидаемых диапазонов кодов состояния.
Имя |
Тип |
Описание |
max
|
integer
|
Максимальный код состояния.
|
min
|
integer
|
Минимальный код состояния.
|
MonitorConfig
Класс, содержащий параметры мониторинга конечных точек в профиле диспетчера трафика.
Имя |
Тип |
Описание |
customHeaders
|
CustomHeaders[]
|
Список настраиваемых заголовков.
|
expectedStatusCodeRanges
|
ExpectedStatusCodeRanges[]
|
Список ожидаемых диапазонов кодов состояния.
|
intervalInSeconds
|
integer
|
Интервал монитора для конечных точек в этом профиле. Это интервал, через который диспетчер трафика будет проверка работоспособность каждой конечной точки в этом профиле.
|
path
|
string
|
Путь относительно имени домена конечной точки, используемого для проверки работоспособности конечной точки.
|
port
|
integer
|
TCP-порт, используемый для проверки работоспособности конечной точки.
|
profileMonitorStatus
|
ProfileMonitorStatus
|
Состояние мониторинга на уровне профиля диспетчера трафика.
|
protocol
|
MonitorProtocol
|
Протокол (HTTP, HTTPS или TCP), используемый для проверки работоспособности конечной точки.
|
timeoutInSeconds
|
integer
|
Время ожидания монитора для конечных точек в этом профиле. Это время, когда диспетчер трафика разрешает конечным точкам в этом профиле реагировать на проверка работоспособности.
|
toleratedNumberOfFailures
|
integer
|
Количество последовательных проверка работоспособности, допускаемых диспетчером трафика перед объявлением конечной точки в этом профиле пониженной после следующего сбоя работоспособности проверка.
|
MonitorProtocol
Протокол (HTTP, HTTPS или TCP), используемый для проверки работоспособности конечной точки.
Имя |
Тип |
Описание |
HTTP
|
string
|
|
HTTPS
|
string
|
|
TCP
|
string
|
|
Profile
Класс, представляющий профиль диспетчера трафика.
Имя |
Тип |
Описание |
id
|
string
|
Полный идентификатор ресурса для ресурса. Пример : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}
|
location
|
string
|
Регион Azure, в котором находится ресурс
|
name
|
string
|
Имя ресурса.
|
properties.allowedEndpointRecordTypes
|
AllowedEndpointRecordType[]
|
Список разрешенных типов записей конечной точки.
|
properties.dnsConfig
|
DnsConfig
|
Параметры DNS профиля диспетчера трафика.
|
properties.endpoints
|
Endpoint[]
|
Список конечных точек в профиле диспетчера трафика.
|
properties.maxReturn
|
integer
|
Максимальное количество конечных точек, возвращаемых для типа маршрутизации MultiValue.
|
properties.monitorConfig
|
MonitorConfig
|
Параметры мониторинга конечной точки профиля диспетчера трафика.
|
properties.profileStatus
|
ProfileStatus
|
Состояние профиля диспетчера трафика.
|
properties.trafficRoutingMethod
|
TrafficRoutingMethod
|
Метод маршрутизации трафика профиля диспетчера трафика.
|
properties.trafficViewEnrollmentStatus
|
TrafficViewEnrollmentStatus
|
Указывает, является ли представление трафика включенным или отключенным для профиля диспетчера трафика. Null, означает "Отключено". Включение этой функции приведет к увеличению стоимости профиля управления трафиком.
|
tags
|
object
|
Теги ресурсов.
|
type
|
string
|
Тип ресурса. Например, Microsoft.Network/trafficManagerProfiles.
|
ProfileMonitorStatus
Состояние мониторинга на уровне профиля диспетчера трафика.
Имя |
Тип |
Описание |
CheckingEndpoints
|
string
|
|
Degraded
|
string
|
|
Disabled
|
string
|
|
Inactive
|
string
|
|
Online
|
string
|
|
ProfileStatus
Состояние профиля диспетчера трафика.
Имя |
Тип |
Описание |
Disabled
|
string
|
|
Enabled
|
string
|
|
Subnets
Список подсетей, IP-адресов и (или) диапазонов адресов, сопоставленных с этой конечной точкой при использовании метода маршрутизации трафика "Подсеть". Пустой список будет соответствовать всем диапазонам, не охватываемым другими конечными точками.
Имя |
Тип |
Описание |
first
|
string
|
Первый адрес в подсети.
|
last
|
string
|
Последний адрес в подсети.
|
scope
|
integer
|
Размер блока (количество битов в начале в маске подсети).
|
TrafficRoutingMethod
Метод маршрутизации трафика профиля диспетчера трафика.
Имя |
Тип |
Описание |
Geographic
|
string
|
|
MultiValue
|
string
|
|
Performance
|
string
|
|
Priority
|
string
|
|
Subnet
|
string
|
|
Weighted
|
string
|
|
TrafficViewEnrollmentStatus
Указывает, является ли представление трафика включенным или отключенным для профиля диспетчера трафика. Null, означает "Отключено". Включение этой функции приведет к увеличению стоимости профиля управления трафиком.
Имя |
Тип |
Описание |
Disabled
|
string
|
|
Enabled
|
string
|
|