Skip to content

Commit

Permalink
fix(automl): deprecate resource name helper methods, update docs con…
Browse files Browse the repository at this point in the history
…figuration (via synth) (#9828)
  • Loading branch information
yoshi-automation authored and busunkim96 committed Nov 19, 2019
1 parent 5349250 commit a6fc8bd
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 20 deletions.
2 changes: 1 addition & 1 deletion automl/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = []
html_static_path = ["_static"]

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down
35 changes: 30 additions & 5 deletions automl/google/cloud/automl_v1/gapic/auto_ml_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def annotation_spec_path(cls, project, location, dataset, annotation_spec):
"""Return a fully-qualified annotation_spec string."""
"""DEPRECATED. Return a fully-qualified annotation_spec string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec}",
project=project,
Expand All @@ -112,7 +117,12 @@ def annotation_spec_path(cls, project, location, dataset, annotation_spec):

@classmethod
def dataset_path(cls, project, location, dataset):
"""Return a fully-qualified dataset string."""
"""DEPRECATED. Return a fully-qualified dataset string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}",
project=project,
Expand All @@ -122,7 +132,12 @@ def dataset_path(cls, project, location, dataset):

@classmethod
def location_path(cls, project, location):
"""Return a fully-qualified location string."""
"""DEPRECATED. Return a fully-qualified location string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}",
project=project,
Expand All @@ -131,7 +146,12 @@ def location_path(cls, project, location):

@classmethod
def model_path(cls, project, location, model):
"""Return a fully-qualified model string."""
"""DEPRECATED. Return a fully-qualified model string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/models/{model}",
project=project,
Expand All @@ -141,7 +161,12 @@ def model_path(cls, project, location, model):

@classmethod
def model_evaluation_path(cls, project, location, model, model_evaluation):
"""Return a fully-qualified model_evaluation string."""
"""DEPRECATED. Return a fully-qualified model_evaluation string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/models/{model}/modelEvaluations/{model_evaluation}",
project=project,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def model_path(cls, project, location, model):
"""Return a fully-qualified model string."""
"""DEPRECATED. Return a fully-qualified model string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/models/{model}",
project=project,
Expand Down
49 changes: 42 additions & 7 deletions automl/google/cloud/automl_v1beta1/gapic/auto_ml_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def annotation_spec_path(cls, project, location, dataset, annotation_spec):
"""Return a fully-qualified annotation_spec string."""
"""DEPRECATED. Return a fully-qualified annotation_spec string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}/annotationSpecs/{annotation_spec}",
project=project,
Expand All @@ -114,7 +119,12 @@ def annotation_spec_path(cls, project, location, dataset, annotation_spec):

@classmethod
def column_spec_path(cls, project, location, dataset, table_spec, column_spec):
"""Return a fully-qualified column_spec string."""
"""DEPRECATED. Return a fully-qualified column_spec string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}/columnSpecs/{column_spec}",
project=project,
Expand All @@ -126,7 +136,12 @@ def column_spec_path(cls, project, location, dataset, table_spec, column_spec):

@classmethod
def dataset_path(cls, project, location, dataset):
"""Return a fully-qualified dataset string."""
"""DEPRECATED. Return a fully-qualified dataset string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}",
project=project,
Expand All @@ -136,7 +151,12 @@ def dataset_path(cls, project, location, dataset):

@classmethod
def location_path(cls, project, location):
"""Return a fully-qualified location string."""
"""DEPRECATED. Return a fully-qualified location string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}",
project=project,
Expand All @@ -145,7 +165,12 @@ def location_path(cls, project, location):

@classmethod
def model_path(cls, project, location, model):
"""Return a fully-qualified model string."""
"""DEPRECATED. Return a fully-qualified model string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/models/{model}",
project=project,
Expand All @@ -155,7 +180,12 @@ def model_path(cls, project, location, model):

@classmethod
def model_evaluation_path(cls, project, location, model, model_evaluation):
"""Return a fully-qualified model_evaluation string."""
"""DEPRECATED. Return a fully-qualified model_evaluation string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/models/{model}/modelEvaluations/{model_evaluation}",
project=project,
Expand All @@ -166,7 +196,12 @@ def model_evaluation_path(cls, project, location, model, model_evaluation):

@classmethod
def table_spec_path(cls, project, location, dataset, table_spec):
"""Return a fully-qualified table_spec string."""
"""DEPRECATED. Return a fully-qualified table_spec string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/datasets/{dataset}/tableSpecs/{table_spec}",
project=project,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ def from_service_account_file(cls, filename, *args, **kwargs):

@classmethod
def model_path(cls, project, location, model):
"""Return a fully-qualified model string."""
"""DEPRECATED. Return a fully-qualified model string."""
warnings.warn(
"Resource name helper functions are deprecated.",
PendingDeprecationWarning,
stacklevel=1,
)
return google.api_core.path_template.expand(
"projects/{project}/locations/{location}/models/{model}",
project=project,
Expand Down
10 changes: 5 additions & 5 deletions automl/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-11-16T13:13:10.249431Z",
"updateTime": "2019-11-19T13:13:53.848416Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.41.1",
"dockerImage": "googleapis/artman@sha256:545c758c76c3f779037aa259023ec3d1ef2d57d2c8cd00a222cb187d63ceac5e"
"version": "0.42.1",
"dockerImage": "googleapis/artman@sha256:c773192618c608a7a0415dd95282f841f8e6bcdef7dd760a988c93b77a64bd57"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "c89394342a9ef70acaf73a6959e04b943fbc817b",
"internalRef": "280761373"
"sha": "d8dd7fe8d5304f7bd1c52207703d7f27d5328c5a",
"internalRef": "281088257"
}
},
{
Expand Down

0 comments on commit a6fc8bd

Please sign in to comment.