本文整理匯總了Golang中github.com/aws/aws-sdk-go/aws.Int64函數的典型用法代碼示例。如果您正苦於以下問題:Golang Int64函數的具體用法?Golang Int64怎麽用?Golang Int64使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Int64函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ExampleStorageGateway_UpdateMaintenanceStartTime
func ExampleStorageGateway_UpdateMaintenanceStartTime() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := storagegateway.New(sess)
params := &storagegateway.UpdateMaintenanceStartTimeInput{
DayOfWeek: aws.Int64(1), // Required
GatewayARN: aws.String("GatewayARN"), // Required
HourOfDay: aws.Int64(1), // Required
MinuteOfHour: aws.Int64(1), // Required
}
resp, err := svc.UpdateMaintenanceStartTime(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: ExampleLambda_CreateFunction
func ExampleLambda_CreateFunction() {
svc := lambda.New(nil)
params := &lambda.CreateFunctionInput{
Code: &lambda.FunctionCode{ // Required
S3Bucket: aws.String("S3Bucket"),
S3Key: aws.String("S3Key"),
S3ObjectVersion: aws.String("S3ObjectVersion"),
ZipFile: []byte("PAYLOAD"),
},
FunctionName: aws.String("FunctionName"), // Required
Handler: aws.String("Handler"), // Required
Role: aws.String("RoleArn"), // Required
Runtime: aws.String("Runtime"), // Required
Description: aws.String("Description"),
MemorySize: aws.Int64(1),
Timeout: aws.Int64(1),
}
resp, err := svc.CreateFunction(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: ExampleECR_UploadLayerPart
func ExampleECR_UploadLayerPart() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := ecr.New(sess)
params := &ecr.UploadLayerPartInput{
LayerPartBlob: []byte("PAYLOAD"), // Required
PartFirstByte: aws.Int64(1), // Required
PartLastByte: aws.Int64(1), // Required
RepositoryName: aws.String("RepositoryName"), // Required
UploadId: aws.String("UploadId"), // Required
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.UploadLayerPart(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: ExampleECS_SubmitContainerStateChange
func ExampleECS_SubmitContainerStateChange() {
svc := ecs.New(session.New())
params := &ecs.SubmitContainerStateChangeInput{
Cluster: aws.String("String"),
ContainerName: aws.String("String"),
ExitCode: aws.Int64(1),
NetworkBindings: []*ecs.NetworkBinding{
{ // Required
BindIP: aws.String("String"),
ContainerPort: aws.Int64(1),
HostPort: aws.Int64(1),
Protocol: aws.String("TransportProtocol"),
},
// More values...
},
Reason: aws.String("String"),
Status: aws.String("String"),
Task: aws.String("String"),
}
resp, err := svc.SubmitContainerStateChange(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)
}
示例5: ExampleELB_ConfigureHealthCheck
func ExampleELB_ConfigureHealthCheck() {
svc := elb.New(nil)
params := &elb.ConfigureHealthCheckInput{
HealthCheck: &elb.HealthCheck{ // Required
HealthyThreshold: aws.Int64(1), // Required
Interval: aws.Int64(1), // Required
Target: aws.String("HealthCheckTarget"), // Required
Timeout: aws.Int64(1), // Required
UnhealthyThreshold: aws.Int64(1), // Required
},
LoadBalancerName: aws.String("AccessPointName"), // Required
}
resp, err := svc.ConfigureHealthCheck(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)
}
示例6: testAccCheckAWSSecurityGroupAttributes
func testAccCheckAWSSecurityGroupAttributes(group *ec2.SecurityGroup) resource.TestCheckFunc {
return func(s *terraform.State) error {
p := &ec2.IpPermission{
FromPort: aws.Int64(80),
ToPort: aws.Int64(8000),
IpProtocol: aws.String("tcp"),
IpRanges: []*ec2.IpRange{&ec2.IpRange{CidrIp: aws.String("10.0.0.0/8")}},
}
if *group.GroupName != "terraform_acceptance_test_example" {
return fmt.Errorf("Bad name: %s", *group.GroupName)
}
if *group.Description != "Used in the terraform acceptance tests" {
return fmt.Errorf("Bad description: %s", *group.Description)
}
if len(group.IpPermissions) == 0 {
return fmt.Errorf("No IPPerms")
}
// Compare our ingress
if !reflect.DeepEqual(group.IpPermissions[0], p) {
return fmt.Errorf(
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
group.IpPermissions[0],
p)
}
return nil
}
}
示例7: resourceAwsEcsServiceUpdate
func resourceAwsEcsServiceUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ecsconn
log.Printf("[DEBUG] Updating ECS service %s", d.Id())
input := ecs.UpdateServiceInput{
Service: aws.String(d.Id()),
Cluster: aws.String(d.Get("cluster").(string)),
}
if d.HasChange("desired_count") {
_, n := d.GetChange("desired_count")
input.DesiredCount = aws.Int64(int64(n.(int)))
}
if d.HasChange("task_definition") {
_, n := d.GetChange("task_definition")
input.TaskDefinition = aws.String(n.(string))
}
if d.HasChange("deployment_maximum_percent") || d.HasChange("deployment_minimum_healthy_percent") {
input.DeploymentConfiguration = &ecs.DeploymentConfiguration{
MaximumPercent: aws.Int64(int64(d.Get("deployment_maximum_percent").(int))),
MinimumHealthyPercent: aws.Int64(int64(d.Get("deployment_minimum_healthy_percent").(int))),
}
}
out, err := conn.UpdateService(&input)
if err != nil {
return err
}
service := out.Service
log.Printf("[DEBUG] Updated ECS service %s", service)
return resourceAwsEcsServiceRead(d, meta)
}
示例8: ExampleSQS_ReceiveMessage
func ExampleSQS_ReceiveMessage() {
svc := sqs.New(session.New())
params := &sqs.ReceiveMessageInput{
QueueUrl: aws.String("String"), // Required
AttributeNames: []*string{
aws.String("QueueAttributeName"), // Required
// More values...
},
MaxNumberOfMessages: aws.Int64(1),
MessageAttributeNames: []*string{
aws.String("MessageAttributeName"), // Required
// More values...
},
VisibilityTimeout: aws.Int64(1),
WaitTimeSeconds: aws.Int64(1),
}
resp, err := svc.ReceiveMessage(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)
}
示例9: ExampleRoute53_UpdateHealthCheck
func ExampleRoute53_UpdateHealthCheck() {
svc := route53.New(session.New())
params := &route53.UpdateHealthCheckInput{
HealthCheckId: aws.String("HealthCheckId"), // Required
ChildHealthChecks: []*string{
aws.String("HealthCheckId"), // Required
// More values...
},
FailureThreshold: aws.Int64(1),
FullyQualifiedDomainName: aws.String("FullyQualifiedDomainName"),
HealthCheckVersion: aws.Int64(1),
HealthThreshold: aws.Int64(1),
IPAddress: aws.String("IPAddress"),
Inverted: aws.Bool(true),
Port: aws.Int64(1),
ResourcePath: aws.String("ResourcePath"),
SearchString: aws.String("SearchString"),
}
resp, err := svc.UpdateHealthCheck(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)
}
示例10: testAccCheckAWSELBAttributes
func testAccCheckAWSELBAttributes(conf *elb.LoadBalancerDescription) resource.TestCheckFunc {
return func(s *terraform.State) error {
zones := []string{"us-west-2a", "us-west-2b", "us-west-2c"}
azs := make([]string, 0, len(conf.AvailabilityZones))
for _, x := range conf.AvailabilityZones {
azs = append(azs, *x)
}
sort.StringSlice(azs).Sort()
if !reflect.DeepEqual(azs, zones) {
return fmt.Errorf("bad availability_zones")
}
l := elb.Listener{
InstancePort: aws.Int64(int64(8000)),
InstanceProtocol: aws.String("HTTP"),
LoadBalancerPort: aws.Int64(int64(80)),
Protocol: aws.String("HTTP"),
}
if !reflect.DeepEqual(conf.ListenerDescriptions[0].Listener, &l) {
return fmt.Errorf(
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
conf.ListenerDescriptions[0].Listener,
l)
}
if *conf.DNSName == "" {
return fmt.Errorf("empty dns_name")
}
return nil
}
}
示例11: testAccCheckAWSELBAttributesHealthCheck
func testAccCheckAWSELBAttributesHealthCheck(conf *elb.LoadBalancerDescription) resource.TestCheckFunc {
return func(s *terraform.State) error {
zones := []string{"us-west-2a", "us-west-2b", "us-west-2c"}
azs := make([]string, 0, len(conf.AvailabilityZones))
for _, x := range conf.AvailabilityZones {
azs = append(azs, *x)
}
sort.StringSlice(azs).Sort()
if !reflect.DeepEqual(azs, zones) {
return fmt.Errorf("bad availability_zones")
}
check := &elb.HealthCheck{
Timeout: aws.Int64(int64(30)),
UnhealthyThreshold: aws.Int64(int64(5)),
HealthyThreshold: aws.Int64(int64(5)),
Interval: aws.Int64(int64(60)),
Target: aws.String("HTTP:8000/"),
}
if !reflect.DeepEqual(conf.HealthCheck, check) {
return fmt.Errorf(
"Got:\n\n%#v\n\nExpected:\n\n%#v\n",
conf.HealthCheck,
check)
}
if *conf.DNSName == "" {
return fmt.Errorf("empty dns_name")
}
return nil
}
}
示例12: receive_from_queue
func receive_from_queue(svc *sqs.SQS, queue_url *string) (*string, *string, *string, error) {
// get sqs message
params := &sqs.ReceiveMessageInput{
QueueUrl: queue_url,
MaxNumberOfMessages: aws.Int64(1),
VisibilityTimeout: aws.Int64(1),
}
resp, err := svc.ReceiveMessage(params)
if err != nil { return nil, nil, nil, err }
// error on empty queue
if len(resp.Messages) == 0 { return nil, nil, nil, errors.New("queue is empty") }
receipt_handle := resp.Messages[0].ReceiptHandle
body := resp.Messages[0].Body
// unmarshal sqs message body
data := &SqsBody{}
err = json.Unmarshal([]byte(*body), &data)
if err != nil { return nil, nil, nil, err }
bucket := &data.Records[0].S3.Bucket.Name
key := &data.Records[0].S3.Object.Key
return receipt_handle, bucket, key, nil
}
示例13: ExampleStorageGateway_CreateTapes
func ExampleStorageGateway_CreateTapes() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := storagegateway.New(sess)
params := &storagegateway.CreateTapesInput{
ClientToken: aws.String("ClientToken"), // Required
GatewayARN: aws.String("GatewayARN"), // Required
NumTapesToCreate: aws.Int64(1), // Required
TapeBarcodePrefix: aws.String("TapeBarcodePrefix"), // Required
TapeSizeInBytes: aws.Int64(1), // Required
}
resp, err := svc.CreateTapes(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)
}
示例14: ExampleStorageGateway_UpdateSnapshotSchedule
func ExampleStorageGateway_UpdateSnapshotSchedule() {
sess, err := session.NewSession()
if err != nil {
fmt.Println("failed to create session,", err)
return
}
svc := storagegateway.New(sess)
params := &storagegateway.UpdateSnapshotScheduleInput{
RecurrenceInHours: aws.Int64(1), // Required
StartAt: aws.Int64(1), // Required
VolumeARN: aws.String("VolumeARN"), // Required
Description: aws.String("Description"),
}
resp, err := svc.UpdateSnapshotSchedule(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)
}
示例15: TestFlattenHealthCheck
func TestFlattenHealthCheck(t *testing.T) {
cases := []struct {
Input *elb.HealthCheck
Output []map[string]interface{}
}{
{
Input: &elb.HealthCheck{
UnhealthyThreshold: aws.Int64(int64(10)),
HealthyThreshold: aws.Int64(int64(10)),
Target: aws.String("HTTP:80/"),
Timeout: aws.Int64(int64(30)),
Interval: aws.Int64(int64(30)),
},
Output: []map[string]interface{}{
map[string]interface{}{
"unhealthy_threshold": int64(10),
"healthy_threshold": int64(10),
"target": "HTTP:80/",
"timeout": int64(30),
"interval": int64(30),
},
},
},
}
for _, tc := range cases {
output := flattenHealthCheck(tc.Input)
if !reflect.DeepEqual(output, tc.Output) {
t.Fatalf("Got:\n\n%#v\n\nExpected:\n\n%#v", output, tc.Output)
}
}
}