diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/.coveragerc b/owl-bot-staging/google-cloud-modelarmor/v1/.coveragerc deleted file mode 100644 index 63fc14a43357..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -branch = True - -[report] -show_missing = True -omit = - google/cloud/modelarmor/__init__.py - google/cloud/modelarmor/gapic_version.py -exclude_lines = - # Re-enable the standard pragma - pragma: NO COVER - # Ignore debug-only repr - def __repr__ diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/.flake8 b/owl-bot-staging/google-cloud-modelarmor/v1/.flake8 deleted file mode 100644 index 29227d4cf419..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/.flake8 +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 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 -# -# https://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. - -# Generated by synthtool. DO NOT EDIT! -[flake8] -ignore = E203, E266, E501, W503 -exclude = - # Exclude generated code. - **/proto/** - **/gapic/** - **/services/** - **/types/** - *_pb2.py - - # Standard linting exemptions. - **/.nox/** - __pycache__, - .git, - *.pyc, - conf.py diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/MANIFEST.in b/owl-bot-staging/google-cloud-modelarmor/v1/MANIFEST.in deleted file mode 100644 index 4921708f5039..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -recursive-include google/cloud/modelarmor *.py -recursive-include google/cloud/modelarmor_v1 *.py diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/README.rst b/owl-bot-staging/google-cloud-modelarmor/v1/README.rst deleted file mode 100644 index f994011af43a..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/README.rst +++ /dev/null @@ -1,143 +0,0 @@ -Python Client for Google Cloud Modelarmor API -================================================= - -Quick Start ------------ - -In order to use this library, you first need to go through the following steps: - -1. `Select or create a Cloud Platform project.`_ -2. `Enable billing for your project.`_ -3. Enable the Google Cloud Modelarmor API. -4. `Setup Authentication.`_ - -.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project -.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project -.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html - -Installation -~~~~~~~~~~~~ - -Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to -create isolated Python environments. The basic problem it addresses is one of -dependencies and versions, and indirectly permissions. - -With `virtualenv`_, it's possible to install this library without needing system -install permissions, and without clashing with the installed system -dependencies. - -.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ - - -Mac/Linux -^^^^^^^^^ - -.. code-block:: console - - python3 -m venv - source /bin/activate - /bin/pip install /path/to/library - - -Windows -^^^^^^^ - -.. code-block:: console - - python3 -m venv - \Scripts\activate - \Scripts\pip.exe install \path\to\library - - -Logging -------- - -This library uses the standard Python :code:`logging` functionality to log some RPC events that could be of interest for debugging and monitoring purposes. -Note the following: - -#. Logs may contain sensitive information. Take care to **restrict access to the logs** if they are saved, whether it be on local storage or on Google Cloud Logging. -#. Google may refine the occurrence, level, and content of various log messages in this library without flagging such changes as breaking. **Do not depend on immutability of the logging events**. -#. By default, the logging events from this library are not handled. You must **explicitly configure log handling** using one of the mechanisms below. - - -Simple, environment-based configuration -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -To enable logging for this library without any changes in your code, set the :code:`GOOGLE_SDK_PYTHON_LOGGING_SCOPE` environment variable to a valid Google -logging scope. This configures handling of logging events (at level :code:`logging.DEBUG` or higher) from this library in a default manner, emitting the logged -messages in a structured format. It does not currently allow customizing the logging levels captured nor the handlers, formatters, etc. used for any logging -event. - -A logging scope is a period-separated namespace that begins with :code:`google`, identifying the Python module or package to log. - -- Valid logging scopes: :code:`google`, :code:`google.cloud.asset.v1`, :code:`google.api`, :code:`google.auth`, etc. -- Invalid logging scopes: :code:`foo`, :code:`123`, etc. - -**NOTE**: If the logging scope is invalid, the library does not set up any logging handlers. - - -Examples -^^^^^^^^ - -- Enabling the default handler for all Google-based loggers - -.. code-block:: console - - export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google - -- Enabling the default handler for a specific Google module (for a client library called :code:`library_v1`): - -.. code-block:: console - - export GOOGLE_SDK_PYTHON_LOGGING_SCOPE=google.cloud.library_v1 - - -Advanced, code-based configuration -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can also configure a valid logging scope using Python's standard `logging` mechanism. - - -Examples -^^^^^^^^ - -- Configuring a handler for all Google-based loggers - -.. code-block:: python - - import logging - - from google.cloud.translate_v3 import translate - - base_logger = logging.getLogger("google") - base_logger.addHandler(logging.StreamHandler()) - base_logger.setLevel(logging.DEBUG) - -- Configuring a handler for a specific Google module (for a client library called :code:`library_v1`): - -.. code-block:: python - - import logging - - from google.cloud.translate_v3 import translate - - base_logger = logging.getLogger("google.cloud.library_v1") - base_logger.addHandler(logging.StreamHandler()) - base_logger.setLevel(logging.DEBUG) - - -Logging details -~~~~~~~~~~~~~~~ - -#. Regardless of which of the mechanisms above you use to configure logging for this library, by default logging events are not propagated up to the root - logger from the `google`-level logger. If you need the events to be propagated to the root logger, you must explicitly set - :code:`logging.getLogger("google").propagate = True` in your code. -#. You can mix the different logging configurations above for different Google modules. For example, you may want use a code-based logging configuration for - one library, but decide you need to also set up environment-based logging configuration for another library. - - #. If you attempt to use both code-based and environment-based configuration for the same module, the environment-based configuration will be ineffectual - if the code -based configuration gets applied first. - -#. The Google-specific logging configurations (default handlers for environment-based configuration; not propagating logging events to the root logger) get - executed the first time *any* client library is instantiated in your application, and only if the affected loggers have not been previously configured. - (This is the reason for 2.i. above.) diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/docs/_static/custom.css b/owl-bot-staging/google-cloud-modelarmor/v1/docs/_static/custom.css deleted file mode 100644 index 06423be0b592..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/docs/_static/custom.css +++ /dev/null @@ -1,3 +0,0 @@ -dl.field-list > dt { - min-width: 100px -} diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/docs/conf.py b/owl-bot-staging/google-cloud-modelarmor/v1/docs/conf.py deleted file mode 100644 index fd251e0cd21a..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/docs/conf.py +++ /dev/null @@ -1,376 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 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. -# -# -# google-cloud-modelarmor documentation build configuration file -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys -import os -import shlex - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath("..")) - -__version__ = "0.1.0" - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = "4.0.1" - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.autosummary", - "sphinx.ext.intersphinx", - "sphinx.ext.coverage", - "sphinx.ext.napoleon", - "sphinx.ext.todo", - "sphinx.ext.viewcode", -] - -# autodoc/autosummary flags -autoclass_content = "both" -autodoc_default_flags = ["members"] -autosummary_generate = True - - -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] - -# Allow markdown includes (so releases.md can include CHANGLEOG.md) -# http://www.sphinx-doc.org/en/master/markdown.html -source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -source_suffix = [".rst", ".md"] - -# The encoding of source files. -# source_encoding = 'utf-8-sig' - -# The root toctree document. -root_doc = "index" - -# General information about the project. -project = u"google-cloud-modelarmor" -copyright = u"2023, Google, LLC" -author = u"Google APIs" # TODO: autogenerate this bit - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The full version, including alpha/beta/rc tags. -release = __version__ -# The short X.Y version. -version = ".".join(release.split(".")[0:2]) - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = 'en' - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -# today = '' -# Else, today_fmt is used as the format for a strftime call. -# today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ["_build"] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -# default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -# add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -# add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -# show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" - -# A list of ignored prefixes for module index sorting. -# modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -# keep_warnings = False - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = "alabaster" - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -html_theme_options = { - "description": "Google Cloud Client Libraries for Python", - "github_user": "googleapis", - "github_repo": "google-cloud-python", - "github_banner": True, - "font_family": "'Roboto', Georgia, sans", - "head_font_family": "'Roboto', Georgia, serif", - "code_font_family": "'Roboto Mono', 'Consolas', monospace", -} - -# Add any paths that contain custom themes here, relative to this directory. -# html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -# html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -# html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -# html_favicon = None - -# 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 = ["_static"] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -# html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -# html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -# html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -# html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -# html_additional_pages = {} - -# If false, no module index is generated. -# html_domain_indices = True - -# If false, no index is generated. -# html_use_index = True - -# If true, the index is split into individual pages for each letter. -# html_split_index = False - -# If true, links to the reST sources are added to the pages. -# html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -# html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' -# html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# Now only 'ja' uses this config value -# html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -# html_search_scorer = 'scorer.js' - -# Output file base name for HTML help builder. -htmlhelp_basename = "google-cloud-modelarmor-doc" - -# -- Options for warnings ------------------------------------------------------ - - -suppress_warnings = [ - # Temporarily suppress this to avoid "more than one target found for - # cross-reference" warning, which are intractable for us to avoid while in - # a mono-repo. - # See https://github.com/sphinx-doc/sphinx/blob - # /2a65ffeef5c107c19084fabdd706cdff3f52d93c/sphinx/domains/python.py#L843 - "ref.python" -] - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # 'preamble': '', - # Latex figure (float) alignment - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ( - root_doc, - "google-cloud-modelarmor.tex", - u"google-cloud-modelarmor Documentation", - author, - "manual", - ) -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# latex_use_parts = False - -# If true, show page references after internal links. -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# latex_appendices = [] - -# If false, no module index is generated. -# latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ( - root_doc, - "google-cloud-modelarmor", - u"Google Cloud Modelarmor Documentation", - [author], - 1, - ) -] - -# If true, show URL addresses after external links. -# man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ( - root_doc, - "google-cloud-modelarmor", - u"google-cloud-modelarmor Documentation", - author, - "google-cloud-modelarmor", - "GAPIC library for Google Cloud Modelarmor API", - "APIs", - ) -] - -# Documents to append as an appendix to all manuals. -# texinfo_appendices = [] - -# If false, no module index is generated. -# texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -# texinfo_no_detailmenu = False - - -# Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = { - "python": ("http://python.readthedocs.org/en/latest/", None), - "gax": ("https://gax-python.readthedocs.org/en/latest/", None), - "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), - "google-gax": ("https://gax-python.readthedocs.io/en/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), - "grpc": ("https://grpc.io/grpc/python/", None), - "requests": ("http://requests.kennethreitz.org/en/stable/", None), - "proto": ("https://proto-plus-python.readthedocs.io/en/stable", None), - "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), -} - - -# Napoleon settings -napoleon_google_docstring = True -napoleon_numpy_docstring = True -napoleon_include_private_with_doc = False -napoleon_include_special_with_doc = True -napoleon_use_admonition_for_examples = False -napoleon_use_admonition_for_notes = False -napoleon_use_admonition_for_references = False -napoleon_use_ivar = False -napoleon_use_param = True -napoleon_use_rtype = True diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/docs/index.rst b/owl-bot-staging/google-cloud-modelarmor/v1/docs/index.rst deleted file mode 100644 index 26143eb59be8..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/docs/index.rst +++ /dev/null @@ -1,7 +0,0 @@ -API Reference -------------- -.. toctree:: - :maxdepth: 2 - - modelarmor_v1/services_ - modelarmor_v1/types_ diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/docs/modelarmor_v1/model_armor.rst b/owl-bot-staging/google-cloud-modelarmor/v1/docs/modelarmor_v1/model_armor.rst deleted file mode 100644 index 20a6f66d12fa..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/docs/modelarmor_v1/model_armor.rst +++ /dev/null @@ -1,10 +0,0 @@ -ModelArmor ----------------------------- - -.. automodule:: google.cloud.modelarmor_v1.services.model_armor - :members: - :inherited-members: - -.. automodule:: google.cloud.modelarmor_v1.services.model_armor.pagers - :members: - :inherited-members: diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/docs/modelarmor_v1/services_.rst b/owl-bot-staging/google-cloud-modelarmor/v1/docs/modelarmor_v1/services_.rst deleted file mode 100644 index 17642b96fd46..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/docs/modelarmor_v1/services_.rst +++ /dev/null @@ -1,6 +0,0 @@ -Services for Google Cloud Modelarmor v1 API -=========================================== -.. toctree:: - :maxdepth: 2 - - model_armor diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/docs/modelarmor_v1/types_.rst b/owl-bot-staging/google-cloud-modelarmor/v1/docs/modelarmor_v1/types_.rst deleted file mode 100644 index 5405311617c3..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/docs/modelarmor_v1/types_.rst +++ /dev/null @@ -1,6 +0,0 @@ -Types for Google Cloud Modelarmor v1 API -======================================== - -.. automodule:: google.cloud.modelarmor_v1.types - :members: - :show-inheritance: diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor/__init__.py b/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor/__init__.py deleted file mode 100644 index 4fe2ba767db6..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor/__init__.py +++ /dev/null @@ -1,113 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 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 google.cloud.modelarmor import gapic_version as package_version - -__version__ = package_version.__version__ - - -from google.cloud.modelarmor_v1.services.model_armor.client import ModelArmorClient -from google.cloud.modelarmor_v1.services.model_armor.async_client import ModelArmorAsyncClient - -from google.cloud.modelarmor_v1.types.service import ByteDataItem -from google.cloud.modelarmor_v1.types.service import CreateTemplateRequest -from google.cloud.modelarmor_v1.types.service import CsamFilterResult -from google.cloud.modelarmor_v1.types.service import DataItem -from google.cloud.modelarmor_v1.types.service import DeleteTemplateRequest -from google.cloud.modelarmor_v1.types.service import FilterConfig -from google.cloud.modelarmor_v1.types.service import FilterResult -from google.cloud.modelarmor_v1.types.service import FloorSetting -from google.cloud.modelarmor_v1.types.service import GetFloorSettingRequest -from google.cloud.modelarmor_v1.types.service import GetTemplateRequest -from google.cloud.modelarmor_v1.types.service import ListTemplatesRequest -from google.cloud.modelarmor_v1.types.service import ListTemplatesResponse -from google.cloud.modelarmor_v1.types.service import MaliciousUriFilterResult -from google.cloud.modelarmor_v1.types.service import MaliciousUriFilterSettings -from google.cloud.modelarmor_v1.types.service import MessageItem -from google.cloud.modelarmor_v1.types.service import PiAndJailbreakFilterResult -from google.cloud.modelarmor_v1.types.service import PiAndJailbreakFilterSettings -from google.cloud.modelarmor_v1.types.service import RaiFilterResult -from google.cloud.modelarmor_v1.types.service import RaiFilterSettings -from google.cloud.modelarmor_v1.types.service import RangeInfo -from google.cloud.modelarmor_v1.types.service import SanitizationResult -from google.cloud.modelarmor_v1.types.service import SanitizeModelResponseRequest -from google.cloud.modelarmor_v1.types.service import SanitizeModelResponseResponse -from google.cloud.modelarmor_v1.types.service import SanitizeUserPromptRequest -from google.cloud.modelarmor_v1.types.service import SanitizeUserPromptResponse -from google.cloud.modelarmor_v1.types.service import SdpAdvancedConfig -from google.cloud.modelarmor_v1.types.service import SdpBasicConfig -from google.cloud.modelarmor_v1.types.service import SdpDeidentifyResult -from google.cloud.modelarmor_v1.types.service import SdpFilterResult -from google.cloud.modelarmor_v1.types.service import SdpFilterSettings -from google.cloud.modelarmor_v1.types.service import SdpFinding -from google.cloud.modelarmor_v1.types.service import SdpInspectResult -from google.cloud.modelarmor_v1.types.service import Template -from google.cloud.modelarmor_v1.types.service import UpdateFloorSettingRequest -from google.cloud.modelarmor_v1.types.service import UpdateTemplateRequest -from google.cloud.modelarmor_v1.types.service import VirusDetail -from google.cloud.modelarmor_v1.types.service import VirusScanFilterResult -from google.cloud.modelarmor_v1.types.service import DetectionConfidenceLevel -from google.cloud.modelarmor_v1.types.service import FilterExecutionState -from google.cloud.modelarmor_v1.types.service import FilterMatchState -from google.cloud.modelarmor_v1.types.service import InvocationResult -from google.cloud.modelarmor_v1.types.service import RaiFilterType -from google.cloud.modelarmor_v1.types.service import SdpFindingLikelihood - -__all__ = ('ModelArmorClient', - 'ModelArmorAsyncClient', - 'ByteDataItem', - 'CreateTemplateRequest', - 'CsamFilterResult', - 'DataItem', - 'DeleteTemplateRequest', - 'FilterConfig', - 'FilterResult', - 'FloorSetting', - 'GetFloorSettingRequest', - 'GetTemplateRequest', - 'ListTemplatesRequest', - 'ListTemplatesResponse', - 'MaliciousUriFilterResult', - 'MaliciousUriFilterSettings', - 'MessageItem', - 'PiAndJailbreakFilterResult', - 'PiAndJailbreakFilterSettings', - 'RaiFilterResult', - 'RaiFilterSettings', - 'RangeInfo', - 'SanitizationResult', - 'SanitizeModelResponseRequest', - 'SanitizeModelResponseResponse', - 'SanitizeUserPromptRequest', - 'SanitizeUserPromptResponse', - 'SdpAdvancedConfig', - 'SdpBasicConfig', - 'SdpDeidentifyResult', - 'SdpFilterResult', - 'SdpFilterSettings', - 'SdpFinding', - 'SdpInspectResult', - 'Template', - 'UpdateFloorSettingRequest', - 'UpdateTemplateRequest', - 'VirusDetail', - 'VirusScanFilterResult', - 'DetectionConfidenceLevel', - 'FilterExecutionState', - 'FilterMatchState', - 'InvocationResult', - 'RaiFilterType', - 'SdpFindingLikelihood', -) diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor/gapic_version.py b/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor/gapic_version.py deleted file mode 100644 index 558c8aab67c5..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 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. -# -__version__ = "0.0.0" # {x-release-please-version} diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor/py.typed b/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor/py.typed deleted file mode 100644 index 82eb7144ecd6..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-modelarmor package uses inline types. diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/__init__.py b/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/__init__.py deleted file mode 100644 index 422f225f9b80..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/__init__.py +++ /dev/null @@ -1,114 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 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 google.cloud.modelarmor_v1 import gapic_version as package_version - -__version__ = package_version.__version__ - - -from .services.model_armor import ModelArmorClient -from .services.model_armor import ModelArmorAsyncClient - -from .types.service import ByteDataItem -from .types.service import CreateTemplateRequest -from .types.service import CsamFilterResult -from .types.service import DataItem -from .types.service import DeleteTemplateRequest -from .types.service import FilterConfig -from .types.service import FilterResult -from .types.service import FloorSetting -from .types.service import GetFloorSettingRequest -from .types.service import GetTemplateRequest -from .types.service import ListTemplatesRequest -from .types.service import ListTemplatesResponse -from .types.service import MaliciousUriFilterResult -from .types.service import MaliciousUriFilterSettings -from .types.service import MessageItem -from .types.service import PiAndJailbreakFilterResult -from .types.service import PiAndJailbreakFilterSettings -from .types.service import RaiFilterResult -from .types.service import RaiFilterSettings -from .types.service import RangeInfo -from .types.service import SanitizationResult -from .types.service import SanitizeModelResponseRequest -from .types.service import SanitizeModelResponseResponse -from .types.service import SanitizeUserPromptRequest -from .types.service import SanitizeUserPromptResponse -from .types.service import SdpAdvancedConfig -from .types.service import SdpBasicConfig -from .types.service import SdpDeidentifyResult -from .types.service import SdpFilterResult -from .types.service import SdpFilterSettings -from .types.service import SdpFinding -from .types.service import SdpInspectResult -from .types.service import Template -from .types.service import UpdateFloorSettingRequest -from .types.service import UpdateTemplateRequest -from .types.service import VirusDetail -from .types.service import VirusScanFilterResult -from .types.service import DetectionConfidenceLevel -from .types.service import FilterExecutionState -from .types.service import FilterMatchState -from .types.service import InvocationResult -from .types.service import RaiFilterType -from .types.service import SdpFindingLikelihood - -__all__ = ( - 'ModelArmorAsyncClient', -'ByteDataItem', -'CreateTemplateRequest', -'CsamFilterResult', -'DataItem', -'DeleteTemplateRequest', -'DetectionConfidenceLevel', -'FilterConfig', -'FilterExecutionState', -'FilterMatchState', -'FilterResult', -'FloorSetting', -'GetFloorSettingRequest', -'GetTemplateRequest', -'InvocationResult', -'ListTemplatesRequest', -'ListTemplatesResponse', -'MaliciousUriFilterResult', -'MaliciousUriFilterSettings', -'MessageItem', -'ModelArmorClient', -'PiAndJailbreakFilterResult', -'PiAndJailbreakFilterSettings', -'RaiFilterResult', -'RaiFilterSettings', -'RaiFilterType', -'RangeInfo', -'SanitizationResult', -'SanitizeModelResponseRequest', -'SanitizeModelResponseResponse', -'SanitizeUserPromptRequest', -'SanitizeUserPromptResponse', -'SdpAdvancedConfig', -'SdpBasicConfig', -'SdpDeidentifyResult', -'SdpFilterResult', -'SdpFilterSettings', -'SdpFinding', -'SdpFindingLikelihood', -'SdpInspectResult', -'Template', -'UpdateFloorSettingRequest', -'UpdateTemplateRequest', -'VirusDetail', -'VirusScanFilterResult', -) diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/gapic_metadata.json b/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/gapic_metadata.json deleted file mode 100644 index 1597fcac7630..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/gapic_metadata.json +++ /dev/null @@ -1,163 +0,0 @@ - { - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "python", - "libraryPackage": "google.cloud.modelarmor_v1", - "protoPackage": "google.cloud.modelarmor.v1", - "schema": "1.0", - "services": { - "ModelArmor": { - "clients": { - "grpc": { - "libraryClient": "ModelArmorClient", - "rpcs": { - "CreateTemplate": { - "methods": [ - "create_template" - ] - }, - "DeleteTemplate": { - "methods": [ - "delete_template" - ] - }, - "GetFloorSetting": { - "methods": [ - "get_floor_setting" - ] - }, - "GetTemplate": { - "methods": [ - "get_template" - ] - }, - "ListTemplates": { - "methods": [ - "list_templates" - ] - }, - "SanitizeModelResponse": { - "methods": [ - "sanitize_model_response" - ] - }, - "SanitizeUserPrompt": { - "methods": [ - "sanitize_user_prompt" - ] - }, - "UpdateFloorSetting": { - "methods": [ - "update_floor_setting" - ] - }, - "UpdateTemplate": { - "methods": [ - "update_template" - ] - } - } - }, - "grpc-async": { - "libraryClient": "ModelArmorAsyncClient", - "rpcs": { - "CreateTemplate": { - "methods": [ - "create_template" - ] - }, - "DeleteTemplate": { - "methods": [ - "delete_template" - ] - }, - "GetFloorSetting": { - "methods": [ - "get_floor_setting" - ] - }, - "GetTemplate": { - "methods": [ - "get_template" - ] - }, - "ListTemplates": { - "methods": [ - "list_templates" - ] - }, - "SanitizeModelResponse": { - "methods": [ - "sanitize_model_response" - ] - }, - "SanitizeUserPrompt": { - "methods": [ - "sanitize_user_prompt" - ] - }, - "UpdateFloorSetting": { - "methods": [ - "update_floor_setting" - ] - }, - "UpdateTemplate": { - "methods": [ - "update_template" - ] - } - } - }, - "rest": { - "libraryClient": "ModelArmorClient", - "rpcs": { - "CreateTemplate": { - "methods": [ - "create_template" - ] - }, - "DeleteTemplate": { - "methods": [ - "delete_template" - ] - }, - "GetFloorSetting": { - "methods": [ - "get_floor_setting" - ] - }, - "GetTemplate": { - "methods": [ - "get_template" - ] - }, - "ListTemplates": { - "methods": [ - "list_templates" - ] - }, - "SanitizeModelResponse": { - "methods": [ - "sanitize_model_response" - ] - }, - "SanitizeUserPrompt": { - "methods": [ - "sanitize_user_prompt" - ] - }, - "UpdateFloorSetting": { - "methods": [ - "update_floor_setting" - ] - }, - "UpdateTemplate": { - "methods": [ - "update_template" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/gapic_version.py b/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/gapic_version.py deleted file mode 100644 index 558c8aab67c5..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/gapic_version.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 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. -# -__version__ = "0.0.0" # {x-release-please-version} diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/py.typed b/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/py.typed deleted file mode 100644 index 82eb7144ecd6..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/py.typed +++ /dev/null @@ -1,2 +0,0 @@ -# Marker file for PEP 561. -# The google-cloud-modelarmor package uses inline types. diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/services/__init__.py b/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/services/__init__.py deleted file mode 100644 index 8f6cf068242c..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/services/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 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. -# diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/services/model_armor/__init__.py b/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/services/model_armor/__init__.py deleted file mode 100644 index 994deaef79f5..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/services/model_armor/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 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 .client import ModelArmorClient -from .async_client import ModelArmorAsyncClient - -__all__ = ( - 'ModelArmorClient', - 'ModelArmorAsyncClient', -) diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/services/model_armor/async_client.py b/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/services/model_armor/async_client.py deleted file mode 100644 index a5196db210cd..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/services/model_armor/async_client.py +++ /dev/null @@ -1,1308 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 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. -# -import logging as std_logging -from collections import OrderedDict -import re -from typing import Dict, Callable, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union - -from google.cloud.modelarmor_v1 import gapic_version as package_version - -from google.api_core.client_options import ClientOptions -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry_async as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - - -try: - OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore - -from google.cloud.location import locations_pb2 # type: ignore -from google.cloud.modelarmor_v1.services.model_armor import pagers -from google.cloud.modelarmor_v1.types import service -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import ModelArmorTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import ModelArmorGrpcAsyncIOTransport -from .client import ModelArmorClient - -try: - from google.api_core import client_logging # type: ignore - CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER -except ImportError: # pragma: NO COVER - CLIENT_LOGGING_SUPPORTED = False - -_LOGGER = std_logging.getLogger(__name__) - -class ModelArmorAsyncClient: - """Service describing handlers for resources""" - - _client: ModelArmorClient - - # Copy defaults from the synchronous client for use here. - # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead. - DEFAULT_ENDPOINT = ModelArmorClient.DEFAULT_ENDPOINT - DEFAULT_MTLS_ENDPOINT = ModelArmorClient.DEFAULT_MTLS_ENDPOINT - _DEFAULT_ENDPOINT_TEMPLATE = ModelArmorClient._DEFAULT_ENDPOINT_TEMPLATE - _DEFAULT_UNIVERSE = ModelArmorClient._DEFAULT_UNIVERSE - - floor_setting_path = staticmethod(ModelArmorClient.floor_setting_path) - parse_floor_setting_path = staticmethod(ModelArmorClient.parse_floor_setting_path) - template_path = staticmethod(ModelArmorClient.template_path) - parse_template_path = staticmethod(ModelArmorClient.parse_template_path) - common_billing_account_path = staticmethod(ModelArmorClient.common_billing_account_path) - parse_common_billing_account_path = staticmethod(ModelArmorClient.parse_common_billing_account_path) - common_folder_path = staticmethod(ModelArmorClient.common_folder_path) - parse_common_folder_path = staticmethod(ModelArmorClient.parse_common_folder_path) - common_organization_path = staticmethod(ModelArmorClient.common_organization_path) - parse_common_organization_path = staticmethod(ModelArmorClient.parse_common_organization_path) - common_project_path = staticmethod(ModelArmorClient.common_project_path) - parse_common_project_path = staticmethod(ModelArmorClient.parse_common_project_path) - common_location_path = staticmethod(ModelArmorClient.common_location_path) - parse_common_location_path = staticmethod(ModelArmorClient.parse_common_location_path) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ModelArmorAsyncClient: The constructed client. - """ - return ModelArmorClient.from_service_account_info.__func__(ModelArmorAsyncClient, info, *args, **kwargs) # type: ignore - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ModelArmorAsyncClient: The constructed client. - """ - return ModelArmorClient.from_service_account_file.__func__(ModelArmorAsyncClient, filename, *args, **kwargs) # type: ignore - - from_service_account_json = from_service_account_file - - @classmethod - def get_mtls_endpoint_and_cert_source(cls, client_options: Optional[ClientOptions] = None): - """Return the API endpoint and client cert source for mutual TLS. - - The client cert source is determined in the following order: - (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the - client cert source is None. - (2) if `client_options.client_cert_source` is provided, use the provided one; if the - default client cert source exists, use the default one; otherwise the client cert - source is None. - - The API endpoint is determined in the following order: - (1) if `client_options.api_endpoint` if provided, use the provided one. - (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the - default mTLS endpoint; if the environment variable is "never", use the default API - endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise - use the default API endpoint. - - More details can be found at https://google.aip.dev/auth/4114. - - Args: - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. Only the `api_endpoint` and `client_cert_source` properties may be used - in this method. - - Returns: - Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the - client cert source to use. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If any errors happen. - """ - return ModelArmorClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore - - @property - def transport(self) -> ModelArmorTransport: - """Returns the transport used by the client instance. - - Returns: - ModelArmorTransport: The transport used by the client instance. - """ - return self._client.transport - - @property - def api_endpoint(self): - """Return the API endpoint used by the client instance. - - Returns: - str: The API endpoint used by the client instance. - """ - return self._client._api_endpoint - - @property - def universe_domain(self) -> str: - """Return the universe domain used by the client instance. - - Returns: - str: The universe domain used - by the client instance. - """ - return self._client._universe_domain - - get_transport_class = ModelArmorClient.get_transport_class - - def __init__(self, *, - credentials: Optional[ga_credentials.Credentials] = None, - transport: Optional[Union[str, ModelArmorTransport, Callable[..., ModelArmorTransport]]] = "grpc_asyncio", - client_options: Optional[ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiates the model armor async client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Optional[Union[str,ModelArmorTransport,Callable[..., ModelArmorTransport]]]): - The transport to use, or a Callable that constructs and returns a new transport to use. - If a Callable is given, it will be called with the same set of initialization - arguments as used in the ModelArmorTransport constructor. - If set to None, a transport is chosen automatically. - client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): - Custom options for the client. - - 1. The ``api_endpoint`` property can be used to override the - default endpoint provided by the client when ``transport`` is - not explicitly provided. Only if this property is not set and - ``transport`` was not explicitly provided, the endpoint is - determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment - variable, which have one of the following values: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto-switch to the - default mTLS endpoint if client certificate is present; this is - the default value). - - 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide a client certificate for mTLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - - 3. The ``universe_domain`` property can be used to override the - default "googleapis.com" universe. Note that ``api_endpoint`` - property still takes precedence; and ``universe_domain`` is - currently not supported for mTLS. - - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._client = ModelArmorClient( - credentials=credentials, - transport=transport, - client_options=client_options, - client_info=client_info, - - ) - - if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(std_logging.DEBUG): # pragma: NO COVER - _LOGGER.debug( - "Created client `google.cloud.modelarmor_v1.ModelArmorAsyncClient`.", - extra = { - "serviceName": "google.cloud.modelarmor.v1.ModelArmor", - "universeDomain": getattr(self._client._transport._credentials, "universe_domain", ""), - "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}", - "credentialsInfo": getattr(self.transport._credentials, "get_cred_info", lambda: None)(), - } if hasattr(self._client._transport, "_credentials") else { - "serviceName": "google.cloud.modelarmor.v1.ModelArmor", - "credentialsType": None, - } - ) - - async def list_templates(self, - request: Optional[Union[service.ListTemplatesRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> pagers.ListTemplatesAsyncPager: - r"""Lists Templates in a given project and location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import modelarmor_v1 - - async def sample_list_templates(): - # Create a client - client = modelarmor_v1.ModelArmorAsyncClient() - - # Initialize request argument(s) - request = modelarmor_v1.ListTemplatesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_templates(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.cloud.modelarmor_v1.types.ListTemplatesRequest, dict]]): - The request object. Message for requesting list of - Templates - parent (:class:`str`): - Required. Parent value for - ListTemplatesRequest - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.modelarmor_v1.services.model_armor.pagers.ListTemplatesAsyncPager: - Message for response to listing - Templates - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # - Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, service.ListTemplatesRequest): - request = service.ListTemplatesRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.list_templates] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListTemplatesAsyncPager( - method=rpc, - request=request, - response=response, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_template(self, - request: Optional[Union[service.GetTemplateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> service.Template: - r"""Gets details of a single Template. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import modelarmor_v1 - - async def sample_get_template(): - # Create a client - client = modelarmor_v1.ModelArmorAsyncClient() - - # Initialize request argument(s) - request = modelarmor_v1.GetTemplateRequest( - name="name_value", - ) - - # Make the request - response = await client.get_template(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.modelarmor_v1.types.GetTemplateRequest, dict]]): - The request object. Message for getting a Template - name (:class:`str`): - Required. Name of the resource - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.modelarmor_v1.types.Template: - Message describing Template resource - """ - # Create or coerce a protobuf request object. - # - Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, service.GetTemplateRequest): - request = service.GetTemplateRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.get_template] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_template(self, - request: Optional[Union[service.CreateTemplateRequest, dict]] = None, - *, - parent: Optional[str] = None, - template: Optional[service.Template] = None, - template_id: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> service.Template: - r"""Creates a new Template in a given project and - location. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import modelarmor_v1 - - async def sample_create_template(): - # Create a client - client = modelarmor_v1.ModelArmorAsyncClient() - - # Initialize request argument(s) - request = modelarmor_v1.CreateTemplateRequest( - parent="parent_value", - template_id="template_id_value", - ) - - # Make the request - response = await client.create_template(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.modelarmor_v1.types.CreateTemplateRequest, dict]]): - The request object. Message for creating a Template - parent (:class:`str`): - Required. Value for parent. - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - template (:class:`google.cloud.modelarmor_v1.types.Template`): - Required. The resource being created - This corresponds to the ``template`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - template_id (:class:`str`): - Required. Id of the requesting object If auto-generating - Id server-side, remove this field and template_id from - the method_signature of Create RPC - - This corresponds to the ``template_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.modelarmor_v1.types.Template: - Message describing Template resource - """ - # Create or coerce a protobuf request object. - # - Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, template, template_id]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, service.CreateTemplateRequest): - request = service.CreateTemplateRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if template is not None: - request.template = template - if template_id is not None: - request.template_id = template_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.create_template] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("parent", request.parent), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_template(self, - request: Optional[Union[service.UpdateTemplateRequest, dict]] = None, - *, - template: Optional[service.Template] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> service.Template: - r"""Updates the parameters of a single Template. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import modelarmor_v1 - - async def sample_update_template(): - # Create a client - client = modelarmor_v1.ModelArmorAsyncClient() - - # Initialize request argument(s) - request = modelarmor_v1.UpdateTemplateRequest( - ) - - # Make the request - response = await client.update_template(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.modelarmor_v1.types.UpdateTemplateRequest, dict]]): - The request object. Message for updating a Template - template (:class:`google.cloud.modelarmor_v1.types.Template`): - Required. The resource being updated - This corresponds to the ``template`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. Field mask is used to specify the fields to be - overwritten in the Template resource by the update. The - fields specified in the update_mask are relative to the - resource, not the full request. A field will be - overwritten if it is in the mask. If the user does not - provide a mask then all fields will be overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.modelarmor_v1.types.Template: - Message describing Template resource - """ - # Create or coerce a protobuf request object. - # - Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([template, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, service.UpdateTemplateRequest): - request = service.UpdateTemplateRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if template is not None: - request.template = template - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.update_template] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("template.name", request.template.name), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def delete_template(self, - request: Optional[Union[service.DeleteTemplateRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> None: - r"""Deletes a single Template. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import modelarmor_v1 - - async def sample_delete_template(): - # Create a client - client = modelarmor_v1.ModelArmorAsyncClient() - - # Initialize request argument(s) - request = modelarmor_v1.DeleteTemplateRequest( - name="name_value", - ) - - # Make the request - await client.delete_template(request=request) - - Args: - request (Optional[Union[google.cloud.modelarmor_v1.types.DeleteTemplateRequest, dict]]): - The request object. Message for deleting a Template - name (:class:`str`): - Required. Name of the resource - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - """ - # Create or coerce a protobuf request object. - # - Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, service.DeleteTemplateRequest): - request = service.DeleteTemplateRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.delete_template] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - async def get_floor_setting(self, - request: Optional[Union[service.GetFloorSettingRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> service.FloorSetting: - r"""Gets details of a single floor setting of a project - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import modelarmor_v1 - - async def sample_get_floor_setting(): - # Create a client - client = modelarmor_v1.ModelArmorAsyncClient() - - # Initialize request argument(s) - request = modelarmor_v1.GetFloorSettingRequest( - name="name_value", - ) - - # Make the request - response = await client.get_floor_setting(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.modelarmor_v1.types.GetFloorSettingRequest, dict]]): - The request object. Message for getting a Floor Setting - name (:class:`str`): - Required. The name of the floor - setting to get, example - projects/123/floorsetting. - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.modelarmor_v1.types.FloorSetting: - Message describing FloorSetting - resource - - """ - # Create or coerce a protobuf request object. - # - Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, service.GetFloorSettingRequest): - request = service.GetFloorSettingRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.get_floor_setting] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_floor_setting(self, - request: Optional[Union[service.UpdateFloorSettingRequest, dict]] = None, - *, - floor_setting: Optional[service.FloorSetting] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> service.FloorSetting: - r"""Updates the parameters of a single floor setting of a - project - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import modelarmor_v1 - - async def sample_update_floor_setting(): - # Create a client - client = modelarmor_v1.ModelArmorAsyncClient() - - # Initialize request argument(s) - request = modelarmor_v1.UpdateFloorSettingRequest( - ) - - # Make the request - response = await client.update_floor_setting(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.modelarmor_v1.types.UpdateFloorSettingRequest, dict]]): - The request object. Message for Updating a Floor Setting - floor_setting (:class:`google.cloud.modelarmor_v1.types.FloorSetting`): - Required. The floor setting being - updated. - - This corresponds to the ``floor_setting`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Optional. Field mask is used to specify the fields to be - overwritten in the FloorSetting resource by the update. - The fields specified in the update_mask are relative to - the resource, not the full request. A field will be - overwritten if it is in the mask. If the user does not - provide a mask then all fields will be overwritten. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.modelarmor_v1.types.FloorSetting: - Message describing FloorSetting - resource - - """ - # Create or coerce a protobuf request object. - # - Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([floor_setting, update_mask]) - if request is not None and has_flattened_params: - raise ValueError("If the `request` argument is set, then none of " - "the individual field arguments should be set.") - - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, service.UpdateFloorSettingRequest): - request = service.UpdateFloorSettingRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if floor_setting is not None: - request.floor_setting = floor_setting - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.update_floor_setting] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("floor_setting.name", request.floor_setting.name), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def sanitize_user_prompt(self, - request: Optional[Union[service.SanitizeUserPromptRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> service.SanitizeUserPromptResponse: - r"""Sanitizes User Prompt. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import modelarmor_v1 - - async def sample_sanitize_user_prompt(): - # Create a client - client = modelarmor_v1.ModelArmorAsyncClient() - - # Initialize request argument(s) - user_prompt_data = modelarmor_v1.DataItem() - user_prompt_data.text = "text_value" - - request = modelarmor_v1.SanitizeUserPromptRequest( - name="name_value", - user_prompt_data=user_prompt_data, - ) - - # Make the request - response = await client.sanitize_user_prompt(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.modelarmor_v1.types.SanitizeUserPromptRequest, dict]]): - The request object. Sanitize User Prompt request. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.modelarmor_v1.types.SanitizeUserPromptResponse: - Sanitized User Prompt Response. - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, service.SanitizeUserPromptRequest): - request = service.SanitizeUserPromptRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.sanitize_user_prompt] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def sanitize_model_response(self, - request: Optional[Union[service.SanitizeModelResponseRequest, dict]] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> service.SanitizeModelResponseResponse: - r"""Sanitizes Model Response. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.cloud import modelarmor_v1 - - async def sample_sanitize_model_response(): - # Create a client - client = modelarmor_v1.ModelArmorAsyncClient() - - # Initialize request argument(s) - model_response_data = modelarmor_v1.DataItem() - model_response_data.text = "text_value" - - request = modelarmor_v1.SanitizeModelResponseRequest( - name="name_value", - model_response_data=model_response_data, - ) - - # Make the request - response = await client.sanitize_model_response(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.cloud.modelarmor_v1.types.SanitizeModelResponseRequest, dict]]): - The request object. Sanitize Model Response request. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - - Returns: - google.cloud.modelarmor_v1.types.SanitizeModelResponseResponse: - Sanitized Model Response Response. - """ - # Create or coerce a protobuf request object. - # - Use the request object if provided (there's no risk of modifying the input as - # there are no flattened fields), or create one. - if not isinstance(request, service.SanitizeModelResponseRequest): - request = service.SanitizeModelResponseRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._client._transport._wrapped_methods[self._client._transport.sanitize_model_response] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata(( - ("name", request.name), - )), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_location( - self, - request: Optional[locations_pb2.GetLocationRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> locations_pb2.Location: - r"""Gets information about a location. - - Args: - request (:class:`~.location_pb2.GetLocationRequest`): - The request object. Request message for - `GetLocation` method. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - Returns: - ~.location_pb2.Location: - Location object. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = locations_pb2.GetLocationRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self.transport._wrapped_methods[self._client._transport.get_location] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def list_locations( - self, - request: Optional[locations_pb2.ListLocationsRequest] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), - ) -> locations_pb2.ListLocationsResponse: - r"""Lists information about the supported locations for this service. - - Args: - request (:class:`~.location_pb2.ListLocationsRequest`): - The request object. Request message for - `ListLocations` method. - retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, - if any, should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be - sent along with the request as metadata. Normally, each value must be of type `str`, - but for metadata keys ending with the suffix `-bin`, the corresponding values must - be of type `bytes`. - Returns: - ~.location_pb2.ListLocationsResponse: - Response message for ``ListLocations`` method. - """ - # Create or coerce a protobuf request object. - # The request isn't a proto-plus wrapped type, - # so it must be constructed via keyword expansion. - if isinstance(request, dict): - request = locations_pb2.ListLocationsRequest(**request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self.transport._wrapped_methods[self._client._transport.list_locations] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("name", request.name),)), - ) - - # Validate the universe domain. - self._client._validate_universe_domain() - - # Send the request. - response = await rpc( - request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - - async def __aenter__(self) -> "ModelArmorAsyncClient": - return self - - async def __aexit__(self, exc_type, exc, tb): - await self.transport.close() - -DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__) - - -__all__ = ( - "ModelArmorAsyncClient", -) diff --git a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/services/model_armor/client.py b/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/services/model_armor/client.py deleted file mode 100644 index 9645dde7ffa3..000000000000 --- a/owl-bot-staging/google-cloud-modelarmor/v1/google/cloud/modelarmor_v1/services/model_armor/client.py +++ /dev/null @@ -1,1675 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2024 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 collections import OrderedDict -from http import HTTPStatus -import json -import logging as std_logging -import os -import re -from typing import Dict, Callable, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast -import warnings - -from google.cloud.modelarmor_v1 import gapic_version as package_version - -from google.api_core import client_options as client_options_lib -from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import retry as retries -from google.auth import credentials as ga_credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] -except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object, None] # type: ignore - -try: - from google.api_core import client_logging # type: ignore - CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER -except ImportError: # pragma: NO COVER - CLIENT_LOGGING_SUPPORTED = False - -_LOGGER = std_logging.getLogger(__name__) - -from google.cloud.location import locations_pb2 # type: ignore -from google.cloud.modelarmor_v1.services.model_armor import pagers -from google.cloud.modelarmor_v1.types import service -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import ModelArmorTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import ModelArmorGrpcTransport -from .transports.grpc_asyncio import ModelArmorGrpcAsyncIOTransport -from .transports.rest import ModelArmorRestTransport - - -class ModelArmorClientMeta(type): - """Metaclass for the ModelArmor client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - _transport_registry = OrderedDict() # type: Dict[str, Type[ModelArmorTransport]] - _transport_registry["grpc"] = ModelArmorGrpcTransport - _transport_registry["grpc_asyncio"] = ModelArmorGrpcAsyncIOTransport - _transport_registry["rest"] = ModelArmorRestTransport - - def get_transport_class(cls, - label: Optional[str] = None, - ) -> Type[ModelArmorTransport]: - """Returns an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ModelArmorClient(metaclass=ModelArmorClientMeta): - """Service describing handlers for resources""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Converts api endpoint to mTLS endpoint. - - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead. - DEFAULT_ENDPOINT = "modelarmor.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - _DEFAULT_ENDPOINT_TEMPLATE = "modelarmor.{UNIVERSE_DOMAIN}" - _DEFAULT_UNIVERSE = "googleapis.com" - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials - info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ModelArmorClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ModelArmorClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ModelArmorTransport: - """Returns the transport used by the client instance. - - Returns: - ModelArmorTransport: The transport used by the client - instance. - """ - return self._transport - - @staticmethod - def floor_setting_path(project: str,location: str,) -> str: - """Returns a fully-qualified floor_setting string.""" - return "projects/{project}/locations/{location}/floorSetting".format(project=project, location=location, ) - - @staticmethod - def parse_floor_setting_path(path: str) -> Dict[str,str]: - """Parses a floor_setting path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/floorSetting$", path) - return m.groupdict() if m else {} - - @staticmethod - def template_path(project: str,location: str,template: str,) -> str: - """Returns a fully-qualified template string.""" - return "projects/{project}/locations/{location}/templates/{template}".format(project=project, location=location, template=template, ) - - @staticmethod - def parse_template_path(path: str) -> Dict[str,str]: - """Parses a template path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)/templates/(?P