Class: AWSCDK::Pipelines::GitHubSourceOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
pipelines/git_hub_source_options.rb

Overview

Options for GitHub sources.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action_name: nil, authentication: nil, trigger: nil) ⇒ GitHubSourceOptions

Returns a new instance of GitHubSourceOptions.

Parameters:

  • action_name (String, nil) (defaults to: nil)

    The action name used for this source in the CodePipeline.

  • authentication (AWSCDK::SecretValue, nil) (defaults to: nil)

    A GitHub OAuth token to use for authentication.

  • trigger (AWSCDK::CodePipelineActions::GitHubTrigger, nil) (defaults to: nil)

    How AWS CodePipeline should be triggered.



10
11
12
13
14
15
16
17
# File 'pipelines/git_hub_source_options.rb', line 10

def initialize(action_name: nil, authentication: nil, trigger: nil)
  @action_name = action_name
  Jsii::Type.check_type(@action_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "actionName") unless @action_name.nil?
  @authentication = authentication
  Jsii::Type.check_type(@authentication, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TZWNyZXRWYWx1ZSJ9")), "authentication") unless @authentication.nil?
  @trigger = trigger
  Jsii::Type.check_type(@trigger, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZXBpcGVsaW5lX2FjdGlvbnMuR2l0SHViVHJpZ2dlciJ9")), "trigger") unless @trigger.nil?
end

Instance Attribute Details

#action_nameString? (readonly)

Note:

Default: - The repository string

The action name used for this source in the CodePipeline.

Returns:

  • (String, nil)


23
24
25
# File 'pipelines/git_hub_source_options.rb', line 23

def action_name
  @action_name
end

#authenticationAWSCDK::SecretValue? (readonly)

Note:

Default: - SecretValue.secretsManager('github-token')

A GitHub OAuth token to use for authentication.

It is recommended to use a Secrets Manager Secret to obtain the token:

oauth = AWSCDK::SecretValue.secrets_manager("my-github-token")

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)


40
41
42
# File 'pipelines/git_hub_source_options.rb', line 40

def authentication
  @authentication
end

#triggerAWSCDK::CodePipelineActions::GitHubTrigger? (readonly)

Note:

Default: GitHubTrigger.WEBHOOK

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).



52
53
54
# File 'pipelines/git_hub_source_options.rb', line 52

def trigger
  @trigger
end

Class Method Details

.jsii_propertiesObject



54
55
56
57
58
59
60
# File 'pipelines/git_hub_source_options.rb', line 54

def self.jsii_properties
  {
    :action_name => "actionName",
    :authentication => "authentication",
    :trigger => "trigger",
  }
end

Instance Method Details

#to_jsiiObject



62
63
64
65
66
67
68
69
70
# File 'pipelines/git_hub_source_options.rb', line 62

def to_jsii
  result = {}
  result.merge!({
    "actionName" => @action_name,
    "authentication" => @authentication,
    "trigger" => @trigger,
  })
  result.compact
end