123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
- package budgets_test
- import (
- "bytes"
- "fmt"
- "time"
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/session"
- "github.com/aws/aws-sdk-go/service/budgets"
- )
- var _ time.Duration
- var _ bytes.Buffer
- func ExampleBudgets_CreateBudget() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := budgets.New(sess)
- params := &budgets.CreateBudgetInput{
- AccountId: aws.String("AccountId"), // Required
- Budget: &budgets.Budget{ // Required
- BudgetLimit: &budgets.Spend{ // Required
- Amount: aws.String("NumericValue"), // Required
- Unit: aws.String("GenericString"), // Required
- },
- BudgetName: aws.String("BudgetName"), // Required
- BudgetType: aws.String("BudgetType"), // Required
- CostTypes: &budgets.CostTypes{ // Required
- IncludeSubscription: aws.Bool(true), // Required
- IncludeTax: aws.Bool(true), // Required
- UseBlended: aws.Bool(true), // Required
- },
- TimePeriod: &budgets.TimePeriod{ // Required
- End: aws.Time(time.Now()), // Required
- Start: aws.Time(time.Now()), // Required
- },
- TimeUnit: aws.String("TimeUnit"), // Required
- CalculatedSpend: &budgets.CalculatedSpend{
- ActualSpend: &budgets.Spend{ // Required
- Amount: aws.String("NumericValue"), // Required
- Unit: aws.String("GenericString"), // Required
- },
- ForecastedSpend: &budgets.Spend{
- Amount: aws.String("NumericValue"), // Required
- Unit: aws.String("GenericString"), // Required
- },
- },
- CostFilters: map[string][]*string{
- "Key": { // Required
- aws.String("GenericString"), // Required
- // More values...
- },
- // More values...
- },
- },
- NotificationsWithSubscribers: []*budgets.NotificationWithSubscribers{
- { // Required
- Notification: &budgets.Notification{ // Required
- ComparisonOperator: aws.String("ComparisonOperator"), // Required
- NotificationType: aws.String("NotificationType"), // Required
- Threshold: aws.Float64(1.0), // Required
- },
- Subscribers: []*budgets.Subscriber{ // Required
- { // Required
- Address: aws.String("GenericString"), // Required
- SubscriptionType: aws.String("SubscriptionType"), // Required
- },
- // More values...
- },
- },
- // More values...
- },
- }
- resp, err := svc.CreateBudget(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleBudgets_CreateNotification() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := budgets.New(sess)
- params := &budgets.CreateNotificationInput{
- AccountId: aws.String("AccountId"), // Required
- BudgetName: aws.String("BudgetName"), // Required
- Notification: &budgets.Notification{ // Required
- ComparisonOperator: aws.String("ComparisonOperator"), // Required
- NotificationType: aws.String("NotificationType"), // Required
- Threshold: aws.Float64(1.0), // Required
- },
- Subscribers: []*budgets.Subscriber{ // Required
- { // Required
- Address: aws.String("GenericString"), // Required
- SubscriptionType: aws.String("SubscriptionType"), // Required
- },
- // More values...
- },
- }
- resp, err := svc.CreateNotification(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleBudgets_CreateSubscriber() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := budgets.New(sess)
- params := &budgets.CreateSubscriberInput{
- AccountId: aws.String("AccountId"), // Required
- BudgetName: aws.String("BudgetName"), // Required
- Notification: &budgets.Notification{ // Required
- ComparisonOperator: aws.String("ComparisonOperator"), // Required
- NotificationType: aws.String("NotificationType"), // Required
- Threshold: aws.Float64(1.0), // Required
- },
- Subscriber: &budgets.Subscriber{ // Required
- Address: aws.String("GenericString"), // Required
- SubscriptionType: aws.String("SubscriptionType"), // Required
- },
- }
- resp, err := svc.CreateSubscriber(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleBudgets_DeleteBudget() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := budgets.New(sess)
- params := &budgets.DeleteBudgetInput{
- AccountId: aws.String("AccountId"), // Required
- BudgetName: aws.String("BudgetName"), // Required
- }
- resp, err := svc.DeleteBudget(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleBudgets_DeleteNotification() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := budgets.New(sess)
- params := &budgets.DeleteNotificationInput{
- AccountId: aws.String("AccountId"), // Required
- BudgetName: aws.String("BudgetName"), // Required
- Notification: &budgets.Notification{ // Required
- ComparisonOperator: aws.String("ComparisonOperator"), // Required
- NotificationType: aws.String("NotificationType"), // Required
- Threshold: aws.Float64(1.0), // Required
- },
- }
- resp, err := svc.DeleteNotification(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleBudgets_DeleteSubscriber() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := budgets.New(sess)
- params := &budgets.DeleteSubscriberInput{
- AccountId: aws.String("AccountId"), // Required
- BudgetName: aws.String("BudgetName"), // Required
- Notification: &budgets.Notification{ // Required
- ComparisonOperator: aws.String("ComparisonOperator"), // Required
- NotificationType: aws.String("NotificationType"), // Required
- Threshold: aws.Float64(1.0), // Required
- },
- Subscriber: &budgets.Subscriber{ // Required
- Address: aws.String("GenericString"), // Required
- SubscriptionType: aws.String("SubscriptionType"), // Required
- },
- }
- resp, err := svc.DeleteSubscriber(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleBudgets_DescribeBudget() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := budgets.New(sess)
- params := &budgets.DescribeBudgetInput{
- AccountId: aws.String("AccountId"), // Required
- BudgetName: aws.String("BudgetName"), // Required
- }
- resp, err := svc.DescribeBudget(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleBudgets_DescribeBudgets() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := budgets.New(sess)
- params := &budgets.DescribeBudgetsInput{
- AccountId: aws.String("AccountId"), // Required
- MaxResults: aws.Int64(1),
- NextToken: aws.String("GenericString"),
- }
- resp, err := svc.DescribeBudgets(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleBudgets_DescribeNotificationsForBudget() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := budgets.New(sess)
- params := &budgets.DescribeNotificationsForBudgetInput{
- AccountId: aws.String("AccountId"), // Required
- BudgetName: aws.String("BudgetName"), // Required
- MaxResults: aws.Int64(1),
- NextToken: aws.String("GenericString"),
- }
- resp, err := svc.DescribeNotificationsForBudget(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleBudgets_DescribeSubscribersForNotification() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := budgets.New(sess)
- params := &budgets.DescribeSubscribersForNotificationInput{
- AccountId: aws.String("AccountId"), // Required
- BudgetName: aws.String("BudgetName"), // Required
- Notification: &budgets.Notification{ // Required
- ComparisonOperator: aws.String("ComparisonOperator"), // Required
- NotificationType: aws.String("NotificationType"), // Required
- Threshold: aws.Float64(1.0), // Required
- },
- MaxResults: aws.Int64(1),
- NextToken: aws.String("GenericString"),
- }
- resp, err := svc.DescribeSubscribersForNotification(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleBudgets_UpdateBudget() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := budgets.New(sess)
- params := &budgets.UpdateBudgetInput{
- AccountId: aws.String("AccountId"), // Required
- NewBudget: &budgets.Budget{ // Required
- BudgetLimit: &budgets.Spend{ // Required
- Amount: aws.String("NumericValue"), // Required
- Unit: aws.String("GenericString"), // Required
- },
- BudgetName: aws.String("BudgetName"), // Required
- BudgetType: aws.String("BudgetType"), // Required
- CostTypes: &budgets.CostTypes{ // Required
- IncludeSubscription: aws.Bool(true), // Required
- IncludeTax: aws.Bool(true), // Required
- UseBlended: aws.Bool(true), // Required
- },
- TimePeriod: &budgets.TimePeriod{ // Required
- End: aws.Time(time.Now()), // Required
- Start: aws.Time(time.Now()), // Required
- },
- TimeUnit: aws.String("TimeUnit"), // Required
- CalculatedSpend: &budgets.CalculatedSpend{
- ActualSpend: &budgets.Spend{ // Required
- Amount: aws.String("NumericValue"), // Required
- Unit: aws.String("GenericString"), // Required
- },
- ForecastedSpend: &budgets.Spend{
- Amount: aws.String("NumericValue"), // Required
- Unit: aws.String("GenericString"), // Required
- },
- },
- CostFilters: map[string][]*string{
- "Key": { // Required
- aws.String("GenericString"), // Required
- // More values...
- },
- // More values...
- },
- },
- }
- resp, err := svc.UpdateBudget(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleBudgets_UpdateNotification() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := budgets.New(sess)
- params := &budgets.UpdateNotificationInput{
- AccountId: aws.String("AccountId"), // Required
- BudgetName: aws.String("BudgetName"), // Required
- NewNotification: &budgets.Notification{ // Required
- ComparisonOperator: aws.String("ComparisonOperator"), // Required
- NotificationType: aws.String("NotificationType"), // Required
- Threshold: aws.Float64(1.0), // Required
- },
- OldNotification: &budgets.Notification{ // Required
- ComparisonOperator: aws.String("ComparisonOperator"), // Required
- NotificationType: aws.String("NotificationType"), // Required
- Threshold: aws.Float64(1.0), // Required
- },
- }
- resp, err := svc.UpdateNotification(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleBudgets_UpdateSubscriber() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := budgets.New(sess)
- params := &budgets.UpdateSubscriberInput{
- AccountId: aws.String("AccountId"), // Required
- BudgetName: aws.String("BudgetName"), // Required
- NewSubscriber: &budgets.Subscriber{ // Required
- Address: aws.String("GenericString"), // Required
- SubscriptionType: aws.String("SubscriptionType"), // Required
- },
- Notification: &budgets.Notification{ // Required
- ComparisonOperator: aws.String("ComparisonOperator"), // Required
- NotificationType: aws.String("NotificationType"), // Required
- Threshold: aws.Float64(1.0), // Required
- },
- OldSubscriber: &budgets.Subscriber{ // Required
- Address: aws.String("GenericString"), // Required
- SubscriptionType: aws.String("SubscriptionType"), // Required
- },
- }
- resp, err := svc.UpdateSubscriber(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
|