Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Add pubsubConfigs to cloud source repository
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
c2thorn authored and modular-magician committed Dec 3, 2019
1 parent 597ae39 commit d72fd2a
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/resources/google_sourcerepo_repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ See [google_sourcerepo_repository.md](google_sourcerepo_repository.md) for more
* `names`: an array of `google_sourcerepo_repository` name
* `urls`: an array of `google_sourcerepo_repository` url
* `sizes`: an array of `google_sourcerepo_repository` size
* `pubsub_configs`: an array of `google_sourcerepo_repository` pubsub_configs

## Filter Criteria
This resource supports all of the above properties as filter criteria, which can be used
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/google_sourcerepo_repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Properties that can be accessed from the `google_sourcerepo_repository` resource

* `size`: The disk usage of the repo, in bytes.

* `pubsub_configs`: How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names.


## GCP Permissions

Expand Down
37 changes: 37 additions & 0 deletions libraries/google/sourcerepo/property/repository_pubsub_configs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
module GoogleInSpec
module SourceRepo
module Property
class RepositoryPubsubConfigs
attr_reader :message_format

attr_reader :service_account_email

def initialize(args = nil, parent_identifier = nil)
return if args.nil?
@parent_identifier = parent_identifier
@message_format = args['messageFormat']
@service_account_email = args['serviceAccountEmail']
end

def to_s
"#{@parent_identifier} RepositoryPubsubConfigs"
end
end
end
end
end
2 changes: 2 additions & 0 deletions libraries/google_sourcerepo_repositories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class SourceRepoRepositorys < GcpResourceBase
filter_table_config.add(:names, field: :name)
filter_table_config.add(:urls, field: :url)
filter_table_config.add(:sizes, field: :size)
filter_table_config.add(:pubsub_configs, field: :pubsub_configs)

filter_table_config.connect(self, :table)

Expand Down Expand Up @@ -68,6 +69,7 @@ def transformers
'name' => ->(obj) { return :name, obj['name'] },
'url' => ->(obj) { return :url, obj['url'] },
'size' => ->(obj) { return :size, obj['size'] },
'pubsubConfigs' => ->(obj) { return :pubsub_configs, obj['pubsubConfigs'] },
}
end

Expand Down
3 changes: 3 additions & 0 deletions libraries/google_sourcerepo_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#
# ----------------------------------------------------------------------------
require 'gcp_backend'
require 'google/sourcerepo/property/repository_pubsub_configs'

# A provider to manage Cloud Source Repositories resources.
class SourceRepoRepository < GcpResourceBase
Expand All @@ -25,6 +26,7 @@ class SourceRepoRepository < GcpResourceBase
attr_reader :name
attr_reader :url
attr_reader :size
attr_reader :pubsub_configs

def initialize(params)
super(params.merge({ use_http_transport: true }))
Expand All @@ -37,6 +39,7 @@ def parse
@name = @fetched['name']
@url = @fetched['url']
@size = @fetched['size']
@pubsub_configs = @fetched['pubsubConfigs']
end

# Handles parsing RFC3339 time string
Expand Down

0 comments on commit d72fd2a

Please sign in to comment.