예제 #1
0
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)
}
예제 #2
0
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)
}
예제 #3
0
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)
}
예제 #4
0
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)
}