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

feat: Onboard Google Cloud Release Notes dataset #133

Merged
merged 6 commits into from Aug 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,26 @@
/**
* Copyright 2021 Google LLC
*
* 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.
*/


resource "google_bigquery_dataset" "google_cloud_release_notes" {
dataset_id = "google_cloud_release_notes"
project = var.project_id
description = "This dataset contains release notes for the majority of generally available Google Cloud products found on cloud.google.com. You can use this BigQuery public dataset to consume release notes programmatically across all products. HTML versions of release notes are available within each product\u0027s documentation and also in a filterable format at https://console.cloud.google.com/release-notes."
}

output "bigquery_dataset-google_cloud_release_notes-dataset_id" {
value = google_bigquery_dataset.google_cloud_release_notes.dataset_id
}
28 changes: 28 additions & 0 deletions datasets/google_cloud_release_notes/_terraform/provider.tf
@@ -0,0 +1,28 @@
/**
* Copyright 2021 Google LLC
*
* 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.
*/


provider "google" {
project = var.project_id
impersonate_service_account = var.impersonating_acct
region = var.region
}

data "google_client_openid_userinfo" "me" {}

output "impersonating-account" {
value = data.google_client_openid_userinfo.me.email
}
@@ -0,0 +1,39 @@
/**
* Copyright 2021 Google LLC
*
* 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.
*/


resource "google_bigquery_table" "release_notes" {
project = var.project_id
dataset_id = "google_cloud_release_notes"
table_id = "release_notes"

description = "This table contains release notes for the majority of generally available Google Cloud products found on cloud.google.com. You can use this BigQuery public dataset to consume release notes programmatically across all products. HTML versions of release notes are available within each product\u0027s documentation and also in a filterable format at https://console.cloud.google.com/release-notes."




depends_on = [
google_bigquery_dataset.google_cloud_release_notes
]
}

output "bigquery_table-release_notes-table_id" {
value = google_bigquery_table.release_notes.table_id
}

output "bigquery_table-release_notes-id" {
value = google_bigquery_table.release_notes.id
}
23 changes: 23 additions & 0 deletions datasets/google_cloud_release_notes/_terraform/variables.tf
@@ -0,0 +1,23 @@
/**
* Copyright 2021 Google LLC
*
* 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.
*/


variable "project_id" {}
variable "bucket_name_prefix" {}
variable "impersonating_acct" {}
variable "region" {}
variable "env" {}

25 changes: 25 additions & 0 deletions datasets/google_cloud_release_notes/dataset.yaml
@@ -0,0 +1,25 @@
# Copyright 2021 Google LLC
#
# 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.

dataset:
name: google_cloud_release_notes
friendly_name: ~
description: ~
dataset_sources: ~
terms_of_use: ~

resources:
- type: bigquery_dataset
dataset_id: google_cloud_release_notes
description: "This dataset contains release notes for the majority of generally available Google Cloud products found on cloud.google.com. You can use this BigQuery public dataset to consume release notes programmatically across all products. HTML versions of release notes are available within each product's documentation and also in a filterable format at https://console.cloud.google.com/release-notes."
47 changes: 47 additions & 0 deletions datasets/google_cloud_release_notes/release_notes/pipeline.yaml
@@ -0,0 +1,47 @@
# Copyright 2021 Google LLC
#
# 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.

---
resources:
- type: bigquery_table
table_id: release_notes
description: "This table contains release notes for the majority of generally available Google Cloud products found on cloud.google.com. You can use this BigQuery public dataset to consume release notes programmatically across all products. HTML versions of release notes are available within each product's documentation and also in a filterable format at https://console.cloud.google.com/release-notes."

dag:
airflow_version: 1
initialize:
dag_id: release_notes
default_args:
owner: "Google"
depends_on_past: False
start_date: '2021-08-05'
max_active_runs: 1
schedule_interval: "0 5 * * *" # run daily at 5am
catchup: False
default_view: graph

tasks:
- operator: "BigQueryToBigQueryOperator"
description: "Task to run a BQ to BQ operator"

args:
task_id: "google_cloud_release_notes"
source_project_dataset_tables: ["{{ var.json.google_cloud_release_notes.release_notes.source_project_dataset_table }}"]
destination_project_dataset_table: "{{ var.json.google_cloud_release_notes.release_notes.destination_project_dataset_table }}"
impersonation_chain: "{{ var.json.google_cloud_release_notes.service_account }}"
write_disposition: "WRITE_TRUNCATE"
gcp_conn_id: "google_cloud_release_notes_conn"

graph_paths:
- "google_cloud_release_notes"
@@ -0,0 +1,47 @@
# Copyright 2021 Google LLC
#
# 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.


from airflow import DAG
from airflow.contrib.operators import bigquery_to_bigquery

default_args = {
"owner": "Google",
"depends_on_past": False,
"start_date": "2021-08-05",
}


with DAG(
dag_id="google_cloud_release_notes.release_notes",
default_args=default_args,
max_active_runs=1,
schedule_interval="0 5 * * *",
catchup=False,
default_view="graph",
) as dag:

# Task to run a BQ to BQ operator
google_cloud_release_notes = bigquery_to_bigquery.BigQueryToBigQueryOperator(
task_id="google_cloud_release_notes",
source_project_dataset_tables=[
"{{ var.json.google_cloud_release_notes.release_notes.source_project_dataset_table }}"
],
destination_project_dataset_table="{{ var.json.google_cloud_release_notes.release_notes.destination_project_dataset_table }}",
impersonation_chain="{{ var.json.google_cloud_release_notes.service_account }}",
write_disposition="WRITE_TRUNCATE",
gcp_conn_id="google_cloud_release_notes_conn",
)

google_cloud_release_notes