Back to Aws Sdk Js V3

@aws-sdk/client-mediapackagev2

clients/client-mediapackagev2/README.md

3.1043.021.2 KB
Original Source
<!-- generated file, do not edit directly -->

@aws-sdk/client-mediapackagev2

Description

AWS SDK for JavaScript MediaPackageV2 Client for Node.js, Browser and React Native.

<note> <p>This guide is intended for creating AWS Elemental MediaPackage resources in MediaPackage Version 2 (v2) starting from May 2023. To get started with MediaPackage v2, create your MediaPackage resources. There isn't an automated process to migrate your resources from MediaPackage v1 to MediaPackage v2. </p> <p>The names of the entities that you use to access this API, like URLs and ARNs, all have the versioning information added, like "v2", to distinguish from the prior version. If you used MediaPackage prior to this release, you can't use the MediaPackage v2 CLI or the MediaPackage v2 API to access any MediaPackage v1 resources.</p> <p>If you created resources in MediaPackage v1, use video on demand (VOD) workflows, and aren't looking to migrate to MediaPackage v2 yet, see the <a href="https://docs.aws.amazon.com/mediapackage/latest/apireference/what-is.html">MediaPackage v1 Live API Reference</a>.</p> </note> <p>This is the AWS Elemental MediaPackage v2 Live REST API Reference. It describes all the MediaPackage API operations for live content in detail, and provides sample requests, responses, and errors for the supported web services protocols.</p> <p>We assume that you have the IAM permissions that you need to use MediaPackage via the REST API. We also assume that you are familiar with the features and operations of MediaPackage, as described in the AWS Elemental MediaPackage User Guide.</p>

Installing

To install this package, use the CLI of your favorite package manager:

  • npm install @aws-sdk/client-mediapackagev2
  • yarn add @aws-sdk/client-mediapackagev2
  • pnpm add @aws-sdk/client-mediapackagev2

Getting Started

Import

The AWS SDK is modulized by clients and commands. To send a request, you only need to import the MediaPackageV2Client and the commands you need, for example ListChannelGroupsCommand:

js
// ES5 example
const { MediaPackageV2Client, ListChannelGroupsCommand } = require("@aws-sdk/client-mediapackagev2");
ts
// ES6+ example
import { MediaPackageV2Client, ListChannelGroupsCommand } from "@aws-sdk/client-mediapackagev2";

Usage

To send a request:

  • Instantiate a client with configuration (e.g. credentials, region).
  • Instantiate a command with input parameters.
  • Call the send operation on the client, providing the command object as input.
js
const client = new MediaPackageV2Client({ region: "REGION" });

const params = { /** input parameters */ };
const command = new ListChannelGroupsCommand(params);

Async/await

We recommend using the await operator to wait for the promise returned by send operation as follows:

js
// async/await.
try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  // error handling.
} finally {
  // finally.
}

Promises

You can also use Promise chaining.

js
client
  .send(command)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  })
  .finally(() => {
    // finally.
  });

Aggregated client

The aggregated client class is exported from the same package, but without the "Client" suffix.

MediaPackageV2 extends MediaPackageV2Client and additionally supports all operations, waiters, and paginators as methods. This style may be familiar to you from the AWS SDK for JavaScript v2.

If you are bundling the AWS SDK, we recommend using only the bare-bones client (MediaPackageV2Client). More details are in the blog post on modular packages in AWS SDK for JavaScript.

ts
import { MediaPackageV2 } from "@aws-sdk/client-mediapackagev2";

const client = new MediaPackageV2({ region: "REGION" });

// async/await.
try {
  const data = await client.listChannelGroups(params);
  // process data.
} catch (error) {
  // error handling.
}

// Promises.
client
  .listChannelGroups(params)
  .then((data) => {
    // process data.
  })
  .catch((error) => {
    // error handling.
  });

// callbacks (not recommended).
client.listChannelGroups(params, (err, data) => {
  // process err and data.
});

Troubleshooting

When the service returns an exception, the error will include the exception information, as well as response metadata (e.g. request id).

js
try {
  const data = await client.send(command);
  // process data.
} catch (error) {
  const { requestId, cfId, extendedRequestId } = error.$metadata;
  console.log({ requestId, cfId, extendedRequestId });
  /**
   * The keys within exceptions are also parsed.
   * You can access them by specifying exception names:
   * if (error.name === 'SomeServiceException') {
   *     const value = error.specialKeyInException;
   * }
   */
}

See also docs/ERROR_HANDLING.

Getting Help

Please use these community resources for getting help. We use GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.

To test your universal JavaScript code in Node.js, browser and react-native environments, visit our code samples repo.

Contributing

This client code is generated automatically. Any modifications will be overwritten the next time the @aws-sdk/client-mediapackagev2 package is updated. To contribute to client you can check our generate clients scripts.

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.

Client Commands (Operations List)

<details> <summary> CancelHarvestJob </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateChannel </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateChannelGroup </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateHarvestJob </summary>

Command API Reference / Input / Output

</details> <details> <summary> CreateOriginEndpoint </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteChannel </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteChannelGroup </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteChannelPolicy </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteOriginEndpoint </summary>

Command API Reference / Input / Output

</details> <details> <summary> DeleteOriginEndpointPolicy </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetChannel </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetChannelGroup </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetChannelPolicy </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetHarvestJob </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetOriginEndpoint </summary>

Command API Reference / Input / Output

</details> <details> <summary> GetOriginEndpointPolicy </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListChannelGroups </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListChannels </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListHarvestJobs </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListOriginEndpoints </summary>

Command API Reference / Input / Output

</details> <details> <summary> ListTagsForResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> PutChannelPolicy </summary>

Command API Reference / Input / Output

</details> <details> <summary> PutOriginEndpointPolicy </summary>

Command API Reference / Input / Output

</details> <details> <summary> ResetChannelState </summary>

Command API Reference / Input / Output

</details> <details> <summary> ResetOriginEndpointState </summary>

Command API Reference / Input / Output

</details> <details> <summary> TagResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> UntagResource </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateChannel </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateChannelGroup </summary>

Command API Reference / Input / Output

</details> <details> <summary> UpdateOriginEndpoint </summary>

Command API Reference / Input / Output

</details>