Skip to content

Commit

Permalink
Add status to bigquery_job (#4455)
Browse files Browse the repository at this point in the history
* Add `status` field to `google_bigquery_job`

fixes hashicorp/terraform-provider-google#8357

* fixup! ignore `.status.0.state` in tests
  • Loading branch information
kanterov authored Feb 3, 2021
1 parent efbbc3c commit 1a71093
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
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
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

0 comments on commit 1a71093

Please sign in to comment.