Get a list of Target Type resources for given location.
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes?api-version=2024-01-01
With optional parameters:
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes?api-version=2024-01-01&continuationToken={continuationToken}
URI Parameters
Name |
In |
Required |
Type |
Description |
locationName
|
path |
True
|
string
|
String that represents a Location resource name.
Regex pattern: ^[a-zA-Z0-9_\-\.]+$
|
subscriptionId
|
path |
True
|
string
|
GUID that represents an Azure subscription ID.
Regex pattern: ^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$
|
api-version
|
query |
True
|
string
|
String that sets the API version.
Regex pattern: ^[0-9]{4}-[0-9]{2}-[0-9]{2}(|-preview)$
|
continuationToken
|
query |
|
string
|
String that sets the continuation token.
|
Responses
Name |
Type |
Description |
200 OK
|
targetTypeListResult
|
List of Target Type resources returned if request was successful.
|
Other Status Codes
|
ErrorResponse
|
Error response returned if request was unsuccessful.
|
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
Impersonate your user account
|
Examples
List all Target Types for westus2 location.
Sample Request
GET https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes?api-version=2024-01-01&continuationToken=
/**
* Samples for TargetTypes List.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargetTypes.json
*/
/**
* Sample code: List all Target Types for westus2 location.
*
* @param manager Entry point to ChaosManager.
*/
public static void listAllTargetTypesForWestus2Location(com.azure.resourcemanager.chaos.ChaosManager manager) {
manager.targetTypes().list("westus2", null, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.chaos import ChaosManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-chaos
# USAGE
python list_target_types.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 = ChaosManagementClient(
credential=DefaultAzureCredential(),
subscription_id="6b052e15-03d3-4f17-b2e1-be7f07588291",
)
response = client.target_types.list(
location_name="westus2",
)
for item in response:
print(item)
# x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargetTypes.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 armchaos_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargetTypes.json
func ExampleTargetTypesClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armchaos.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewTargetTypesClient().NewListPager("westus2", &armchaos.TargetTypesClientListOptions{ContinuationToken: nil})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.TargetTypeListResult = armchaos.TargetTypeListResult{
// Value: []*armchaos.TargetType{
// {
// Name: to.Ptr("Microsoft-Agent"),
// Type: to.Ptr("Microsoft.Chaos/locations/targetTypes"),
// ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-Agent"),
// Location: to.Ptr("centraluseuap"),
// Properties: &armchaos.TargetTypeProperties{
// Description: to.Ptr("A target represents Chaos Agent."),
// DisplayName: to.Ptr("Chaos Agent"),
// PropertiesSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine.json"),
// ResourceTypes: []*string{
// to.Ptr("Microsoft.Compute/virtualMachines"),
// to.Ptr("Microsoft.Compute/virtualMachineScaleSets")},
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ChaosManagementClient } = require("@azure/arm-chaos");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Get a list of Target Type resources for given location.
*
* @summary Get a list of Target Type resources for given location.
* x-ms-original-file: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargetTypes.json
*/
async function listAllTargetTypesForWestus2Location() {
const subscriptionId =
process.env["CHAOS_SUBSCRIPTION_ID"] || "6b052e15-03d3-4f17-b2e1-be7f07588291";
const locationName = "westus2";
const continuationToken = undefined;
const options = { continuationToken };
const credential = new DefaultAzureCredential();
const client = new ChaosManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.targetTypes.list(locationName, options)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Chaos;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargetTypes.json
// this example is just showing the usage of "TargetTypes_List" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SubscriptionResource created on azure
// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
string subscriptionId = "6b052e15-03d3-4f17-b2e1-be7f07588291";
ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
// get the collection of this ChaosTargetTypeResource
string locationName = "westus2";
ChaosTargetTypeCollection collection = subscriptionResource.GetChaosTargetTypes(locationName);
// invoke the operation and iterate over the result
string continuationToken = null;
await foreach (ChaosTargetTypeResource item in collection.GetAllAsync(continuationToken: continuationToken))
{
// the variable item is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ChaosTargetTypeData resourceData = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"value": [
{
"id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-Agent",
"type": "Microsoft.Chaos/locations/targetTypes",
"name": "Microsoft-Agent",
"location": "centraluseuap",
"properties": {
"displayName": "Chaos Agent",
"description": "A target represents Chaos Agent.",
"propertiesSchema": "https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine.json",
"resourceTypes": [
"Microsoft.Compute/virtualMachines",
"Microsoft.Compute/virtualMachineScaleSets"
]
}
}
],
"nextLink": "https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes?continuationToken=&api-version=2024-01-01"
}
Definitions
createdByType
The type of identity that created the resource.
Name |
Type |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
The resource management error additional info.
Name |
Type |
Description |
info
|
object
|
The additional info.
|
type
|
string
|
The additional info type.
|
ErrorDetail
The error detail.
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
code
|
string
|
The error code.
|
details
|
ErrorDetail[]
|
The error details.
|
message
|
string
|
The error message.
|
target
|
string
|
The error target.
|
ErrorResponse
Error response
Name |
Type |
Description |
error
|
ErrorDetail
|
The error object.
|
systemData
Metadata pertaining to creation and last modification of the resource.
Name |
Type |
Description |
createdAt
|
string
|
The timestamp of resource creation (UTC).
|
createdBy
|
string
|
The identity that created the resource.
|
createdByType
|
createdByType
|
The type of identity that created the resource.
|
lastModifiedAt
|
string
|
The timestamp of resource last modification (UTC)
|
lastModifiedBy
|
string
|
The identity that last modified the resource.
|
lastModifiedByType
|
createdByType
|
The type of identity that last modified the resource.
|
targetType
Model that represents a Target Type resource.
Name |
Type |
Description |
id
|
string
|
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
location
|
string
|
Location of the Target Type resource.
|
name
|
string
|
The name of the resource
|
properties.description
|
string
|
Localized string of the description.
|
properties.displayName
|
string
|
Localized string of the display name.
|
properties.propertiesSchema
|
string
|
URL to retrieve JSON schema of the Target Type properties.
|
properties.resourceTypes
|
string[]
|
List of resource types this Target Type can extend.
|
systemData
|
systemData
|
The system metadata properties of the target type resource.
|
type
|
string
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
targetTypeListResult
Model that represents a list of Target Type resources and a link for pagination.
Name |
Type |
Description |
nextLink
|
string
|
URL to retrieve the next page of Target Type resources.
|
value
|
targetType[]
|
List of Target Type resources.
|