Skip to content

Commit

Permalink
CodeGen from PR 12681 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 44c2b70fadca775bc9bbaa64398c4ade1caf4b88 into d3637e8172761388ebbfd2b6f1467855ba4e34c0
  • Loading branch information
SDKAuto committed Feb 4, 2021
1 parent ea5bf30 commit c1d353f
Show file tree
Hide file tree
Showing 41 changed files with 1,743 additions and 209 deletions.
2 changes: 1 addition & 1 deletion sdk/mediaservices/arm-mediaservices/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2020 Microsoft
Copyright (c) 2021 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
55 changes: 17 additions & 38 deletions sdk/mediaservices/arm-mediaservices/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ npm install @azure/arm-mediaservices

### How to use

#### nodejs - Authentication, client creation and list all Assets as an example written in TypeScript.
This sample shows how to use Service Principal authentication with details obtained from the Azure Portal's API Access page in your Azure Media Services account.
It also demonstrates how to create the Media Services client and do a simple listing of all assets in the account. If no Assets have been created yet, the list will just return empty.

More detailed examples are available at the following Samples repository. Contributions are encouraged!
- [Azure Media Services v3 Node samples](https://github.com/Azure-Samples/media-services-v3-node-tutorials)
#### nodejs - client creation and list accountFilters as an example written in TypeScript.

##### Install @azure/ms-rest-nodeauth

Expand All @@ -31,38 +26,22 @@ npm install @azure/ms-rest-nodeauth@"^3.0.0"

##### Sample code

While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package
```typescript
import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import { AzureMediaServices, AzureMediaServicesModels, AzureMediaServicesMappers } from "@azure/arm-mediaservices";

export async function main() {
// Go to the Azure Portal and copy the values obtained
// from your Media Services account's API Access page into the constants
const clientId = "<<Enter the AadClientId value from the Azure Portal>>";
const secret = "<<Enter the AadSecret value from the Azure Portal>>";
const tenantDomain = "<<Enter the AadTenantDomain value from the Azure portal>>";
const subscriptionId = "<<Enter the SubscriptionId value from the Azure portal>>";
const resourceGroup = "<<Enter the ResourceGroup value from the Azure portal>>";
const accountName = "<<Enter the AccountName value from the Azure portal>>";


const creds = await msRestNodeAuth.loginWithServicePrincipalSecret(clientId, secret, tenantDomain);
const mediaClient = new AzureMediaServices(creds, subscriptionId);

// List Assets in Account
console.log("Listing Assets Names in account:")
var assets = await mediaClient.assets.list(resourceGroup, accountName);

assets.forEach(asset => {
console.log(asset.name);
});

}

main().catch((err) => {
console.error("Error running sample:", err.message);
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
const { AzureMediaServices } = require("@azure/arm-mediaservices");
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new AzureMediaServices(creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const accountName = "testaccountName";
client.accountFilters.list(resourceGroupName, accountName).then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.error(err);
});
```

Expand Down Expand Up @@ -102,7 +81,7 @@ See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to
const client = new Azure.ArmMediaservices.AzureMediaServices(res.creds, subscriptionId);
const resourceGroupName = "testresourceGroupName";
const accountName = "testaccountName";
client.assets.list(resourceGroupName, accountName).then((result) => {
client.accountFilters.list(resourceGroupName, accountName).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
Expand Down
4 changes: 2 additions & 2 deletions sdk/mediaservices/arm-mediaservices/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const config = {
"@azure/ms-rest-azure-js": "msRestAzure"
},
banner: `/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
Expand Down
5 changes: 2 additions & 3 deletions sdk/mediaservices/arm-mediaservices/src/azureMediaServices.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
Expand All @@ -21,6 +21,7 @@ export {
Audio,
AudioAnalyzerPreset,
AudioOverlay,
AudioTrackDescriptor,
AzureEntityResource,
BaseResource,
BuiltInStandardEncoderPreset,
Expand Down Expand Up @@ -67,11 +68,18 @@ export {
FilterTrackSelection,
FirstQuality,
Format,
FromAllInputFile,
FromEachInputFile,
H264Layer,
H264Video,
H265Layer,
H265Video,
H265VideoLayer,
Hls,
Image,
ImageFormat,
InputDefinition,
InputFile,
IPAccessControl,
IPRange,
Job,
Expand All @@ -82,6 +90,7 @@ export {
JobInputClip,
JobInputHttp,
JobInputs,
JobInputSequence,
JobOutput,
JobOutputAsset,
JpgFormat,
Expand Down Expand Up @@ -120,6 +129,10 @@ export {
ProxyResource,
Rectangle,
Resource,
SelectAudioTrackByAttribute,
SelectAudioTrackById,
SelectVideoTrackByAttribute,
SelectVideoTrackById,
StandardEncoderPreset,
StorageAccount,
StreamingEndpoint,
Expand All @@ -132,6 +145,8 @@ export {
StreamingPolicyFairPlayConfiguration,
StreamingPolicyPlayReadyConfiguration,
StreamingPolicyWidevineConfiguration,
SystemData,
TrackDescriptor,
TrackedResource,
TrackPropertyCondition,
TrackSelection,
Expand All @@ -142,5 +157,6 @@ export {
Video,
VideoAnalyzerPreset,
VideoLayer,
VideoOverlay
VideoOverlay,
VideoTrackDescriptor
} from "../models/mappers";
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
Expand All @@ -21,6 +21,7 @@ export {
Audio,
AudioAnalyzerPreset,
AudioOverlay,
AudioTrackDescriptor,
AzureEntityResource,
BaseResource,
BuiltInStandardEncoderPreset,
Expand Down Expand Up @@ -67,11 +68,18 @@ export {
FilterTrackSelection,
FirstQuality,
Format,
FromAllInputFile,
FromEachInputFile,
H264Layer,
H264Video,
H265Layer,
H265Video,
H265VideoLayer,
Hls,
Image,
ImageFormat,
InputDefinition,
InputFile,
IPAccessControl,
IPRange,
Job,
Expand All @@ -82,6 +90,7 @@ export {
JobInputClip,
JobInputHttp,
JobInputs,
JobInputSequence,
JobOutput,
JobOutputAsset,
JpgFormat,
Expand Down Expand Up @@ -120,6 +129,10 @@ export {
ProxyResource,
Rectangle,
Resource,
SelectAudioTrackByAttribute,
SelectAudioTrackById,
SelectVideoTrackByAttribute,
SelectVideoTrackById,
StandardEncoderPreset,
StorageAccount,
StreamingEndpoint,
Expand All @@ -132,6 +145,8 @@ export {
StreamingPolicyFairPlayConfiguration,
StreamingPolicyPlayReadyConfiguration,
StreamingPolicyWidevineConfiguration,
SystemData,
TrackDescriptor,
TrackedResource,
TrackPropertyCondition,
TrackSelection,
Expand All @@ -142,5 +157,6 @@ export {
Video,
VideoAnalyzerPreset,
VideoLayer,
VideoOverlay
VideoOverlay,
VideoTrackDescriptor
} from "../models/mappers";
22 changes: 19 additions & 3 deletions sdk/mediaservices/arm-mediaservices/src/models/assetsMappers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
Expand All @@ -24,6 +24,7 @@ export {
Audio,
AudioAnalyzerPreset,
AudioOverlay,
AudioTrackDescriptor,
AzureEntityResource,
BaseResource,
BuiltInStandardEncoderPreset,
Expand Down Expand Up @@ -70,11 +71,18 @@ export {
FilterTrackSelection,
FirstQuality,
Format,
FromAllInputFile,
FromEachInputFile,
H264Layer,
H264Video,
H265Layer,
H265Video,
H265VideoLayer,
Hls,
Image,
ImageFormat,
InputDefinition,
InputFile,
IPAccessControl,
IPRange,
Job,
Expand All @@ -85,6 +93,7 @@ export {
JobInputClip,
JobInputHttp,
JobInputs,
JobInputSequence,
JobOutput,
JobOutputAsset,
JpgFormat,
Expand Down Expand Up @@ -125,6 +134,10 @@ export {
ProxyResource,
Rectangle,
Resource,
SelectAudioTrackByAttribute,
SelectAudioTrackById,
SelectVideoTrackByAttribute,
SelectVideoTrackById,
StandardEncoderPreset,
StorageAccount,
StorageEncryptedAssetDecryptionData,
Expand All @@ -138,6 +151,8 @@ export {
StreamingPolicyFairPlayConfiguration,
StreamingPolicyPlayReadyConfiguration,
StreamingPolicyWidevineConfiguration,
SystemData,
TrackDescriptor,
TrackedResource,
TrackPropertyCondition,
TrackSelection,
Expand All @@ -148,5 +163,6 @@ export {
Video,
VideoAnalyzerPreset,
VideoLayer,
VideoOverlay
VideoOverlay,
VideoTrackDescriptor
} from "../models/mappers";
Loading

0 comments on commit c1d353f

Please sign in to comment.