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

Add status to bigquery_job #4455

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions mmv1/products/bigquery/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,50 @@ objects:
description: |
The geographic location of the job. The default value is US.
default_value: 'US'
- !ruby/object:Api::Type::NestedObject
name: 'status'
output: true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is needed. Because of that terraform generator doesn't set maxItems: 1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is needed because the user cannot set the value of the status object. output: true is not necessarily needed on the sub-fields of this object, as if the top-level is output only then all sub fields will be as well

description: |
The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
properties:
- !ruby/object:Api::Type::NestedObject
name: 'errorResult'
output: true
description: |
Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
properties:
- !ruby/object:Api::Type::String
name: 'reason'
description: A short error code that summarizes the error.
- !ruby/object:Api::Type::String
name: 'location'
description: Specifies where the error occurred, if present.
- !ruby/object:Api::Type::String
name: 'message'
description: A human-readable description of the error.
- !ruby/object:Api::Type::Array
name: 'errors'
output: true
description: |
The first errors encountered during the running of the job. The final message
includes the number of errors that caused the process to stop. Errors here do
not necessarily mean that the job has not completed or was unsuccessful.
item_type: !ruby/object:Api::Type::NestedObject
properties:
- !ruby/object:Api::Type::String
name: 'reason'
description: A short error code that summarizes the error.
- !ruby/object:Api::Type::String
name: 'location'
description: Specifies where the error occurred, if present.
- !ruby/object:Api::Type::String
name: 'message'
description: A human-readable description of the error.
- !ruby/object:Api::Type::String
name: 'state'
output: true
description: |
Running state of the job. Valid states include 'PENDING', 'RUNNING', and 'DONE'.
- !ruby/object:Api::Resource
name: 'Table'
kind: 'bigquery#table'
Expand Down
8 changes: 8 additions & 0 deletions mmv1/products/bigquery/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
account_name: "bqowner"
ignore_read_extra:
- "etag"
- "status.0.state"
- !ruby/object:Provider::Terraform::Examples
name: "bigquery_job_query_table_reference"
primary_resource_id: "job"
Expand All @@ -156,13 +157,15 @@ overrides: !ruby/object:Overrides::ResourceOverrides
- "etag"
- "query.0.default_dataset.0.dataset_id"
- "query.0.destination_table.0.table_id"
- "status.0.state"
- !ruby/object:Provider::Terraform::Examples
name: "bigquery_job_load"
primary_resource_id: "job"
vars:
job_id: "job_load"
ignore_read_extra:
- "etag"
- "status.0.state"
- !ruby/object:Provider::Terraform::Examples
name: "bigquery_job_load_table_reference"
primary_resource_id: "job"
Expand All @@ -171,6 +174,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
ignore_read_extra:
- "etag"
- "load.0.destination_table.0.table_id"
- "status.0.state"
skip_docs: true # there are a lot of examples for this resource, so omitting some that are similar to others
- !ruby/object:Provider::Terraform::Examples
name: "bigquery_job_copy"
Expand All @@ -184,6 +188,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
project: :PROJECT_NAME
ignore_read_extra:
- "etag"
- "status.0.state"
- !ruby/object:Provider::Terraform::Examples
name: "bigquery_job_copy_table_reference"
primary_resource_id: "job"
Expand All @@ -199,6 +204,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
- "copy.0.destination_table.0.table_id"
- "copy.0.source_tables.0.table_id"
- "copy.0.source_tables.1.table_id"
- "status.0.state"
skip_docs: true # there are a lot of examples for this resource, so omitting some that are similar to others
- !ruby/object:Provider::Terraform::Examples
name: "bigquery_job_extract"
Expand All @@ -208,6 +214,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
account_name: "bqowner"
ignore_read_extra:
- "etag"
- "status.0.state"
- !ruby/object:Provider::Terraform::Examples
name: "bigquery_job_extract_table_reference"
primary_resource_id: "job"
Expand All @@ -217,6 +224,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
ignore_read_extra:
- "etag"
- "extract.0.source_table.0.table_id"
- "status.0.state"
skip_docs: true # there are a lot of examples for this resource, so omitting some that are similar to others
properties:
id: !ruby/object:Overrides::Terraform::PropertyOverride
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestAccBigQueryJob_withLocation(t *testing.T) {
ImportStateId: importID,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"etag"},
ImportStateVerifyIgnore: []string{"etag", "status.0.state"},
},
},
})
Expand Down