Tworzenie lokalizatora przesyłania strumieniowego na koncie usługi Media Services
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaServices/{accountName}/streamingLocators/{streamingLocatorName}?api-version=2022-08-01
Parametry identyfikatora URI
Nazwa |
W |
Wymagane |
Typ |
Opis |
accountName
|
path |
True
|
string
|
Nazwa konta usługi Media Services.
|
resourceGroupName
|
path |
True
|
string
|
Nazwa grupy zasobów w ramach subskrypcji platformy Azure.
|
streamingLocatorName
|
path |
True
|
string
|
Nazwa lokalizatora przesyłania strumieniowego.
|
subscriptionId
|
path |
True
|
string
|
Unikatowy identyfikator subskrypcji platformy Microsoft Azure.
|
api-version
|
query |
True
|
string
|
Wersja interfejsu API, która ma być używana z żądaniem klienta.
|
Treść żądania
Nazwa |
Wymagane |
Typ |
Opis |
properties.assetName
|
True
|
string
|
Nazwa zasobu
|
properties.streamingPolicyName
|
True
|
string
|
Nazwa zasad przesyłania strumieniowego używanych przez ten lokalizator przesyłania strumieniowego. Określ nazwę utworzonych zasad przesyłania strumieniowego lub użyj jednej ze wstępnie zdefiniowanych zasad przesyłania strumieniowego. Dostępne są wstępnie zdefiniowane zasady przesyłania strumieniowego: "Predefined_DownloadOnly", "Predefined_ClearStreamingOnly", "Predefined_DownloadAndClearStreaming", "Predefined_ClearKey", "Predefined_MultiDrmCencStreaming" i "Predefined_MultiDrmStreaming"
|
properties.alternativeMediaId
|
|
string
|
Alternatywny identyfikator nośnika tego lokalizatora przesyłania strumieniowego
|
properties.contentKeys
|
|
StreamingLocatorContentKey[]
|
Keys używane przez ten lokalizator przesyłania strumieniowego.
|
properties.defaultContentKeyPolicyName
|
|
string
|
Nazwa domyślnego obiektu ContentKeyPolicy używanego przez ten lokalizator przesyłania strumieniowego.
|
properties.endTime
|
|
string
|
Godzina zakończenia lokalizatora przesyłania strumieniowego.
|
properties.filters
|
|
string[]
|
Lista filtrów zasobów lub kont, które mają zastosowanie do tego lokalizatora przesyłania strumieniowego
|
properties.startTime
|
|
string
|
Godzina rozpoczęcia lokalizatora przesyłania strumieniowego.
|
properties.streamingLocatorId
|
|
string
|
Element StreamingLocatorId lokalizatora przesyłania strumieniowego.
|
Odpowiedzi
Przykłady
Creates a Streaming Locator with clear streaming
Sample Request
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/streamingLocators/UserCreatedClearStreamingLocator?api-version=2022-08-01
{
"properties": {
"streamingPolicyName": "clearStreamingPolicy",
"assetName": "ClimbingMountRainier"
}
}
/** Samples for StreamingLocators Create. */
public final class Main {
/*
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-clear.json
*/
/**
* Sample code: Creates a Streaming Locator with clear streaming.
*
* @param manager Entry point to MediaServicesManager.
*/
public static void createsAStreamingLocatorWithClearStreaming(
com.azure.resourcemanager.mediaservices.MediaServicesManager manager) {
manager
.streamingLocators()
.define("UserCreatedClearStreamingLocator")
.withExistingMediaService("contosorg", "contosomedia")
.withAssetName("ClimbingMountRainier")
.withStreamingPolicyName("clearStreamingPolicy")
.create();
}
}
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.media import AzureMediaServices
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-media
# USAGE
python streaminglocatorscreateclear.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 = AzureMediaServices(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.streaming_locators.create(
resource_group_name="contoso",
account_name="contosomedia",
streaming_locator_name="UserCreatedClearStreamingLocator",
parameters={"properties": {"assetName": "ClimbingMountRainier", "streamingPolicyName": "clearStreamingPolicy"}},
)
print(response)
# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-clear.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 armmediaservices_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/mediaservices/armmediaservices/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7bf3adfa2d5e5cdbb804eec35279501794f461c/specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-clear.json
func ExampleStreamingLocatorsClient_Create_createsAStreamingLocatorWithClearStreaming() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmediaservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewStreamingLocatorsClient().Create(ctx, "contoso", "contosomedia", "UserCreatedClearStreamingLocator", armmediaservices.StreamingLocator{
Properties: &armmediaservices.StreamingLocatorProperties{
AssetName: to.Ptr("ClimbingMountRainier"),
StreamingPolicyName: to.Ptr("clearStreamingPolicy"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { AzureMediaServices } = require("@azure/arm-mediaservices");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create a Streaming Locator in the Media Services account
*
* @summary Create a Streaming Locator in the Media Services account
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-clear.json
*/
async function createsAStreamingLocatorWithClearStreaming() {
const subscriptionId =
process.env["MEDIASERVICES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["MEDIASERVICES_RESOURCE_GROUP"] || "contoso";
const accountName = "contosomedia";
const streamingLocatorName = "UserCreatedClearStreamingLocator";
const parameters = {
assetName: "ClimbingMountRainier",
streamingPolicyName: "clearStreamingPolicy",
};
const credential = new DefaultAzureCredential();
const client = new AzureMediaServices(credential, subscriptionId);
const result = await client.streamingLocators.create(
resourceGroupName,
accountName,
streamingLocatorName,
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 System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Media;
using Azure.ResourceManager.Media.Models;
// Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-clear.json
// this example is just showing the usage of "StreamingLocators_Create" 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 StreamingLocatorResource created on azure
// for more information of creating StreamingLocatorResource, please refer to the document of StreamingLocatorResource
string subscriptionId = "00000000-0000-0000-0000-000000000000";
string resourceGroupName = "contoso";
string accountName = "contosomedia";
string streamingLocatorName = "UserCreatedClearStreamingLocator";
ResourceIdentifier streamingLocatorResourceId = StreamingLocatorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, streamingLocatorName);
StreamingLocatorResource streamingLocator = client.GetStreamingLocatorResource(streamingLocatorResourceId);
// invoke the operation
StreamingLocatorData data = new StreamingLocatorData()
{
AssetName = "ClimbingMountRainier",
StreamingPolicyName = "clearStreamingPolicy",
};
ArmOperation<StreamingLocatorResource> lro = await streamingLocator.UpdateAsync(WaitUntil.Completed, data);
StreamingLocatorResource 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
StreamingLocatorData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"name": "UserCreatedClearStreamingLocator",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/streamingLocators/UserCreatedClearStreamingLocator",
"type": "Microsoft.Media/mediaservices/streamingLocators",
"properties": {
"assetName": "ClimbingMountRainier",
"created": "2018-08-08T18:29:32.4323237Z",
"endTime": "9999-12-31T23:59:59.9999999Z",
"streamingLocatorId": "e34b0fc4-3be0-4a3c-9793-1f6b7be5b013",
"streamingPolicyName": "clearStreamingPolicy",
"contentKeys": []
}
}
Creates a Streaming Locator with secure streaming
Sample Request
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/streamingLocators/UserCreatedSecureStreamingLocator?api-version=2022-08-01
{
"properties": {
"streamingPolicyName": "UserCreatedSecureStreamingPolicy",
"assetName": "ClimbingMountRainier",
"startTime": "2018-03-01T00:00:00Z",
"endTime": "2028-12-31T23:59:59.9999999Z"
}
}
import java.time.OffsetDateTime;
/** Samples for StreamingLocators Create. */
public final class Main {
/*
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-secure.json
*/
/**
* Sample code: Creates a Streaming Locator with secure streaming.
*
* @param manager Entry point to MediaServicesManager.
*/
public static void createsAStreamingLocatorWithSecureStreaming(
com.azure.resourcemanager.mediaservices.MediaServicesManager manager) {
manager
.streamingLocators()
.define("UserCreatedSecureStreamingLocator")
.withExistingMediaService("contosorg", "contosomedia")
.withAssetName("ClimbingMountRainier")
.withStartTime(OffsetDateTime.parse("2018-03-01T00:00:00Z"))
.withEndTime(OffsetDateTime.parse("2028-12-31T23:59:59.9999999Z"))
.withStreamingPolicyName("UserCreatedSecureStreamingPolicy")
.create();
}
}
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.media import AzureMediaServices
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-media
# USAGE
python streaminglocatorscreatesecure.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 = AzureMediaServices(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.streaming_locators.create(
resource_group_name="contoso",
account_name="contosomedia",
streaming_locator_name="UserCreatedSecureStreamingLocator",
parameters={
"properties": {
"assetName": "ClimbingMountRainier",
"endTime": "2028-12-31T23:59:59.9999999Z",
"startTime": "2018-03-01T00:00:00Z",
"streamingPolicyName": "secureStreamingPolicy",
}
},
)
print(response)
# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-secure.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 armmediaservices_test
import (
"context"
"log"
"time"
"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/mediaservices/armmediaservices/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7bf3adfa2d5e5cdbb804eec35279501794f461c/specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-secure.json
func ExampleStreamingLocatorsClient_Create_createsAStreamingLocatorWithSecureStreaming() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmediaservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewStreamingLocatorsClient().Create(ctx, "contoso", "contosomedia", "UserCreatedSecureStreamingLocator", armmediaservices.StreamingLocator{
Properties: &armmediaservices.StreamingLocatorProperties{
AssetName: to.Ptr("ClimbingMountRainier"),
EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2028-12-31T23:59:59.999Z"); return t }()),
StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-01T00:00:00.000Z"); return t }()),
StreamingPolicyName: to.Ptr("secureStreamingPolicy"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { AzureMediaServices } = require("@azure/arm-mediaservices");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create a Streaming Locator in the Media Services account
*
* @summary Create a Streaming Locator in the Media Services account
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-secure.json
*/
async function createsAStreamingLocatorWithSecureStreaming() {
const subscriptionId =
process.env["MEDIASERVICES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["MEDIASERVICES_RESOURCE_GROUP"] || "contoso";
const accountName = "contosomedia";
const streamingLocatorName = "UserCreatedSecureStreamingLocator";
const parameters = {
assetName: "ClimbingMountRainier",
endTime: new Date("2028-12-31T23:59:59.9999999Z"),
startTime: new Date("2018-03-01T00:00:00Z"),
streamingPolicyName: "secureStreamingPolicy",
};
const credential = new DefaultAzureCredential();
const client = new AzureMediaServices(credential, subscriptionId);
const result = await client.streamingLocators.create(
resourceGroupName,
accountName,
streamingLocatorName,
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 System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Media;
using Azure.ResourceManager.Media.Models;
// Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-secure.json
// this example is just showing the usage of "StreamingLocators_Create" 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 StreamingLocatorResource created on azure
// for more information of creating StreamingLocatorResource, please refer to the document of StreamingLocatorResource
string subscriptionId = "00000000-0000-0000-0000-000000000000";
string resourceGroupName = "contoso";
string accountName = "contosomedia";
string streamingLocatorName = "UserCreatedSecureStreamingLocator";
ResourceIdentifier streamingLocatorResourceId = StreamingLocatorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, streamingLocatorName);
StreamingLocatorResource streamingLocator = client.GetStreamingLocatorResource(streamingLocatorResourceId);
// invoke the operation
StreamingLocatorData data = new StreamingLocatorData()
{
AssetName = "ClimbingMountRainier",
StartOn = DateTimeOffset.Parse("2018-03-01T00:00:00Z"),
EndOn = DateTimeOffset.Parse("2028-12-31T23:59:59.9999999Z"),
StreamingPolicyName = "secureStreamingPolicy",
};
ArmOperation<StreamingLocatorResource> lro = await streamingLocator.UpdateAsync(WaitUntil.Completed, data);
StreamingLocatorResource 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
StreamingLocatorData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"name": "UserCreatedSecureStreamingLocator",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/streamingLocators/UserCreatedSecureStreamingLocator",
"type": "Microsoft.Media/mediaservices/streamingLocators",
"properties": {
"assetName": "ClimbingMountRainier",
"created": "2018-08-08T18:29:32.6243295Z",
"startTime": "2018-03-01T00:00:00Z",
"endTime": "2028-12-31T23:59:59.9999999Z",
"streamingLocatorId": "962775be-41fb-452a-b0dc-72ca2543a945",
"streamingPolicyName": "UserCreatedSecureStreamingPolicy",
"contentKeys": [
{
"id": "1b2d5581-4518-4a51-ad8a-f55d3bf993d4",
"type": "CommonEncryptionCbcs",
"labelReferenceInStreamingPolicy": "cbcsDefaultKey",
"tracks": []
},
{
"id": "1a9858b1-3566-4bf1-9fee-60f2fb98e7e4",
"type": "CommonEncryptionCenc",
"labelReferenceInStreamingPolicy": "cencDefaultKey",
"tracks": []
},
{
"id": "5faac86a-3aca-4d6b-99c0-6bb8cc3497a1",
"type": "EnvelopeEncryption",
"labelReferenceInStreamingPolicy": "aesDefaultKey",
"tracks": []
}
]
}
}
Creates a Streaming Locator with user defined content keys
Sample Request
PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaServices/contosomedia/streamingLocators/UserCreatedSecureStreamingLocatorWithUserDefinedContentKeys?api-version=2022-08-01
{
"properties": {
"assetName": "ClimbingMountRainier",
"streamingPolicyName": "secureStreamingPolicy",
"streamingLocatorId": "90000000-0000-0000-0000-00000000000A",
"contentKeys": [
{
"labelReferenceInStreamingPolicy": "aesDefaultKey",
"id": "60000000-0000-0000-0000-000000000001",
"value": "1UqLohAfWsEGkULYxHjYZg=="
},
{
"labelReferenceInStreamingPolicy": "cencDefaultKey",
"id": "60000000-0000-0000-0000-000000000004",
"value": "4UqLohAfWsEGkULYxHjYZg=="
},
{
"labelReferenceInStreamingPolicy": "cbcsDefaultKey",
"id": "60000000-0000-0000-0000-000000000007",
"value": "7UqLohAfWsEGkULYxHjYZg=="
}
]
}
}
import com.azure.resourcemanager.mediaservices.models.StreamingLocatorContentKey;
import java.util.Arrays;
import java.util.UUID;
/** Samples for StreamingLocators Create. */
public final class Main {
/*
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-secure-userDefinedContentKeys.json
*/
/**
* Sample code: Creates a Streaming Locator with user defined content keys.
*
* @param manager Entry point to MediaServicesManager.
*/
public static void createsAStreamingLocatorWithUserDefinedContentKeys(
com.azure.resourcemanager.mediaservices.MediaServicesManager manager) {
manager
.streamingLocators()
.define("UserCreatedSecureStreamingLocatorWithUserDefinedContentKeys")
.withExistingMediaService("contosorg", "contosomedia")
.withAssetName("ClimbingMountRainier")
.withStreamingLocatorId(UUID.fromString("90000000-0000-0000-0000-00000000000A"))
.withStreamingPolicyName("secureStreamingPolicy")
.withContentKeys(
Arrays
.asList(
new StreamingLocatorContentKey()
.withId(UUID.fromString("60000000-0000-0000-0000-000000000001"))
.withLabelReferenceInStreamingPolicy("aesDefaultKey")
.withValue("1UqLohAfWsEGkULYxHjYZg=="),
new StreamingLocatorContentKey()
.withId(UUID.fromString("60000000-0000-0000-0000-000000000004"))
.withLabelReferenceInStreamingPolicy("cencDefaultKey")
.withValue("4UqLohAfWsEGkULYxHjYZg=="),
new StreamingLocatorContentKey()
.withId(UUID.fromString("60000000-0000-0000-0000-000000000007"))
.withLabelReferenceInStreamingPolicy("cbcsDefaultKey")
.withValue("7UqLohAfWsEGkULYxHjYZg==")))
.create();
}
}
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.media import AzureMediaServices
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-media
# USAGE
python streaminglocatorscreatesecureuser_defined_content_keys.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 = AzureMediaServices(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.streaming_locators.create(
resource_group_name="contoso",
account_name="contosomedia",
streaming_locator_name="UserCreatedSecureStreamingLocatorWithUserDefinedContentKeys",
parameters={
"properties": {
"assetName": "ClimbingMountRainier",
"contentKeys": [
{
"id": "60000000-0000-0000-0000-000000000001",
"labelReferenceInStreamingPolicy": "aesDefaultKey",
"value": "1UqLohAfWsEGkULYxHjYZg==",
},
{
"id": "60000000-0000-0000-0000-000000000004",
"labelReferenceInStreamingPolicy": "cencDefaultKey",
"value": "4UqLohAfWsEGkULYxHjYZg==",
},
{
"id": "60000000-0000-0000-0000-000000000007",
"labelReferenceInStreamingPolicy": "cbcsDefaultKey",
"value": "7UqLohAfWsEGkULYxHjYZg==",
},
],
"streamingLocatorId": "90000000-0000-0000-0000-00000000000A",
"streamingPolicyName": "secureStreamingPolicy",
}
},
)
print(response)
# x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-secure-userDefinedContentKeys.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 armmediaservices_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/mediaservices/armmediaservices/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7bf3adfa2d5e5cdbb804eec35279501794f461c/specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-secure-userDefinedContentKeys.json
func ExampleStreamingLocatorsClient_Create_createsAStreamingLocatorWithUserDefinedContentKeys() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmediaservices.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewStreamingLocatorsClient().Create(ctx, "contoso", "contosomedia", "UserCreatedSecureStreamingLocatorWithUserDefinedContentKeys", armmediaservices.StreamingLocator{
Properties: &armmediaservices.StreamingLocatorProperties{
AssetName: to.Ptr("ClimbingMountRainier"),
ContentKeys: []*armmediaservices.StreamingLocatorContentKey{
{
ID: to.Ptr("60000000-0000-0000-0000-000000000001"),
LabelReferenceInStreamingPolicy: to.Ptr("aesDefaultKey"),
Value: to.Ptr("1UqLohAfWsEGkULYxHjYZg=="),
},
{
ID: to.Ptr("60000000-0000-0000-0000-000000000004"),
LabelReferenceInStreamingPolicy: to.Ptr("cencDefaultKey"),
Value: to.Ptr("4UqLohAfWsEGkULYxHjYZg=="),
},
{
ID: to.Ptr("60000000-0000-0000-0000-000000000007"),
LabelReferenceInStreamingPolicy: to.Ptr("cbcsDefaultKey"),
Value: to.Ptr("7UqLohAfWsEGkULYxHjYZg=="),
}},
StreamingLocatorID: to.Ptr("90000000-0000-0000-0000-00000000000A"),
StreamingPolicyName: to.Ptr("secureStreamingPolicy"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { AzureMediaServices } = require("@azure/arm-mediaservices");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create a Streaming Locator in the Media Services account
*
* @summary Create a Streaming Locator in the Media Services account
* x-ms-original-file: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-secure-userDefinedContentKeys.json
*/
async function createsAStreamingLocatorWithUserDefinedContentKeys() {
const subscriptionId =
process.env["MEDIASERVICES_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["MEDIASERVICES_RESOURCE_GROUP"] || "contoso";
const accountName = "contosomedia";
const streamingLocatorName = "UserCreatedSecureStreamingLocatorWithUserDefinedContentKeys";
const parameters = {
assetName: "ClimbingMountRainier",
contentKeys: [
{
id: "60000000-0000-0000-0000-000000000001",
labelReferenceInStreamingPolicy: "aesDefaultKey",
value: "1UqLohAfWsEGkULYxHjYZg==",
},
{
id: "60000000-0000-0000-0000-000000000004",
labelReferenceInStreamingPolicy: "cencDefaultKey",
value: "4UqLohAfWsEGkULYxHjYZg==",
},
{
id: "60000000-0000-0000-0000-000000000007",
labelReferenceInStreamingPolicy: "cbcsDefaultKey",
value: "7UqLohAfWsEGkULYxHjYZg==",
},
],
streamingLocatorId: "90000000-0000-0000-0000-00000000000A",
streamingPolicyName: "secureStreamingPolicy",
};
const credential = new DefaultAzureCredential();
const client = new AzureMediaServices(credential, subscriptionId);
const result = await client.streamingLocators.create(
resourceGroupName,
accountName,
streamingLocatorName,
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 System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Media;
using Azure.ResourceManager.Media.Models;
// Generated from example definition: specification/mediaservices/resource-manager/Microsoft.Media/Metadata/stable/2022-08-01/examples/streaming-locators-create-secure-userDefinedContentKeys.json
// this example is just showing the usage of "StreamingLocators_Create" 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 StreamingLocatorResource created on azure
// for more information of creating StreamingLocatorResource, please refer to the document of StreamingLocatorResource
string subscriptionId = "00000000-0000-0000-0000-000000000000";
string resourceGroupName = "contoso";
string accountName = "contosomedia";
string streamingLocatorName = "UserCreatedSecureStreamingLocatorWithUserDefinedContentKeys";
ResourceIdentifier streamingLocatorResourceId = StreamingLocatorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, streamingLocatorName);
StreamingLocatorResource streamingLocator = client.GetStreamingLocatorResource(streamingLocatorResourceId);
// invoke the operation
StreamingLocatorData data = new StreamingLocatorData()
{
AssetName = "ClimbingMountRainier",
StreamingLocatorId = Guid.Parse("90000000-0000-0000-0000-00000000000A"),
StreamingPolicyName = "secureStreamingPolicy",
ContentKeys =
{
new StreamingLocatorContentKey(Guid.Parse("60000000-0000-0000-0000-000000000001"))
{
LabelReferenceInStreamingPolicy = "aesDefaultKey",
Value = "1UqLohAfWsEGkULYxHjYZg==",
},new StreamingLocatorContentKey(Guid.Parse("60000000-0000-0000-0000-000000000004"))
{
LabelReferenceInStreamingPolicy = "cencDefaultKey",
Value = "4UqLohAfWsEGkULYxHjYZg==",
},new StreamingLocatorContentKey(Guid.Parse("60000000-0000-0000-0000-000000000007"))
{
LabelReferenceInStreamingPolicy = "cbcsDefaultKey",
Value = "7UqLohAfWsEGkULYxHjYZg==",
}
},
};
ArmOperation<StreamingLocatorResource> lro = await streamingLocator.UpdateAsync(WaitUntil.Completed, data);
StreamingLocatorResource 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
StreamingLocatorData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"name": "UserCreatedSecureStreamingLocatorWithUserDefinedContentKeys",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contosorg/providers/Microsoft.Media/mediaservices/contosomedia/streamingLocators/UserCreatedSecureStreamingLocatorWithUserDefinedContentKeys",
"type": "Microsoft.Media/mediaservices/streamingLocators",
"properties": {
"assetName": "ClimbingMountRainier",
"created": "2018-08-08T18:29:32.7859424Z",
"endTime": "9999-12-31T23:59:59.9999999Z",
"streamingLocatorId": "90000000-0000-0000-0000-00000000000a",
"streamingPolicyName": "secureStreamingPolicy",
"contentKeys": [
{
"id": "60000000-0000-0000-0000-000000000007",
"type": "CommonEncryptionCbcs",
"labelReferenceInStreamingPolicy": "cbcsDefaultKey",
"tracks": []
},
{
"id": "60000000-0000-0000-0000-000000000004",
"type": "CommonEncryptionCenc",
"labelReferenceInStreamingPolicy": "cencDefaultKey",
"tracks": []
},
{
"id": "60000000-0000-0000-0000-000000000001",
"type": "EnvelopeEncryption",
"labelReferenceInStreamingPolicy": "aesDefaultKey",
"tracks": []
}
]
}
}
Definicje
createdByType
Typ tożsamości, która utworzyła zasób.
Nazwa |
Typ |
Opis |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
Dodatkowe informacje o błędzie zarządzania zasobami.
Nazwa |
Typ |
Opis |
info
|
object
|
Dodatkowe informacje.
|
type
|
string
|
Dodatkowy typ informacji.
|
ErrorDetail
Szczegóły błędu.
Nazwa |
Typ |
Opis |
additionalInfo
|
ErrorAdditionalInfo[]
|
Dodatkowe informacje o błędzie.
|
code
|
string
|
Kod błędu.
|
details
|
ErrorDetail[]
|
Szczegóły błędu.
|
message
|
string
|
Komunikat o błędzie.
|
target
|
string
|
Element docelowy błędu.
|
ErrorResponse
Odpowiedź na błąd
StreamingLocator
Zasób lokalizatora przesyłania strumieniowego
Nazwa |
Typ |
Opis |
id
|
string
|
W pełni kwalifikowany identyfikator zasobu dla zasobu. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
Nazwa zasobu
|
properties.alternativeMediaId
|
string
|
Alternatywny identyfikator nośnika tego lokalizatora przesyłania strumieniowego
|
properties.assetName
|
string
|
Nazwa zasobu
|
properties.contentKeys
|
StreamingLocatorContentKey[]
|
Keys używane przez ten lokalizator przesyłania strumieniowego.
|
properties.created
|
string
|
Czas utworzenia lokalizatora przesyłania strumieniowego.
|
properties.defaultContentKeyPolicyName
|
string
|
Nazwa domyślnego obiektu ContentKeyPolicy używanego przez ten lokalizator przesyłania strumieniowego.
|
properties.endTime
|
string
|
Godzina zakończenia lokalizatora przesyłania strumieniowego.
|
properties.filters
|
string[]
|
Lista filtrów zasobów lub kont, które mają zastosowanie do tego lokalizatora przesyłania strumieniowego
|
properties.startTime
|
string
|
Godzina rozpoczęcia lokalizatora przesyłania strumieniowego.
|
properties.streamingLocatorId
|
string
|
Element StreamingLocatorId lokalizatora przesyłania strumieniowego.
|
properties.streamingPolicyName
|
string
|
Nazwa zasad przesyłania strumieniowego używanych przez ten lokalizator przesyłania strumieniowego. Określ nazwę utworzonych zasad przesyłania strumieniowego lub użyj jednej ze wstępnie zdefiniowanych zasad przesyłania strumieniowego. Dostępne są wstępnie zdefiniowane zasady przesyłania strumieniowego: "Predefined_DownloadOnly", "Predefined_ClearStreamingOnly", "Predefined_DownloadAndClearStreaming", "Predefined_ClearKey", "Predefined_MultiDrmCencStreaming" i "Predefined_MultiDrmStreaming"
|
systemData
|
systemData
|
Metadane systemowe odnoszące się do tego zasobu.
|
type
|
string
|
Typ zasobu. Np. "Microsoft.Compute/virtualMachines" lub "Microsoft.Storage/storageAccounts"
|
StreamingLocatorContentKey
Klasa klucza zawartości w lokalizatorze przesyłania strumieniowego
Nazwa |
Typ |
Opis |
id
|
string
|
Identyfikator klucza zawartości
|
labelReferenceInStreamingPolicy
|
string
|
Etykieta klucza zawartości określona w zasadach przesyłania strumieniowego
|
policyName
|
string
|
ContentKeyPolicy używane przez klucz zawartości
|
tracks
|
TrackSelection[]
|
Śledzi, które używają tego klucza zawartości
|
type
|
StreamingLocatorContentKeyType
|
Typ szyfrowania klucza zawartości
|
value
|
string
|
Wartość klucza zawartości
|
StreamingLocatorContentKeyType
Typ szyfrowania klucza zawartości
Nazwa |
Typ |
Opis |
CommonEncryptionCbcs
|
string
|
Common Encryption using CBCS
|
CommonEncryptionCenc
|
string
|
Common Encryption using CENC
|
EnvelopeEncryption
|
string
|
Szyfrowanie kopert
|
systemData
Metadane dotyczące tworzenia i ostatniej modyfikacji zasobu.
Nazwa |
Typ |
Opis |
createdAt
|
string
|
Sygnatura czasowa tworzenia zasobów (UTC).
|
createdBy
|
string
|
Tożsamość, która utworzyła zasób.
|
createdByType
|
createdByType
|
Typ tożsamości, która utworzyła zasób.
|
lastModifiedAt
|
string
|
Sygnatura czasowa ostatniej modyfikacji zasobu (UTC)
|
lastModifiedBy
|
string
|
Tożsamość, która ostatnio zmodyfikowała zasób.
|
lastModifiedByType
|
createdByType
|
Typ tożsamości, która ostatnio zmodyfikowała zasób.
|
TrackPropertyCompareOperation
Śledzenie operacji warunku właściwości
Nazwa |
Typ |
Opis |
Equal
|
string
|
Równa operacja
|
Unknown
|
string
|
Nieznana operacja porównywania właściwości śledzenia
|
TrackPropertyCondition
Klasa określająca warunek jednej właściwości śledzenia
TrackPropertyType
Śledzenie typu właściwości
Nazwa |
Typ |
Opis |
FourCC
|
string
|
Track FourCC
|
Unknown
|
string
|
Nieznana właściwość ścieżki
|
TrackSelection
Klasa do wybierania ścieżki
Nazwa |
Typ |
Opis |
trackSelections
|
TrackPropertyCondition[]
|
TrackSelections to lista warunków śledzenia właściwości, która może określać ścieżki
|