Beispiel #1
0
func ExampleCloudWatch_PutMetricData() {
	svc := cloudwatch.New(nil)

	params := &cloudwatch.PutMetricDataInput{
		MetricData: []*cloudwatch.MetricDatum{ // Required
			&cloudwatch.MetricDatum{ // Required
				MetricName: aws.String("MetricName"), // Required
				Dimensions: []*cloudwatch.Dimension{
					&cloudwatch.Dimension{ // Required
						Name:  aws.String("DimensionName"),  // Required
						Value: aws.String("DimensionValue"), // Required
					},
					// More values...
				},
				StatisticValues: &cloudwatch.StatisticSet{
					Maximum:     aws.Double(1.0), // Required
					Minimum:     aws.Double(1.0), // Required
					SampleCount: aws.Double(1.0), // Required
					Sum:         aws.Double(1.0), // Required
				},
				Timestamp: aws.Time(time.Now()),
				Unit:      aws.String("StandardUnit"),
				Value:     aws.Double(1.0),
			},
			// More values...
		},
		Namespace: aws.String("Namespace"), // Required
	}
	resp, err := svc.PutMetricData(params)

	if awserr := aws.Error(err); awserr != nil {
		// A service error occurred.
		fmt.Println("Error:", awserr.Code, awserr.Message)
	} else if err != nil {
		// A non-service error occurred.
		panic(err)
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Beispiel #2
0
func ExampleCloudWatch_PutMetricAlarm() {
	svc := cloudwatch.New(nil)

	params := &cloudwatch.PutMetricAlarmInput{
		AlarmName:          aws.String("AlarmName"),          // Required
		ComparisonOperator: aws.String("ComparisonOperator"), // Required
		EvaluationPeriods:  aws.Long(1),                      // Required
		MetricName:         aws.String("MetricName"),         // Required
		Namespace:          aws.String("Namespace"),          // Required
		Period:             aws.Long(1),                      // Required
		Statistic:          aws.String("Statistic"),          // Required
		Threshold:          aws.Double(1.0),                  // Required
		ActionsEnabled:     aws.Boolean(true),
		AlarmActions: []*string{
			aws.String("ResourceName"), // Required
			// More values...
		},
		AlarmDescription: aws.String("AlarmDescription"),
		Dimensions: []*cloudwatch.Dimension{
			&cloudwatch.Dimension{ // Required
				Name:  aws.String("DimensionName"),  // Required
				Value: aws.String("DimensionValue"), // Required
			},
			// More values...
		},
		InsufficientDataActions: []*string{
			aws.String("ResourceName"), // Required
			// More values...
		},
		OKActions: []*string{
			aws.String("ResourceName"), // Required
			// More values...
		},
		Unit: aws.String("StandardUnit"),
	}
	resp, err := svc.PutMetricAlarm(params)

	if awserr := aws.Error(err); awserr != nil {
		// A service error occurred.
		fmt.Println("Error:", awserr.Code, awserr.Message)
	} else if err != nil {
		// A non-service error occurred.
		panic(err)
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Beispiel #3
0
func ExampleECS_RegisterContainerInstance() {
	svc := ecs.New(nil)

	params := &ecs.RegisterContainerInstanceInput{
		Cluster:                           aws.String("String"),
		InstanceIdentityDocument:          aws.String("String"),
		InstanceIdentityDocumentSignature: aws.String("String"),
		TotalResources: []*ecs.Resource{
			&ecs.Resource{ // Required
				DoubleValue:  aws.Double(1.0),
				IntegerValue: aws.Long(1),
				LongValue:    aws.Long(1),
				Name:         aws.String("String"),
				StringSetValue: []*string{
					aws.String("String"), // Required
					// More values...
				},
				Type: aws.String("String"),
			},
			// More values...
		},
		VersionInfo: &ecs.VersionInfo{
			AgentHash:     aws.String("String"),
			AgentVersion:  aws.String("String"),
			DockerVersion: aws.String("String"),
		},
	}
	resp, err := svc.RegisterContainerInstance(params)

	if awserr := aws.Error(err); awserr != nil {
		// A service error occurred.
		fmt.Println("Error:", awserr.Code, awserr.Message)
	} else if err != nil {
		// A non-service error occurred.
		panic(err)
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Beispiel #4
0
func ExampleOpsWorks_SetLoadBasedAutoScaling() {
	svc := opsworks.New(nil)

	params := &opsworks.SetLoadBasedAutoScalingInput{
		LayerID: aws.String("String"), // Required
		DownScaling: &opsworks.AutoScalingThresholds{
			CPUThreshold:       aws.Double(1.0),
			IgnoreMetricsTime:  aws.Long(1),
			InstanceCount:      aws.Long(1),
			LoadThreshold:      aws.Double(1.0),
			MemoryThreshold:    aws.Double(1.0),
			ThresholdsWaitTime: aws.Long(1),
		},
		Enable: aws.Boolean(true),
		UpScaling: &opsworks.AutoScalingThresholds{
			CPUThreshold:       aws.Double(1.0),
			IgnoreMetricsTime:  aws.Long(1),
			InstanceCount:      aws.Long(1),
			LoadThreshold:      aws.Double(1.0),
			MemoryThreshold:    aws.Double(1.0),
			ThresholdsWaitTime: aws.Long(1),
		},
	}
	resp, err := svc.SetLoadBasedAutoScaling(params)

	if awserr := aws.Error(err); awserr != nil {
		// A service error occurred.
		fmt.Println("Error:", awserr.Code, awserr.Message)
	} else if err != nil {
		// A non-service error occurred.
		panic(err)
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}
Beispiel #5
0
func ExampleCloudSearch_DefineIndexField() {
	svc := cloudsearch.New(nil)

	params := &cloudsearch.DefineIndexFieldInput{
		DomainName: aws.String("DomainName"), // Required
		IndexField: &cloudsearch.IndexField{ // Required
			IndexFieldName: aws.String("DynamicFieldName"), // Required
			IndexFieldType: aws.String("IndexFieldType"),   // Required
			DateArrayOptions: &cloudsearch.DateArrayOptions{
				DefaultValue:  aws.String("FieldValue"),
				FacetEnabled:  aws.Boolean(true),
				ReturnEnabled: aws.Boolean(true),
				SearchEnabled: aws.Boolean(true),
				SourceFields:  aws.String("FieldNameCommaList"),
			},
			DateOptions: &cloudsearch.DateOptions{
				DefaultValue:  aws.String("FieldValue"),
				FacetEnabled:  aws.Boolean(true),
				ReturnEnabled: aws.Boolean(true),
				SearchEnabled: aws.Boolean(true),
				SortEnabled:   aws.Boolean(true),
				SourceField:   aws.String("FieldName"),
			},
			DoubleArrayOptions: &cloudsearch.DoubleArrayOptions{
				DefaultValue:  aws.Double(1.0),
				FacetEnabled:  aws.Boolean(true),
				ReturnEnabled: aws.Boolean(true),
				SearchEnabled: aws.Boolean(true),
				SourceFields:  aws.String("FieldNameCommaList"),
			},
			DoubleOptions: &cloudsearch.DoubleOptions{
				DefaultValue:  aws.Double(1.0),
				FacetEnabled:  aws.Boolean(true),
				ReturnEnabled: aws.Boolean(true),
				SearchEnabled: aws.Boolean(true),
				SortEnabled:   aws.Boolean(true),
				SourceField:   aws.String("FieldName"),
			},
			IntArrayOptions: &cloudsearch.IntArrayOptions{
				DefaultValue:  aws.Long(1),
				FacetEnabled:  aws.Boolean(true),
				ReturnEnabled: aws.Boolean(true),
				SearchEnabled: aws.Boolean(true),
				SourceFields:  aws.String("FieldNameCommaList"),
			},
			IntOptions: &cloudsearch.IntOptions{
				DefaultValue:  aws.Long(1),
				FacetEnabled:  aws.Boolean(true),
				ReturnEnabled: aws.Boolean(true),
				SearchEnabled: aws.Boolean(true),
				SortEnabled:   aws.Boolean(true),
				SourceField:   aws.String("FieldName"),
			},
			LatLonOptions: &cloudsearch.LatLonOptions{
				DefaultValue:  aws.String("FieldValue"),
				FacetEnabled:  aws.Boolean(true),
				ReturnEnabled: aws.Boolean(true),
				SearchEnabled: aws.Boolean(true),
				SortEnabled:   aws.Boolean(true),
				SourceField:   aws.String("FieldName"),
			},
			LiteralArrayOptions: &cloudsearch.LiteralArrayOptions{
				DefaultValue:  aws.String("FieldValue"),
				FacetEnabled:  aws.Boolean(true),
				ReturnEnabled: aws.Boolean(true),
				SearchEnabled: aws.Boolean(true),
				SourceFields:  aws.String("FieldNameCommaList"),
			},
			LiteralOptions: &cloudsearch.LiteralOptions{
				DefaultValue:  aws.String("FieldValue"),
				FacetEnabled:  aws.Boolean(true),
				ReturnEnabled: aws.Boolean(true),
				SearchEnabled: aws.Boolean(true),
				SortEnabled:   aws.Boolean(true),
				SourceField:   aws.String("FieldName"),
			},
			TextArrayOptions: &cloudsearch.TextArrayOptions{
				AnalysisScheme:   aws.String("Word"),
				DefaultValue:     aws.String("FieldValue"),
				HighlightEnabled: aws.Boolean(true),
				ReturnEnabled:    aws.Boolean(true),
				SourceFields:     aws.String("FieldNameCommaList"),
			},
			TextOptions: &cloudsearch.TextOptions{
				AnalysisScheme:   aws.String("Word"),
				DefaultValue:     aws.String("FieldValue"),
				HighlightEnabled: aws.Boolean(true),
				ReturnEnabled:    aws.Boolean(true),
				SortEnabled:      aws.Boolean(true),
				SourceField:      aws.String("FieldName"),
			},
		},
	}
	resp, err := svc.DefineIndexField(params)

	if awserr := aws.Error(err); awserr != nil {
		// A service error occurred.
		fmt.Println("Error:", awserr.Code, awserr.Message)
	} else if err != nil {
		// A non-service error occurred.
		panic(err)
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.StringValue(resp))
}