diff --git a/.ci/ci.yml.tmpl b/.ci/ci.yml.tmpl index d76d8652433d..20508baaa07c 100644 --- a/.ci/ci.yml.tmpl +++ b/.ci/ci.yml.tmpl @@ -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 terraform_enabled = true %} {% set ansible_enabled = true %} diff --git a/.gitmodules b/.gitmodules index 515df3d2c747..4a11ff8e1358 100644 --- a/.gitmodules +++ b/.gitmodules @@ -81,3 +81,6 @@ [submodule "build/chef/iam"] path = build/chef/iam url = git@github.com:GoogleCloudPlatform/chef-google-iam.git +[submodule "build/chef/bigquery"] + path = build/chef/bigquery + url = https://github.com/GoogleCloudPlatform/chef-google-bigquery diff --git a/build/chef/bigquery b/build/chef/bigquery new file mode 160000 index 000000000000..582fa4064583 --- /dev/null +++ b/build/chef/bigquery @@ -0,0 +1 @@ +Subproject commit 582fa40645833b06d965c410e0ef2fc897de7734 diff --git a/products/bigquery/chef.yaml b/products/bigquery/chef.yaml new file mode 100644 index 000000000000..0c23d0453d07 --- /dev/null +++ b/products/bigquery/chef.yaml @@ -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' diff --git a/products/bigquery/examples/chef/dataset.rb b/products/bigquery/examples/chef/dataset.rb new file mode 100644 index 000000000000..5a70393e92a4 --- /dev/null +++ b/products/bigquery/examples/chef/dataset.rb @@ -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 \ No newline at end of file diff --git a/products/bigquery/examples/chef/delete_dataset.rb b/products/bigquery/examples/chef/delete_dataset.rb new file mode 100644 index 000000000000..d75b0dd64b1d --- /dev/null +++ b/products/bigquery/examples/chef/delete_dataset.rb @@ -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 diff --git a/products/bigquery/examples/chef/readme.rb b/products/bigquery/examples/chef/readme.rb new file mode 100644 index 000000000000..62407ba43280 --- /dev/null +++ b/products/bigquery/examples/chef/readme.rb @@ -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 diff --git a/products/bigquery/examples/chef/table.rb b/products/bigquery/examples/chef/table.rb new file mode 100644 index 000000000000..97fb7b7cc237 --- /dev/null +++ b/products/bigquery/examples/chef/table.rb @@ -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