本文整理汇总了Golang中github.com/aws/aws-sdk-go/aws.Float64函数的典型用法代码示例。如果您正苦于以下问题:Golang Float64函数的具体用法?Golang Float64怎么用?Golang Float64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Float64函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ExampleBudgets_UpdateNotification
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)
}
开发者ID:xibz,项目名称:aws-sdk-go,代码行数:35,代码来源:examples_test.go
示例2: ExampleAutoScaling_ExecutePolicy
func ExampleAutoScaling_ExecutePolicy() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := autoscaling.New(sess)
params := &autoscaling.ExecutePolicyInput{
PolicyName: aws.String("ResourceName"), // Required
AutoScalingGroupName: aws.String("ResourceName"),
BreachThreshold: aws.Float64(1.0),
HonorCooldown: aws.Bool(true),
MetricValue: aws.Float64(1.0),
}
resp, err := svc.ExecutePolicy(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)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:28,代码来源:examples_test.go
示例3: ExampleAutoScaling_PutScalingPolicy
func ExampleAutoScaling_PutScalingPolicy() {
svc := autoscaling.New(session.New())
params := &autoscaling.PutScalingPolicyInput{
AdjustmentType: aws.String("XmlStringMaxLen255"), // Required
AutoScalingGroupName: aws.String("ResourceName"), // Required
PolicyName: aws.String("XmlStringMaxLen255"), // Required
Cooldown: aws.Int64(1),
EstimatedInstanceWarmup: aws.Int64(1),
MetricAggregationType: aws.String("XmlStringMaxLen32"),
MinAdjustmentMagnitude: aws.Int64(1),
MinAdjustmentStep: aws.Int64(1),
PolicyType: aws.String("XmlStringMaxLen64"),
ScalingAdjustment: aws.Int64(1),
StepAdjustments: []*autoscaling.StepAdjustment{
{ // Required
ScalingAdjustment: aws.Int64(1), // Required
MetricIntervalLowerBound: aws.Float64(1.0),
MetricIntervalUpperBound: aws.Float64(1.0),
},
// More values...
},
}
resp, err := svc.PutScalingPolicy(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)
}
开发者ID:lucmichalski,项目名称:s3secrets,代码行数:35,代码来源:examples_test.go
示例4: TestExpandStepAdjustments
func TestExpandStepAdjustments(t *testing.T) {
expanded := []interface{}{
map[string]interface{}{
"metric_interval_lower_bound": "1.0",
"metric_interval_upper_bound": "2.0",
"scaling_adjustment": 1,
},
}
parameters, err := expandStepAdjustments(expanded)
if err != nil {
t.Fatalf("bad: %#v", err)
}
expected := &autoscaling.StepAdjustment{
MetricIntervalLowerBound: aws.Float64(1.0),
MetricIntervalUpperBound: aws.Float64(2.0),
ScalingAdjustment: aws.Int64(int64(1)),
}
if !reflect.DeepEqual(parameters[0], expected) {
t.Fatalf(
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
parameters[0],
expected)
}
}
开发者ID:partamonov,项目名称:terraform,代码行数:26,代码来源:structure_test.go
示例5: createScheduleRunInput
func createScheduleRunInput(p *model.RunParameters) *devicefarm.ScheduleRunInput {
var wg sync.WaitGroup
result := &devicefarm.ScheduleRunInput{
ProjectArn: aws.String(p.ProjectArn),
Test: &devicefarm.ScheduleRunTest{},
Configuration: &devicefarm.ScheduleRunConfiguration{
Radios: &devicefarm.Radios{
Bluetooth: aws.Bool(true),
Gps: aws.Bool(true),
Nfc: aws.Bool(true),
Wifi: aws.Bool(true),
},
Location: &devicefarm.Location{
Latitude: aws.Float64(47.6204),
Longitude: aws.Float64(-122.3491),
},
},
}
result.Name = aws.String(p.Config.RunName)
result.Configuration.AuxiliaryApps = aws.StringSlice(p.Config.AdditionalData.AuxiliaryApps)
if p.Config.AdditionalData.BillingMethod != "" {
result.Configuration.BillingMethod = aws.String(p.Config.AdditionalData.BillingMethod)
}
result.Configuration.Locale = aws.String(p.Config.AdditionalData.Locale)
if p.Config.AdditionalData.Location.Latitude != 0 {
result.Configuration.Location.Latitude = aws.Float64(p.Config.AdditionalData.Location.Latitude)
}
if p.Config.AdditionalData.Location.Longitude != 0 {
result.Configuration.Location.Longitude = aws.Float64(p.Config.AdditionalData.Location.Longitude)
}
if p.Config.AdditionalData.NetworkProfileArn != "" {
result.Configuration.NetworkProfileArn = aws.String(p.Config.AdditionalData.NetworkProfileArn)
}
result.Configuration.Radios.Bluetooth = aws.Bool(stringToBool(p.Config.AdditionalData.Radios.Bluetooth))
result.Configuration.Radios.Gps = aws.Bool(stringToBool(p.Config.AdditionalData.Radios.Gps))
result.Configuration.Radios.Nfc = aws.Bool(stringToBool(p.Config.AdditionalData.Radios.Nfc))
result.Configuration.Radios.Wifi = aws.Bool(stringToBool(p.Config.AdditionalData.Radios.Wifi))
result.Test.Filter = aws.String(p.Config.Test.Filter)
result.Test.Parameters = aws.StringMap(p.Config.Test.Parameters)
if p.Config.Test.Type != "" {
result.Test.Type = aws.String(p.Config.Test.Type)
} else {
result.Test.Type = aws.String("BUILTIN_FUZZ")
}
if p.Config.Test.TestPackageArn != "" {
result.Test.TestPackageArn = aws.String(p.Config.Test.TestPackageArn)
} else {
uploadTestPackage(p, result, &wg)
}
if p.Config.AdditionalData.ExtraDataPackageArn != "" {
result.Configuration.ExtraDataPackageArn = aws.String(p.Config.AdditionalData.ExtraDataPackageArn)
} else {
uploadExtraData(p, result, &wg)
}
wg.Wait()
return result
}
开发者ID:artemnikitin,项目名称:devicefarm-ci-tool,代码行数:58,代码来源:config_gen.go
示例6: ExampleDeviceFarm_ScheduleRun
func ExampleDeviceFarm_ScheduleRun() {
svc := devicefarm.New(nil)
params := &devicefarm.ScheduleRunInput{
AppARN: aws.String("AmazonResourceName"), // Required
DevicePoolARN: aws.String("AmazonResourceName"), // Required
ProjectARN: aws.String("AmazonResourceName"), // Required
Test: &devicefarm.ScheduleRunTest{ // Required
Type: aws.String("TestType"), // Required
Filter: aws.String("Filter"),
Parameters: map[string]*string{
"Key": aws.String("String"), // Required
// More values...
},
TestPackageARN: aws.String("AmazonResourceName"),
},
Configuration: &devicefarm.ScheduleRunConfiguration{
AuxiliaryApps: []*string{
aws.String("AmazonResourceName"), // Required
// More values...
},
BillingMethod: aws.String("BillingMethod"),
ExtraDataPackageARN: aws.String("AmazonResourceName"),
Locale: aws.String("String"),
Location: &devicefarm.Location{
Latitude: aws.Float64(1.0), // Required
Longitude: aws.Float64(1.0), // Required
},
NetworkProfileARN: aws.String("AmazonResourceName"),
Radios: &devicefarm.Radios{
Bluetooth: aws.Bool(true),
Gps: aws.Bool(true),
Nfc: aws.Bool(true),
Wifi: aws.Bool(true),
},
},
Name: aws.String("Name"),
}
resp, err := svc.ScheduleRun(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
开发者ID:Talos208,项目名称:aws-sdk-go,代码行数:58,代码来源:examples_test.go
示例7: ExampleDeviceFarm_ScheduleRun
func ExampleDeviceFarm_ScheduleRun() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := devicefarm.New(sess)
params := &devicefarm.ScheduleRunInput{
DevicePoolArn: aws.String("AmazonResourceName"), // Required
ProjectArn: aws.String("AmazonResourceName"), // Required
Test: &devicefarm.ScheduleRunTest{ // Required
Type: aws.String("TestType"), // Required
Filter: aws.String("Filter"),
Parameters: map[string]*string{
"Key": aws.String("String"), // Required
// More values...
},
TestPackageArn: aws.String("AmazonResourceName"),
},
AppArn: aws.String("AmazonResourceName"),
Configuration: &devicefarm.ScheduleRunConfiguration{
AuxiliaryApps: []*string{
aws.String("AmazonResourceName"), // Required
// More values...
},
BillingMethod: aws.String("BillingMethod"),
ExtraDataPackageArn: aws.String("AmazonResourceName"),
Locale: aws.String("String"),
Location: &devicefarm.Location{
Latitude: aws.Float64(1.0), // Required
Longitude: aws.Float64(1.0), // Required
},
NetworkProfileArn: aws.String("AmazonResourceName"),
Radios: &devicefarm.Radios{
Bluetooth: aws.Bool(true),
Gps: aws.Bool(true),
Nfc: aws.Bool(true),
Wifi: aws.Bool(true),
},
},
Name: aws.String("Name"),
}
resp, err := svc.ScheduleRun(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)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:56,代码来源:examples_test.go
示例8: expandAppautoscalingStepAdjustments
// Takes the result of flatmap.Expand for an array of step adjustments and
// returns a []*applicationautoscaling.StepAdjustment.
func expandAppautoscalingStepAdjustments(configured []interface{}) ([]*applicationautoscaling.StepAdjustment, error) {
var adjustments []*applicationautoscaling.StepAdjustment
// Loop over our configured step adjustments and create an array
// of aws-sdk-go compatible objects. We're forced to convert strings
// to floats here because there's no way to detect whether or not
// an uninitialized, optional schema element is "0.0" deliberately.
// With strings, we can test for "", which is definitely an empty
// struct value.
for _, raw := range configured {
data := raw.(map[string]interface{})
a := &applicationautoscaling.StepAdjustment{
ScalingAdjustment: aws.Int64(int64(data["scaling_adjustment"].(int))),
}
if data["metric_interval_lower_bound"] != "" {
bound := data["metric_interval_lower_bound"]
switch bound := bound.(type) {
case string:
f, err := strconv.ParseFloat(bound, 64)
if err != nil {
return nil, fmt.Errorf(
"metric_interval_lower_bound must be a float value represented as a string")
}
a.MetricIntervalLowerBound = aws.Float64(f)
default:
return nil, fmt.Errorf(
"metric_interval_lower_bound isn't a string. This is a bug. Please file an issue.")
}
}
if data["metric_interval_upper_bound"] != "" {
bound := data["metric_interval_upper_bound"]
switch bound := bound.(type) {
case string:
f, err := strconv.ParseFloat(bound, 64)
if err != nil {
return nil, fmt.Errorf(
"metric_interval_upper_bound must be a float value represented as a string")
}
a.MetricIntervalUpperBound = aws.Float64(f)
default:
return nil, fmt.Errorf(
"metric_interval_upper_bound isn't a string. This is a bug. Please file an issue.")
}
}
adjustments = append(adjustments, a)
}
return adjustments, nil
}
开发者ID:Zordrak,项目名称:terraform,代码行数:51,代码来源:resource_aws_appautoscaling_policy.go
示例9: ExampleCloudWatch_PutMetricData
func ExampleCloudWatch_PutMetricData() {
svc := cloudwatch.New(nil)
params := &cloudwatch.PutMetricDataInput{
MetricData: []*cloudwatch.MetricDatum{ // Required
{ // Required
MetricName: aws.String("MetricName"), // Required
Dimensions: []*cloudwatch.Dimension{
{ // Required
Name: aws.String("DimensionName"), // Required
Value: aws.String("DimensionValue"), // Required
},
// More values...
},
StatisticValues: &cloudwatch.StatisticSet{
Maximum: aws.Float64(1.0), // Required
Minimum: aws.Float64(1.0), // Required
SampleCount: aws.Float64(1.0), // Required
Sum: aws.Float64(1.0), // Required
},
Timestamp: aws.Time(time.Now()),
Unit: aws.String("StandardUnit"),
Value: aws.Float64(1.0),
},
// More values...
},
Namespace: aws.String("Namespace"), // Required
}
resp, err := svc.PutMetricData(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
开发者ID:astiusa,项目名称:go-metrics-cloudwatch,代码行数:48,代码来源:examples_test.go
示例10: ExampleGameLift_PutScalingPolicy
func ExampleGameLift_PutScalingPolicy() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := gamelift.New(sess)
params := &gamelift.PutScalingPolicyInput{
ComparisonOperator: aws.String("ComparisonOperatorType"), // Required
EvaluationPeriods: aws.Int64(1), // Required
FleetId: aws.String("FleetId"), // Required
MetricName: aws.String("MetricName"), // Required
Name: aws.String("NonZeroAndMaxString"), // Required
ScalingAdjustment: aws.Int64(1), // Required
ScalingAdjustmentType: aws.String("ScalingAdjustmentType"), // Required
Threshold: aws.Float64(1.0), // Required
}
resp, err := svc.PutScalingPolicy(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)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:31,代码来源:examples_test.go
示例11: Send
// Helper function to send data.
func Send(cw *cloudwatch.CloudWatch, dn, dv, n string, v float64) {
_, err := cw.PutMetricData(&cloudwatch.PutMetricDataInput{
MetricData: []*cloudwatch.MetricDatum{
{
MetricName: aws.String(n),
Dimensions: []*cloudwatch.Dimension{
{
Name: aws.String(dn),
Value: aws.String(dv),
},
},
Timestamp: aws.Time(time.Now()),
Value: aws.Float64(v),
},
},
Namespace: aws.String("Custom"),
})
if err != nil {
log.Println(err)
return
}
log.WithFields(log.Fields{
"DimensionName": dn,
"DimensionValue": dv,
"MetricName": n,
"MetricValue": v,
}).Info("Successfully posted to CloudWatch")
}
开发者ID:nickschuch,项目名称:metrics,代码行数:30,代码来源:main.go
示例12: TestGetStatistics
func TestGetStatistics(t *testing.T) {
mockCtrl := gomock.NewController(t)
defer mockCtrl.Finish()
serviceMock := mock_cloudwatchiface.NewMockCloudWatchAPI(mockCtrl)
metrics := [][]string{
[]string{"Invocations", "Count"},
[]string{"Errors", "Count"},
[]string{"Duration", "Milliseconds"},
[]string{"Throttles", "Count"},
}
startTime := time.Date(2016, time.January, 17, 10, 0, 0, 0, time.UTC)
endTime := time.Date(2016, time.January, 18, 18, 0, 0, 0, time.UTC)
for _, metric := range metrics {
rand.Seed(time.Now().UTC().UnixNano())
serviceMock.EXPECT().GetMetricStatistics(&cloudwatch.GetMetricStatisticsInput{
MetricName: aws.String(metric[0]),
Namespace: aws.String("AWS/Lambda"),
StartTime: aws.Time(startTime),
EndTime: aws.Time(endTime),
Period: aws.Int64(int64((time.Duration(24) * time.Hour).Seconds())),
Statistics: []*string{
aws.String("Sum"),
},
Dimensions: []*cloudwatch.Dimension{
{
Name: aws.String("FunctionName"),
Value: aws.String("go_testf"),
},
},
Unit: aws.String(metric[1]),
}).Return(&cloudwatch.GetMetricStatisticsOutput{
Datapoints: []*cloudwatch.Datapoint{
&cloudwatch.Datapoint{Sum: aws.Float64(float64(rand.Intn(9999)))},
},
Label: aws.String("label"),
}, nil)
}
name := "go_testf"
mc := &MetricCollector{
Metrics: []string{"Invocations", "Errors", "Duration", "Throttles"},
Collected: 0,
FunctionName: name,
Service: serviceMock,
StartDate: startTime,
EndDate: endTime,
}
count := 0
for _ = range mc.Collect() {
count++
}
if count != 4 {
t.Errorf("Wrong metrics count")
}
}
开发者ID:kujohn,项目名称:apex,代码行数:60,代码来源:metrics_test.go
示例13: ExampleMachineLearning_UpdateMLModel
func ExampleMachineLearning_UpdateMLModel() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := machinelearning.New(sess)
params := &machinelearning.UpdateMLModelInput{
MLModelId: aws.String("EntityId"), // Required
MLModelName: aws.String("EntityName"),
ScoreThreshold: aws.Float64(1.0),
}
resp, err := svc.UpdateMLModel(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)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:26,代码来源:examples_test.go
示例14: TestLoadOK
// Test loading a series of items succeeds and Run exits cleanly
func TestLoadOK(t *testing.T) {
items := newLoadItems(makeIntItem("v", 1), makeIntItem("v", 2), makeIntItem("v", 3))
var values stringVals
dyn := &fakeDynPuter{
put: func(input *dynamodb.PutItemInput) (*dynamodb.PutItemOutput, error) {
values.Add(aws.StringValue(input.Item["v"].N))
return &dynamodb.PutItemOutput{
ConsumedCapacity: &dynamodb.ConsumedCapacity{CapacityUnits: aws.Float64(1)},
}, nil
},
}
ld := &Loader{
Dyn: dyn,
TableName: "test-table",
MaxParallel: 2,
Source: items,
}
done := make(chan error)
go func() { done <- ld.Run() }()
select {
case <-time.After(time.Second):
t.Fatal("Timed out waiting for Run to complete")
case err := <-done:
if err != nil {
t.Error("Unexpected error from Run", err)
}
}
expected := []string{"1", "2", "3"}
if vals := values.Sorted(); !reflect.DeepEqual(vals, expected) {
t.Error("Incorrect values sent to Dynamo", vals)
}
}
开发者ID:gwatts,项目名称:dyndump,代码行数:36,代码来源:loader_test.go
示例15: ExampleMachineLearning_UpdateMLModel
func ExampleMachineLearning_UpdateMLModel() {
svc := machinelearning.New(nil)
params := &machinelearning.UpdateMLModelInput{
MLModelId: aws.String("EntityId"), // Required
MLModelName: aws.String("EntityName"),
ScoreThreshold: aws.Float64(1.0),
}
resp, err := svc.UpdateMLModel(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.Prettify(resp))
}
开发者ID:strife25,项目名称:aws-sdk-go,代码行数:28,代码来源:examples_test.go
示例16: TestLoadReadErr
// Test that a failure from readitem causes Run to exit with error
func TestLoadReadErr(t *testing.T) {
testErr := errors.New("test error")
items := newLoadItems(makeIntItem("v", 1), makeIntItem("v", 2), makeIntItem("v", 3))
items.appendError(testErr)
dyn := &fakeDynPuter{
put: func(input *dynamodb.PutItemInput) (*dynamodb.PutItemOutput, error) {
return &dynamodb.PutItemOutput{
ConsumedCapacity: &dynamodb.ConsumedCapacity{CapacityUnits: aws.Float64(1)},
}, nil
},
}
ld := &Loader{
Dyn: dyn,
TableName: "test-table",
MaxParallel: 2,
Source: items,
}
done := make(chan error)
go func() { done <- ld.Run() }()
select {
case <-time.After(time.Second):
t.Fatal("Timed out waiting for Run to complete")
case err := <-done:
if err != testErr {
t.Error("Incorrect error from Run", err)
}
}
}
开发者ID:gwatts,项目名称:dyndump,代码行数:33,代码来源:loader_test.go
示例17: GetMetricStatistics
func (m *mockCloudWatchClient) GetMetricStatistics(params *cloudwatch.GetMetricStatisticsInput) (*cloudwatch.GetMetricStatisticsOutput, error) {
dataPoint := &cloudwatch.Datapoint{
Timestamp: params.EndTime,
Minimum: aws.Float64(0.1),
Maximum: aws.Float64(0.3),
Average: aws.Float64(0.2),
Sum: aws.Float64(123),
SampleCount: aws.Float64(100),
Unit: aws.String("Seconds"),
}
result := &cloudwatch.GetMetricStatisticsOutput{
Label: aws.String("Latency"),
Datapoints: []*cloudwatch.Datapoint{dataPoint},
}
return result, nil
}
开发者ID:jeichorn,项目名称:telegraf,代码行数:16,代码来源:cloudwatch_test.go
示例18: ExampleCloudWatchLogs_PutMetricFilter
func ExampleCloudWatchLogs_PutMetricFilter() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudwatchlogs.New(sess)
params := &cloudwatchlogs.PutMetricFilterInput{
FilterName: aws.String("FilterName"), // Required
FilterPattern: aws.String("FilterPattern"), // Required
LogGroupName: aws.String("LogGroupName"), // Required
MetricTransformations: []*cloudwatchlogs.MetricTransformation{ // Required
{ // Required
MetricName: aws.String("MetricName"), // Required
MetricNamespace: aws.String("MetricNamespace"), // Required
MetricValue: aws.String("MetricValue"), // Required
DefaultValue: aws.Float64(1.0),
},
// More values...
},
}
resp, err := svc.PutMetricFilter(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)
}
开发者ID:realestate-com-au,项目名称:shush,代码行数:35,代码来源:examples_test.go
示例19: ExampleCloudWatch_PutMetricData
func ExampleCloudWatch_PutMetricData() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := cloudwatch.New(sess)
params := &cloudwatch.PutMetricDataInput{
MetricData: []*cloudwatch.MetricDatum{ // Required
{ // Required
MetricName: aws.String("MetricName"), // Required
Dimensions: []*cloudwatch.Dimension{
{ // Required
Name: aws.String("DimensionName"), // Required
Value: aws.String("DimensionValue"), // Required
},
// More values...
},
StatisticValues: &cloudwatch.StatisticSet{
Maximum: aws.Float64(1.0), // Required
Minimum: aws.Float64(1.0), // Required
SampleCount: aws.Float64(1.0), // Required
Sum: aws.Float64(1.0), // Required
},
Timestamp: aws.Time(time.Now()),
Unit: aws.String("StandardUnit"),
Value: aws.Float64(1.0),
},
// More values...
},
Namespace: aws.String("Namespace"), // Required
}
resp, err := svc.PutMetricData(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)
}
开发者ID:acquia,项目名称:fifo2kinesis,代码行数:46,代码来源:examples_test.go
示例20: addMetric
func addMetric(name, unit string, value float64, dimensions []*cloudwatch.Dimension, metricData []*cloudwatch.MetricDatum) (ret []*cloudwatch.MetricDatum, err error) {
_metric := cloudwatch.MetricDatum{
MetricName: aws.String(name),
Unit: aws.String(unit),
Value: aws.Float64(value),
Dimensions: dimensions,
}
metricData = append(metricData, &_metric)
return metricData, nil
}
开发者ID:vanga,项目名称:go-aws-mon,代码行数:10,代码来源:cw.go
注:本文中的github.com/aws/aws-sdk-go/aws.Float64函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论