コード例 #1
0
ファイル: examples_test.go プロジェクト: gunosy/aws-sdk-go
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))
}
コード例 #2
0
ファイル: examples_test.go プロジェクト: gunosy/aws-sdk-go
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))
}
コード例 #3
0
ファイル: examples_test.go プロジェクト: gunosy/aws-sdk-go
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))
}
コード例 #4
0
ファイル: examples_test.go プロジェクト: gunosy/aws-sdk-go
func ExampleCloudWatch_PutMetricAlarm() {
	svc := cloudwatch.New(nil)

	params := &cloudwatch.PutMetricAlarmInput{
		AlarmName:          aws.String("AlarmName"),          // Required
		ComparisonOperator: aws.String("ComparisonOperator"), // Required
		EvaluationPeriods:  aws.Int64(1),                     // Required
		MetricName:         aws.String("MetricName"),         // Required
		Namespace:          aws.String("Namespace"),          // Required
		Period:             aws.Int64(1),                     // Required
		Statistic:          aws.String("Statistic"),          // Required
		Threshold:          aws.Float64(1.0),                 // Required
		ActionsEnabled:     aws.Bool(true),
		AlarmActions: []*string{
			aws.String("ResourceName"), // Required
			// More values...
		},
		AlarmDescription: aws.String("AlarmDescription"),
		Dimensions: []*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 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))
}
コード例 #5
0
ファイル: examples_test.go プロジェクト: gunosy/aws-sdk-go
func ExampleMobileAnalytics_PutEvents() {
	svc := mobileanalytics.New(nil)

	params := &mobileanalytics.PutEventsInput{
		ClientContext: aws.String("String"), // Required
		Events: []*mobileanalytics.Event{ // Required
			{ // Required
				EventType: aws.String("String50Chars"),    // Required
				Timestamp: aws.String("ISO8601Timestamp"), // Required
				Attributes: map[string]*string{
					"Key": aws.String("String0to1000Chars"), // Required
					// More values...
				},
				Metrics: map[string]*float64{
					"Key": aws.Float64(1.0), // Required
					// More values...
				},
				Session: &mobileanalytics.Session{
					Duration:       aws.Int64(1),
					ID:             aws.String("String50Chars"),
					StartTimestamp: aws.String("ISO8601Timestamp"),
					StopTimestamp:  aws.String("ISO8601Timestamp"),
				},
				Version: aws.String("String10Chars"),
			},
			// More values...
		},
		ClientContextEncoding: aws.String("String"),
	}
	resp, err := svc.PutEvents(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))
}
コード例 #6
0
ファイル: examples_test.go プロジェクト: gunosy/aws-sdk-go
func ExampleECS_RegisterContainerInstance() {
	svc := ecs.New(nil)

	params := &ecs.RegisterContainerInstanceInput{
		Cluster:                           aws.String("String"),
		ContainerInstanceARN:              aws.String("String"),
		InstanceIdentityDocument:          aws.String("String"),
		InstanceIdentityDocumentSignature: aws.String("String"),
		TotalResources: []*ecs.Resource{
			{ // Required
				DoubleValue:  aws.Float64(1.0),
				IntegerValue: aws.Int64(1),
				LongValue:    aws.Int64(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 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))
}
コード例 #7
0
ファイル: examples_test.go プロジェクト: gunosy/aws-sdk-go
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.Bool(true),
				ReturnEnabled: aws.Bool(true),
				SearchEnabled: aws.Bool(true),
				SourceFields:  aws.String("FieldNameCommaList"),
			},
			DateOptions: &cloudsearch.DateOptions{
				DefaultValue:  aws.String("FieldValue"),
				FacetEnabled:  aws.Bool(true),
				ReturnEnabled: aws.Bool(true),
				SearchEnabled: aws.Bool(true),
				SortEnabled:   aws.Bool(true),
				SourceField:   aws.String("FieldName"),
			},
			DoubleArrayOptions: &cloudsearch.DoubleArrayOptions{
				DefaultValue:  aws.Float64(1.0),
				FacetEnabled:  aws.Bool(true),
				ReturnEnabled: aws.Bool(true),
				SearchEnabled: aws.Bool(true),
				SourceFields:  aws.String("FieldNameCommaList"),
			},
			DoubleOptions: &cloudsearch.DoubleOptions{
				DefaultValue:  aws.Float64(1.0),
				FacetEnabled:  aws.Bool(true),
				ReturnEnabled: aws.Bool(true),
				SearchEnabled: aws.Bool(true),
				SortEnabled:   aws.Bool(true),
				SourceField:   aws.String("FieldName"),
			},
			IntArrayOptions: &cloudsearch.IntArrayOptions{
				DefaultValue:  aws.Int64(1),
				FacetEnabled:  aws.Bool(true),
				ReturnEnabled: aws.Bool(true),
				SearchEnabled: aws.Bool(true),
				SourceFields:  aws.String("FieldNameCommaList"),
			},
			IntOptions: &cloudsearch.IntOptions{
				DefaultValue:  aws.Int64(1),
				FacetEnabled:  aws.Bool(true),
				ReturnEnabled: aws.Bool(true),
				SearchEnabled: aws.Bool(true),
				SortEnabled:   aws.Bool(true),
				SourceField:   aws.String("FieldName"),
			},
			LatLonOptions: &cloudsearch.LatLonOptions{
				DefaultValue:  aws.String("FieldValue"),
				FacetEnabled:  aws.Bool(true),
				ReturnEnabled: aws.Bool(true),
				SearchEnabled: aws.Bool(true),
				SortEnabled:   aws.Bool(true),
				SourceField:   aws.String("FieldName"),
			},
			LiteralArrayOptions: &cloudsearch.LiteralArrayOptions{
				DefaultValue:  aws.String("FieldValue"),
				FacetEnabled:  aws.Bool(true),
				ReturnEnabled: aws.Bool(true),
				SearchEnabled: aws.Bool(true),
				SourceFields:  aws.String("FieldNameCommaList"),
			},
			LiteralOptions: &cloudsearch.LiteralOptions{
				DefaultValue:  aws.String("FieldValue"),
				FacetEnabled:  aws.Bool(true),
				ReturnEnabled: aws.Bool(true),
				SearchEnabled: aws.Bool(true),
				SortEnabled:   aws.Bool(true),
				SourceField:   aws.String("FieldName"),
			},
			TextArrayOptions: &cloudsearch.TextArrayOptions{
				AnalysisScheme:   aws.String("Word"),
				DefaultValue:     aws.String("FieldValue"),
				HighlightEnabled: aws.Bool(true),
				ReturnEnabled:    aws.Bool(true),
				SourceFields:     aws.String("FieldNameCommaList"),
			},
			TextOptions: &cloudsearch.TextOptions{
				AnalysisScheme:   aws.String("Word"),
				DefaultValue:     aws.String("FieldValue"),
				HighlightEnabled: aws.Bool(true),
				ReturnEnabled:    aws.Bool(true),
				SortEnabled:      aws.Bool(true),
				SourceField:      aws.String("FieldName"),
			},
		},
	}
	resp, err := svc.DefineIndexField(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))
}