Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chef bigquery #507

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/vars.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set chef_modules = ['_bundle', 'auth', 'compute', 'sql', 'storage', 'spanner', 'container', 'dns', 'iam'] %}
{% set chef_modules = ['_bundle', 'auth', 'bigquery', 'compute', 'sql', 'storage', 'spanner', 'container', 'dns', 'iam'] %}
{% set puppet_modules = ['_bundle', 'auth', 'bigquery', 'compute', 'sql', 'storage', 'spanner', 'container', 'dns', 'pubsub', 'resourcemanager'] %}
{% set puppet_no_release = ['bigquery'] %}
{% macro names_as_list(repo, names) -%}
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@
[submodule "build/chef/iam"]
path = build/chef/iam
url = [email protected]:GoogleCloudPlatform/chef-google-iam.git
[submodule "build/chef/bigquery"]
path = build/chef/bigquery
url = https://github.com/GoogleCloudPlatform/chef-google-bigquery
1 change: 1 addition & 0 deletions build/chef/bigquery
Submodule bigquery added at 582fa4
43 changes: 43 additions & 0 deletions products/bigquery/chef.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

--- !ruby/object:Provider::Chef::Config
manifest: !ruby/object:Provider::Chef::Manifest
version: '0.1.0'
source: 'https://github.com/GoogleCloudPlatform/chef-google-bigquery'
issues: 'https://github.com/GoogleCloudPlatform/chef-google-bigquery/issues'
summary: 'A Chef cookbook to manage Google Cloud BigQuery resources'
description: |
This cookbook provides the built-in types and services for Chef to manage
Google Cloud BigQuery resources, as native Chef types.
depends:
<%= indent(compile('provider/chef/common~depends.yaml'), 4) %>
operating_systems:
<%= indent(include('provider/chef/common~operating_systems.yaml'), 4) %>
overrides: !ruby/object:Provider::ResourceOverrides
examples: !ruby/object:Api::Resource::HashArray
Dataset:
- dataset.rb
files: !ruby/object:Provider::Config::Files
copy:
<%= indent(compile('provider/chef/common~copy.yaml'), 4) %>
compile:
<%= indent(include('provider/chef/common~compile~before.yaml'), 4) %>
<%= indent(include('provider/chef/common~compile~after.yaml'), 4) %>
<% # common~compile~after.yaml should be the last line of compile: section -%>
style:
changelog:
- !ruby/object:Provider::Config::Changelog
version: '0.1.0'
date: 2018-09-15T09:00:00-0700
general: 'Initial release'
31 changes: 31 additions & 0 deletions products/bigquery/examples/chef/dataset.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<%# The license inside this block applies to this file
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-%>
<% unless name == 'README.md' -%>
<%= compile 'templates/license.erb' -%>

<%= lines(autogen_notice :chef) -%>

<% end -%>

<%= compile 'templates/chef/example~auth.rb.erb' -%>

gbigquery_dataset <%= example_resource_name('example_dataset') -%> do
action :create
dataset_reference ({
dataset_id: 'example_dataset'
})
project ENV['PROJECT'] # e.g. 'my-test-project'
credential 'mycred'
end
27 changes: 27 additions & 0 deletions products/bigquery/examples/chef/delete_dataset.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<%# The license inside this block applies to this file
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-%>
<% unless name == "README.md" -%>
<%= compile 'templates/license.erb' -%>

<%= lines(autogen_notice :chef) -%>

<%= compile 'templates/chef/example~auth.rb.erb' -%>

<% end # name == README.md -%>
gbigquery_dataset '<%= example_resource_name('example_dataset') -%>' do
action :delete
project ENV['PROJECT'] # e.g. 'my-test-project'
credential 'mycred'
end
31 changes: 31 additions & 0 deletions products/bigquery/examples/chef/readme.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<%# The license inside this block applies to this file
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-%>
<% unless name == 'README.md' -%>

<%= compile 'templates/license.erb' -%>

<%= lines(autogen_notice :chef) -%>

<% end -%>
<%= compile 'templates/chef/example~auth.rb.erb' -%>

gbigquery_dataset <%= example_resource_name('example_dataset') -%> do
action :create
dataset_reference ({
dataset_id: 'example_dataset'
})
project ENV['PROJECT'] # e.g. 'my-test-project'
credential 'mycred'
end
43 changes: 43 additions & 0 deletions products/bigquery/examples/chef/table.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<%# The license inside this block applies to this file
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-%>
<% unless name == 'README.md' -%>
<%= compile 'templates/license.erb' -%>

<%= lines(autogen_notice :chef) -%>

<% end -%>

<%= compile 'templates/chef/example~auth.rb.erb' -%>

gbigquery_dataset <%= example_resource_name('example_dataset') -%> do
action :create
dataset_reference ({
dataset_id: 'example_dataset'
})
project ENV['PROJECT'] # e.g. 'my-test-project'
credential 'mycred'
end

gbigquery_table <%= example_resource_name('example_table') -%> do
action :create
dataset <%= example_resource_name('example_dataset') -%>
table_reference ({
dataset_id: <%= example_resource_name('example_dataset') -%>,
project_id: ENV['PROJECT'],
table_id: <%= example_resource_name('example_table') -%>
})
project ENV['PROJECT'] # e.g. 'my-test-project'
credential 'mycred'
end