Skip to content

Commit

Permalink
update module to work with webhook-go
Browse files Browse the repository at this point in the history
  • Loading branch information
dhollinger committed May 4, 2023
1 parent 0c51051 commit 9654507
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 0 deletions.
43 changes: 43 additions & 0 deletions spec/type_aliases/webhook/config_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'R10k::Webhook::Config' do
context 'full valid configuration' do
let(:data) do
{
server: {
protected: true,
user: 'foo',
password: 'bar',
port: 4000,
tls: {
enabled: true,
certificate: '/some/path/to/cert.pem',
key: '/some/path/to/key.pem',
},
},
chatops: {
enabled: true,
service: 'slack',
channel: '#deploy',
user: 'baz',
auth_token: 'abcde',
server_uri: 'https://test.com/slack',
},
r10k: {
command_path: '/some/path/to/r10k',
config_path: '/some/path/to/r10k.yaml',
default_branch: 'main',
prefix: 'prefix',
allow_uppercase: false,
verbose: true,
deploy_modules: true,
generate_types: true,
}
}
end

it { is_expected.to allow_value(data) }
end
end
5 changes: 5 additions & 0 deletions types/webhook/config.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type R10k::Webhook::Config = Struct[{
server => Optional[R10k::Webhook::Config::Server],
chatops => Optional[R10k::Webhook::Config::Chatops],
r10k => Optional[R10k::Webhook::Config::R10k],
}]
8 changes: 8 additions & 0 deletions types/webhook/config/chatops.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type R10k::Webhook::Config::Chatops = Struct[{
enabled => Boolean,
service => Enum['slack', 'rocketchat'],
channel => Optional[String[1]],
user => Optional[String[1]],
auth_token => Optional[String[1]],
server_uri => Optional[String[1]],
}]
10 changes: 10 additions & 0 deletions types/webhook/config/r10k.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type R10k::Webhook::Config::R10k = Struct[{
command_path => Optional[Stdlib::Absolutepath],
config_path => Optional[Stdlib::Absolutepath],
default_branch => Optional[String[1]],
prefix => Optional[String[1]],
allow_uppercase => Optional[Boolean],
verbose => Optional[Boolean],
deploy_modules => Optional[Boolean],
generate_types => Optional[Boolean],
}]
7 changes: 7 additions & 0 deletions types/webhook/config/server.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type R10k::Webhook::Config::Server = Struct[{
protected => Boolean,
user => Optional[String[1]],
password => Optional[String[1]],
port => Optional[Stdlib::Port],
tls => Optional[R10k::Webhook::Config::Server::Tls],
}]
5 changes: 5 additions & 0 deletions types/webhook/config/server/tls.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type R10k::Webhook::Config::Server::Tls = Struct[{
enabled => Boolean,
certificate => Optional[Stdlib::Absolutepath],
key => Optional[Stdlib::Absolutepath],
}]

0 comments on commit 9654507

Please sign in to comment.