示例#1
0
func ExampleCodePipeline_StartPipelineExecution() {
	svc := codepipeline.New(nil)

	params := &codepipeline.StartPipelineExecutionInput{
		Name: aws.String("PipelineName"), // Required
	}
	resp, err := svc.StartPipelineExecution(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
func ExampleCodePipeline_PutThirdPartyJobFailureResult() {
	svc := codepipeline.New(nil)

	params := &codepipeline.PutThirdPartyJobFailureResultInput{
		ClientToken: aws.String("ClientToken"), // Required
		FailureDetails: &codepipeline.FailureDetails{ // Required
			Type:                aws.String("FailureType"), // Required
			ExternalExecutionID: aws.String("ExecutionId"),
			Message:             aws.String("Message"),
		},
		JobID: aws.String("ThirdPartyJobId"), // Required
	}
	resp, err := svc.PutThirdPartyJobFailureResult(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
func ExampleCodePipeline_PollForThirdPartyJobs() {
	svc := codepipeline.New(nil)

	params := &codepipeline.PollForThirdPartyJobsInput{
		ActionTypeID: &codepipeline.ActionTypeID{ // Required
			Category: aws.String("ActionCategory"), // Required
			Owner:    aws.String("ActionOwner"),    // Required
			Provider: aws.String("ActionProvider"), // Required
			Version:  aws.String("Version"),        // Required
		},
		MaxBatchSize: aws.Int64(1),
	}
	resp, err := svc.PollForThirdPartyJobs(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
func ExampleCodePipeline_CreateCustomActionType() {
	svc := codepipeline.New(nil)

	params := &codepipeline.CreateCustomActionTypeInput{
		Category: aws.String("ActionCategory"), // Required
		InputArtifactDetails: &codepipeline.ArtifactDetails{ // Required
			MaximumCount: aws.Int64(1), // Required
			MinimumCount: aws.Int64(1), // Required
		},
		OutputArtifactDetails: &codepipeline.ArtifactDetails{ // Required
			MaximumCount: aws.Int64(1), // Required
			MinimumCount: aws.Int64(1), // Required
		},
		Provider: aws.String("ActionProvider"), // Required
		Version:  aws.String("Version"),        // Required
		ConfigurationProperties: []*codepipeline.ActionConfigurationProperty{
			{ // Required
				Key:         aws.Bool(true),                       // Required
				Name:        aws.String("ActionConfigurationKey"), // Required
				Required:    aws.Bool(true),                       // Required
				Secret:      aws.Bool(true),                       // Required
				Description: aws.String("Description"),
				Queryable:   aws.Bool(true),
				Type:        aws.String("ActionConfigurationPropertyType"),
			},
			// More values...
		},
		Settings: &codepipeline.ActionTypeSettings{
			EntityURLTemplate:          aws.String("UrlTemplate"),
			ExecutionURLTemplate:       aws.String("UrlTemplate"),
			RevisionURLTemplate:        aws.String("UrlTemplate"),
			ThirdPartyConfigurationURL: aws.String("Url"),
		},
	}
	resp, err := svc.CreateCustomActionType(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
func ExampleCodePipeline_PutThirdPartyJobSuccessResult() {
	svc := codepipeline.New(nil)

	params := &codepipeline.PutThirdPartyJobSuccessResultInput{
		ClientToken:       aws.String("ClientToken"),     // Required
		JobID:             aws.String("ThirdPartyJobId"), // Required
		ContinuationToken: aws.String("ContinuationToken"),
		CurrentRevision: &codepipeline.CurrentRevision{
			ChangeIdentifier: aws.String("RevisionChangeIdentifier"), // Required
			Revision:         aws.String("Revision"),                 // Required
		},
		ExecutionDetails: &codepipeline.ExecutionDetails{
			ExternalExecutionID: aws.String("ExecutionId"),
			PercentComplete:     aws.Int64(1),
			Summary:             aws.String("ExecutionSummary"),
		},
	}
	resp, err := svc.PutThirdPartyJobSuccessResult(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
func ExampleCodePipeline_UpdatePipeline() {
	svc := codepipeline.New(nil)

	params := &codepipeline.UpdatePipelineInput{
		Pipeline: &codepipeline.PipelineDeclaration{ // Required
			ArtifactStore: &codepipeline.ArtifactStore{ // Required
				Location: aws.String("ArtifactStoreLocation"), // Required
				Type:     aws.String("ArtifactStoreType"),     // Required
			},
			Name:    aws.String("PipelineName"), // Required
			RoleARN: aws.String("RoleArn"),      // Required
			Stages: []*codepipeline.StageDeclaration{ // Required
				{ // Required
					Actions: []*codepipeline.ActionDeclaration{ // Required
						{ // Required
							ActionTypeID: &codepipeline.ActionTypeID{ // Required
								Category: aws.String("ActionCategory"), // Required
								Owner:    aws.String("ActionOwner"),    // Required
								Provider: aws.String("ActionProvider"), // Required
								Version:  aws.String("Version"),        // Required
							},
							Name: aws.String("ActionName"), // Required
							Configuration: map[string]*string{
								"Key": aws.String("ActionConfigurationValue"), // Required
								// More values...
							},
							InputArtifacts: []*codepipeline.InputArtifact{
								{ // Required
									Name: aws.String("ArtifactName"), // Required
								},
								// More values...
							},
							OutputArtifacts: []*codepipeline.OutputArtifact{
								{ // Required
									Name: aws.String("ArtifactName"), // Required
								},
								// More values...
							},
							RoleARN:  aws.String("RoleArn"),
							RunOrder: aws.Int64(1),
						},
						// More values...
					},
					Name: aws.String("StageName"), // Required
					Blockers: []*codepipeline.BlockerDeclaration{
						{ // Required
							Name: aws.String("BlockerName"), // Required
							Type: aws.String("BlockerType"), // Required
						},
						// More values...
					},
				},
				// More values...
			},
			Version: aws.Int64(1),
		},
	}
	resp, err := svc.UpdatePipeline(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
func init() {
	Before("@codepipeline", func() {
		World["client"] = codepipeline.New(nil)
	})
}
示例#8
0
func TestInterface(t *testing.T) {
	assert.Implements(t, (*codepipelineiface.CodePipelineAPI)(nil), codepipeline.New(nil))
}