- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
CreateSubscriberCommand
Creates a subscriber. You must create the associated budget and notification before you create the subscriber.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { BudgetsClient, CreateSubscriberCommand } from "@aws-sdk/client-budgets"; // ES Modules import
// const { BudgetsClient, CreateSubscriberCommand } = require("@aws-sdk/client-budgets"); // CommonJS import
const client = new BudgetsClient(config);
const input = { // CreateSubscriberRequest
AccountId: "STRING_VALUE", // required
BudgetName: "STRING_VALUE", // required
Notification: { // Notification
NotificationType: "ACTUAL" || "FORECASTED", // required
ComparisonOperator: "GREATER_THAN" || "LESS_THAN" || "EQUAL_TO", // required
Threshold: Number("double"), // required
ThresholdType: "PERCENTAGE" || "ABSOLUTE_VALUE",
NotificationState: "OK" || "ALARM",
},
Subscriber: { // Subscriber
SubscriptionType: "SNS" || "EMAIL", // required
Address: "STRING_VALUE", // required
},
};
const command = new CreateSubscriberCommand(input);
const response = await client.send(command);
// {};
CreateSubscriberCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
AccountId Required | string | undefined | The |
BudgetName Required | string | undefined | The name of the budget that you want to subscribe to. Budget names must be unique within an account. |
Notification Required | Notification | undefined | The notification that you want to create a subscriber for. |
Subscriber Required | Subscriber | undefined | The subscriber that you want to associate with a budget notification. |
CreateSubscriberCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDeniedException | client | You are not authorized to use this operation with the given parameters. |
CreationLimitExceededException | client | You've exceeded the notification or subscriber limit. |
DuplicateRecordException | client | The budget name already exists. Budget names must be unique within an account. |
InternalErrorException | server | An error on the server occurred during the processing of your request. Try again later. |
InvalidParameterException | client | An error on the client occurred. Typically, the cause is an invalid input value. |
NotFoundException | client | We can’t locate the resource that you specified. |
ThrottlingException | client | The number of API requests has exceeded the maximum allowed API request throttling limit for the account. |
BudgetsServiceException | Base exception class for all service exceptions from Budgets service. |