software.amazon.awscdk.services.codepipeline.actions.GitHubSourceAction Maven / Gradle / Ivy
Show all versions of codepipeline-actions Show documentation
package software.amazon.awscdk.services.codepipeline.actions;
/**
* Source that is provided by a GitHub repository.
*
* Example:
*
*
* Artifact sourceOutput;
* PipelineProject project;
* GitHubSourceAction sourceAction = GitHubSourceAction.Builder.create()
* .actionName("Github_Source")
* .output(sourceOutput)
* .owner("my-owner")
* .repo("my-repo")
* .oauthToken(SecretValue.secretsManager("my-github-token"))
* .variablesNamespace("MyNamespace")
* .build();
* // later:
* // later:
* CodeBuildAction.Builder.create()
* .actionName("CodeBuild")
* .project(project)
* .input(sourceOutput)
* .environmentVariables(Map.of(
* "COMMIT_URL", BuildEnvironmentVariable.builder()
* .value(sourceAction.getVariables().getCommitUrl())
* .build()))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.74.0 (build 6d08790)", date = "2023-05-19T23:09:34.883Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.codepipeline.actions.$Module.class, fqn = "@aws-cdk/aws-codepipeline-actions.GitHubSourceAction")
public class GitHubSourceAction extends software.amazon.awscdk.services.codepipeline.actions.Action {
protected GitHubSourceAction(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected GitHubSourceAction(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public GitHubSourceAction(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.codepipeline.actions.GitHubSourceActionProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* This is a renamed version of the {@link IAction.bind} method.
*
* @param scope This parameter is required.
* @param stage This parameter is required.
* @param _options This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
protected @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.codepipeline.ActionConfig bound(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.core.Construct scope, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.codepipeline.IStage stage, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.codepipeline.ActionBindOptions _options) {
return software.amazon.jsii.Kernel.call(this, "bound", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.codepipeline.ActionConfig.class), new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(stage, "stage is required"), java.util.Objects.requireNonNull(_options, "_options is required") });
}
/**
* The variables emitted by this action.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.codepipeline.actions.GitHubSourceVariables getVariables() {
return software.amazon.jsii.Kernel.get(this, "variables", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.codepipeline.actions.GitHubSourceVariables.class));
}
/**
* A fluent builder for {@link software.amazon.awscdk.services.codepipeline.actions.GitHubSourceAction}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create() {
return new Builder();
}
private final software.amazon.awscdk.services.codepipeline.actions.GitHubSourceActionProps.Builder props;
private Builder() {
this.props = new software.amazon.awscdk.services.codepipeline.actions.GitHubSourceActionProps.Builder();
}
/**
* The physical, human-readable name of the Action.
*
* Note that Action names must be unique within a single Stage.
*
* @return {@code this}
* @param actionName The physical, human-readable name of the Action. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder actionName(final java.lang.String actionName) {
this.props.actionName(actionName);
return this;
}
/**
* The runOrder property for this Action.
*
* RunOrder determines the relative order in which multiple Actions in the same Stage execute.
*
* Default: 1
*
* @return {@code this}
* @see https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html
* @param runOrder The runOrder property for this Action. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder runOrder(final java.lang.Number runOrder) {
this.props.runOrder(runOrder);
return this;
}
/**
* The name of the namespace to use for variables emitted by this action.
*
* Default: - a name will be generated, based on the stage and action names,
* if any of the action's variables were referenced - otherwise,
* no namespace will be set
*
* @return {@code this}
* @param variablesNamespace The name of the namespace to use for variables emitted by this action. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder variablesNamespace(final java.lang.String variablesNamespace) {
this.props.variablesNamespace(variablesNamespace);
return this;
}
/**
* A GitHub OAuth token to use for authentication.
*
* It is recommended to use a Secrets Manager Secret
to obtain the token:
*
* const oauth = cdk.SecretValue.secretsManager('my-github-token');
* new GitHubSource(this, 'GitHubAction', { oauthToken: oauth, ... });
*
* The GitHub Personal Access Token should have these scopes:
*
*
* - repo - to read the repository
* - admin:repo_hook - if you plan to use webhooks (true by default)
*
*
* @return {@code this}
* @see https://docs.aws.amazon.com/codepipeline/latest/userguide/appendix-github-oauth.html#GitHub-create-personal-token-CLI
* @param oauthToken A GitHub OAuth token to use for authentication. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder oauthToken(final software.amazon.awscdk.core.SecretValue oauthToken) {
this.props.oauthToken(oauthToken);
return this;
}
/**
* @return {@code this}
* @param output This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder output(final software.amazon.awscdk.services.codepipeline.Artifact output) {
this.props.output(output);
return this;
}
/**
* The GitHub account/user that owns the repo.
*
* @return {@code this}
* @param owner The GitHub account/user that owns the repo. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder owner(final java.lang.String owner) {
this.props.owner(owner);
return this;
}
/**
* The name of the repo, without the username.
*
* @return {@code this}
* @param repo The name of the repo, without the username. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder repo(final java.lang.String repo) {
this.props.repo(repo);
return this;
}
/**
* The branch to use.
*
* Default: "master"
*
* @return {@code this}
* @param branch The branch to use. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder branch(final java.lang.String branch) {
this.props.branch(branch);
return this;
}
/**
* How AWS CodePipeline should be triggered.
*
* With the default value "WEBHOOK", a webhook is created in GitHub that triggers the action
* With "POLL", CodePipeline periodically checks the source for changes
* With "None", the action is not triggered through changes in the source
*
* To use WEBHOOK
, your GitHub Personal Access Token should have
* admin:repo_hook scope (in addition to the regular repo scope).
*
* Default: GitHubTrigger.WEBHOOK
*
* @return {@code this}
* @param trigger How AWS CodePipeline should be triggered. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder trigger(final software.amazon.awscdk.services.codepipeline.actions.GitHubTrigger trigger) {
this.props.trigger(trigger);
return this;
}
/**
* @returns a newly built instance of {@link software.amazon.awscdk.services.codepipeline.actions.GitHubSourceAction}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public software.amazon.awscdk.services.codepipeline.actions.GitHubSourceAction build() {
return new software.amazon.awscdk.services.codepipeline.actions.GitHubSourceAction(
this.props.build()
);
}
}
}