diff --git a/.kokoro/continuous/containeranalysis.cfg b/.kokoro/continuous/containeranalysis.cfg new file mode 100644 index 000000000000..ae80ed8d8bc6 --- /dev/null +++ b/.kokoro/continuous/containeranalysis.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Tell the trampoline which build file to use. +env_vars: { + key: "PACKAGE" + value: "containeranalysis" +} diff --git a/.kokoro/continuous/grafeas.cfg b/.kokoro/continuous/grafeas.cfg new file mode 100644 index 000000000000..8f0e2f271518 --- /dev/null +++ b/.kokoro/continuous/grafeas.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Tell the trampoline which build file to use. +env_vars: { + key: "PACKAGE" + value: "grafeas" +} diff --git a/.kokoro/presubmit/containeranalysis.cfg b/.kokoro/presubmit/containeranalysis.cfg new file mode 100644 index 000000000000..ae80ed8d8bc6 --- /dev/null +++ b/.kokoro/presubmit/containeranalysis.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Tell the trampoline which build file to use. +env_vars: { + key: "PACKAGE" + value: "containeranalysis" +} diff --git a/.kokoro/presubmit/grafeas.cfg b/.kokoro/presubmit/grafeas.cfg new file mode 100644 index 000000000000..8f0e2f271518 --- /dev/null +++ b/.kokoro/presubmit/grafeas.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Tell the trampoline which build file to use. +env_vars: { + key: "PACKAGE" + value: "grafeas" +} diff --git a/.kokoro/release/containeranalysis.cfg b/.kokoro/release/containeranalysis.cfg new file mode 100644 index 000000000000..ae80ed8d8bc6 --- /dev/null +++ b/.kokoro/release/containeranalysis.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Tell the trampoline which build file to use. +env_vars: { + key: "PACKAGE" + value: "containeranalysis" +} diff --git a/.kokoro/release/grafeas.cfg b/.kokoro/release/grafeas.cfg new file mode 100644 index 000000000000..8f0e2f271518 --- /dev/null +++ b/.kokoro/release/grafeas.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Tell the trampoline which build file to use. +env_vars: { + key: "PACKAGE" + value: "grafeas" +} diff --git a/containeranalysis/.coveragerc b/containeranalysis/.coveragerc new file mode 100644 index 000000000000..6b9ab9da4a1b --- /dev/null +++ b/containeranalysis/.coveragerc @@ -0,0 +1,18 @@ +[run] +branch = True + +[report] +fail_under = 100 +show_missing = True +exclude_lines = + # Re-enable the standard pragma + pragma: NO COVER + # Ignore debug-only repr + def __repr__ + # Ignore abstract methods + raise NotImplementedError +omit = + */gapic/*.py + */proto/*.py + */core/*.py + */site-packages/*.py \ No newline at end of file diff --git a/containeranalysis/.flake8 b/containeranalysis/.flake8 new file mode 100644 index 000000000000..61766fa84d02 --- /dev/null +++ b/containeranalysis/.flake8 @@ -0,0 +1,13 @@ +[flake8] +ignore = E203, E266, E501, W503 +exclude = + # Exclude generated code. + **/proto/** + **/gapic/** + *_pb2.py + + # Standard linting exemptions. + __pycache__, + .git, + *.pyc, + conf.py diff --git a/containeranalysis/CHANGELOG.md b/containeranalysis/CHANGELOG.md new file mode 100644 index 000000000000..5ddad421e08f --- /dev/null +++ b/containeranalysis/CHANGELOG.md @@ -0,0 +1 @@ +# Changelog \ No newline at end of file diff --git a/containeranalysis/LICENSE b/containeranalysis/LICENSE new file mode 100644 index 000000000000..a8ee855de2aa --- /dev/null +++ b/containeranalysis/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/containeranalysis/MANIFEST.in b/containeranalysis/MANIFEST.in new file mode 100644 index 000000000000..9cbf175afe6b --- /dev/null +++ b/containeranalysis/MANIFEST.in @@ -0,0 +1,5 @@ +include README.rst LICENSE +recursive-include google *.json *.proto +recursive-include tests * +global-exclude *.py[co] +global-exclude __pycache__ diff --git a/containeranalysis/README.rst b/containeranalysis/README.rst new file mode 100644 index 000000000000..645ee4364aa5 --- /dev/null +++ b/containeranalysis/README.rst @@ -0,0 +1,76 @@ +Python Client for Container Analysis API (`Alpha`_) +=================================================== + +`Container Analysis API`_: An implementation of the Grafeas API, which stores, and enables querying +and retrieval of critical metadata about all of your software artifacts. + +- `Client Library Documentation`_ +- `Product Documentation`_ + +.. _Alpha: https://github.com/googleapis/google-cloud-python/blob/master/README.rst +.. _Container Analysis API: https://cloud.google.com/container-registry/docs/container-analysis +.. _Client Library Documentation: https://googleapis.github.io/google-cloud-python/latest/containeranalysis/usage.html +.. _Product Documentation: https://cloud.google.com/container-registry/docs/container-analysis + +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 Container Analysis 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 +.. _Enable the Container Analysis API.: https://cloud.google.com/container-registry/docs/container-analysis +.. _Setup Authentication.: https://googleapis.github.io/google-cloud-python/latest/core/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 + + pip install virtualenv + virtualenv + source /bin/activate + /bin/pip install google-cloud-containeranalysis + + +Windows +^^^^^^^ + +.. code-block:: console + + pip install virtualenv + virtualenv + \Scripts\activate + \Scripts\pip.exe install google-cloud-containeranalysis + +Next Steps +~~~~~~~~~~ + +- Read the `Client Library Documentation`_ for Container Analysis API + API to see other available methods on the client. +- Read the `Container Analysis API Product documentation`_ to learn + more about the product and see How-to Guides. +- View this `repository’s main README`_ to see the full list of Cloud + APIs that we cover. + +.. _Container Analysis API Product documentation: https://cloud.google.com/container-registry/docs/container-analysis +.. _repository’s main README: https://github.com/googleapis/google-cloud-python/blob/master/README.rst \ No newline at end of file diff --git a/containeranalysis/docs/README.rst b/containeranalysis/docs/README.rst new file mode 100644 index 000000000000..645ee4364aa5 --- /dev/null +++ b/containeranalysis/docs/README.rst @@ -0,0 +1,76 @@ +Python Client for Container Analysis API (`Alpha`_) +=================================================== + +`Container Analysis API`_: An implementation of the Grafeas API, which stores, and enables querying +and retrieval of critical metadata about all of your software artifacts. + +- `Client Library Documentation`_ +- `Product Documentation`_ + +.. _Alpha: https://github.com/googleapis/google-cloud-python/blob/master/README.rst +.. _Container Analysis API: https://cloud.google.com/container-registry/docs/container-analysis +.. _Client Library Documentation: https://googleapis.github.io/google-cloud-python/latest/containeranalysis/usage.html +.. _Product Documentation: https://cloud.google.com/container-registry/docs/container-analysis + +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 Container Analysis 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 +.. _Enable the Container Analysis API.: https://cloud.google.com/container-registry/docs/container-analysis +.. _Setup Authentication.: https://googleapis.github.io/google-cloud-python/latest/core/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 + + pip install virtualenv + virtualenv + source /bin/activate + /bin/pip install google-cloud-containeranalysis + + +Windows +^^^^^^^ + +.. code-block:: console + + pip install virtualenv + virtualenv + \Scripts\activate + \Scripts\pip.exe install google-cloud-containeranalysis + +Next Steps +~~~~~~~~~~ + +- Read the `Client Library Documentation`_ for Container Analysis API + API to see other available methods on the client. +- Read the `Container Analysis API Product documentation`_ to learn + more about the product and see How-to Guides. +- View this `repository’s main README`_ to see the full list of Cloud + APIs that we cover. + +.. _Container Analysis API Product documentation: https://cloud.google.com/container-registry/docs/container-analysis +.. _repository’s main README: https://github.com/googleapis/google-cloud-python/blob/master/README.rst \ No newline at end of file diff --git a/containeranalysis/docs/changelog.md b/containeranalysis/docs/changelog.md new file mode 120000 index 000000000000..04c99a55caae --- /dev/null +++ b/containeranalysis/docs/changelog.md @@ -0,0 +1 @@ +../CHANGELOG.md \ No newline at end of file diff --git a/containeranalysis/docs/conf.py b/containeranalysis/docs/conf.py new file mode 100644 index 000000000000..d613cc2182c1 --- /dev/null +++ b/containeranalysis/docs/conf.py @@ -0,0 +1,366 @@ +# -*- coding: utf-8 -*- +# +# google-cloud-containeranalysis 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 = "1.6.3" + +# 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'] +source_suffix = [".rst", ".md"] + +# The encoding of source files. +# source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = "index" + +# General information about the project. +project = u"google-cloud-containeranalysis" +copyright = u"2017, Google" +author = u"Google APIs" + +# 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 = None + +# 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 = [] + +# 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-containeranalysis-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 = [ + ( + master_doc, + "google-cloud-containeranalysis.tex", + u"google-cloud-containeranalysis 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 = [ + ( + master_doc, + "google-cloud-containeranalysis", + u"google-cloud-containeranalysis 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 = [ + ( + master_doc, + "google-cloud-containeranalysis", + u"google-cloud-containeranalysis Documentation", + author, + "google-cloud-containeranalysis", + "GAPIC library for the {metadata.shortName} v1 service", + "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.github.io/google-cloud-python/latest", + None, + ), + "grpc": ("https://grpc.io/grpc/python/", None), + "requests": ("http://docs.python-requests.org/en/master/", None), + "fastavro": ("https://fastavro.readthedocs.io/en/stable/", None), + "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", 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/containeranalysis/docs/gapic/v1/api.rst b/containeranalysis/docs/gapic/v1/api.rst new file mode 100644 index 000000000000..60a1b16a6927 --- /dev/null +++ b/containeranalysis/docs/gapic/v1/api.rst @@ -0,0 +1,6 @@ +Client for Container Analysis API +================================= + +.. automodule:: google.cloud.devtools.containeranalysis_v1 + :members: + :inherited-members: \ No newline at end of file diff --git a/containeranalysis/docs/gapic/v1/types.rst b/containeranalysis/docs/gapic/v1/types.rst new file mode 100644 index 000000000000..3940e6aeee95 --- /dev/null +++ b/containeranalysis/docs/gapic/v1/types.rst @@ -0,0 +1,5 @@ +Types for Container Analysis API Client +======================================= + +.. automodule:: google.cloud.devtools.containeranalysis_v1.types + :members: \ No newline at end of file diff --git a/containeranalysis/docs/index.rst b/containeranalysis/docs/index.rst new file mode 100644 index 000000000000..51824979bb1b --- /dev/null +++ b/containeranalysis/docs/index.rst @@ -0,0 +1,20 @@ +.. include:: README.rst + +Api Reference +------------- +.. toctree:: + :maxdepth: 2 + + gapic/v1/api + gapic/v1/types + + +Changelog +---------- + +For all previous ``google-cloud-containeranalysis`` releases: + +.. toctree:: + :maxdepth: 2 + + changelog \ No newline at end of file diff --git a/containeranalysis/google/__init__.py b/containeranalysis/google/__init__.py new file mode 100644 index 000000000000..8fcc60e2b9c6 --- /dev/null +++ b/containeranalysis/google/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + +try: + import pkg_resources + + pkg_resources.declare_namespace(__name__) +except ImportError: + import pkgutil + + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/containeranalysis/google/cloud/__init__.py b/containeranalysis/google/cloud/__init__.py new file mode 100644 index 000000000000..8fcc60e2b9c6 --- /dev/null +++ b/containeranalysis/google/cloud/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + +try: + import pkg_resources + + pkg_resources.declare_namespace(__name__) +except ImportError: + import pkgutil + + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/containeranalysis/google/cloud/containeranalysis_v1/proto/containeranalysis.proto b/containeranalysis/google/cloud/containeranalysis_v1/proto/containeranalysis.proto new file mode 100644 index 000000000000..5c855acbd5ee --- /dev/null +++ b/containeranalysis/google/cloud/containeranalysis_v1/proto/containeranalysis.proto @@ -0,0 +1,100 @@ +// Copyright 2019 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. +// + +syntax = "proto3"; + +package google.devtools.containeranalysis.v1; + +import "google/api/annotations.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.DevTools.ContainerAnalysis.V1"; +option go_package = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1;containeranalysis"; +option java_multiple_files = true; +option java_package = "com.google.containeranalysis.v1"; +option objc_class_prefix = "GCA"; + +// Retrieves analysis results of Cloud components such as Docker container +// images. The Container Analysis API is an implementation of the +// [Grafeas](grafeas.io) API. +// +// Analysis results are stored as a series of occurrences. An `Occurrence` +// contains information about a specific analysis instance on a resource. An +// occurrence refers to a `Note`. A note contains details describing the +// analysis and is generally stored in a separate project, called a `Provider`. +// Multiple occurrences can refer to the same note. +// +// For example, an SSL vulnerability could affect multiple images. In this case, +// there would be one note for the vulnerability and an occurrence for each +// image with the vulnerability referring to that note. +service ContainerAnalysis { + // Sets the access control policy on the specified note or occurrence. + // Requires `containeranalysis.notes.setIamPolicy` or + // `containeranalysis.occurrences.setIamPolicy` permission if the resource is + // a note or an occurrence, respectively. + // + // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + // occurrences. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/notes/*}:setIamPolicy" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/occurrences/*}:setIamPolicy" + body: "*" + } + }; + } + + // Gets the access control policy for a note or an occurrence resource. + // Requires `containeranalysis.notes.setIamPolicy` or + // `containeranalysis.occurrences.setIamPolicy` permission if the resource is + // a note or occurrence, respectively. + // + // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + // occurrences. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/notes/*}:getIamPolicy" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/occurrences/*}:getIamPolicy" + body: "*" + } + }; + } + + // Returns the permissions that a caller has on the specified note or + // occurrence. Requires list permission on the project (for example, + // `containeranalysis.notes.list`). + // + // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + // occurrences. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/notes/*}:testIamPermissions" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/occurrences/*}:testIamPermissions" + body: "*" + } + }; + } +} diff --git a/containeranalysis/google/cloud/devtools/__init__.py b/containeranalysis/google/cloud/devtools/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/containeranalysis/google/cloud/devtools/containeranalysis.py b/containeranalysis/google/cloud/devtools/containeranalysis.py new file mode 100644 index 000000000000..364ca4063a47 --- /dev/null +++ b/containeranalysis/google/cloud/devtools/containeranalysis.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + + +from __future__ import absolute_import + +from google.cloud.devtools.containeranalysis_v1 import ContainerAnalysisClient +from google.cloud.devtools.containeranalysis_v1 import types + + +__all__ = ("types", "ContainerAnalysisClient") diff --git a/containeranalysis/google/cloud/devtools/containeranalysis_v1/__init__.py b/containeranalysis/google/cloud/devtools/containeranalysis_v1/__init__.py new file mode 100644 index 000000000000..9695f705c912 --- /dev/null +++ b/containeranalysis/google/cloud/devtools/containeranalysis_v1/__init__.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + + +from __future__ import absolute_import + +from google.cloud.devtools.containeranalysis_v1 import types +from google.cloud.devtools.containeranalysis_v1.gapic import container_analysis_client + + +class ContainerAnalysisClient(container_analysis_client.ContainerAnalysisClient): + __doc__ = container_analysis_client.ContainerAnalysisClient.__doc__ + + +__all__ = ("types", "ContainerAnalysisClient") diff --git a/containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/__init__.py b/containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client.py b/containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client.py new file mode 100644 index 000000000000..8a5ef9a7d15e --- /dev/null +++ b/containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client.py @@ -0,0 +1,447 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + +"""Accesses the google.devtools.containeranalysis.v1 ContainerAnalysis API.""" + +import pkg_resources +import warnings + +from google.oauth2 import service_account +import google.api_core.gapic_v1.client_info +import google.api_core.gapic_v1.config +import google.api_core.gapic_v1.method +import google.api_core.gapic_v1.routing_header +import google.api_core.grpc_helpers +import google.api_core.path_template +import grpc + +from google.cloud.devtools.containeranalysis_v1.gapic import ( + container_analysis_client_config, +) +from google.cloud.devtools.containeranalysis_v1.gapic.transports import ( + container_analysis_grpc_transport, +) +from google.cloud.devtools.containeranalysis_v1.proto import containeranalysis_pb2_grpc +from google.iam.v1 import iam_policy_pb2 +from google.iam.v1 import policy_pb2 + + +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution( + "google-cloud-containeranalysis" +).version + + +class ContainerAnalysisClient(object): + """ + Retrieves analysis results of Cloud components such as Docker container + images. The Container Analysis API is an implementation of the + `Grafeas `__ API. + + Analysis results are stored as a series of occurrences. An + ``Occurrence`` contains information about a specific analysis instance + on a resource. An occurrence refers to a ``Note``. A note contains + details describing the analysis and is generally stored in a separate + project, called a ``Provider``. Multiple occurrences can refer to the + same note. + + For example, an SSL vulnerability could affect multiple images. In this + case, there would be one note for the vulnerability and an occurrence + for each image with the vulnerability referring to that note. + """ + + SERVICE_ADDRESS = "containeranalysis.googleapis.com:443" + """The default address of the service.""" + + # The name of the interface for this client. This is the key used to + # find the method configuration in the client_config dictionary. + _INTERFACE_NAME = "google.devtools.containeranalysis.v1.ContainerAnalysis" + + @classmethod + def from_service_account_file(cls, filename, *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: + ContainerAnalysisClient: 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 + + @classmethod + def note_path(cls, project, note): + """Return a fully-qualified note string.""" + return google.api_core.path_template.expand( + "projects/{project}/notes/{note}", project=project, note=note + ) + + def __init__( + self, + transport=None, + channel=None, + credentials=None, + client_config=None, + client_info=None, + ): + """Constructor. + + Args: + transport (Union[~.ContainerAnalysisGrpcTransport, + Callable[[~.Credentials, type], ~.ContainerAnalysisGrpcTransport]): A transport + instance, responsible for actually making the API calls. + The default transport uses the gRPC protocol. + This argument may also be a callable which returns a + transport instance. Callables will be sent the credentials + as the first argument and the default transport class as + the second argument. + channel (grpc.Channel): DEPRECATED. A ``Channel`` instance + through which to make calls. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception. + credentials (google.auth.credentials.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is mutually exclusive with providing a + transport instance to ``transport``; doing so will raise + an exception. + client_config (dict): DEPRECATED. A dictionary of call options for + each method. If not specified, the default configuration is used. + 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. + """ + # Raise deprecation warnings for things we want to go away. + if client_config is not None: + warnings.warn( + "The `client_config` argument is deprecated.", + PendingDeprecationWarning, + stacklevel=2, + ) + else: + client_config = container_analysis_client_config.config + + if channel: + warnings.warn( + "The `channel` argument is deprecated; use " "`transport` instead.", + PendingDeprecationWarning, + stacklevel=2, + ) + + # Instantiate the transport. + # The transport is responsible for handling serialization and + # deserialization and actually sending data to the service. + if transport: + if callable(transport): + self.transport = transport( + credentials=credentials, + default_class=container_analysis_grpc_transport.ContainerAnalysisGrpcTransport, + ) + else: + if credentials: + raise ValueError( + "Received both a transport instance and " + "credentials; these are mutually exclusive." + ) + self.transport = transport + else: + self.transport = container_analysis_grpc_transport.ContainerAnalysisGrpcTransport( + address=self.SERVICE_ADDRESS, channel=channel, credentials=credentials + ) + + if client_info is None: + client_info = google.api_core.gapic_v1.client_info.ClientInfo( + gapic_version=_GAPIC_LIBRARY_VERSION + ) + else: + client_info.gapic_version = _GAPIC_LIBRARY_VERSION + self._client_info = client_info + + # Parse out the default settings for retry and timeout for each RPC + # from the client configuration. + # (Ordinarily, these are the defaults specified in the `*_config.py` + # file next to this one.) + self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( + client_config["interfaces"][self._INTERFACE_NAME] + ) + + # Save a dictionary of cached API call functions. + # These are the actual callables which invoke the proper + # transport methods, wrapped with `wrap_method` to add retry, + # timeout, and the like. + self._inner_api_calls = {} + + # Service calls + def set_iam_policy( + self, + resource, + policy, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Sets the access control policy on the specified note or occurrence. + Requires ``containeranalysis.notes.setIamPolicy`` or + ``containeranalysis.occurrences.setIamPolicy`` permission if the + resource is a note or an occurrence, respectively. + + The resource takes the format ``projects/[PROJECT_ID]/notes/[NOTE_ID]`` + for notes and ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`` for + occurrences. + + Example: + >>> from google.cloud.devtools import containeranalysis_v1 + >>> + >>> client = containeranalysis_v1.ContainerAnalysisClient() + >>> + >>> resource = client.note_path('[PROJECT]', '[NOTE]') + >>> + >>> # TODO: Initialize `policy`: + >>> policy = {} + >>> + >>> response = client.set_iam_policy(resource, policy) + + Args: + resource (str): REQUIRED: The resource for which the policy is being specified. + See the operation documentation for the appropriate value for this field. + policy (Union[dict, ~google.cloud.devtools.containeranalysis_v1.types.Policy]): REQUIRED: The complete policy to be applied to the ``resource``. The + size of the policy is limited to a few 10s of KB. An empty policy is a + valid policy but certain Cloud Platform services (such as Projects) + might reject them. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.devtools.containeranalysis_v1.types.Policy` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.devtools.containeranalysis_v1.types.Policy` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "set_iam_policy" not in self._inner_api_calls: + self._inner_api_calls[ + "set_iam_policy" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.set_iam_policy, + default_retry=self._method_configs["SetIamPolicy"].retry, + default_timeout=self._method_configs["SetIamPolicy"].timeout, + client_info=self._client_info, + ) + + request = iam_policy_pb2.SetIamPolicyRequest(resource=resource, policy=policy) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("resource", resource)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["set_iam_policy"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def get_iam_policy( + self, + resource, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Gets the access control policy for a note or an occurrence resource. + Requires ``containeranalysis.notes.setIamPolicy`` or + ``containeranalysis.occurrences.setIamPolicy`` permission if the + resource is a note or occurrence, respectively. + + The resource takes the format ``projects/[PROJECT_ID]/notes/[NOTE_ID]`` + for notes and ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`` for + occurrences. + + Example: + >>> from google.cloud.devtools import containeranalysis_v1 + >>> + >>> client = containeranalysis_v1.ContainerAnalysisClient() + >>> + >>> resource = client.note_path('[PROJECT]', '[NOTE]') + >>> + >>> response = client.get_iam_policy(resource) + + Args: + resource (str): REQUIRED: The resource for which the policy is being requested. + See the operation documentation for the appropriate value for this field. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.devtools.containeranalysis_v1.types.Policy` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "get_iam_policy" not in self._inner_api_calls: + self._inner_api_calls[ + "get_iam_policy" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_iam_policy, + default_retry=self._method_configs["GetIamPolicy"].retry, + default_timeout=self._method_configs["GetIamPolicy"].timeout, + client_info=self._client_info, + ) + + request = iam_policy_pb2.GetIamPolicyRequest(resource=resource) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("resource", resource)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["get_iam_policy"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def test_iam_permissions( + self, + resource, + permissions, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Returns the permissions that a caller has on the specified note or + occurrence. Requires list permission on the project (for example, + ``containeranalysis.notes.list``). + + The resource takes the format ``projects/[PROJECT_ID]/notes/[NOTE_ID]`` + for notes and ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`` for + occurrences. + + Example: + >>> from google.cloud.devtools import containeranalysis_v1 + >>> + >>> client = containeranalysis_v1.ContainerAnalysisClient() + >>> + >>> resource = client.note_path('[PROJECT]', '[NOTE]') + >>> + >>> # TODO: Initialize `permissions`: + >>> permissions = [] + >>> + >>> response = client.test_iam_permissions(resource, permissions) + + Args: + resource (str): REQUIRED: The resource for which the policy detail is being requested. + See the operation documentation for the appropriate value for this field. + permissions (list[str]): The set of permissions to check for the ``resource``. Permissions with + wildcards (such as '*' or 'storage.*') are not allowed. For more + information see `IAM + Overview `__. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.devtools.containeranalysis_v1.types.TestIamPermissionsResponse` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "test_iam_permissions" not in self._inner_api_calls: + self._inner_api_calls[ + "test_iam_permissions" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.test_iam_permissions, + default_retry=self._method_configs["TestIamPermissions"].retry, + default_timeout=self._method_configs["TestIamPermissions"].timeout, + client_info=self._client_info, + ) + + request = iam_policy_pb2.TestIamPermissionsRequest( + resource=resource, permissions=permissions + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("resource", resource)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["test_iam_permissions"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) diff --git a/containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client_config.py b/containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client_config.py new file mode 100644 index 000000000000..f7e39b653e04 --- /dev/null +++ b/containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client_config.py @@ -0,0 +1,38 @@ +config = { + "interfaces": { + "google.devtools.containeranalysis.v1.ContainerAnalysis": { + "retry_codes": { + "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], + "non_idempotent": [], + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 20000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 20000, + "total_timeout_millis": 600000, + } + }, + "methods": { + "SetIamPolicy": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "GetIamPolicy": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "TestIamPermissions": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + }, + } + } +} diff --git a/containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/transports/__init__.py b/containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/transports/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/transports/container_analysis_grpc_transport.py b/containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/transports/container_analysis_grpc_transport.py new file mode 100644 index 000000000000..7627fb4ecc5c --- /dev/null +++ b/containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/transports/container_analysis_grpc_transport.py @@ -0,0 +1,163 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + + +import google.api_core.grpc_helpers + +from google.cloud.devtools.containeranalysis_v1.proto import containeranalysis_pb2_grpc + + +class ContainerAnalysisGrpcTransport(object): + """gRPC transport class providing stubs for + google.devtools.containeranalysis.v1 ContainerAnalysis API. + + The transport provides access to the raw gRPC stubs, + which can be used to take advantage of advanced + features of gRPC. + """ + + # The scopes needed to make gRPC calls to all of the methods defined + # in this service. + _OAUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",) + + def __init__( + self, + channel=None, + credentials=None, + address="containeranalysis.googleapis.com:443", + ): + """Instantiate the transport class. + + Args: + channel (grpc.Channel): A ``Channel`` instance through + which to make calls. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception. + credentials (google.auth.credentials.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If none + are specified, the client will attempt to ascertain the + credentials from the environment. + address (str): The address where the service is hosted. + """ + # If both `channel` and `credentials` are specified, raise an + # exception (channels come with credentials baked in already). + if channel is not None and credentials is not None: + raise ValueError( + "The `channel` and `credentials` arguments are mutually " "exclusive." + ) + + # Create the channel. + if channel is None: + channel = self.create_channel(address=address, credentials=credentials) + + self._channel = channel + + # gRPC uses objects called "stubs" that are bound to the + # channel and provide a basic method for each RPC. + self._stubs = { + "container_analysis_stub": containeranalysis_pb2_grpc.ContainerAnalysisStub( + channel + ) + } + + @classmethod + def create_channel( + cls, address="containeranalysis.googleapis.com:443", credentials=None + ): + """Create and return a gRPC channel object. + + Args: + address (str): The host for the channel to use. + credentials (~.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + + Returns: + grpc.Channel: A gRPC channel object. + """ + return google.api_core.grpc_helpers.create_channel( + address, credentials=credentials, scopes=cls._OAUTH_SCOPES + ) + + @property + def channel(self): + """The gRPC channel used by the transport. + + Returns: + grpc.Channel: A gRPC channel object. + """ + return self._channel + + @property + def set_iam_policy(self): + """Return the gRPC stub for :meth:`ContainerAnalysisClient.set_iam_policy`. + + Sets the access control policy on the specified note or occurrence. + Requires ``containeranalysis.notes.setIamPolicy`` or + ``containeranalysis.occurrences.setIamPolicy`` permission if the + resource is a note or an occurrence, respectively. + + The resource takes the format ``projects/[PROJECT_ID]/notes/[NOTE_ID]`` + for notes and ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`` for + occurrences. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["container_analysis_stub"].SetIamPolicy + + @property + def get_iam_policy(self): + """Return the gRPC stub for :meth:`ContainerAnalysisClient.get_iam_policy`. + + Gets the access control policy for a note or an occurrence resource. + Requires ``containeranalysis.notes.setIamPolicy`` or + ``containeranalysis.occurrences.setIamPolicy`` permission if the + resource is a note or occurrence, respectively. + + The resource takes the format ``projects/[PROJECT_ID]/notes/[NOTE_ID]`` + for notes and ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`` for + occurrences. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["container_analysis_stub"].GetIamPolicy + + @property + def test_iam_permissions(self): + """Return the gRPC stub for :meth:`ContainerAnalysisClient.test_iam_permissions`. + + Returns the permissions that a caller has on the specified note or + occurrence. Requires list permission on the project (for example, + ``containeranalysis.notes.list``). + + The resource takes the format ``projects/[PROJECT_ID]/notes/[NOTE_ID]`` + for notes and ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`` for + occurrences. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["container_analysis_stub"].TestIamPermissions diff --git a/containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/__init__.py b/containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis.proto b/containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis.proto new file mode 100644 index 000000000000..5c855acbd5ee --- /dev/null +++ b/containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis.proto @@ -0,0 +1,100 @@ +// Copyright 2019 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. +// + +syntax = "proto3"; + +package google.devtools.containeranalysis.v1; + +import "google/api/annotations.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.DevTools.ContainerAnalysis.V1"; +option go_package = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1;containeranalysis"; +option java_multiple_files = true; +option java_package = "com.google.containeranalysis.v1"; +option objc_class_prefix = "GCA"; + +// Retrieves analysis results of Cloud components such as Docker container +// images. The Container Analysis API is an implementation of the +// [Grafeas](grafeas.io) API. +// +// Analysis results are stored as a series of occurrences. An `Occurrence` +// contains information about a specific analysis instance on a resource. An +// occurrence refers to a `Note`. A note contains details describing the +// analysis and is generally stored in a separate project, called a `Provider`. +// Multiple occurrences can refer to the same note. +// +// For example, an SSL vulnerability could affect multiple images. In this case, +// there would be one note for the vulnerability and an occurrence for each +// image with the vulnerability referring to that note. +service ContainerAnalysis { + // Sets the access control policy on the specified note or occurrence. + // Requires `containeranalysis.notes.setIamPolicy` or + // `containeranalysis.occurrences.setIamPolicy` permission if the resource is + // a note or an occurrence, respectively. + // + // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + // occurrences. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/notes/*}:setIamPolicy" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/occurrences/*}:setIamPolicy" + body: "*" + } + }; + } + + // Gets the access control policy for a note or an occurrence resource. + // Requires `containeranalysis.notes.setIamPolicy` or + // `containeranalysis.occurrences.setIamPolicy` permission if the resource is + // a note or occurrence, respectively. + // + // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + // occurrences. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/notes/*}:getIamPolicy" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/occurrences/*}:getIamPolicy" + body: "*" + } + }; + } + + // Returns the permissions that a caller has on the specified note or + // occurrence. Requires list permission on the project (for example, + // `containeranalysis.notes.list`). + // + // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + // occurrences. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/notes/*}:testIamPermissions" + body: "*" + additional_bindings { + post: "/v1/{resource=projects/*/occurrences/*}:testIamPermissions" + body: "*" + } + }; + } +} diff --git a/containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2.py b/containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2.py new file mode 100644 index 000000000000..17d3b1845976 --- /dev/null +++ b/containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2.py @@ -0,0 +1,95 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/devtools/containeranalysis_v1/proto/containeranalysis.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_iam__policy__pb2 +from google.iam.v1 import policy_pb2 as google_dot_iam_dot_v1_dot_policy__pb2 +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="google/cloud/devtools/containeranalysis_v1/proto/containeranalysis.proto", + package="google.devtools.containeranalysis.v1", + syntax="proto3", + serialized_options=_b( + "\n\037com.google.containeranalysis.v1P\001ZUgoogle.golang.org/genproto/googleapis/devtools/containeranalysis/v1;containeranalysis\242\002\003GCA\252\002*Google.Cloud.DevTools.ContainerAnalysis.V1" + ), + serialized_pb=_b( + '\nHgoogle/cloud/devtools/containeranalysis_v1/proto/containeranalysis.proto\x12$google.devtools.containeranalysis.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x1egoogle/iam/v1/iam_policy.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a\x1fgoogle/protobuf/timestamp.proto2\x86\x05\n\x11\x43ontainerAnalysis\x12\xbf\x01\n\x0cSetIamPolicy\x12".google.iam.v1.SetIamPolicyRequest\x1a\x15.google.iam.v1.Policy"t\x82\xd3\xe4\x93\x02n"./v1/{resource=projects/*/notes/*}:setIamPolicy:\x01*Z9"4/v1/{resource=projects/*/occurrences/*}:setIamPolicy:\x01*\x12\xbf\x01\n\x0cGetIamPolicy\x12".google.iam.v1.GetIamPolicyRequest\x1a\x15.google.iam.v1.Policy"t\x82\xd3\xe4\x93\x02n"./v1/{resource=projects/*/notes/*}:getIamPolicy:\x01*Z9"4/v1/{resource=projects/*/occurrences/*}:getIamPolicy:\x01*\x12\xec\x01\n\x12TestIamPermissions\x12(.google.iam.v1.TestIamPermissionsRequest\x1a).google.iam.v1.TestIamPermissionsResponse"\x80\x01\x82\xd3\xe4\x93\x02z"4/v1/{resource=projects/*/notes/*}:testIamPermissions:\x01*Z?":/v1/{resource=projects/*/occurrences/*}:testIamPermissions:\x01*B\xad\x01\n\x1f\x63om.google.containeranalysis.v1P\x01ZUgoogle.golang.org/genproto/googleapis/devtools/containeranalysis/v1;containeranalysis\xa2\x02\x03GCA\xaa\x02*Google.Cloud.DevTools.ContainerAnalysis.V1b\x06proto3' + ), + dependencies=[ + google_dot_api_dot_annotations__pb2.DESCRIPTOR, + google_dot_iam_dot_v1_dot_iam__policy__pb2.DESCRIPTOR, + google_dot_iam_dot_v1_dot_policy__pb2.DESCRIPTOR, + google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, + ], +) + + +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + +DESCRIPTOR._options = None + +_CONTAINERANALYSIS = _descriptor.ServiceDescriptor( + name="ContainerAnalysis", + full_name="google.devtools.containeranalysis.v1.ContainerAnalysis", + file=DESCRIPTOR, + index=0, + serialized_options=None, + serialized_start=238, + serialized_end=884, + methods=[ + _descriptor.MethodDescriptor( + name="SetIamPolicy", + full_name="google.devtools.containeranalysis.v1.ContainerAnalysis.SetIamPolicy", + index=0, + containing_service=None, + input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._SETIAMPOLICYREQUEST, + output_type=google_dot_iam_dot_v1_dot_policy__pb2._POLICY, + serialized_options=_b( + '\202\323\344\223\002n"./v1/{resource=projects/*/notes/*}:setIamPolicy:\001*Z9"4/v1/{resource=projects/*/occurrences/*}:setIamPolicy:\001*' + ), + ), + _descriptor.MethodDescriptor( + name="GetIamPolicy", + full_name="google.devtools.containeranalysis.v1.ContainerAnalysis.GetIamPolicy", + index=1, + containing_service=None, + input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._GETIAMPOLICYREQUEST, + output_type=google_dot_iam_dot_v1_dot_policy__pb2._POLICY, + serialized_options=_b( + '\202\323\344\223\002n"./v1/{resource=projects/*/notes/*}:getIamPolicy:\001*Z9"4/v1/{resource=projects/*/occurrences/*}:getIamPolicy:\001*' + ), + ), + _descriptor.MethodDescriptor( + name="TestIamPermissions", + full_name="google.devtools.containeranalysis.v1.ContainerAnalysis.TestIamPermissions", + index=2, + containing_service=None, + input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._TESTIAMPERMISSIONSREQUEST, + output_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._TESTIAMPERMISSIONSRESPONSE, + serialized_options=_b( + '\202\323\344\223\002z"4/v1/{resource=projects/*/notes/*}:testIamPermissions:\001*Z?":/v1/{resource=projects/*/occurrences/*}:testIamPermissions:\001*' + ), + ), + ], +) +_sym_db.RegisterServiceDescriptor(_CONTAINERANALYSIS) + +DESCRIPTOR.services_by_name["ContainerAnalysis"] = _CONTAINERANALYSIS + +# @@protoc_insertion_point(module_scope) diff --git a/containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2_grpc.py b/containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2_grpc.py new file mode 100644 index 000000000000..69ce891f6c14 --- /dev/null +++ b/containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis_pb2_grpc.py @@ -0,0 +1,126 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc + +from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_iam__policy__pb2 +from google.iam.v1 import policy_pb2 as google_dot_iam_dot_v1_dot_policy__pb2 + + +class ContainerAnalysisStub(object): + """Retrieves analysis results of Cloud components such as Docker container + images. The Container Analysis API is an implementation of the + [Grafeas](grafeas.io) API. + + Analysis results are stored as a series of occurrences. An `Occurrence` + contains information about a specific analysis instance on a resource. An + occurrence refers to a `Note`. A note contains details describing the + analysis and is generally stored in a separate project, called a `Provider`. + Multiple occurrences can refer to the same note. + + For example, an SSL vulnerability could affect multiple images. In this case, + there would be one note for the vulnerability and an occurrence for each + image with the vulnerability referring to that note. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SetIamPolicy = channel.unary_unary( + "/google.devtools.containeranalysis.v1.ContainerAnalysis/SetIamPolicy", + request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.SerializeToString, + response_deserializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString, + ) + self.GetIamPolicy = channel.unary_unary( + "/google.devtools.containeranalysis.v1.ContainerAnalysis/GetIamPolicy", + request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.GetIamPolicyRequest.SerializeToString, + response_deserializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString, + ) + self.TestIamPermissions = channel.unary_unary( + "/google.devtools.containeranalysis.v1.ContainerAnalysis/TestIamPermissions", + request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsRequest.SerializeToString, + response_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsResponse.FromString, + ) + + +class ContainerAnalysisServicer(object): + """Retrieves analysis results of Cloud components such as Docker container + images. The Container Analysis API is an implementation of the + [Grafeas](grafeas.io) API. + + Analysis results are stored as a series of occurrences. An `Occurrence` + contains information about a specific analysis instance on a resource. An + occurrence refers to a `Note`. A note contains details describing the + analysis and is generally stored in a separate project, called a `Provider`. + Multiple occurrences can refer to the same note. + + For example, an SSL vulnerability could affect multiple images. In this case, + there would be one note for the vulnerability and an occurrence for each + image with the vulnerability referring to that note. + """ + + def SetIamPolicy(self, request, context): + """Sets the access control policy on the specified note or occurrence. + Requires `containeranalysis.notes.setIamPolicy` or + `containeranalysis.occurrences.setIamPolicy` permission if the resource is + a note or an occurrence, respectively. + + The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + occurrences. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def GetIamPolicy(self, request, context): + """Gets the access control policy for a note or an occurrence resource. + Requires `containeranalysis.notes.setIamPolicy` or + `containeranalysis.occurrences.setIamPolicy` permission if the resource is + a note or occurrence, respectively. + + The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + occurrences. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def TestIamPermissions(self, request, context): + """Returns the permissions that a caller has on the specified note or + occurrence. Requires list permission on the project (for example, + `containeranalysis.notes.list`). + + The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for + notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for + occurrences. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + +def add_ContainerAnalysisServicer_to_server(servicer, server): + rpc_method_handlers = { + "SetIamPolicy": grpc.unary_unary_rpc_method_handler( + servicer.SetIamPolicy, + request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.FromString, + response_serializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.SerializeToString, + ), + "GetIamPolicy": grpc.unary_unary_rpc_method_handler( + servicer.GetIamPolicy, + request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.GetIamPolicyRequest.FromString, + response_serializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.SerializeToString, + ), + "TestIamPermissions": grpc.unary_unary_rpc_method_handler( + servicer.TestIamPermissions, + request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsRequest.FromString, + response_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + "google.devtools.containeranalysis.v1.ContainerAnalysis", rpc_method_handlers + ) + server.add_generic_rpc_handlers((generic_handler,)) diff --git a/containeranalysis/google/cloud/devtools/containeranalysis_v1/types.py b/containeranalysis/google/cloud/devtools/containeranalysis_v1/types.py new file mode 100644 index 000000000000..1eb9e0a73f00 --- /dev/null +++ b/containeranalysis/google/cloud/devtools/containeranalysis_v1/types.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + + +from __future__ import absolute_import +import sys + +from google.api_core.protobuf_helpers import get_messages + +from google.iam.v1 import iam_policy_pb2 +from google.iam.v1 import policy_pb2 +from google.type import expr_pb2 + + +_shared_modules = [iam_policy_pb2, policy_pb2, expr_pb2] + +_local_modules = [] + +names = [] + +for module in _shared_modules: # pragma: NO COVER + for name, message in get_messages(module).items(): + setattr(sys.modules[__name__], name, message) + names.append(name) +for module in _local_modules: + for name, message in get_messages(module).items(): + message.__module__ = "google.cloud.devtools.containeranalysis_v1.types" + setattr(sys.modules[__name__], name, message) + names.append(name) + + +__all__ = tuple(sorted(names)) diff --git a/containeranalysis/noxfile.py b/containeranalysis/noxfile.py new file mode 100644 index 000000000000..cd57422e5961 --- /dev/null +++ b/containeranalysis/noxfile.py @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2018 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. + +from __future__ import absolute_import +import os +import shutil + +import nox + + +LOCAL_DEPS = (os.path.join("..", "api_core"), os.path.join("..", "core")) + +@nox.session(python="3.7") +def lint(session): + """Run linters. + + Returns a failure if the linters find linting errors or sufficiently + serious code quality issues. + """ + session.install("flake8", "black", *LOCAL_DEPS) + session.run( + "black", + "--check", + "google", + "tests", + "docs", + ) + session.run("flake8", "google", "tests") + + +@nox.session(python="3.6") +def blacken(session): + """Run black. + + Format code to uniform standard. + + This currently uses Python 3.6 due to the automated Kokoro run of synthtool. + That run uses an image that doesn't have 3.6 installed. Before updating this + check the state of the `gcp_ubuntu_config` we use for that Kokoro run. + """ + session.install("black") + session.run( + "black", + "google", + "tests", + "docs", + ) + + +@nox.session(python="3.7") +def lint_setup_py(session): + """Verify that setup.py is valid (including RST check).""" + session.install("docutils", "pygments") + session.run("python", "setup.py", "check", "--restructuredtext", "--strict") + + +def default(session): + # Install all test dependencies, then install this package in-place. + session.install("mock", "pytest", "pytest-cov") + for local_dep in LOCAL_DEPS: + session.install("-e", local_dep) + session.install("-e", ".") + + # Run py.test against the unit tests. + session.run( + "py.test", + "--quiet", + "--cov=google.cloud", + "--cov=tests.unit", + "--cov-append", + "--cov-config=.coveragerc", + "--cov-report=", + "--cov-fail-under=51", + os.path.join("tests", "unit"), + *session.posargs, + ) + + +@nox.session(python=["2.7", "3.5", "3.6", "3.7"]) +def unit(session): + """Run the unit test suite.""" + default(session) + + +@nox.session(python=["2.7", "3.7"]) +def system(session): + """Run the system test suite.""" + system_test_path = os.path.join("tests", "system.py") + system_test_folder_path = os.path.join("tests", "system") + # Sanity check: Only run tests if the environment variable is set. + if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): + session.skip("Credentials must be set via environment variable") + + system_test_exists = os.path.exists(system_test_path) + system_test_folder_exists = os.path.exists(system_test_folder_path) + # Sanity check: only run tests if found. + if not system_test_exists and not system_test_folder_exists: + session.skip("System tests were not found") + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + # Install all test dependencies, then install this package into the + # virtualenv's dist-packages. + session.install("mock", "pytest") + for local_dep in LOCAL_DEPS: + session.install("-e", local_dep) + session.install("-e", "../test_utils/") + session.install("-e", ".") + + # Run py.test against the system tests. + if system_test_exists: + session.run("py.test", "--quiet", system_test_path, *session.posargs) + if system_test_folder_exists: + session.run("py.test", "--quiet", system_test_folder_path, *session.posargs) + + +@nox.session(python="3.7") +def cover(session): + """Run the final coverage report. + + This outputs the coverage report aggregating coverage from the unit + test runs (not system test runs), and then erases coverage data. + """ + session.install("coverage", "pytest-cov") + session.run("coverage", "report", "--show-missing", "--fail-under=51") + + session.run("coverage", "erase") + +@nox.session(python="3.7") +def docs(session): + """Build the docs for this library.""" + + session.install('-e', '.') + session.install('sphinx', 'alabaster', 'recommonmark') + + shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True) + session.run( + 'sphinx-build', + '-W', # warnings as errors + '-T', # show full traceback on exception + '-N', # no colors + '-b', 'html', + '-d', os.path.join('docs', '_build', 'doctrees', ''), + os.path.join('docs', ''), + os.path.join('docs', '_build', 'html', ''), + ) diff --git a/containeranalysis/setup.cfg b/containeranalysis/setup.cfg new file mode 100644 index 000000000000..2a9acf13daa9 --- /dev/null +++ b/containeranalysis/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1 diff --git a/containeranalysis/setup.py b/containeranalysis/setup.py new file mode 100644 index 000000000000..4c1762ed599e --- /dev/null +++ b/containeranalysis/setup.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + +import io +import os + +import setuptools + + + +name = 'google-cloud-containeranalysis' +description = 'Container Analysis API API client library' +version = '0.1.0' +release_status = '3 - Alpha' +dependencies = [ + 'google-api-core[grpc] >= 1.4.1, < 2.0.0dev', + 'grpc-google-iam-v1 >= 0.11.1, < 0.12dev', + 'enum34; python_version < "3.4"', +] + + + +package_root = os.path.abspath(os.path.dirname(__file__)) + +readme_filename = os.path.join(package_root, 'README.rst') +with io.open(readme_filename, encoding='utf-8') as readme_file: + readme = readme_file.read() + +packages = [ + package for package in setuptools.find_packages() + if package.startswith('google')] + +namespaces = ['google'] +if 'google.cloud' in packages: + namespaces.append('google.cloud') + + +setuptools.setup( + name=name, + version=version, + description=description, + long_description=readme, + author='Google LLC', + author_email='googleapis-packages@google.com', + license='Apache 2.0', + url='https://github.com/googleapis/google-cloud-python', + classifiers=[ + release_status, + 'Intended Audience :: Developers', + 'License :: OSI Approved :: Apache Software License', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Operating System :: OS Independent', + 'Topic :: Internet', + ], + platforms='Posix; MacOS X; Windows', + packages=packages, + namespace_packages=namespaces, + install_requires=dependencies, + include_package_data=True, + zip_safe=False, +) \ No newline at end of file diff --git a/containeranalysis/synth.metadata b/containeranalysis/synth.metadata new file mode 100644 index 000000000000..fbcbdd5fc932 --- /dev/null +++ b/containeranalysis/synth.metadata @@ -0,0 +1,39 @@ +{ + "updateTime": "2019-06-05T22:45:41.734439Z", + "sources": [ + { + "generator": { + "name": "artman", + "version": "0.23.1", + "dockerImage": "googleapis/artman@sha256:9d5cae1454da64ac3a87028f8ef486b04889e351c83bb95e83b8fab3959faed0" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "5487c78983f6bd5bbafa69166593826a90778a2f", + "internalRef": "251716150" + } + }, + { + "template": { + "name": "python_library", + "origin": "synthtool.gcp", + "version": "2019.5.2" + } + } + ], + "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "containeranalysis", + "apiVersion": "v1", + "language": "python", + "generator": "gapic", + "config": "google/devtools/containeranalysis/artman_containeranalysis_v1.yaml" + } + } + ] +} \ No newline at end of file diff --git a/containeranalysis/synth.py b/containeranalysis/synth.py new file mode 100644 index 000000000000..f36e6426a345 --- /dev/null +++ b/containeranalysis/synth.py @@ -0,0 +1,48 @@ +# Copyright 2018 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. + +"""This script is used to synthesize generated parts of this library.""" + +import synthtool as s +import synthtool.gcp as gcp +import logging + +logging.basicConfig(level=logging.DEBUG) + +gapic = gcp.GAPICGenerator() +common = gcp.CommonTemplates() + +# ---------------------------------------------------------------------------- +# Generate Container Analysis GAPIC layer +# ---------------------------------------------------------------------------- +library = gapic.py_library( + "containeranalysis", + "v1", + config_path="/google/devtools/containeranalysis/artman_containeranalysis_v1.yaml", + include_protos=True, +) + +excludes = ["nox.py", "setup.py", "google/cloud/containeranalysis_v1/proto"] + +s.move(library, excludes=excludes) +# .proto files end up in the wrong place by default +s.move(library / "google/cloud/containeranalysis_v1/proto", "google/cloud/devtools/containeranalysis_v1/proto") + +# ---------------------------------------------------------------------------- +# Add templated files +# ---------------------------------------------------------------------------- +templated_files = common.py_library(unit_cov_level=51, cov_level=51) +s.move(templated_files) + +s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/containeranalysis/tests/unit/gapic/v1/test_container_analysis_client_v1.py b/containeranalysis/tests/unit/gapic/v1/test_container_analysis_client_v1.py new file mode 100644 index 000000000000..416531cd88c0 --- /dev/null +++ b/containeranalysis/tests/unit/gapic/v1/test_container_analysis_client_v1.py @@ -0,0 +1,187 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + +"""Unit tests.""" + +import mock +import pytest + +from google.cloud.devtools import containeranalysis_v1 +from google.iam.v1 import iam_policy_pb2 +from google.iam.v1 import policy_pb2 + + +class MultiCallableStub(object): + """Stub for the grpc.UnaryUnaryMultiCallable interface.""" + + def __init__(self, method, channel_stub): + self.method = method + self.channel_stub = channel_stub + + def __call__(self, request, timeout=None, metadata=None, credentials=None): + self.channel_stub.requests.append((self.method, request)) + + response = None + if self.channel_stub.responses: + response = self.channel_stub.responses.pop() + + if isinstance(response, Exception): + raise response + + if response: + return response + + +class ChannelStub(object): + """Stub for the grpc.Channel interface.""" + + def __init__(self, responses=[]): + self.responses = responses + self.requests = [] + + def unary_unary(self, method, request_serializer=None, response_deserializer=None): + return MultiCallableStub(method, self) + + +class CustomException(Exception): + pass + + +class TestContainerAnalysisClient(object): + def test_set_iam_policy(self): + # Setup Expected Response + version = 351608024 + etag = b"21" + expected_response = {"version": version, "etag": etag} + expected_response = policy_pb2.Policy(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = containeranalysis_v1.ContainerAnalysisClient() + + # Setup Request + resource = client.note_path("[PROJECT]", "[NOTE]") + policy = {} + + response = client.set_iam_policy(resource, policy) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = iam_policy_pb2.SetIamPolicyRequest( + resource=resource, policy=policy + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_set_iam_policy_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = containeranalysis_v1.ContainerAnalysisClient() + + # Setup request + resource = client.note_path("[PROJECT]", "[NOTE]") + policy = {} + + with pytest.raises(CustomException): + client.set_iam_policy(resource, policy) + + def test_get_iam_policy(self): + # Setup Expected Response + version = 351608024 + etag = b"21" + expected_response = {"version": version, "etag": etag} + expected_response = policy_pb2.Policy(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = containeranalysis_v1.ContainerAnalysisClient() + + # Setup Request + resource = client.note_path("[PROJECT]", "[NOTE]") + + response = client.get_iam_policy(resource) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = iam_policy_pb2.GetIamPolicyRequest(resource=resource) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_get_iam_policy_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = containeranalysis_v1.ContainerAnalysisClient() + + # Setup request + resource = client.note_path("[PROJECT]", "[NOTE]") + + with pytest.raises(CustomException): + client.get_iam_policy(resource) + + def test_test_iam_permissions(self): + # Setup Expected Response + expected_response = {} + expected_response = iam_policy_pb2.TestIamPermissionsResponse( + **expected_response + ) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = containeranalysis_v1.ContainerAnalysisClient() + + # Setup Request + resource = client.note_path("[PROJECT]", "[NOTE]") + permissions = [] + + response = client.test_iam_permissions(resource, permissions) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = iam_policy_pb2.TestIamPermissionsRequest( + resource=resource, permissions=permissions + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_test_iam_permissions_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = containeranalysis_v1.ContainerAnalysisClient() + + # Setup request + resource = client.note_path("[PROJECT]", "[NOTE]") + permissions = [] + + with pytest.raises(CustomException): + client.test_iam_permissions(resource, permissions) diff --git a/docs/containeranalysis b/docs/containeranalysis new file mode 120000 index 000000000000..5c1813ec7a94 --- /dev/null +++ b/docs/containeranalysis @@ -0,0 +1 @@ +../containeranalysis/docs \ No newline at end of file diff --git a/docs/grafeas b/docs/grafeas new file mode 120000 index 000000000000..5e8270b35fb2 --- /dev/null +++ b/docs/grafeas @@ -0,0 +1 @@ +../grafeas/docs \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 3487ddd2639f..1dbe45faf1df 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,6 +10,7 @@ BigQuery Storage Bigtable Container + Container Analysis Data Catalog Data Labeling Data Loss Prevention @@ -17,6 +18,7 @@ Datastore DNS Firestore + Grafeas IAM IoT Key Management diff --git a/docs/requirements.txt b/docs/requirements.txt index b5ab0df675ef..99fe149bddc7 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -14,6 +14,7 @@ grpcio-gcp >= 0.2.2 -e bigquery_storage/ -e bigtable/ -e container/ +-e containeranalysis/ -e datacatalog/ -e datalabeling/ -e dataproc/ @@ -21,6 +22,7 @@ grpcio-gcp >= 0.2.2 -e dlp/ -e dns/ -e firestore/ +-e grafeas/ -e iam/ -e iot/ -e irm/ diff --git a/grafeas/.coveragerc b/grafeas/.coveragerc new file mode 100644 index 000000000000..6b9ab9da4a1b --- /dev/null +++ b/grafeas/.coveragerc @@ -0,0 +1,18 @@ +[run] +branch = True + +[report] +fail_under = 100 +show_missing = True +exclude_lines = + # Re-enable the standard pragma + pragma: NO COVER + # Ignore debug-only repr + def __repr__ + # Ignore abstract methods + raise NotImplementedError +omit = + */gapic/*.py + */proto/*.py + */core/*.py + */site-packages/*.py \ No newline at end of file diff --git a/grafeas/.flake8 b/grafeas/.flake8 new file mode 100644 index 000000000000..61766fa84d02 --- /dev/null +++ b/grafeas/.flake8 @@ -0,0 +1,13 @@ +[flake8] +ignore = E203, E266, E501, W503 +exclude = + # Exclude generated code. + **/proto/** + **/gapic/** + *_pb2.py + + # Standard linting exemptions. + __pycache__, + .git, + *.pyc, + conf.py diff --git a/grafeas/CHANGELOG.md b/grafeas/CHANGELOG.md new file mode 100644 index 000000000000..5ddad421e08f --- /dev/null +++ b/grafeas/CHANGELOG.md @@ -0,0 +1 @@ +# Changelog \ No newline at end of file diff --git a/grafeas/LICENSE b/grafeas/LICENSE new file mode 100644 index 000000000000..a8ee855de2aa --- /dev/null +++ b/grafeas/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/grafeas/MANIFEST.in b/grafeas/MANIFEST.in new file mode 100644 index 000000000000..9cbf175afe6b --- /dev/null +++ b/grafeas/MANIFEST.in @@ -0,0 +1,5 @@ +include README.rst LICENSE +recursive-include google *.json *.proto +recursive-include tests * +global-exclude *.py[co] +global-exclude __pycache__ diff --git a/grafeas/README.rst b/grafeas/README.rst new file mode 100644 index 000000000000..c7a46773f922 --- /dev/null +++ b/grafeas/README.rst @@ -0,0 +1,76 @@ +Python Client for Grafeas API (`Alpha`_) +=================================================== + +`Grafeas API`_: An implementation of the Grafeas API, which stores, and enables querying and +retrieval of critical metadata about all of your software artifacts. + +- `Client Library Documentation`_ +- `Product Documentation`_ + +.. _Alpha: https://github.com/googleapis/google-cloud-python/blob/master/README.rst +.. _Grafeas API: https://cloud.google.com/grafeas +.. _Client Library Documentation: https://googleapis.github.io/google-cloud-python/latest/grafeas/usage.html +.. _Product Documentation: https://cloud.google.com/grafeas + +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 Grafeas 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 +.. _Enable the Grafeas API.: https://cloud.google.com/grafeas +.. _Setup Authentication.: https://googleapis.github.io/google-cloud-python/latest/core/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 + + pip install virtualenv + virtualenv + source /bin/activate + /bin/pip install grafeas + + +Windows +^^^^^^^ + +.. code-block:: console + + pip install virtualenv + virtualenv + \Scripts\activate + \Scripts\pip.exe install grafeas + +Next Steps +~~~~~~~~~~ + +- Read the `Client Library Documentation`_ for Grafeas API + API to see other available methods on the client. +- Read the `Grafeas API Product documentation`_ to learn + more about the product and see How-to Guides. +- View this `repository’s main README`_ to see the full list of Cloud + APIs that we cover. + +.. _Grafeas API Product documentation: https://cloud.google.com/grafeas +.. _repository’s main README: https://github.com/googleapis/google-cloud-python/blob/master/README.rst \ No newline at end of file diff --git a/grafeas/docs/README.rst b/grafeas/docs/README.rst new file mode 120000 index 000000000000..89a0106941ff --- /dev/null +++ b/grafeas/docs/README.rst @@ -0,0 +1 @@ +../README.rst \ No newline at end of file diff --git a/grafeas/docs/changelog.md b/grafeas/docs/changelog.md new file mode 120000 index 000000000000..04c99a55caae --- /dev/null +++ b/grafeas/docs/changelog.md @@ -0,0 +1 @@ +../CHANGELOG.md \ No newline at end of file diff --git a/grafeas/docs/conf.py b/grafeas/docs/conf.py new file mode 100644 index 000000000000..5210c836fe80 --- /dev/null +++ b/grafeas/docs/conf.py @@ -0,0 +1,352 @@ +# -*- coding: utf-8 -*- +# +# grafeas 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 = "1.6.3" + +# 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'] +source_suffix = [".rst", ".md"] + +# The encoding of source files. +# source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = "index" + +# General information about the project. +project = u"grafeas" +copyright = u"2017, Google" +author = u"Google APIs" + +# 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 = None + +# 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 = [] + +# 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 = "grafeas-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 = [ + (master_doc, "grafeas.tex", u"grafeas 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 = [(master_doc, "grafeas", u"grafeas 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 = [ + ( + master_doc, + "grafeas", + u"grafeas Documentation", + author, + "grafeas", + "GAPIC library for the {metadata.shortName} v1 service", + "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.github.io/google-cloud-python/latest", + None, + ), + "grpc": ("https://grpc.io/grpc/python/", None), + "requests": ("http://docs.python-requests.org/en/master/", None), + "fastavro": ("https://fastavro.readthedocs.io/en/stable/", None), + "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", 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/grafeas/docs/gapic/v1/api.rst b/grafeas/docs/gapic/v1/api.rst new file mode 100644 index 000000000000..66589f53952e --- /dev/null +++ b/grafeas/docs/gapic/v1/api.rst @@ -0,0 +1,6 @@ +Client for Grafeas API +================================= + +.. automodule:: grafeas.grafeas_v1 + :members: + :inherited-members: \ No newline at end of file diff --git a/grafeas/docs/gapic/v1/types.rst b/grafeas/docs/gapic/v1/types.rst new file mode 100644 index 000000000000..ee1343181d2d --- /dev/null +++ b/grafeas/docs/gapic/v1/types.rst @@ -0,0 +1,5 @@ +Types for Grafeas API Client +======================================= + +.. automodule:: grafeas.grafeas_v1.types + :members: \ No newline at end of file diff --git a/grafeas/docs/index.rst b/grafeas/docs/index.rst new file mode 100644 index 000000000000..221c0e06399d --- /dev/null +++ b/grafeas/docs/index.rst @@ -0,0 +1,19 @@ +.. include:: README.rst + +Api Reference +------------- +.. toctree:: + :maxdepth: 2 + + gapic/v1/api + gapic/v1/types + +Changelog +--------- + +For a list of all ``grafeas`` releases: + +.. toctree:: + :maxdepth: 2 + + changelog \ No newline at end of file diff --git a/grafeas/grafeas.py b/grafeas/grafeas.py new file mode 100644 index 000000000000..b40dffd3313f --- /dev/null +++ b/grafeas/grafeas.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + + +from __future__ import absolute_import + +from grafeas_v1 import GrafeasClient +from grafeas_v1 import enums +from grafeas_v1 import types + + +__all__ = ( + 'enums', + 'types', + 'GrafeasClient', +) diff --git a/grafeas/grafeas/__init__.py b/grafeas/grafeas/__init__.py new file mode 100644 index 000000000000..8fcc60e2b9c6 --- /dev/null +++ b/grafeas/grafeas/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + +try: + import pkg_resources + + pkg_resources.declare_namespace(__name__) +except ImportError: + import pkgutil + + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/grafeas/grafeas/grafeas.py b/grafeas/grafeas/grafeas.py new file mode 100644 index 000000000000..768aa8c77f29 --- /dev/null +++ b/grafeas/grafeas/grafeas.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + + +from __future__ import absolute_import + +from grafeas.grafeas_v1 import GrafeasClient +from grafeas.grafeas_v1 import enums +from grafeas.grafeas_v1 import types + + +__all__ = ("enums", "types", "GrafeasClient") diff --git a/grafeas/grafeas/grafeas_v1/__init__.py b/grafeas/grafeas/grafeas_v1/__init__.py new file mode 100644 index 000000000000..9bbb0db16767 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/__init__.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + + +from __future__ import absolute_import + +from grafeas.grafeas_v1 import types +from grafeas.grafeas_v1.gapic import enums +from grafeas.grafeas_v1.gapic import grafeas_client + + +class GrafeasClient(grafeas_client.GrafeasClient): + __doc__ = grafeas_client.GrafeasClient.__doc__ + enums = enums + + +__all__ = ("enums", "types", "GrafeasClient") diff --git a/grafeas/grafeas/grafeas_v1/gapic/__init__.py b/grafeas/grafeas/grafeas_v1/gapic/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/grafeas/grafeas/grafeas_v1/gapic/enums.py b/grafeas/grafeas/grafeas_v1/gapic/enums.py new file mode 100644 index 000000000000..af9846618abe --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/gapic/enums.py @@ -0,0 +1,255 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + +"""Wrappers for protocol buffer enum types.""" + +import enum + + +class Architecture(enum.IntEnum): + """ + Instruction set architectures supported by various package managers. + + Attributes: + ARCHITECTURE_UNSPECIFIED (int): Unknown architecture. + X86 (int): X86 architecture. + X64 (int): X64 architecture. + """ + + ARCHITECTURE_UNSPECIFIED = 0 + X86 = 1 + X64 = 2 + + +class NoteKind(enum.IntEnum): + """ + Kind represents the kinds of notes supported. + + Attributes: + NOTE_KIND_UNSPECIFIED (int): Unknown. + VULNERABILITY (int): The note and occurrence represent a package vulnerability. + BUILD (int): The note and occurrence assert build provenance. + IMAGE (int): This represents an image basis relationship. + PACKAGE (int): This represents a package installed via a package manager. + DEPLOYMENT (int): The note and occurrence track deployment events. + DISCOVERY (int): The note and occurrence track the initial discovery status of a resource. + ATTESTATION (int): This represents a logical "role" that can attest to artifacts. + """ + + NOTE_KIND_UNSPECIFIED = 0 + VULNERABILITY = 1 + BUILD = 2 + IMAGE = 3 + PACKAGE = 4 + DEPLOYMENT = 5 + DISCOVERY = 6 + ATTESTATION = 7 + + +class Severity(enum.IntEnum): + """ + Note provider assigned severity/impact ranking. + + Attributes: + SEVERITY_UNSPECIFIED (int): Unknown. + MINIMAL (int): Minimal severity. + LOW (int): Low severity. + MEDIUM (int): Medium severity. + HIGH (int): High severity. + CRITICAL (int): Critical severity. + """ + + SEVERITY_UNSPECIFIED = 0 + MINIMAL = 1 + LOW = 2 + MEDIUM = 3 + HIGH = 4 + CRITICAL = 5 + + +class AliasContext(object): + class Kind(enum.IntEnum): + """ + The type of an alias. + + Attributes: + KIND_UNSPECIFIED (int): Unknown. + FIXED (int): Git tag. + MOVABLE (int): Git branch. + OTHER (int): Used to specify non-standard aliases. For example, if a Git repo has a + ref named "refs/foo/bar". + """ + + KIND_UNSPECIFIED = 0 + FIXED = 1 + MOVABLE = 2 + OTHER = 4 + + +class CVSSv3(object): + class AttackComplexity(enum.IntEnum): + """ + Attributes: + ATTACK_COMPLEXITY_UNSPECIFIED (int) + ATTACK_COMPLEXITY_LOW (int) + ATTACK_COMPLEXITY_HIGH (int) + """ + + ATTACK_COMPLEXITY_UNSPECIFIED = 0 + ATTACK_COMPLEXITY_LOW = 1 + ATTACK_COMPLEXITY_HIGH = 2 + + class AttackVector(enum.IntEnum): + """ + Attributes: + ATTACK_VECTOR_UNSPECIFIED (int) + ATTACK_VECTOR_NETWORK (int) + ATTACK_VECTOR_ADJACENT (int) + ATTACK_VECTOR_LOCAL (int) + ATTACK_VECTOR_PHYSICAL (int) + """ + + ATTACK_VECTOR_UNSPECIFIED = 0 + ATTACK_VECTOR_NETWORK = 1 + ATTACK_VECTOR_ADJACENT = 2 + ATTACK_VECTOR_LOCAL = 3 + ATTACK_VECTOR_PHYSICAL = 4 + + class Impact(enum.IntEnum): + """ + Attributes: + IMPACT_UNSPECIFIED (int) + IMPACT_HIGH (int) + IMPACT_LOW (int) + IMPACT_NONE (int) + """ + + IMPACT_UNSPECIFIED = 0 + IMPACT_HIGH = 1 + IMPACT_LOW = 2 + IMPACT_NONE = 3 + + class PrivilegesRequired(enum.IntEnum): + """ + Attributes: + PRIVILEGES_REQUIRED_UNSPECIFIED (int) + PRIVILEGES_REQUIRED_NONE (int) + PRIVILEGES_REQUIRED_LOW (int) + PRIVILEGES_REQUIRED_HIGH (int) + """ + + PRIVILEGES_REQUIRED_UNSPECIFIED = 0 + PRIVILEGES_REQUIRED_NONE = 1 + PRIVILEGES_REQUIRED_LOW = 2 + PRIVILEGES_REQUIRED_HIGH = 3 + + class Scope(enum.IntEnum): + """ + Attributes: + SCOPE_UNSPECIFIED (int) + SCOPE_UNCHANGED (int) + SCOPE_CHANGED (int) + """ + + SCOPE_UNSPECIFIED = 0 + SCOPE_UNCHANGED = 1 + SCOPE_CHANGED = 2 + + class UserInteraction(enum.IntEnum): + """ + Attributes: + USER_INTERACTION_UNSPECIFIED (int) + USER_INTERACTION_NONE (int) + USER_INTERACTION_REQUIRED (int) + """ + + USER_INTERACTION_UNSPECIFIED = 0 + USER_INTERACTION_NONE = 1 + USER_INTERACTION_REQUIRED = 2 + + +class DeploymentOccurrence(object): + class Platform(enum.IntEnum): + """ + Types of platforms. + + Attributes: + PLATFORM_UNSPECIFIED (int): Unknown. + GKE (int): Google Container Engine. + FLEX (int): Google App Engine: Flexible Environment. + CUSTOM (int): Custom user-defined platform. + """ + + PLATFORM_UNSPECIFIED = 0 + GKE = 1 + FLEX = 2 + CUSTOM = 3 + + +class DiscoveryOccurrence(object): + class AnalysisStatus(enum.IntEnum): + """ + Analysis status for a resource. Currently for initial analysis only (not + updated in continuous analysis). + + Attributes: + ANALYSIS_STATUS_UNSPECIFIED (int): Unknown. + PENDING (int): Resource is known but no action has been taken yet. + SCANNING (int): Resource is being analyzed. + FINISHED_SUCCESS (int): Analysis has finished successfully. + FINISHED_FAILED (int): Analysis has finished unsuccessfully, the analysis itself is in a bad + state. + FINISHED_UNSUPPORTED (int): The resource is known not to be supported + """ + + ANALYSIS_STATUS_UNSPECIFIED = 0 + PENDING = 1 + SCANNING = 2 + FINISHED_SUCCESS = 3 + FINISHED_FAILED = 4 + FINISHED_UNSUPPORTED = 5 + + class ContinuousAnalysis(enum.IntEnum): + """ + Whether the resource is continuously analyzed. + + Attributes: + CONTINUOUS_ANALYSIS_UNSPECIFIED (int): Unknown. + ACTIVE (int): The resource is continuously analyzed. + INACTIVE (int): The resource is ignored for continuous analysis. + """ + + CONTINUOUS_ANALYSIS_UNSPECIFIED = 0 + ACTIVE = 1 + INACTIVE = 2 + + +class Version(object): + class VersionKind(enum.IntEnum): + """ + Whether this is an ordinary package version or a sentinel MIN/MAX version. + + Attributes: + VERSION_KIND_UNSPECIFIED (int): Unknown. + NORMAL (int): A standard package version. + MINIMUM (int): A special version representing negative infinity. + MAXIMUM (int): A special version representing positive infinity. + """ + + VERSION_KIND_UNSPECIFIED = 0 + NORMAL = 1 + MINIMUM = 2 + MAXIMUM = 3 diff --git a/grafeas/grafeas/grafeas_v1/gapic/grafeas_client.py b/grafeas/grafeas/grafeas_v1/gapic/grafeas_client.py new file mode 100644 index 000000000000..ecee8f4c1d86 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/gapic/grafeas_client.py @@ -0,0 +1,1363 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + +"""Accesses the grafeas.v1 Grafeas API.""" + +import functools +import pkg_resources +import warnings + +from google.oauth2 import service_account +import google.api_core.gapic_v1.client_info +import google.api_core.gapic_v1.config +import google.api_core.gapic_v1.method +import google.api_core.gapic_v1.routing_header +import google.api_core.grpc_helpers +import google.api_core.page_iterator +import google.api_core.path_template +import grpc + +from google.protobuf import empty_pb2 +from google.protobuf import field_mask_pb2 +from grafeas.grafeas_v1.gapic import enums +from grafeas.grafeas_v1.gapic import grafeas_client_config +from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport +from grafeas.grafeas_v1.proto import grafeas_pb2 +from grafeas.grafeas_v1.proto import grafeas_pb2_grpc + + +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("grafeas").version + + +class GrafeasClient(object): + """ + `Grafeas `__ API. + + Retrieves analysis results of Cloud components such as Docker container + images. + + Analysis results are stored as a series of occurrences. An + ``Occurrence`` contains information about a specific analysis instance + on a resource. An occurrence refers to a ``Note``. A note contains + details describing the analysis and is generally stored in a separate + project, called a ``Provider``. Multiple occurrences can refer to the + same note. + + For example, an SSL vulnerability could affect multiple images. In this + case, there would be one note for the vulnerability and an occurrence + for each image with the vulnerability referring to that note. + """ + + # The name of the interface for this client. This is the key used to + # find the method configuration in the client_config dictionary. + _INTERFACE_NAME = "grafeas.v1.Grafeas" + + @classmethod + def note_path(cls, project, note): + """Return a fully-qualified note string.""" + return google.api_core.path_template.expand( + "projects/{project}/notes/{note}", project=project, note=note + ) + + @classmethod + def occurrence_path(cls, project, occurrence): + """Return a fully-qualified occurrence string.""" + return google.api_core.path_template.expand( + "projects/{project}/occurrences/{occurrence}", + project=project, + occurrence=occurrence, + ) + + @classmethod + def project_path(cls, project): + """Return a fully-qualified project string.""" + return google.api_core.path_template.expand( + "projects/{project}", project=project + ) + + def __init__(self, transport, client_config=None, client_info=None): + """Constructor. + + Args: + transport (~.GrafeasGrpcTransport): A transport + instance, responsible for actually making the API calls. + The default transport uses the gRPC protocol. + This argument may also be a callable which returns a + transport instance. Callables will be sent the credentials + as the first argument and the default transport class as + the second argument. + + client_config (dict): DEPRECATED. A dictionary of call options for + each method. If not specified, the default configuration is used. + 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. + """ + # Raise deprecation warnings for things we want to go away. + if client_config is not None: + warnings.warn( + "The `client_config` argument is deprecated.", + PendingDeprecationWarning, + stacklevel=2, + ) + else: + client_config = grafeas_client_config.config + + # Instantiate the transport. + # The transport is responsible for handling serialization and + # deserialization and actually sending data to the service. + self.transport = transport + + if client_info is None: + client_info = google.api_core.gapic_v1.client_info.ClientInfo( + gapic_version=_GAPIC_LIBRARY_VERSION + ) + else: + client_info.gapic_version = _GAPIC_LIBRARY_VERSION + self._client_info = client_info + + # Parse out the default settings for retry and timeout for each RPC + # from the client configuration. + # (Ordinarily, these are the defaults specified in the `*_config.py` + # file next to this one.) + self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( + client_config["interfaces"][self._INTERFACE_NAME] + ) + + # Save a dictionary of cached API call functions. + # These are the actual callables which invoke the proper + # transport methods, wrapped with `wrap_method` to add retry, + # timeout, and the like. + self._inner_api_calls = {} + + # Service calls + def get_occurrence( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Gets the specified occurrence. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> name = client.occurrence_path('[PROJECT]', '[OCCURRENCE]') + >>> + >>> response = client.get_occurrence(name) + + Args: + name (str): The name of the occurrence in the form of + ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]``. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~grafeas.grafeas_v1.types.Occurrence` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "get_occurrence" not in self._inner_api_calls: + self._inner_api_calls[ + "get_occurrence" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_occurrence, + default_retry=self._method_configs["GetOccurrence"].retry, + default_timeout=self._method_configs["GetOccurrence"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.GetOccurrenceRequest(name=name) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["get_occurrence"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def list_occurrences( + self, + parent, + filter_=None, + page_size=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Lists occurrences for the specified project. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> parent = client.project_path('[PROJECT]') + >>> + >>> # Iterate over all results + >>> for element in client.list_occurrences(parent): + ... # process element + ... pass + >>> + >>> + >>> # Alternatively: + >>> + >>> # Iterate over results one page at a time + >>> for page in client.list_occurrences(parent).pages: + ... for element in page: + ... # process element + ... pass + + Args: + parent (str): The name of the project to list occurrences for in the form of + ``projects/[PROJECT_ID]``. + filter_ (str): The filter expression. + page_size (int): The maximum number of resources contained in the + underlying API response. If page streaming is performed per- + resource, this parameter does not affect the return value. If page + streaming is performed per-page, this determines the maximum number + of resources in a page. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.gax.PageIterator` instance. By default, this + is an iterable of :class:`~grafeas.grafeas_v1.types.Occurrence` instances. + This object can also be configured to iterate over the pages + of the response through the `options` parameter. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "list_occurrences" not in self._inner_api_calls: + self._inner_api_calls[ + "list_occurrences" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.list_occurrences, + default_retry=self._method_configs["ListOccurrences"].retry, + default_timeout=self._method_configs["ListOccurrences"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.ListOccurrencesRequest( + parent=parent, filter=filter_, page_size=page_size + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + iterator = google.api_core.page_iterator.GRPCIterator( + client=None, + method=functools.partial( + self._inner_api_calls["list_occurrences"], + retry=retry, + timeout=timeout, + metadata=metadata, + ), + request=request, + items_field="occurrences", + request_token_field="page_token", + response_token_field="next_page_token", + ) + return iterator + + def delete_occurrence( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Deletes the specified occurrence. For example, use this method to delete an + occurrence when the occurrence is no longer applicable for the given + resource. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> name = client.occurrence_path('[PROJECT]', '[OCCURRENCE]') + >>> + >>> client.delete_occurrence(name) + + Args: + name (str): The name of the occurrence in the form of + ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]``. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "delete_occurrence" not in self._inner_api_calls: + self._inner_api_calls[ + "delete_occurrence" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.delete_occurrence, + default_retry=self._method_configs["DeleteOccurrence"].retry, + default_timeout=self._method_configs["DeleteOccurrence"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.DeleteOccurrenceRequest(name=name) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + self._inner_api_calls["delete_occurrence"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def create_occurrence( + self, + parent, + occurrence, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Creates a new occurrence. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> parent = client.project_path('[PROJECT]') + >>> + >>> # TODO: Initialize `occurrence`: + >>> occurrence = {} + >>> + >>> response = client.create_occurrence(parent, occurrence) + + Args: + parent (str): The name of the project in the form of ``projects/[PROJECT_ID]``, under + which the occurrence is to be created. + occurrence (Union[dict, ~grafeas.grafeas_v1.types.Occurrence]): The occurrence to create. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~grafeas.grafeas_v1.types.Occurrence` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~grafeas.grafeas_v1.types.Occurrence` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "create_occurrence" not in self._inner_api_calls: + self._inner_api_calls[ + "create_occurrence" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.create_occurrence, + default_retry=self._method_configs["CreateOccurrence"].retry, + default_timeout=self._method_configs["CreateOccurrence"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.CreateOccurrenceRequest( + parent=parent, occurrence=occurrence + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["create_occurrence"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def batch_create_occurrences( + self, + parent, + occurrences, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Creates new occurrences in batch. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> parent = client.project_path('[PROJECT]') + >>> + >>> # TODO: Initialize `occurrences`: + >>> occurrences = [] + >>> + >>> response = client.batch_create_occurrences(parent, occurrences) + + Args: + parent (str): The name of the project in the form of ``projects/[PROJECT_ID]``, under + which the occurrences are to be created. + occurrences (list[Union[dict, ~grafeas.grafeas_v1.types.Occurrence]]): The occurrences to create. Max allowed length is 1000. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~grafeas.grafeas_v1.types.Occurrence` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~grafeas.grafeas_v1.types.BatchCreateOccurrencesResponse` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "batch_create_occurrences" not in self._inner_api_calls: + self._inner_api_calls[ + "batch_create_occurrences" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.batch_create_occurrences, + default_retry=self._method_configs["BatchCreateOccurrences"].retry, + default_timeout=self._method_configs["BatchCreateOccurrences"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.BatchCreateOccurrencesRequest( + parent=parent, occurrences=occurrences + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["batch_create_occurrences"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def update_occurrence( + self, + name, + occurrence, + update_mask=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Updates the specified occurrence. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> name = client.occurrence_path('[PROJECT]', '[OCCURRENCE]') + >>> + >>> # TODO: Initialize `occurrence`: + >>> occurrence = {} + >>> + >>> response = client.update_occurrence(name, occurrence) + + Args: + name (str): The name of the occurrence in the form of + ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]``. + occurrence (Union[dict, ~grafeas.grafeas_v1.types.Occurrence]): The updated occurrence. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~grafeas.grafeas_v1.types.Occurrence` + update_mask (Union[dict, ~grafeas.grafeas_v1.types.FieldMask]): The fields to update. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~grafeas.grafeas_v1.types.FieldMask` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~grafeas.grafeas_v1.types.Occurrence` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "update_occurrence" not in self._inner_api_calls: + self._inner_api_calls[ + "update_occurrence" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.update_occurrence, + default_retry=self._method_configs["UpdateOccurrence"].retry, + default_timeout=self._method_configs["UpdateOccurrence"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.UpdateOccurrenceRequest( + name=name, occurrence=occurrence, update_mask=update_mask + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["update_occurrence"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def get_occurrence_note( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Gets the note attached to the specified occurrence. Consumer projects can + use this method to get a note that belongs to a provider project. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> name = client.occurrence_path('[PROJECT]', '[OCCURRENCE]') + >>> + >>> response = client.get_occurrence_note(name) + + Args: + name (str): The name of the occurrence in the form of + ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]``. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~grafeas.grafeas_v1.types.Note` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "get_occurrence_note" not in self._inner_api_calls: + self._inner_api_calls[ + "get_occurrence_note" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_occurrence_note, + default_retry=self._method_configs["GetOccurrenceNote"].retry, + default_timeout=self._method_configs["GetOccurrenceNote"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.GetOccurrenceNoteRequest(name=name) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["get_occurrence_note"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def get_note( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Gets the specified note. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> name = client.note_path('[PROJECT]', '[NOTE]') + >>> + >>> response = client.get_note(name) + + Args: + name (str): The name of the note in the form of + ``projects/[PROVIDER_ID]/notes/[NOTE_ID]``. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~grafeas.grafeas_v1.types.Note` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "get_note" not in self._inner_api_calls: + self._inner_api_calls[ + "get_note" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_note, + default_retry=self._method_configs["GetNote"].retry, + default_timeout=self._method_configs["GetNote"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.GetNoteRequest(name=name) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["get_note"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def list_notes( + self, + parent, + filter_=None, + page_size=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Lists notes for the specified project. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> parent = client.project_path('[PROJECT]') + >>> + >>> # Iterate over all results + >>> for element in client.list_notes(parent): + ... # process element + ... pass + >>> + >>> + >>> # Alternatively: + >>> + >>> # Iterate over results one page at a time + >>> for page in client.list_notes(parent).pages: + ... for element in page: + ... # process element + ... pass + + Args: + parent (str): The name of the project to list notes for in the form of + ``projects/[PROJECT_ID]``. + filter_ (str): The filter expression. + page_size (int): The maximum number of resources contained in the + underlying API response. If page streaming is performed per- + resource, this parameter does not affect the return value. If page + streaming is performed per-page, this determines the maximum number + of resources in a page. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.gax.PageIterator` instance. By default, this + is an iterable of :class:`~grafeas.grafeas_v1.types.Note` instances. + This object can also be configured to iterate over the pages + of the response through the `options` parameter. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "list_notes" not in self._inner_api_calls: + self._inner_api_calls[ + "list_notes" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.list_notes, + default_retry=self._method_configs["ListNotes"].retry, + default_timeout=self._method_configs["ListNotes"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.ListNotesRequest( + parent=parent, filter=filter_, page_size=page_size + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + iterator = google.api_core.page_iterator.GRPCIterator( + client=None, + method=functools.partial( + self._inner_api_calls["list_notes"], + retry=retry, + timeout=timeout, + metadata=metadata, + ), + request=request, + items_field="notes", + request_token_field="page_token", + response_token_field="next_page_token", + ) + return iterator + + def delete_note( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Deletes the specified note. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> name = client.note_path('[PROJECT]', '[NOTE]') + >>> + >>> client.delete_note(name) + + Args: + name (str): The name of the note in the form of + ``projects/[PROVIDER_ID]/notes/[NOTE_ID]``. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "delete_note" not in self._inner_api_calls: + self._inner_api_calls[ + "delete_note" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.delete_note, + default_retry=self._method_configs["DeleteNote"].retry, + default_timeout=self._method_configs["DeleteNote"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.DeleteNoteRequest(name=name) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + self._inner_api_calls["delete_note"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def create_note( + self, + parent, + note_id, + note, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Creates a new note. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> parent = client.project_path('[PROJECT]') + >>> + >>> # TODO: Initialize `note_id`: + >>> note_id = '' + >>> + >>> # TODO: Initialize `note`: + >>> note = {} + >>> + >>> response = client.create_note(parent, note_id, note) + + Args: + parent (str): The name of the project in the form of ``projects/[PROJECT_ID]``, under + which the note is to be created. + note_id (str): The ID to use for this note. + note (Union[dict, ~grafeas.grafeas_v1.types.Note]): The note to create. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~grafeas.grafeas_v1.types.Note` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~grafeas.grafeas_v1.types.Note` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "create_note" not in self._inner_api_calls: + self._inner_api_calls[ + "create_note" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.create_note, + default_retry=self._method_configs["CreateNote"].retry, + default_timeout=self._method_configs["CreateNote"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.CreateNoteRequest( + parent=parent, note_id=note_id, note=note + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["create_note"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def batch_create_notes( + self, + parent, + notes, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Creates new notes in batch. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> parent = client.project_path('[PROJECT]') + >>> + >>> # TODO: Initialize `notes`: + >>> notes = {} + >>> + >>> response = client.batch_create_notes(parent, notes) + + Args: + parent (str): The name of the project in the form of ``projects/[PROJECT_ID]``, under + which the notes are to be created. + notes (dict[str -> Union[dict, ~grafeas.grafeas_v1.types.Note]]): The notes to create. Max allowed length is 1000. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~grafeas.grafeas_v1.types.Note` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~grafeas.grafeas_v1.types.BatchCreateNotesResponse` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "batch_create_notes" not in self._inner_api_calls: + self._inner_api_calls[ + "batch_create_notes" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.batch_create_notes, + default_retry=self._method_configs["BatchCreateNotes"].retry, + default_timeout=self._method_configs["BatchCreateNotes"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.BatchCreateNotesRequest(parent=parent, notes=notes) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["batch_create_notes"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def update_note( + self, + name, + note, + update_mask=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Updates the specified note. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> name = client.note_path('[PROJECT]', '[NOTE]') + >>> + >>> # TODO: Initialize `note`: + >>> note = {} + >>> + >>> response = client.update_note(name, note) + + Args: + name (str): The name of the note in the form of + ``projects/[PROVIDER_ID]/notes/[NOTE_ID]``. + note (Union[dict, ~grafeas.grafeas_v1.types.Note]): The updated note. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~grafeas.grafeas_v1.types.Note` + update_mask (Union[dict, ~grafeas.grafeas_v1.types.FieldMask]): The fields to update. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~grafeas.grafeas_v1.types.FieldMask` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~grafeas.grafeas_v1.types.Note` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "update_note" not in self._inner_api_calls: + self._inner_api_calls[ + "update_note" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.update_note, + default_retry=self._method_configs["UpdateNote"].retry, + default_timeout=self._method_configs["UpdateNote"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.UpdateNoteRequest( + name=name, note=note, update_mask=update_mask + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["update_note"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def list_note_occurrences( + self, + name, + filter_=None, + page_size=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Lists occurrences referencing the specified note. Provider projects can use + this method to get all occurrences across consumer projects referencing the + specified note. + + Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport) + >>> + >>> name = client.note_path('[PROJECT]', '[NOTE]') + >>> + >>> # Iterate over all results + >>> for element in client.list_note_occurrences(name): + ... # process element + ... pass + >>> + >>> + >>> # Alternatively: + >>> + >>> # Iterate over results one page at a time + >>> for page in client.list_note_occurrences(name).pages: + ... for element in page: + ... # process element + ... pass + + Args: + name (str): The name of the note to list occurrences for in the form of + ``projects/[PROVIDER_ID]/notes/[NOTE_ID]``. + filter_ (str): The filter expression. + page_size (int): The maximum number of resources contained in the + underlying API response. If page streaming is performed per- + resource, this parameter does not affect the return value. If page + streaming is performed per-page, this determines the maximum number + of resources in a page. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.gax.PageIterator` instance. By default, this + is an iterable of :class:`~grafeas.grafeas_v1.types.Occurrence` instances. + This object can also be configured to iterate over the pages + of the response through the `options` parameter. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "list_note_occurrences" not in self._inner_api_calls: + self._inner_api_calls[ + "list_note_occurrences" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.list_note_occurrences, + default_retry=self._method_configs["ListNoteOccurrences"].retry, + default_timeout=self._method_configs["ListNoteOccurrences"].timeout, + client_info=self._client_info, + ) + + request = grafeas_pb2.ListNoteOccurrencesRequest( + name=name, filter=filter_, page_size=page_size + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + iterator = google.api_core.page_iterator.GRPCIterator( + client=None, + method=functools.partial( + self._inner_api_calls["list_note_occurrences"], + retry=retry, + timeout=timeout, + metadata=metadata, + ), + request=request, + items_field="occurrences", + request_token_field="page_token", + response_token_field="next_page_token", + ) + return iterator diff --git a/grafeas/grafeas/grafeas_v1/gapic/grafeas_client_config.py b/grafeas/grafeas/grafeas_v1/gapic/grafeas_client_config.py new file mode 100644 index 000000000000..f899bf6ddd4b --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/gapic/grafeas_client_config.py @@ -0,0 +1,93 @@ +config = { + "interfaces": { + "grafeas.v1.Grafeas": { + "retry_codes": { + "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], + "non_idempotent": [], + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 20000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 20000, + "total_timeout_millis": 600000, + } + }, + "methods": { + "GetOccurrence": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "ListOccurrences": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "DeleteOccurrence": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "CreateOccurrence": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "BatchCreateOccurrences": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "UpdateOccurrence": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "GetOccurrenceNote": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "GetNote": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "ListNotes": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "DeleteNote": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "CreateNote": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "BatchCreateNotes": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "UpdateNote": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "ListNoteOccurrences": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + }, + } + } +} diff --git a/grafeas/grafeas/grafeas_v1/gapic/transports/__init__.py b/grafeas/grafeas/grafeas_v1/gapic/transports/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/grafeas/grafeas/grafeas_v1/gapic/transports/grafeas_grpc_transport.py b/grafeas/grafeas/grafeas_v1/gapic/transports/grafeas_grpc_transport.py new file mode 100644 index 000000000000..28f43c092d58 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/gapic/transports/grafeas_grpc_transport.py @@ -0,0 +1,279 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + + +import google.api_core.grpc_helpers + +from grafeas.grafeas_v1.proto import grafeas_pb2_grpc + + +class GrafeasGrpcTransport(object): + """gRPC transport class providing stubs for + grafeas.v1 Grafeas API. + + The transport provides access to the raw gRPC stubs, + which can be used to take advantage of advanced + features of gRPC. + """ + + def __init__(self, address, scopes, channel=None, credentials=None): + """Instantiate the transport class. + + Args: + address (str): The address where the service is hosted. + scopes (Sequence[str]): The scopes needed to make gRPC calls. + channel (grpc.Channel): A ``Channel`` instance through + which to make calls. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception. + credentials (google.auth.credentials.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If none + are specified, the client will attempt to ascertain the + credentials from the environment. + + """ + # If both `channel` and `credentials` are specified, raise an + # exception (channels come with credentials baked in already). + if channel is not None and credentials is not None: + raise ValueError( + "The `channel` and `credentials` arguments are mutually " "exclusive." + ) + + # Create the channel. + if channel is None: + channel = self.create_channel(address, scopes, credentials=credentials) + + self._channel = channel + + # gRPC uses objects called "stubs" that are bound to the + # channel and provide a basic method for each RPC. + self._stubs = {"grafeas_stub": grafeas_pb2_grpc.GrafeasStub(channel)} + + @classmethod + def create_channel(cls, address, scopes, credentials=None): + """Create and return a gRPC channel object. + + Args: + address (str): The host for the channel to use. + scopes (Sequence[str]): The scopes needed to make gRPC calls. + credentials (~.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + + Returns: + grpc.Channel: A gRPC channel object. + """ + return google.api_core.grpc_helpers.create_channel( + address, credentials=credentials, scopes=scopes + ) + + @property + def channel(self): + """The gRPC channel used by the transport. + + Returns: + grpc.Channel: A gRPC channel object. + """ + return self._channel + + @property + def get_occurrence(self): + """Return the gRPC stub for :meth:`GrafeasClient.get_occurrence`. + + Gets the specified occurrence. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].GetOccurrence + + @property + def list_occurrences(self): + """Return the gRPC stub for :meth:`GrafeasClient.list_occurrences`. + + Lists occurrences for the specified project. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].ListOccurrences + + @property + def delete_occurrence(self): + """Return the gRPC stub for :meth:`GrafeasClient.delete_occurrence`. + + Deletes the specified occurrence. For example, use this method to delete an + occurrence when the occurrence is no longer applicable for the given + resource. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].DeleteOccurrence + + @property + def create_occurrence(self): + """Return the gRPC stub for :meth:`GrafeasClient.create_occurrence`. + + Creates a new occurrence. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].CreateOccurrence + + @property + def batch_create_occurrences(self): + """Return the gRPC stub for :meth:`GrafeasClient.batch_create_occurrences`. + + Creates new occurrences in batch. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].BatchCreateOccurrences + + @property + def update_occurrence(self): + """Return the gRPC stub for :meth:`GrafeasClient.update_occurrence`. + + Updates the specified occurrence. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].UpdateOccurrence + + @property + def get_occurrence_note(self): + """Return the gRPC stub for :meth:`GrafeasClient.get_occurrence_note`. + + Gets the note attached to the specified occurrence. Consumer projects can + use this method to get a note that belongs to a provider project. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].GetOccurrenceNote + + @property + def get_note(self): + """Return the gRPC stub for :meth:`GrafeasClient.get_note`. + + Gets the specified note. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].GetNote + + @property + def list_notes(self): + """Return the gRPC stub for :meth:`GrafeasClient.list_notes`. + + Lists notes for the specified project. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].ListNotes + + @property + def delete_note(self): + """Return the gRPC stub for :meth:`GrafeasClient.delete_note`. + + Deletes the specified note. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].DeleteNote + + @property + def create_note(self): + """Return the gRPC stub for :meth:`GrafeasClient.create_note`. + + Creates a new note. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].CreateNote + + @property + def batch_create_notes(self): + """Return the gRPC stub for :meth:`GrafeasClient.batch_create_notes`. + + Creates new notes in batch. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].BatchCreateNotes + + @property + def update_note(self): + """Return the gRPC stub for :meth:`GrafeasClient.update_note`. + + Updates the specified note. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].UpdateNote + + @property + def list_note_occurrences(self): + """Return the gRPC stub for :meth:`GrafeasClient.list_note_occurrences`. + + Lists occurrences referencing the specified note. Provider projects can use + this method to get all occurrences across consumer projects referencing the + specified note. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["grafeas_stub"].ListNoteOccurrences diff --git a/grafeas/grafeas/grafeas_v1/proto/__init__.py b/grafeas/grafeas/grafeas_v1/proto/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/grafeas/grafeas/grafeas_v1/proto/attestation.proto b/grafeas/grafeas/grafeas_v1/proto/attestation.proto new file mode 100644 index 000000000000..61423d3eb29e --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/attestation.proto @@ -0,0 +1,73 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// 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. + +syntax = "proto3"; + +package grafeas.v1; + +import "grafeas/v1/common.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// An attestation wrapper with a PGP-compatible signature. This message only +// supports `ATTACHED` signatures, where the payload that is signed is included +// alongside the signature itself in the same file. + +// Note kind that represents a logical attestation "role" or "authority". For +// example, an organization might have one `Authority` for "QA" and one for +// "build". This note is intended to act strictly as a grouping mechanism for +// the attached occurrences (Attestations). This grouping mechanism also +// provides a security boundary, since IAM ACLs gate the ability for a principle +// to attach an occurrence to a given note. It also provides a single point of +// lookup to find all attached attestation occurrences, even if they don't all +// live in the same project. +message AttestationNote { + // This submessage provides human-readable hints about the purpose of the + // authority. Because the name of a note acts as its resource reference, it is + // important to disambiguate the canonical name of the Note (which might be a + // UUID for security purposes) from "readable" names more suitable for debug + // output. Note that these hints should not be used to look up authorities in + // security sensitive contexts, such as when looking up attestations to + // verify. + message Hint { + // Required. The human readable name of this attestation authority, for + // example "qa". + string human_readable_name = 1; + } + + // Hint hints at the purpose of the attestation authority. + Hint hint = 1; +} + +// Occurrence that represents a single "attestation". The authenticity of an +// attestation can be verified using the attached signature. If the verifier +// trusts the public key of the signer, then verifying the signature is +// sufficient to establish trust. In this circumstance, the authority to which +// this attestation is attached is primarily useful for lookup (how to find +// this attestation if you already know the authority and artifact to be +// verified) and intent (for which authority this attestation was intended to +// sign. +message AttestationOccurrence { + // Required. The serialized payload that is verified by one or more + // `signatures`. + bytes serialized_payload = 1; + // One or more signatures over `serialized_payload`. Verifier implementations + // should consider this attestation message verified if at least one + // `signature` verifies `serialized_payload`. See `Signature` in common.proto + // for more details on signature structure and verification. + repeated Signature signatures = 2; +} diff --git a/grafeas/grafeas/grafeas_v1/proto/attestation_pb2.py b/grafeas/grafeas/grafeas_v1/proto/attestation_pb2.py new file mode 100644 index 000000000000..9fdd7964ef2d --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/attestation_pb2.py @@ -0,0 +1,259 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: grafeas_v1/proto/attestation.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from grafeas.grafeas_v1.proto import common_pb2 as grafeas__v1_dot_proto_dot_common__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="grafeas_v1/proto/attestation.proto", + package="grafeas.v1", + syntax="proto3", + serialized_options=_b( + "\n\rio.grafeas.v1P\001Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\242\002\003GRA" + ), + serialized_pb=_b( + '\n"grafeas_v1/proto/attestation.proto\x12\ngrafeas.v1\x1a\x1dgrafeas_v1/proto/common.proto"f\n\x0f\x41ttestationNote\x12.\n\x04hint\x18\x01 \x01(\x0b\x32 .grafeas.v1.AttestationNote.Hint\x1a#\n\x04Hint\x12\x1b\n\x13human_readable_name\x18\x01 \x01(\t"^\n\x15\x41ttestationOccurrence\x12\x1a\n\x12serialized_payload\x18\x01 \x01(\x0c\x12)\n\nsignatures\x18\x02 \x03(\x0b\x32\x15.grafeas.v1.SignatureBQ\n\rio.grafeas.v1P\x01Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\xa2\x02\x03GRAb\x06proto3' + ), + dependencies=[grafeas__v1_dot_proto_dot_common__pb2.DESCRIPTOR], +) + + +_ATTESTATIONNOTE_HINT = _descriptor.Descriptor( + name="Hint", + full_name="grafeas.v1.AttestationNote.Hint", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="human_readable_name", + full_name="grafeas.v1.AttestationNote.Hint.human_readable_name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=148, + serialized_end=183, +) + +_ATTESTATIONNOTE = _descriptor.Descriptor( + name="AttestationNote", + full_name="grafeas.v1.AttestationNote", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="hint", + full_name="grafeas.v1.AttestationNote.hint", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[_ATTESTATIONNOTE_HINT], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=81, + serialized_end=183, +) + + +_ATTESTATIONOCCURRENCE = _descriptor.Descriptor( + name="AttestationOccurrence", + full_name="grafeas.v1.AttestationOccurrence", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="serialized_payload", + full_name="grafeas.v1.AttestationOccurrence.serialized_payload", + index=0, + number=1, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="signatures", + full_name="grafeas.v1.AttestationOccurrence.signatures", + index=1, + number=2, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=185, + serialized_end=279, +) + +_ATTESTATIONNOTE_HINT.containing_type = _ATTESTATIONNOTE +_ATTESTATIONNOTE.fields_by_name["hint"].message_type = _ATTESTATIONNOTE_HINT +_ATTESTATIONOCCURRENCE.fields_by_name[ + "signatures" +].message_type = grafeas__v1_dot_proto_dot_common__pb2._SIGNATURE +DESCRIPTOR.message_types_by_name["AttestationNote"] = _ATTESTATIONNOTE +DESCRIPTOR.message_types_by_name["AttestationOccurrence"] = _ATTESTATIONOCCURRENCE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +AttestationNote = _reflection.GeneratedProtocolMessageType( + "AttestationNote", + (_message.Message,), + dict( + Hint=_reflection.GeneratedProtocolMessageType( + "Hint", + (_message.Message,), + dict( + DESCRIPTOR=_ATTESTATIONNOTE_HINT, + __module__="grafeas_v1.proto.attestation_pb2", + __doc__="""This submessage provides human-readable hints about the purpose of the + authority. Because the name of a note acts as its resource reference, it + is important to disambiguate the canonical name of the Note (which might + be a UUID for security purposes) from "readable" names more suitable for + debug output. Note that these hints should not be used to look up + authorities in security sensitive contexts, such as when looking up + attestations to verify. + + + Attributes: + human_readable_name: + Required. The human readable name of this attestation + authority, for example "qa". + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.AttestationNote.Hint) + ), + ), + DESCRIPTOR=_ATTESTATIONNOTE, + __module__="grafeas_v1.proto.attestation_pb2", + __doc__="""Note kind that represents a logical attestation "role" or "authority". + For example, an organization might have one ``Authority`` for "QA" and + one for "build". This note is intended to act strictly as a grouping + mechanism for the attached occurrences (Attestations). This grouping + mechanism also provides a security boundary, since IAM ACLs gate the + ability for a principle to attach an occurrence to a given note. It also + provides a single point of lookup to find all attached attestation + occurrences, even if they don't all live in the same project. + + + Attributes: + hint: + Hint hints at the purpose of the attestation authority. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.AttestationNote) + ), +) +_sym_db.RegisterMessage(AttestationNote) +_sym_db.RegisterMessage(AttestationNote.Hint) + +AttestationOccurrence = _reflection.GeneratedProtocolMessageType( + "AttestationOccurrence", + (_message.Message,), + dict( + DESCRIPTOR=_ATTESTATIONOCCURRENCE, + __module__="grafeas_v1.proto.attestation_pb2", + __doc__="""Occurrence that represents a single "attestation". The authenticity of + an attestation can be verified using the attached signature. If the + verifier trusts the public key of the signer, then verifying the + signature is sufficient to establish trust. In this circumstance, the + authority to which this attestation is attached is primarily useful for + lookup (how to find this attestation if you already know the authority + and artifact to be verified) and intent (for which authority this + attestation was intended to sign. + + + Attributes: + serialized_payload: + Required. The serialized payload that is verified by one or + more ``signatures``. + signatures: + One or more signatures over ``serialized_payload``. Verifier + implementations should consider this attestation message + verified if at least one ``signature`` verifies + ``serialized_payload``. See ``Signature`` in common.proto for + more details on signature structure and verification. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.AttestationOccurrence) + ), +) +_sym_db.RegisterMessage(AttestationOccurrence) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/grafeas/grafeas/grafeas_v1/proto/attestation_pb2_grpc.py b/grafeas/grafeas/grafeas_v1/proto/attestation_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/attestation_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/grafeas/grafeas/grafeas_v1/proto/build.proto b/grafeas/grafeas/grafeas_v1/proto/build.proto new file mode 100644 index 000000000000..c0e9c7566540 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/build.proto @@ -0,0 +1,50 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// 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. + +syntax = "proto3"; + +package grafeas.v1; + +import "grafeas/v1/provenance.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// Note holding the version of the provider's builder and the signature of the +// provenance message in the build details occurrence. +message BuildNote { + // Required. Immutable. Version of the builder which produced this build. + string builder_version = 1; +} + +// Details of a build occurrence. +message BuildOccurrence { + // Required. The actual provenance for the build. + grafeas.v1.BuildProvenance provenance = 1; + + // Serialized JSON representation of the provenance, used in generating the + // build signature in the corresponding build note. After verifying the + // signature, `provenance_bytes` can be unmarshalled and compared to the + // provenance to confirm that it is unchanged. A base64-encoded string + // representation of the provenance bytes is used for the signature in order + // to interoperate with openssl which expects this format for signature + // verification. + // + // The serialized form is captured both to avoid ambiguity in how the + // provenance is marshalled to json as well to prevent incompatibilities with + // future changes. + string provenance_bytes = 2; +} diff --git a/grafeas/grafeas/grafeas_v1/proto/build_pb2.py b/grafeas/grafeas/grafeas_v1/proto/build_pb2.py new file mode 100644 index 000000000000..cb82d1d34b09 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/build_pb2.py @@ -0,0 +1,189 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: grafeas_v1/proto/build.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from grafeas.grafeas_v1.proto import ( + provenance_pb2 as grafeas__v1_dot_proto_dot_provenance__pb2, +) + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="grafeas_v1/proto/build.proto", + package="grafeas.v1", + syntax="proto3", + serialized_options=_b( + "\n\rio.grafeas.v1P\001Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\242\002\003GRA" + ), + serialized_pb=_b( + '\n\x1cgrafeas_v1/proto/build.proto\x12\ngrafeas.v1\x1a!grafeas_v1/proto/provenance.proto"$\n\tBuildNote\x12\x17\n\x0f\x62uilder_version\x18\x01 \x01(\t"\\\n\x0f\x42uildOccurrence\x12/\n\nprovenance\x18\x01 \x01(\x0b\x32\x1b.grafeas.v1.BuildProvenance\x12\x18\n\x10provenance_bytes\x18\x02 \x01(\tBQ\n\rio.grafeas.v1P\x01Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\xa2\x02\x03GRAb\x06proto3' + ), + dependencies=[grafeas__v1_dot_proto_dot_provenance__pb2.DESCRIPTOR], +) + + +_BUILDNOTE = _descriptor.Descriptor( + name="BuildNote", + full_name="grafeas.v1.BuildNote", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="builder_version", + full_name="grafeas.v1.BuildNote.builder_version", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=79, + serialized_end=115, +) + + +_BUILDOCCURRENCE = _descriptor.Descriptor( + name="BuildOccurrence", + full_name="grafeas.v1.BuildOccurrence", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="provenance", + full_name="grafeas.v1.BuildOccurrence.provenance", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="provenance_bytes", + full_name="grafeas.v1.BuildOccurrence.provenance_bytes", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=117, + serialized_end=209, +) + +_BUILDOCCURRENCE.fields_by_name[ + "provenance" +].message_type = grafeas__v1_dot_proto_dot_provenance__pb2._BUILDPROVENANCE +DESCRIPTOR.message_types_by_name["BuildNote"] = _BUILDNOTE +DESCRIPTOR.message_types_by_name["BuildOccurrence"] = _BUILDOCCURRENCE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +BuildNote = _reflection.GeneratedProtocolMessageType( + "BuildNote", + (_message.Message,), + dict( + DESCRIPTOR=_BUILDNOTE, + __module__="grafeas_v1.proto.build_pb2", + __doc__="""Note holding the version of the provider's builder and the signature of + the provenance message in the build details occurrence. + + + Attributes: + builder_version: + Required. Immutable. Version of the builder which produced + this build. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.BuildNote) + ), +) +_sym_db.RegisterMessage(BuildNote) + +BuildOccurrence = _reflection.GeneratedProtocolMessageType( + "BuildOccurrence", + (_message.Message,), + dict( + DESCRIPTOR=_BUILDOCCURRENCE, + __module__="grafeas_v1.proto.build_pb2", + __doc__="""Details of a build occurrence. + + + Attributes: + provenance: + Required. The actual provenance for the build. + provenance_bytes: + Serialized JSON representation of the provenance, used in + generating the build signature in the corresponding build + note. After verifying the signature, ``provenance_bytes`` can + be unmarshalled and compared to the provenance to confirm that + it is unchanged. A base64-encoded string representation of the + provenance bytes is used for the signature in order to + interoperate with openssl which expects this format for + signature verification. The serialized form is captured both + to avoid ambiguity in how the provenance is marshalled to json + as well to prevent incompatibilities with future changes. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.BuildOccurrence) + ), +) +_sym_db.RegisterMessage(BuildOccurrence) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/grafeas/grafeas/grafeas_v1/proto/build_pb2_grpc.py b/grafeas/grafeas/grafeas_v1/proto/build_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/build_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/grafeas/grafeas/grafeas_v1/proto/common.proto b/grafeas/grafeas/grafeas_v1/proto/common.proto new file mode 100644 index 000000000000..846948a5286a --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/common.proto @@ -0,0 +1,101 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// 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. + +syntax = "proto3"; + +package grafeas.v1; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// Kind represents the kinds of notes supported. +enum NoteKind { + // Unknown. + NOTE_KIND_UNSPECIFIED = 0; + // The note and occurrence represent a package vulnerability. + VULNERABILITY = 1; + // The note and occurrence assert build provenance. + BUILD = 2; + // This represents an image basis relationship. + IMAGE = 3; + // This represents a package installed via a package manager. + PACKAGE = 4; + // The note and occurrence track deployment events. + DEPLOYMENT = 5; + // The note and occurrence track the initial discovery status of a resource. + DISCOVERY = 6; + // This represents a logical "role" that can attest to artifacts. + ATTESTATION = 7; +} + +// Metadata for any related URL information. +message RelatedUrl { + // Specific URL associated with the resource. + string url = 1; + // Label to describe usage of the URL. + string label = 2; +} + +// Verifiers (e.g. Kritis implementations) MUST verify signatures +// with respect to the trust anchors defined in policy (e.g. a Kritis policy). +// Typically this means that the verifier has been configured with a map from +// `public_key_id` to public key material (and any required parameters, e.g. +// signing algorithm). +// +// In particular, verification implementations MUST NOT treat the signature +// `public_key_id` as anything more than a key lookup hint. The `public_key_id` +// DOES NOT validate or authenticate a public key; it only provides a mechanism +// for quickly selecting a public key ALREADY CONFIGURED on the verifier through +// a trusted channel. Verification implementations MUST reject signatures in any +// of the following circumstances: +// * The `public_key_id` is not recognized by the verifier. +// * The public key that `public_key_id` refers to does not verify the +// signature with respect to the payload. +// +// The `signature` contents SHOULD NOT be "attached" (where the payload is +// included with the serialized `signature` bytes). Verifiers MUST ignore any +// "attached" payload and only verify signatures with respect to explicitly +// provided payload (e.g. a `payload` field on the proto message that holds +// this Signature, or the canonical serialization of the proto message that +// holds this signature). +message Signature { + // The content of the signature, an opaque bytestring. + // The payload that this signature verifies MUST be unambiguously provided + // with the Signature during verification. A wrapper message might provide + // the payload explicitly. Alternatively, a message might have a canonical + // serialization that can always be unambiguously computed to derive the + // payload. + bytes signature = 1; + + // The identifier for the public key that verifies this signature. + // * The `public_key_id` is required. + // * The `public_key_id` MUST be an RFC3986 conformant URI. + // * When possible, the `public_key_id` SHOULD be an immutable reference, + // such as a cryptographic digest. + // + // Examples of valid `public_key_id`s: + // + // OpenPGP V4 public key fingerprint: + // * "openpgp4fpr:74FAF3B861BDA0870C7B6DEF607E48D2A663AEEA" + // See https://www.iana.org/assignments/uri-schemes/prov/openpgp4fpr for more + // details on this scheme. + // + // RFC6920 digest-named SubjectPublicKeyInfo (digest of the DER + // serialization): + // * "ni:///sha-256;cD9o9Cq6LG3jD0iKXqEi_vdjJGecm_iXkbqVoScViaU" + // * "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9bf89791ba95a1271589a5" + string public_key_id = 2; +} diff --git a/grafeas/grafeas/grafeas_v1/proto/common_pb2.py b/grafeas/grafeas/grafeas_v1/proto/common_pb2.py new file mode 100644 index 000000000000..8c4fbc1531a2 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/common_pb2.py @@ -0,0 +1,281 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: grafeas_v1/proto/common.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="grafeas_v1/proto/common.proto", + package="grafeas.v1", + syntax="proto3", + serialized_options=_b( + "\n\rio.grafeas.v1P\001Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\242\002\003GRA" + ), + serialized_pb=_b( + '\n\x1dgrafeas_v1/proto/common.proto\x12\ngrafeas.v1"(\n\nRelatedUrl\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\r\n\x05label\x18\x02 \x01(\t"5\n\tSignature\x12\x11\n\tsignature\x18\x01 \x01(\x0c\x12\x15\n\rpublic_key_id\x18\x02 \x01(\t*\x8b\x01\n\x08NoteKind\x12\x19\n\x15NOTE_KIND_UNSPECIFIED\x10\x00\x12\x11\n\rVULNERABILITY\x10\x01\x12\t\n\x05\x42UILD\x10\x02\x12\t\n\x05IMAGE\x10\x03\x12\x0b\n\x07PACKAGE\x10\x04\x12\x0e\n\nDEPLOYMENT\x10\x05\x12\r\n\tDISCOVERY\x10\x06\x12\x0f\n\x0b\x41TTESTATION\x10\x07\x42Q\n\rio.grafeas.v1P\x01Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\xa2\x02\x03GRAb\x06proto3' + ), +) + +_NOTEKIND = _descriptor.EnumDescriptor( + name="NoteKind", + full_name="grafeas.v1.NoteKind", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="NOTE_KIND_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="VULNERABILITY", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="BUILD", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="IMAGE", index=3, number=3, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="PACKAGE", index=4, number=4, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="DEPLOYMENT", index=5, number=5, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="DISCOVERY", index=6, number=6, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="ATTESTATION", index=7, number=7, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=143, + serialized_end=282, +) +_sym_db.RegisterEnumDescriptor(_NOTEKIND) + +NoteKind = enum_type_wrapper.EnumTypeWrapper(_NOTEKIND) +NOTE_KIND_UNSPECIFIED = 0 +VULNERABILITY = 1 +BUILD = 2 +IMAGE = 3 +PACKAGE = 4 +DEPLOYMENT = 5 +DISCOVERY = 6 +ATTESTATION = 7 + + +_RELATEDURL = _descriptor.Descriptor( + name="RelatedUrl", + full_name="grafeas.v1.RelatedUrl", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="url", + full_name="grafeas.v1.RelatedUrl.url", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="label", + full_name="grafeas.v1.RelatedUrl.label", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=45, + serialized_end=85, +) + + +_SIGNATURE = _descriptor.Descriptor( + name="Signature", + full_name="grafeas.v1.Signature", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="signature", + full_name="grafeas.v1.Signature.signature", + index=0, + number=1, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="public_key_id", + full_name="grafeas.v1.Signature.public_key_id", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=87, + serialized_end=140, +) + +DESCRIPTOR.message_types_by_name["RelatedUrl"] = _RELATEDURL +DESCRIPTOR.message_types_by_name["Signature"] = _SIGNATURE +DESCRIPTOR.enum_types_by_name["NoteKind"] = _NOTEKIND +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +RelatedUrl = _reflection.GeneratedProtocolMessageType( + "RelatedUrl", + (_message.Message,), + dict( + DESCRIPTOR=_RELATEDURL, + __module__="grafeas_v1.proto.common_pb2", + __doc__="""Metadata for any related URL information. + + + Attributes: + url: + Specific URL associated with the resource. + label: + Label to describe usage of the URL. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.RelatedUrl) + ), +) +_sym_db.RegisterMessage(RelatedUrl) + +Signature = _reflection.GeneratedProtocolMessageType( + "Signature", + (_message.Message,), + dict( + DESCRIPTOR=_SIGNATURE, + __module__="grafeas_v1.proto.common_pb2", + __doc__="""Verifiers (e.g. Kritis implementations) MUST verify signatures with + respect to the trust anchors defined in policy (e.g. a Kritis policy). + Typically this means that the verifier has been configured with a map + from ``public_key_id`` to public key material (and any required + parameters, e.g. signing algorithm). + + In particular, verification implementations MUST NOT treat the signature + ``public_key_id`` as anything more than a key lookup hint. The + ``public_key_id`` DOES NOT validate or authenticate a public key; it + only provides a mechanism for quickly selecting a public key ALREADY + CONFIGURED on the verifier through a trusted channel. Verification + implementations MUST reject signatures in any of the following + circumstances: \* The ``public_key_id`` is not recognized by the + verifier. \* The public key that ``public_key_id`` refers to does not + verify the signature with respect to the payload. + + The ``signature`` contents SHOULD NOT be "attached" (where the payload + is included with the serialized ``signature`` bytes). Verifiers MUST + ignore any "attached" payload and only verify signatures with respect to + explicitly provided payload (e.g. a ``payload`` field on the proto + message that holds this Signature, or the canonical serialization of the + proto message that holds this signature). + + + Attributes: + signature: + The content of the signature, an opaque bytestring. The + payload that this signature verifies MUST be unambiguously + provided with the Signature during verification. A wrapper + message might provide the payload explicitly. Alternatively, a + message might have a canonical serialization that can always + be unambiguously computed to derive the payload. + public_key_id: + The identifier for the public key that verifies this + signature. \* The ``public_key_id`` is required. \* The + ``public_key_id`` MUST be an RFC3986 conformant URI. \* When + possible, the ``public_key_id`` SHOULD be an immutable + reference, such as a cryptographic digest. Examples of valid + ``public_key_id``\ s: OpenPGP V4 public key fingerprint: \* + "openpgp4fpr:74FAF3B861BDA0870C7B6DEF607E48D2A663AEEA" See + https://www.iana.org/assignments/uri-schemes/prov/openpgp4fpr + for more details on this scheme. RFC6920 digest-named + SubjectPublicKeyInfo (digest of the DER serialization): \* + "ni:///sha-256;cD9o9Cq6LG3jD0iKXqEi\_vdjJGecm\_iXkbqVoScViaU" + \* "nih:///sha-256;703f68f42aba2c6de30f488a5ea122fef76324679c9 + bf89791ba95a1271589a5" + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.Signature) + ), +) +_sym_db.RegisterMessage(Signature) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/grafeas/grafeas/grafeas_v1/proto/common_pb2_grpc.py b/grafeas/grafeas/grafeas_v1/proto/common_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/common_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/grafeas/grafeas/grafeas_v1/proto/cvss.proto b/grafeas/grafeas/grafeas_v1/proto/cvss.proto new file mode 100644 index 000000000000..b41cd633d2a9 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/cvss.proto @@ -0,0 +1,85 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// 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. + +syntax = "proto3"; + +package grafeas.v1; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// Common Vulnerability Scoring System version 3. +// For details, see https://www.first.org/cvss/specification-document +message CVSSv3 { + // The base score is a function of the base metric scores. + float base_score = 1; + + float exploitability_score = 2; + + float impact_score = 3; + + // Base Metrics + // Represents the intrinsic characteristics of a vulnerability that are + // constant over time and across user environments. + AttackVector attack_vector = 5; + AttackComplexity attack_complexity = 6; + PrivilegesRequired privileges_required = 7; + UserInteraction user_interaction = 8; + Scope scope = 9; + Impact confidentiality_impact = 10; + Impact integrity_impact = 11; + Impact availability_impact = 12; + + enum AttackVector { + ATTACK_VECTOR_UNSPECIFIED = 0; + ATTACK_VECTOR_NETWORK = 1; + ATTACK_VECTOR_ADJACENT = 2; + ATTACK_VECTOR_LOCAL = 3; + ATTACK_VECTOR_PHYSICAL = 4; + } + + enum AttackComplexity { + ATTACK_COMPLEXITY_UNSPECIFIED = 0; + ATTACK_COMPLEXITY_LOW = 1; + ATTACK_COMPLEXITY_HIGH = 2; + } + + enum PrivilegesRequired { + PRIVILEGES_REQUIRED_UNSPECIFIED = 0; + PRIVILEGES_REQUIRED_NONE = 1; + PRIVILEGES_REQUIRED_LOW = 2; + PRIVILEGES_REQUIRED_HIGH = 3; + } + + enum UserInteraction { + USER_INTERACTION_UNSPECIFIED = 0; + USER_INTERACTION_NONE = 1; + USER_INTERACTION_REQUIRED = 2; + } + + enum Scope { + SCOPE_UNSPECIFIED = 0; + SCOPE_UNCHANGED = 1; + SCOPE_CHANGED = 2; + } + + enum Impact { + IMPACT_UNSPECIFIED = 0; + IMPACT_HIGH = 1; + IMPACT_LOW = 2; + IMPACT_NONE = 3; + } +} diff --git a/grafeas/grafeas/grafeas_v1/proto/cvss_pb2.py b/grafeas/grafeas/grafeas_v1/proto/cvss_pb2.py new file mode 100644 index 000000000000..d7d66d8a41ab --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/cvss_pb2.py @@ -0,0 +1,520 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: grafeas_v1/proto/cvss.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="grafeas_v1/proto/cvss.proto", + package="grafeas.v1", + syntax="proto3", + serialized_options=_b( + "\n\rio.grafeas.v1P\001Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\242\002\003GRA" + ), + serialized_pb=_b( + '\n\x1bgrafeas_v1/proto/cvss.proto\x12\ngrafeas.v1"\xc5\t\n\x06\x43VSSv3\x12\x12\n\nbase_score\x18\x01 \x01(\x02\x12\x1c\n\x14\x65xploitability_score\x18\x02 \x01(\x02\x12\x14\n\x0cimpact_score\x18\x03 \x01(\x02\x12\x36\n\rattack_vector\x18\x05 \x01(\x0e\x32\x1f.grafeas.v1.CVSSv3.AttackVector\x12>\n\x11\x61ttack_complexity\x18\x06 \x01(\x0e\x32#.grafeas.v1.CVSSv3.AttackComplexity\x12\x42\n\x13privileges_required\x18\x07 \x01(\x0e\x32%.grafeas.v1.CVSSv3.PrivilegesRequired\x12<\n\x10user_interaction\x18\x08 \x01(\x0e\x32".grafeas.v1.CVSSv3.UserInteraction\x12\'\n\x05scope\x18\t \x01(\x0e\x32\x18.grafeas.v1.CVSSv3.Scope\x12\x39\n\x16\x63onfidentiality_impact\x18\n \x01(\x0e\x32\x19.grafeas.v1.CVSSv3.Impact\x12\x33\n\x10integrity_impact\x18\x0b \x01(\x0e\x32\x19.grafeas.v1.CVSSv3.Impact\x12\x36\n\x13\x61vailability_impact\x18\x0c \x01(\x0e\x32\x19.grafeas.v1.CVSSv3.Impact"\x99\x01\n\x0c\x41ttackVector\x12\x1d\n\x19\x41TTACK_VECTOR_UNSPECIFIED\x10\x00\x12\x19\n\x15\x41TTACK_VECTOR_NETWORK\x10\x01\x12\x1a\n\x16\x41TTACK_VECTOR_ADJACENT\x10\x02\x12\x17\n\x13\x41TTACK_VECTOR_LOCAL\x10\x03\x12\x1a\n\x16\x41TTACK_VECTOR_PHYSICAL\x10\x04"l\n\x10\x41ttackComplexity\x12!\n\x1d\x41TTACK_COMPLEXITY_UNSPECIFIED\x10\x00\x12\x19\n\x15\x41TTACK_COMPLEXITY_LOW\x10\x01\x12\x1a\n\x16\x41TTACK_COMPLEXITY_HIGH\x10\x02"\x92\x01\n\x12PrivilegesRequired\x12#\n\x1fPRIVILEGES_REQUIRED_UNSPECIFIED\x10\x00\x12\x1c\n\x18PRIVILEGES_REQUIRED_NONE\x10\x01\x12\x1b\n\x17PRIVILEGES_REQUIRED_LOW\x10\x02\x12\x1c\n\x18PRIVILEGES_REQUIRED_HIGH\x10\x03"m\n\x0fUserInteraction\x12 \n\x1cUSER_INTERACTION_UNSPECIFIED\x10\x00\x12\x19\n\x15USER_INTERACTION_NONE\x10\x01\x12\x1d\n\x19USER_INTERACTION_REQUIRED\x10\x02"F\n\x05Scope\x12\x15\n\x11SCOPE_UNSPECIFIED\x10\x00\x12\x13\n\x0fSCOPE_UNCHANGED\x10\x01\x12\x11\n\rSCOPE_CHANGED\x10\x02"R\n\x06Impact\x12\x16\n\x12IMPACT_UNSPECIFIED\x10\x00\x12\x0f\n\x0bIMPACT_HIGH\x10\x01\x12\x0e\n\nIMPACT_LOW\x10\x02\x12\x0f\n\x0bIMPACT_NONE\x10\x03\x42Q\n\rio.grafeas.v1P\x01Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\xa2\x02\x03GRAb\x06proto3' + ), +) + + +_CVSSV3_ATTACKVECTOR = _descriptor.EnumDescriptor( + name="AttackVector", + full_name="grafeas.v1.CVSSv3.AttackVector", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="ATTACK_VECTOR_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="ATTACK_VECTOR_NETWORK", + index=1, + number=1, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="ATTACK_VECTOR_ADJACENT", + index=2, + number=2, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="ATTACK_VECTOR_LOCAL", + index=3, + number=3, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="ATTACK_VECTOR_PHYSICAL", + index=4, + number=4, + serialized_options=None, + type=None, + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=586, + serialized_end=739, +) +_sym_db.RegisterEnumDescriptor(_CVSSV3_ATTACKVECTOR) + +_CVSSV3_ATTACKCOMPLEXITY = _descriptor.EnumDescriptor( + name="AttackComplexity", + full_name="grafeas.v1.CVSSv3.AttackComplexity", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="ATTACK_COMPLEXITY_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="ATTACK_COMPLEXITY_LOW", + index=1, + number=1, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="ATTACK_COMPLEXITY_HIGH", + index=2, + number=2, + serialized_options=None, + type=None, + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=741, + serialized_end=849, +) +_sym_db.RegisterEnumDescriptor(_CVSSV3_ATTACKCOMPLEXITY) + +_CVSSV3_PRIVILEGESREQUIRED = _descriptor.EnumDescriptor( + name="PrivilegesRequired", + full_name="grafeas.v1.CVSSv3.PrivilegesRequired", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="PRIVILEGES_REQUIRED_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="PRIVILEGES_REQUIRED_NONE", + index=1, + number=1, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="PRIVILEGES_REQUIRED_LOW", + index=2, + number=2, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="PRIVILEGES_REQUIRED_HIGH", + index=3, + number=3, + serialized_options=None, + type=None, + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=852, + serialized_end=998, +) +_sym_db.RegisterEnumDescriptor(_CVSSV3_PRIVILEGESREQUIRED) + +_CVSSV3_USERINTERACTION = _descriptor.EnumDescriptor( + name="UserInteraction", + full_name="grafeas.v1.CVSSv3.UserInteraction", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="USER_INTERACTION_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="USER_INTERACTION_NONE", + index=1, + number=1, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="USER_INTERACTION_REQUIRED", + index=2, + number=2, + serialized_options=None, + type=None, + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=1000, + serialized_end=1109, +) +_sym_db.RegisterEnumDescriptor(_CVSSV3_USERINTERACTION) + +_CVSSV3_SCOPE = _descriptor.EnumDescriptor( + name="Scope", + full_name="grafeas.v1.CVSSv3.Scope", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="SCOPE_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="SCOPE_UNCHANGED", + index=1, + number=1, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="SCOPE_CHANGED", index=2, number=2, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=1111, + serialized_end=1181, +) +_sym_db.RegisterEnumDescriptor(_CVSSV3_SCOPE) + +_CVSSV3_IMPACT = _descriptor.EnumDescriptor( + name="Impact", + full_name="grafeas.v1.CVSSv3.Impact", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="IMPACT_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="IMPACT_HIGH", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="IMPACT_LOW", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="IMPACT_NONE", index=3, number=3, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=1183, + serialized_end=1265, +) +_sym_db.RegisterEnumDescriptor(_CVSSV3_IMPACT) + + +_CVSSV3 = _descriptor.Descriptor( + name="CVSSv3", + full_name="grafeas.v1.CVSSv3", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="base_score", + full_name="grafeas.v1.CVSSv3.base_score", + index=0, + number=1, + type=2, + cpp_type=6, + label=1, + has_default_value=False, + default_value=float(0), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="exploitability_score", + full_name="grafeas.v1.CVSSv3.exploitability_score", + index=1, + number=2, + type=2, + cpp_type=6, + label=1, + has_default_value=False, + default_value=float(0), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="impact_score", + full_name="grafeas.v1.CVSSv3.impact_score", + index=2, + number=3, + type=2, + cpp_type=6, + label=1, + has_default_value=False, + default_value=float(0), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="attack_vector", + full_name="grafeas.v1.CVSSv3.attack_vector", + index=3, + number=5, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="attack_complexity", + full_name="grafeas.v1.CVSSv3.attack_complexity", + index=4, + number=6, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="privileges_required", + full_name="grafeas.v1.CVSSv3.privileges_required", + index=5, + number=7, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="user_interaction", + full_name="grafeas.v1.CVSSv3.user_interaction", + index=6, + number=8, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="scope", + full_name="grafeas.v1.CVSSv3.scope", + index=7, + number=9, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="confidentiality_impact", + full_name="grafeas.v1.CVSSv3.confidentiality_impact", + index=8, + number=10, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="integrity_impact", + full_name="grafeas.v1.CVSSv3.integrity_impact", + index=9, + number=11, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="availability_impact", + full_name="grafeas.v1.CVSSv3.availability_impact", + index=10, + number=12, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[ + _CVSSV3_ATTACKVECTOR, + _CVSSV3_ATTACKCOMPLEXITY, + _CVSSV3_PRIVILEGESREQUIRED, + _CVSSV3_USERINTERACTION, + _CVSSV3_SCOPE, + _CVSSV3_IMPACT, + ], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=44, + serialized_end=1265, +) + +_CVSSV3.fields_by_name["attack_vector"].enum_type = _CVSSV3_ATTACKVECTOR +_CVSSV3.fields_by_name["attack_complexity"].enum_type = _CVSSV3_ATTACKCOMPLEXITY +_CVSSV3.fields_by_name["privileges_required"].enum_type = _CVSSV3_PRIVILEGESREQUIRED +_CVSSV3.fields_by_name["user_interaction"].enum_type = _CVSSV3_USERINTERACTION +_CVSSV3.fields_by_name["scope"].enum_type = _CVSSV3_SCOPE +_CVSSV3.fields_by_name["confidentiality_impact"].enum_type = _CVSSV3_IMPACT +_CVSSV3.fields_by_name["integrity_impact"].enum_type = _CVSSV3_IMPACT +_CVSSV3.fields_by_name["availability_impact"].enum_type = _CVSSV3_IMPACT +_CVSSV3_ATTACKVECTOR.containing_type = _CVSSV3 +_CVSSV3_ATTACKCOMPLEXITY.containing_type = _CVSSV3 +_CVSSV3_PRIVILEGESREQUIRED.containing_type = _CVSSV3 +_CVSSV3_USERINTERACTION.containing_type = _CVSSV3 +_CVSSV3_SCOPE.containing_type = _CVSSV3 +_CVSSV3_IMPACT.containing_type = _CVSSV3 +DESCRIPTOR.message_types_by_name["CVSSv3"] = _CVSSV3 +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +CVSSv3 = _reflection.GeneratedProtocolMessageType( + "CVSSv3", + (_message.Message,), + dict( + DESCRIPTOR=_CVSSV3, + __module__="grafeas_v1.proto.cvss_pb2", + __doc__="""Common Vulnerability Scoring System version 3. For details, see + https://www.first.org/cvss/specification-document + + + Attributes: + base_score: + The base score is a function of the base metric scores. + attack_vector: + Base Metrics Represents the intrinsic characteristics of a + vulnerability that are constant over time and across user + environments. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.CVSSv3) + ), +) +_sym_db.RegisterMessage(CVSSv3) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/grafeas/grafeas/grafeas_v1/proto/cvss_pb2_grpc.py b/grafeas/grafeas/grafeas_v1/proto/cvss_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/cvss_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/grafeas/grafeas/grafeas_v1/proto/deployment.proto b/grafeas/grafeas/grafeas_v1/proto/deployment.proto new file mode 100644 index 000000000000..5204004fd646 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/deployment.proto @@ -0,0 +1,66 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// 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. + +syntax = "proto3"; + +package grafeas.v1; + +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// An artifact that can be deployed in some runtime. +message DeploymentNote { + // Required. Resource URI for the artifact being deployed. + repeated string resource_uri = 1; +} + +// The period during which some deployable was active in a runtime. +message DeploymentOccurrence { + // Identity of the user that triggered this deployment. + string user_email = 1; + + // Required. Beginning of the lifetime of this deployment. + google.protobuf.Timestamp deploy_time = 2; + + // End of the lifetime of this deployment. + google.protobuf.Timestamp undeploy_time = 3; + + // Configuration used to create this deployment. + string config = 4; + + // Address of the runtime element hosting this deployment. + string address = 5; + + // Output only. Resource URI for the artifact being deployed taken from + // the deployable field with the same name. + repeated string resource_uri = 6; + + // Types of platforms. + enum Platform { + // Unknown. + PLATFORM_UNSPECIFIED = 0; + // Google Container Engine. + GKE = 1; + // Google App Engine: Flexible Environment. + FLEX = 2; + // Custom user-defined platform. + CUSTOM = 3; + } + // Platform hosting this deployment. + Platform platform = 7; +} diff --git a/grafeas/grafeas/grafeas_v1/proto/deployment_pb2.py b/grafeas/grafeas/grafeas_v1/proto/deployment_pb2.py new file mode 100644 index 000000000000..6049826f2405 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/deployment_pb2.py @@ -0,0 +1,315 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: grafeas_v1/proto/deployment.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="grafeas_v1/proto/deployment.proto", + package="grafeas.v1", + syntax="proto3", + serialized_options=_b( + "\n\rio.grafeas.v1P\001Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\242\002\003GRA" + ), + serialized_pb=_b( + '\n!grafeas_v1/proto/deployment.proto\x12\ngrafeas.v1\x1a\x1fgoogle/protobuf/timestamp.proto"&\n\x0e\x44\x65ploymentNote\x12\x14\n\x0cresource_uri\x18\x01 \x03(\t"\xc7\x02\n\x14\x44\x65ploymentOccurrence\x12\x12\n\nuser_email\x18\x01 \x01(\t\x12/\n\x0b\x64\x65ploy_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x31\n\rundeploy_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0e\n\x06\x63onfig\x18\x04 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x05 \x01(\t\x12\x14\n\x0cresource_uri\x18\x06 \x03(\t\x12;\n\x08platform\x18\x07 \x01(\x0e\x32).grafeas.v1.DeploymentOccurrence.Platform"C\n\x08Platform\x12\x18\n\x14PLATFORM_UNSPECIFIED\x10\x00\x12\x07\n\x03GKE\x10\x01\x12\x08\n\x04\x46LEX\x10\x02\x12\n\n\x06\x43USTOM\x10\x03\x42Q\n\rio.grafeas.v1P\x01Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\xa2\x02\x03GRAb\x06proto3' + ), + dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR], +) + + +_DEPLOYMENTOCCURRENCE_PLATFORM = _descriptor.EnumDescriptor( + name="Platform", + full_name="grafeas.v1.DeploymentOccurrence.Platform", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="PLATFORM_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="GKE", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="FLEX", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="CUSTOM", index=3, number=3, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=383, + serialized_end=450, +) +_sym_db.RegisterEnumDescriptor(_DEPLOYMENTOCCURRENCE_PLATFORM) + + +_DEPLOYMENTNOTE = _descriptor.Descriptor( + name="DeploymentNote", + full_name="grafeas.v1.DeploymentNote", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="resource_uri", + full_name="grafeas.v1.DeploymentNote.resource_uri", + index=0, + number=1, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=82, + serialized_end=120, +) + + +_DEPLOYMENTOCCURRENCE = _descriptor.Descriptor( + name="DeploymentOccurrence", + full_name="grafeas.v1.DeploymentOccurrence", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="user_email", + full_name="grafeas.v1.DeploymentOccurrence.user_email", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="deploy_time", + full_name="grafeas.v1.DeploymentOccurrence.deploy_time", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="undeploy_time", + full_name="grafeas.v1.DeploymentOccurrence.undeploy_time", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="config", + full_name="grafeas.v1.DeploymentOccurrence.config", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="address", + full_name="grafeas.v1.DeploymentOccurrence.address", + index=4, + number=5, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="resource_uri", + full_name="grafeas.v1.DeploymentOccurrence.resource_uri", + index=5, + number=6, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="platform", + full_name="grafeas.v1.DeploymentOccurrence.platform", + index=6, + number=7, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[_DEPLOYMENTOCCURRENCE_PLATFORM], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=123, + serialized_end=450, +) + +_DEPLOYMENTOCCURRENCE.fields_by_name[ + "deploy_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_DEPLOYMENTOCCURRENCE.fields_by_name[ + "undeploy_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_DEPLOYMENTOCCURRENCE.fields_by_name[ + "platform" +].enum_type = _DEPLOYMENTOCCURRENCE_PLATFORM +_DEPLOYMENTOCCURRENCE_PLATFORM.containing_type = _DEPLOYMENTOCCURRENCE +DESCRIPTOR.message_types_by_name["DeploymentNote"] = _DEPLOYMENTNOTE +DESCRIPTOR.message_types_by_name["DeploymentOccurrence"] = _DEPLOYMENTOCCURRENCE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +DeploymentNote = _reflection.GeneratedProtocolMessageType( + "DeploymentNote", + (_message.Message,), + dict( + DESCRIPTOR=_DEPLOYMENTNOTE, + __module__="grafeas_v1.proto.deployment_pb2", + __doc__="""An artifact that can be deployed in some runtime. + + + Attributes: + resource_uri: + Required. Resource URI for the artifact being deployed. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.DeploymentNote) + ), +) +_sym_db.RegisterMessage(DeploymentNote) + +DeploymentOccurrence = _reflection.GeneratedProtocolMessageType( + "DeploymentOccurrence", + (_message.Message,), + dict( + DESCRIPTOR=_DEPLOYMENTOCCURRENCE, + __module__="grafeas_v1.proto.deployment_pb2", + __doc__="""The period during which some deployable was active in a runtime. + + + Attributes: + user_email: + Identity of the user that triggered this deployment. + deploy_time: + Required. Beginning of the lifetime of this deployment. + undeploy_time: + End of the lifetime of this deployment. + config: + Configuration used to create this deployment. + address: + Address of the runtime element hosting this deployment. + resource_uri: + Output only. Resource URI for the artifact being deployed + taken from the deployable field with the same name. + platform: + Platform hosting this deployment. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.DeploymentOccurrence) + ), +) +_sym_db.RegisterMessage(DeploymentOccurrence) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/grafeas/grafeas/grafeas_v1/proto/deployment_pb2_grpc.py b/grafeas/grafeas/grafeas_v1/proto/deployment_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/deployment_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/grafeas/grafeas/grafeas_v1/proto/discovery.proto b/grafeas/grafeas/grafeas_v1/proto/discovery.proto new file mode 100644 index 000000000000..ba8034d38d9b --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/discovery.proto @@ -0,0 +1,76 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// 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. + +syntax = "proto3"; + +package grafeas.v1; + +import "google/rpc/status.proto"; +import "grafeas/v1/common.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// A note that indicates a type of analysis a provider would perform. This note +// exists in a provider's project. A `Discovery` occurrence is created in a +// consumer's project at the start of analysis. +message DiscoveryNote { + // Required. Immutable. The kind of analysis that is handled by this + // discovery. + grafeas.v1.NoteKind analysis_kind = 1; +} + +// Provides information about the analysis status of a discovered resource. +message DiscoveryOccurrence { + // Whether the resource is continuously analyzed. + enum ContinuousAnalysis { + // Unknown. + CONTINUOUS_ANALYSIS_UNSPECIFIED = 0; + // The resource is continuously analyzed. + ACTIVE = 1; + // The resource is ignored for continuous analysis. + INACTIVE = 2; + } + + // Whether the resource is continuously analyzed. + ContinuousAnalysis continuous_analysis = 1; + + // Analysis status for a resource. Currently for initial analysis only (not + // updated in continuous analysis). + enum AnalysisStatus { + // Unknown. + ANALYSIS_STATUS_UNSPECIFIED = 0; + // Resource is known but no action has been taken yet. + PENDING = 1; + // Resource is being analyzed. + SCANNING = 2; + // Analysis has finished successfully. + FINISHED_SUCCESS = 3; + // Analysis has finished unsuccessfully, the analysis itself is in a bad + // state. + FINISHED_FAILED = 4; + // The resource is known not to be supported + FINISHED_UNSUPPORTED = 5; + } + + // The status of discovery for the resource. + AnalysisStatus analysis_status = 2; + + // When an error is encountered this will contain a LocalizedMessage under + // details to show to the user. The LocalizedMessage is output only and + // populated by the API. + google.rpc.Status analysis_status_error = 3; +} diff --git a/grafeas/grafeas/grafeas_v1/proto/discovery_pb2.py b/grafeas/grafeas/grafeas_v1/proto/discovery_pb2.py new file mode 100644 index 000000000000..f6381166c7ec --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/discovery_pb2.py @@ -0,0 +1,295 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: grafeas_v1/proto/discovery.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.rpc import status_pb2 as google_dot_rpc_dot_status__pb2 +from grafeas.grafeas_v1.proto import common_pb2 as grafeas__v1_dot_proto_dot_common__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="grafeas_v1/proto/discovery.proto", + package="grafeas.v1", + syntax="proto3", + serialized_options=_b( + "\n\rio.grafeas.v1P\001Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\242\002\003GRA" + ), + serialized_pb=_b( + '\n grafeas_v1/proto/discovery.proto\x12\ngrafeas.v1\x1a\x17google/rpc/status.proto\x1a\x1dgrafeas_v1/proto/common.proto"<\n\rDiscoveryNote\x12+\n\ranalysis_kind\x18\x01 \x01(\x0e\x32\x14.grafeas.v1.NoteKind"\xcb\x03\n\x13\x44iscoveryOccurrence\x12O\n\x13\x63ontinuous_analysis\x18\x01 \x01(\x0e\x32\x32.grafeas.v1.DiscoveryOccurrence.ContinuousAnalysis\x12G\n\x0f\x61nalysis_status\x18\x02 \x01(\x0e\x32..grafeas.v1.DiscoveryOccurrence.AnalysisStatus\x12\x31\n\x15\x61nalysis_status_error\x18\x03 \x01(\x0b\x32\x12.google.rpc.Status"S\n\x12\x43ontinuousAnalysis\x12#\n\x1f\x43ONTINUOUS_ANALYSIS_UNSPECIFIED\x10\x00\x12\n\n\x06\x41\x43TIVE\x10\x01\x12\x0c\n\x08INACTIVE\x10\x02"\x91\x01\n\x0e\x41nalysisStatus\x12\x1f\n\x1b\x41NALYSIS_STATUS_UNSPECIFIED\x10\x00\x12\x0b\n\x07PENDING\x10\x01\x12\x0c\n\x08SCANNING\x10\x02\x12\x14\n\x10\x46INISHED_SUCCESS\x10\x03\x12\x13\n\x0f\x46INISHED_FAILED\x10\x04\x12\x18\n\x14\x46INISHED_UNSUPPORTED\x10\x05\x42Q\n\rio.grafeas.v1P\x01Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\xa2\x02\x03GRAb\x06proto3' + ), + dependencies=[ + google_dot_rpc_dot_status__pb2.DESCRIPTOR, + grafeas__v1_dot_proto_dot_common__pb2.DESCRIPTOR, + ], +) + + +_DISCOVERYOCCURRENCE_CONTINUOUSANALYSIS = _descriptor.EnumDescriptor( + name="ContinuousAnalysis", + full_name="grafeas.v1.DiscoveryOccurrence.ContinuousAnalysis", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="CONTINUOUS_ANALYSIS_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="ACTIVE", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="INACTIVE", index=2, number=2, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=395, + serialized_end=478, +) +_sym_db.RegisterEnumDescriptor(_DISCOVERYOCCURRENCE_CONTINUOUSANALYSIS) + +_DISCOVERYOCCURRENCE_ANALYSISSTATUS = _descriptor.EnumDescriptor( + name="AnalysisStatus", + full_name="grafeas.v1.DiscoveryOccurrence.AnalysisStatus", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="ANALYSIS_STATUS_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="PENDING", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="SCANNING", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="FINISHED_SUCCESS", + index=3, + number=3, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="FINISHED_FAILED", + index=4, + number=4, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="FINISHED_UNSUPPORTED", + index=5, + number=5, + serialized_options=None, + type=None, + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=481, + serialized_end=626, +) +_sym_db.RegisterEnumDescriptor(_DISCOVERYOCCURRENCE_ANALYSISSTATUS) + + +_DISCOVERYNOTE = _descriptor.Descriptor( + name="DiscoveryNote", + full_name="grafeas.v1.DiscoveryNote", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="analysis_kind", + full_name="grafeas.v1.DiscoveryNote.analysis_kind", + index=0, + number=1, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=104, + serialized_end=164, +) + + +_DISCOVERYOCCURRENCE = _descriptor.Descriptor( + name="DiscoveryOccurrence", + full_name="grafeas.v1.DiscoveryOccurrence", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="continuous_analysis", + full_name="grafeas.v1.DiscoveryOccurrence.continuous_analysis", + index=0, + number=1, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="analysis_status", + full_name="grafeas.v1.DiscoveryOccurrence.analysis_status", + index=1, + number=2, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="analysis_status_error", + full_name="grafeas.v1.DiscoveryOccurrence.analysis_status_error", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[ + _DISCOVERYOCCURRENCE_CONTINUOUSANALYSIS, + _DISCOVERYOCCURRENCE_ANALYSISSTATUS, + ], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=167, + serialized_end=626, +) + +_DISCOVERYNOTE.fields_by_name[ + "analysis_kind" +].enum_type = grafeas__v1_dot_proto_dot_common__pb2._NOTEKIND +_DISCOVERYOCCURRENCE.fields_by_name[ + "continuous_analysis" +].enum_type = _DISCOVERYOCCURRENCE_CONTINUOUSANALYSIS +_DISCOVERYOCCURRENCE.fields_by_name[ + "analysis_status" +].enum_type = _DISCOVERYOCCURRENCE_ANALYSISSTATUS +_DISCOVERYOCCURRENCE.fields_by_name[ + "analysis_status_error" +].message_type = google_dot_rpc_dot_status__pb2._STATUS +_DISCOVERYOCCURRENCE_CONTINUOUSANALYSIS.containing_type = _DISCOVERYOCCURRENCE +_DISCOVERYOCCURRENCE_ANALYSISSTATUS.containing_type = _DISCOVERYOCCURRENCE +DESCRIPTOR.message_types_by_name["DiscoveryNote"] = _DISCOVERYNOTE +DESCRIPTOR.message_types_by_name["DiscoveryOccurrence"] = _DISCOVERYOCCURRENCE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +DiscoveryNote = _reflection.GeneratedProtocolMessageType( + "DiscoveryNote", + (_message.Message,), + dict( + DESCRIPTOR=_DISCOVERYNOTE, + __module__="grafeas_v1.proto.discovery_pb2", + __doc__="""A note that indicates a type of analysis a provider would perform. This + note exists in a provider's project. A ``Discovery`` occurrence is + created in a consumer's project at the start of analysis. + + + Attributes: + analysis_kind: + Required. Immutable. The kind of analysis that is handled by + this discovery. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.DiscoveryNote) + ), +) +_sym_db.RegisterMessage(DiscoveryNote) + +DiscoveryOccurrence = _reflection.GeneratedProtocolMessageType( + "DiscoveryOccurrence", + (_message.Message,), + dict( + DESCRIPTOR=_DISCOVERYOCCURRENCE, + __module__="grafeas_v1.proto.discovery_pb2", + __doc__="""Provides information about the analysis status of a discovered resource. + + + Attributes: + continuous_analysis: + Whether the resource is continuously analyzed. + analysis_status: + The status of discovery for the resource. + analysis_status_error: + When an error is encountered this will contain a + LocalizedMessage under details to show to the user. The + LocalizedMessage is output only and populated by the API. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.DiscoveryOccurrence) + ), +) +_sym_db.RegisterMessage(DiscoveryOccurrence) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/grafeas/grafeas/grafeas_v1/proto/discovery_pb2_grpc.py b/grafeas/grafeas/grafeas_v1/proto/discovery_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/discovery_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/grafeas/grafeas/grafeas_v1/proto/grafeas.proto b/grafeas/grafeas/grafeas_v1/proto/grafeas.proto new file mode 100644 index 000000000000..1364b2aae63d --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/grafeas.proto @@ -0,0 +1,452 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// 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. + +syntax = "proto3"; + +package grafeas.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "grafeas/v1/attestation.proto"; +import "grafeas/v1/build.proto"; +import "grafeas/v1/common.proto"; +import "grafeas/v1/deployment.proto"; +import "grafeas/v1/discovery.proto"; +import "grafeas/v1/image.proto"; +import "grafeas/v1/package.proto"; +import "grafeas/v1/provenance.proto"; +import "grafeas/v1/vulnerability.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// [Grafeas](https://grafeas.io) API. +// +// Retrieves analysis results of Cloud components such as Docker container +// images. +// +// Analysis results are stored as a series of occurrences. An `Occurrence` +// contains information about a specific analysis instance on a resource. An +// occurrence refers to a `Note`. A note contains details describing the +// analysis and is generally stored in a separate project, called a `Provider`. +// Multiple occurrences can refer to the same note. +// +// For example, an SSL vulnerability could affect multiple images. In this case, +// there would be one note for the vulnerability and an occurrence for each +// image with the vulnerability referring to that note. +service Grafeas { + // Gets the specified occurrence. + rpc GetOccurrence(GetOccurrenceRequest) returns (Occurrence) { + option (google.api.http) = { + get: "/v1/{name=projects/*/occurrences/*}" + }; + } + + // Lists occurrences for the specified project. + rpc ListOccurrences(ListOccurrencesRequest) + returns (ListOccurrencesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/occurrences" + }; + } + + // Deletes the specified occurrence. For example, use this method to delete an + // occurrence when the occurrence is no longer applicable for the given + // resource. + rpc DeleteOccurrence(DeleteOccurrenceRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/occurrences/*}" + }; + } + + // Creates a new occurrence. + rpc CreateOccurrence(CreateOccurrenceRequest) returns (Occurrence) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/occurrences" + body: "occurrence" + }; + } + + // Creates new occurrences in batch. + rpc BatchCreateOccurrences(BatchCreateOccurrencesRequest) + returns (BatchCreateOccurrencesResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/occurrences:batchCreate" + body: "*" + }; + } + + // Updates the specified occurrence. + rpc UpdateOccurrence(UpdateOccurrenceRequest) returns (Occurrence) { + option (google.api.http) = { + patch: "/v1/{name=projects/*/occurrences/*}" + body: "occurrence" + }; + } + + // Gets the note attached to the specified occurrence. Consumer projects can + // use this method to get a note that belongs to a provider project. + rpc GetOccurrenceNote(GetOccurrenceNoteRequest) returns (Note) { + option (google.api.http) = { + get: "/v1/{name=projects/*/occurrences/*}/notes" + }; + } + + // Gets the specified note. + rpc GetNote(GetNoteRequest) returns (Note) { + option (google.api.http) = { + get: "/v1/{name=projects/*/notes/*}" + }; + } + + // Lists notes for the specified project. + rpc ListNotes(ListNotesRequest) returns (ListNotesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/notes" + }; + } + + // Deletes the specified note. + rpc DeleteNote(DeleteNoteRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/notes/*}" + }; + } + + // Creates a new note. + rpc CreateNote(CreateNoteRequest) returns (Note) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/notes" + body: "note" + }; + } + + // Creates new notes in batch. + rpc BatchCreateNotes(BatchCreateNotesRequest) + returns (BatchCreateNotesResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/notes:batchCreate" + body: "*" + }; + } + + // Updates the specified note. + rpc UpdateNote(UpdateNoteRequest) returns (Note) { + option (google.api.http) = { + patch: "/v1/{name=projects/*/notes/*}" + body: "note" + }; + } + + // Lists occurrences referencing the specified note. Provider projects can use + // this method to get all occurrences across consumer projects referencing the + // specified note. + rpc ListNoteOccurrences(ListNoteOccurrencesRequest) + returns (ListNoteOccurrencesResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/notes/*}/occurrences" + }; + } +} + +// An instance of an analysis type that has been found on a resource. +message Occurrence { + // Output only. The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1; + + // Required. Immutable. A URI that represents the resource for which the + // occurrence applies. For example, + // `https://gcr.io/project/image@sha256:123abc` for a Docker image. + string resource_uri = 2; + + // Required. Immutable. The analysis note associated with this occurrence, in + // the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be + // used as a filter in list requests. + string note_name = 3; + + // Output only. This explicitly denotes which of the occurrence details are + // specified. This field can be used as a filter in list requests. + grafeas.v1.NoteKind kind = 4; + + // A description of actions that can be taken to remedy the note. + string remediation = 5; + + // Output only. The time this occurrence was created. + google.protobuf.Timestamp create_time = 6; + + // Output only. The time this occurrence was last updated. + google.protobuf.Timestamp update_time = 7; + + // Required. Immutable. Describes the details of the note kind found on this + // resource. + oneof details { + // Describes a security vulnerability. + grafeas.v1.VulnerabilityOccurrence vulnerability = 8; + // Describes a verifiable build. + grafeas.v1.BuildOccurrence build = 9; + // Describes how this resource derives from the basis in the associated + // note. + grafeas.v1.ImageOccurrence image = 10; + // Describes the installation of a package on the linked resource. + grafeas.v1.PackageOccurrence package = 11; + // Describes the deployment of an artifact on a runtime. + grafeas.v1.DeploymentOccurrence deployment = 12; + // Describes when a resource was discovered. + grafeas.v1.DiscoveryOccurrence discovery = 13; + // Describes an attestation of an artifact. + grafeas.v1.AttestationOccurrence attestation = 14; + } +} + +// A type of analysis that can be done for a resource. +message Note { + // Output only. The name of the note in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1; + + // A one sentence description of this note. + string short_description = 2; + + // A detailed description of this note. + string long_description = 3; + + // Output only. The type of analysis. This field can be used as a filter in + // list requests. + grafeas.v1.NoteKind kind = 4; + + // URLs associated with this note. + repeated grafeas.v1.RelatedUrl related_url = 5; + + // Time of expiration for this note. Empty if note does not expire. + google.protobuf.Timestamp expiration_time = 6; + + // Output only. The time this note was created. This field can be used as a + // filter in list requests. + google.protobuf.Timestamp create_time = 7; + + // Output only. The time this note was last updated. This field can be used as + // a filter in list requests. + google.protobuf.Timestamp update_time = 8; + + // Other notes related to this note. + repeated string related_note_names = 9; + + // Required. Immutable. The type of analysis this note represents. + oneof type { + // A note describing a package vulnerability. + grafeas.v1.VulnerabilityNote vulnerability = 10; + // A note describing build provenance for a verifiable build. + grafeas.v1.BuildNote build = 11; + // A note describing a base image. + grafeas.v1.ImageNote image = 12; + // A note describing a package hosted by various package managers. + grafeas.v1.PackageNote package = 13; + // A note describing something that can be deployed. + grafeas.v1.DeploymentNote deployment = 14; + // A note describing the initial analysis of a resource. + grafeas.v1.DiscoveryNote discovery = 15; + // A note describing an attestation role. + grafeas.v1.AttestationNote attestation = 16; + } +} + +// Request to get an occurrence. +message GetOccurrenceRequest { + // The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1; +} + +// Request to list occurrences. +message ListOccurrencesRequest { + // The name of the project to list occurrences for in the form of + // `projects/[PROJECT_ID]`. + string parent = 1; + + // The filter expression. + string filter = 2; + + // Number of occurrences to return in the list. Must be positive. Max allowed + // page size is 1000. If not specified, page size defaults to 20. + int32 page_size = 3; + + // Token to provide to skip to a particular spot in the list. + string page_token = 4; +} + +// Response for listing occurrences. +message ListOccurrencesResponse { + // The occurrences requested. + repeated Occurrence occurrences = 1; + // The next pagination token in the list response. It should be used as + // `page_token` for the following request. An empty value means no more + // results. + string next_page_token = 2; +} + +// Request to delete a occurrence. +message DeleteOccurrenceRequest { + // The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1; +} + +// Request to create a new occurrence. +message CreateOccurrenceRequest { + // The name of the project in the form of `projects/[PROJECT_ID]`, under which + // the occurrence is to be created. + string parent = 1; + // The occurrence to create. + Occurrence occurrence = 2; +} + +// Request to update an occurrence. +message UpdateOccurrenceRequest { + // The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1; + // The updated occurrence. + Occurrence occurrence = 2; + // The fields to update. + google.protobuf.FieldMask update_mask = 3; +} + +// Request to get a note. +message GetNoteRequest { + // The name of the note in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1; +} + +// Request to get the note to which the specified occurrence is attached. +message GetOccurrenceNoteRequest { + // The name of the occurrence in the form of + // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. + string name = 1; +} + +// Request to list notes. +message ListNotesRequest { + // The name of the project to list notes for in the form of + // `projects/[PROJECT_ID]`. + string parent = 1; + + // The filter expression. + string filter = 2; + + // Number of notes to return in the list. Must be positive. Max allowed page + // size is 1000. If not specified, page size defaults to 20. + int32 page_size = 3; + + // Token to provide to skip to a particular spot in the list. + string page_token = 4; +} + +// Response for listing notes. +message ListNotesResponse { + // The notes requested. + repeated Note notes = 1; + // The next pagination token in the list response. It should be used as + // `page_token` for the following request. An empty value means no more + // results. + string next_page_token = 2; +} + +// Request to delete a note. +message DeleteNoteRequest { + // The name of the note in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1; +} + +// Request to create a new note. +message CreateNoteRequest { + // The name of the project in the form of `projects/[PROJECT_ID]`, under which + // the note is to be created. + string parent = 1; + // The ID to use for this note. + string note_id = 2; + // The note to create. + Note note = 3; +} + +// Request to update a note. +message UpdateNoteRequest { + // The name of the note in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1; + // The updated note. + Note note = 2; + // The fields to update. + google.protobuf.FieldMask update_mask = 3; +} + +// Request to list occurrences for a note. +message ListNoteOccurrencesRequest { + // The name of the note to list occurrences for in the form of + // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. + string name = 1; + // The filter expression. + string filter = 2; + // Number of occurrences to return in the list. + int32 page_size = 3; + // Token to provide to skip to a particular spot in the list. + string page_token = 4; +} + +// Response for listing occurrences for a note. +message ListNoteOccurrencesResponse { + // The occurrences attached to the specified note. + repeated Occurrence occurrences = 1; + // Token to provide to skip to a particular spot in the list. + string next_page_token = 2; +} + +// Request to create notes in batch. +message BatchCreateNotesRequest { + // The name of the project in the form of `projects/[PROJECT_ID]`, under which + // the notes are to be created. + string parent = 1; + + // The notes to create. Max allowed length is 1000. + map notes = 2; +} + +// Response for creating notes in batch. +message BatchCreateNotesResponse { + // The notes that were created. + repeated Note notes = 1; +} + +// Request to create occurrences in batch. +message BatchCreateOccurrencesRequest { + // The name of the project in the form of `projects/[PROJECT_ID]`, under which + // the occurrences are to be created. + string parent = 1; + + // The occurrences to create. Max allowed length is 1000. + repeated Occurrence occurrences = 2; +} + +// Response for creating occurrences in batch. +message BatchCreateOccurrencesResponse { + // The occurrences that were created. + repeated Occurrence occurrences = 1; +} diff --git a/grafeas/grafeas/grafeas_v1/proto/grafeas_pb2.py b/grafeas/grafeas/grafeas_v1/proto/grafeas_pb2.py new file mode 100644 index 000000000000..49a2370997e2 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/grafeas_pb2.py @@ -0,0 +1,2720 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: grafeas_v1/proto/grafeas.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 +from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 +from grafeas.grafeas_v1.proto import ( + attestation_pb2 as grafeas__v1_dot_proto_dot_attestation__pb2, +) +from grafeas.grafeas_v1.proto import build_pb2 as grafeas__v1_dot_proto_dot_build__pb2 +from grafeas.grafeas_v1.proto import common_pb2 as grafeas__v1_dot_proto_dot_common__pb2 +from grafeas.grafeas_v1.proto import ( + deployment_pb2 as grafeas__v1_dot_proto_dot_deployment__pb2, +) +from grafeas.grafeas_v1.proto import ( + discovery_pb2 as grafeas__v1_dot_proto_dot_discovery__pb2, +) +from grafeas.grafeas_v1.proto import image_pb2 as grafeas__v1_dot_proto_dot_image__pb2 +from grafeas.grafeas_v1.proto import ( + package_pb2 as grafeas__v1_dot_proto_dot_package__pb2, +) +from grafeas.grafeas_v1.proto import ( + provenance_pb2 as grafeas__v1_dot_proto_dot_provenance__pb2, +) +from grafeas.grafeas_v1.proto import ( + vulnerability_pb2 as grafeas__v1_dot_proto_dot_vulnerability__pb2, +) + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="grafeas_v1/proto/grafeas.proto", + package="grafeas.v1", + syntax="proto3", + serialized_options=_b( + "\n\rio.grafeas.v1P\001Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\242\002\003GRA" + ), + serialized_pb=_b( + '\n\x1egrafeas_v1/proto/grafeas.proto\x12\ngrafeas.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a"grafeas_v1/proto/attestation.proto\x1a\x1cgrafeas_v1/proto/build.proto\x1a\x1dgrafeas_v1/proto/common.proto\x1a!grafeas_v1/proto/deployment.proto\x1a grafeas_v1/proto/discovery.proto\x1a\x1cgrafeas_v1/proto/image.proto\x1a\x1egrafeas_v1/proto/package.proto\x1a!grafeas_v1/proto/provenance.proto\x1a$grafeas_v1/proto/vulnerability.proto"\xdd\x04\n\nOccurrence\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0cresource_uri\x18\x02 \x01(\t\x12\x11\n\tnote_name\x18\x03 \x01(\t\x12"\n\x04kind\x18\x04 \x01(\x0e\x32\x14.grafeas.v1.NoteKind\x12\x13\n\x0bremediation\x18\x05 \x01(\t\x12/\n\x0b\x63reate_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12<\n\rvulnerability\x18\x08 \x01(\x0b\x32#.grafeas.v1.VulnerabilityOccurrenceH\x00\x12,\n\x05\x62uild\x18\t \x01(\x0b\x32\x1b.grafeas.v1.BuildOccurrenceH\x00\x12,\n\x05image\x18\n \x01(\x0b\x32\x1b.grafeas.v1.ImageOccurrenceH\x00\x12\x30\n\x07package\x18\x0b \x01(\x0b\x32\x1d.grafeas.v1.PackageOccurrenceH\x00\x12\x36\n\ndeployment\x18\x0c \x01(\x0b\x32 .grafeas.v1.DeploymentOccurrenceH\x00\x12\x34\n\tdiscovery\x18\r \x01(\x0b\x32\x1f.grafeas.v1.DiscoveryOccurrenceH\x00\x12\x38\n\x0b\x61ttestation\x18\x0e \x01(\x0b\x32!.grafeas.v1.AttestationOccurrenceH\x00\x42\t\n\x07\x64\x65tails"\x9f\x05\n\x04Note\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x19\n\x11short_description\x18\x02 \x01(\t\x12\x18\n\x10long_description\x18\x03 \x01(\t\x12"\n\x04kind\x18\x04 \x01(\x0e\x32\x14.grafeas.v1.NoteKind\x12+\n\x0brelated_url\x18\x05 \x03(\x0b\x32\x16.grafeas.v1.RelatedUrl\x12\x33\n\x0f\x65xpiration_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0b\x63reate_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1a\n\x12related_note_names\x18\t \x03(\t\x12\x36\n\rvulnerability\x18\n \x01(\x0b\x32\x1d.grafeas.v1.VulnerabilityNoteH\x00\x12&\n\x05\x62uild\x18\x0b \x01(\x0b\x32\x15.grafeas.v1.BuildNoteH\x00\x12&\n\x05image\x18\x0c \x01(\x0b\x32\x15.grafeas.v1.ImageNoteH\x00\x12*\n\x07package\x18\r \x01(\x0b\x32\x17.grafeas.v1.PackageNoteH\x00\x12\x30\n\ndeployment\x18\x0e \x01(\x0b\x32\x1a.grafeas.v1.DeploymentNoteH\x00\x12.\n\tdiscovery\x18\x0f \x01(\x0b\x32\x19.grafeas.v1.DiscoveryNoteH\x00\x12\x32\n\x0b\x61ttestation\x18\x10 \x01(\x0b\x32\x1b.grafeas.v1.AttestationNoteH\x00\x42\x06\n\x04type"$\n\x14GetOccurrenceRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"_\n\x16ListOccurrencesRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x02 \x01(\t\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x12\n\npage_token\x18\x04 \x01(\t"_\n\x17ListOccurrencesResponse\x12+\n\x0boccurrences\x18\x01 \x03(\x0b\x32\x16.grafeas.v1.Occurrence\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"\'\n\x17\x44\x65leteOccurrenceRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"U\n\x17\x43reateOccurrenceRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12*\n\noccurrence\x18\x02 \x01(\x0b\x32\x16.grafeas.v1.Occurrence"\x84\x01\n\x17UpdateOccurrenceRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12*\n\noccurrence\x18\x02 \x01(\x0b\x32\x16.grafeas.v1.Occurrence\x12/\n\x0bupdate_mask\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"\x1e\n\x0eGetNoteRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"(\n\x18GetOccurrenceNoteRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"Y\n\x10ListNotesRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x02 \x01(\t\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x12\n\npage_token\x18\x04 \x01(\t"M\n\x11ListNotesResponse\x12\x1f\n\x05notes\x18\x01 \x03(\x0b\x32\x10.grafeas.v1.Note\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"!\n\x11\x44\x65leteNoteRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"T\n\x11\x43reateNoteRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x0f\n\x07note_id\x18\x02 \x01(\t\x12\x1e\n\x04note\x18\x03 \x01(\x0b\x32\x10.grafeas.v1.Note"r\n\x11UpdateNoteRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x1e\n\x04note\x18\x02 \x01(\x0b\x32\x10.grafeas.v1.Note\x12/\n\x0bupdate_mask\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"a\n\x1aListNoteOccurrencesRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x02 \x01(\t\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x12\n\npage_token\x18\x04 \x01(\t"c\n\x1bListNoteOccurrencesResponse\x12+\n\x0boccurrences\x18\x01 \x03(\x0b\x32\x16.grafeas.v1.Occurrence\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"\xa8\x01\n\x17\x42\x61tchCreateNotesRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12=\n\x05notes\x18\x02 \x03(\x0b\x32..grafeas.v1.BatchCreateNotesRequest.NotesEntry\x1a>\n\nNotesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1f\n\x05value\x18\x02 \x01(\x0b\x32\x10.grafeas.v1.Note:\x02\x38\x01";\n\x18\x42\x61tchCreateNotesResponse\x12\x1f\n\x05notes\x18\x01 \x03(\x0b\x32\x10.grafeas.v1.Note"\\\n\x1d\x42\x61tchCreateOccurrencesRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12+\n\x0boccurrences\x18\x02 \x03(\x0b\x32\x16.grafeas.v1.Occurrence"M\n\x1e\x42\x61tchCreateOccurrencesResponse\x12+\n\x0boccurrences\x18\x01 \x03(\x0b\x32\x16.grafeas.v1.Occurrence2\x94\x0e\n\x07Grafeas\x12v\n\rGetOccurrence\x12 .grafeas.v1.GetOccurrenceRequest\x1a\x16.grafeas.v1.Occurrence"+\x82\xd3\xe4\x93\x02%\x12#/v1/{name=projects/*/occurrences/*}\x12\x87\x01\n\x0fListOccurrences\x12".grafeas.v1.ListOccurrencesRequest\x1a#.grafeas.v1.ListOccurrencesResponse"+\x82\xd3\xe4\x93\x02%\x12#/v1/{parent=projects/*}/occurrences\x12|\n\x10\x44\x65leteOccurrence\x12#.grafeas.v1.DeleteOccurrenceRequest\x1a\x16.google.protobuf.Empty"+\x82\xd3\xe4\x93\x02%*#/v1/{name=projects/*/occurrences/*}\x12\x88\x01\n\x10\x43reateOccurrence\x12#.grafeas.v1.CreateOccurrenceRequest\x1a\x16.grafeas.v1.Occurrence"7\x82\xd3\xe4\x93\x02\x31"#/v1/{parent=projects/*}/occurrences:\noccurrence\x12\xab\x01\n\x16\x42\x61tchCreateOccurrences\x12).grafeas.v1.BatchCreateOccurrencesRequest\x1a*.grafeas.v1.BatchCreateOccurrencesResponse":\x82\xd3\xe4\x93\x02\x34"//v1/{parent=projects/*}/occurrences:batchCreate:\x01*\x12\x88\x01\n\x10UpdateOccurrence\x12#.grafeas.v1.UpdateOccurrenceRequest\x1a\x16.grafeas.v1.Occurrence"7\x82\xd3\xe4\x93\x02\x31\x32#/v1/{name=projects/*/occurrences/*}:\noccurrence\x12~\n\x11GetOccurrenceNote\x12$.grafeas.v1.GetOccurrenceNoteRequest\x1a\x10.grafeas.v1.Note"1\x82\xd3\xe4\x93\x02+\x12)/v1/{name=projects/*/occurrences/*}/notes\x12^\n\x07GetNote\x12\x1a.grafeas.v1.GetNoteRequest\x1a\x10.grafeas.v1.Note"%\x82\xd3\xe4\x93\x02\x1f\x12\x1d/v1/{name=projects/*/notes/*}\x12o\n\tListNotes\x12\x1c.grafeas.v1.ListNotesRequest\x1a\x1d.grafeas.v1.ListNotesResponse"%\x82\xd3\xe4\x93\x02\x1f\x12\x1d/v1/{parent=projects/*}/notes\x12j\n\nDeleteNote\x12\x1d.grafeas.v1.DeleteNoteRequest\x1a\x16.google.protobuf.Empty"%\x82\xd3\xe4\x93\x02\x1f*\x1d/v1/{name=projects/*/notes/*}\x12j\n\nCreateNote\x12\x1d.grafeas.v1.CreateNoteRequest\x1a\x10.grafeas.v1.Note"+\x82\xd3\xe4\x93\x02%"\x1d/v1/{parent=projects/*}/notes:\x04note\x12\x93\x01\n\x10\x42\x61tchCreateNotes\x12#.grafeas.v1.BatchCreateNotesRequest\x1a$.grafeas.v1.BatchCreateNotesResponse"4\x82\xd3\xe4\x93\x02.")/v1/{parent=projects/*}/notes:batchCreate:\x01*\x12j\n\nUpdateNote\x12\x1d.grafeas.v1.UpdateNoteRequest\x1a\x10.grafeas.v1.Note"+\x82\xd3\xe4\x93\x02%2\x1d/v1/{name=projects/*/notes/*}:\x04note\x12\x99\x01\n\x13ListNoteOccurrences\x12&.grafeas.v1.ListNoteOccurrencesRequest\x1a\'.grafeas.v1.ListNoteOccurrencesResponse"1\x82\xd3\xe4\x93\x02+\x12)/v1/{name=projects/*/notes/*}/occurrencesBQ\n\rio.grafeas.v1P\x01Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\xa2\x02\x03GRAb\x06proto3' + ), + dependencies=[ + google_dot_api_dot_annotations__pb2.DESCRIPTOR, + google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, + google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, + google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, + grafeas__v1_dot_proto_dot_attestation__pb2.DESCRIPTOR, + grafeas__v1_dot_proto_dot_build__pb2.DESCRIPTOR, + grafeas__v1_dot_proto_dot_common__pb2.DESCRIPTOR, + grafeas__v1_dot_proto_dot_deployment__pb2.DESCRIPTOR, + grafeas__v1_dot_proto_dot_discovery__pb2.DESCRIPTOR, + grafeas__v1_dot_proto_dot_image__pb2.DESCRIPTOR, + grafeas__v1_dot_proto_dot_package__pb2.DESCRIPTOR, + grafeas__v1_dot_proto_dot_provenance__pb2.DESCRIPTOR, + grafeas__v1_dot_proto_dot_vulnerability__pb2.DESCRIPTOR, + ], +) + + +_OCCURRENCE = _descriptor.Descriptor( + name="Occurrence", + full_name="grafeas.v1.Occurrence", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.Occurrence.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="resource_uri", + full_name="grafeas.v1.Occurrence.resource_uri", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="note_name", + full_name="grafeas.v1.Occurrence.note_name", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="kind", + full_name="grafeas.v1.Occurrence.kind", + index=3, + number=4, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="remediation", + full_name="grafeas.v1.Occurrence.remediation", + index=4, + number=5, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="create_time", + full_name="grafeas.v1.Occurrence.create_time", + index=5, + number=6, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="update_time", + full_name="grafeas.v1.Occurrence.update_time", + index=6, + number=7, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="vulnerability", + full_name="grafeas.v1.Occurrence.vulnerability", + index=7, + number=8, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="build", + full_name="grafeas.v1.Occurrence.build", + index=8, + number=9, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="image", + full_name="grafeas.v1.Occurrence.image", + index=9, + number=10, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="package", + full_name="grafeas.v1.Occurrence.package", + index=10, + number=11, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="deployment", + full_name="grafeas.v1.Occurrence.deployment", + index=11, + number=12, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="discovery", + full_name="grafeas.v1.Occurrence.discovery", + index=12, + number=13, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="attestation", + full_name="grafeas.v1.Occurrence.attestation", + index=13, + number=14, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="details", + full_name="grafeas.v1.Occurrence.details", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=474, + serialized_end=1079, +) + + +_NOTE = _descriptor.Descriptor( + name="Note", + full_name="grafeas.v1.Note", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.Note.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="short_description", + full_name="grafeas.v1.Note.short_description", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="long_description", + full_name="grafeas.v1.Note.long_description", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="kind", + full_name="grafeas.v1.Note.kind", + index=3, + number=4, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="related_url", + full_name="grafeas.v1.Note.related_url", + index=4, + number=5, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="expiration_time", + full_name="grafeas.v1.Note.expiration_time", + index=5, + number=6, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="create_time", + full_name="grafeas.v1.Note.create_time", + index=6, + number=7, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="update_time", + full_name="grafeas.v1.Note.update_time", + index=7, + number=8, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="related_note_names", + full_name="grafeas.v1.Note.related_note_names", + index=8, + number=9, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="vulnerability", + full_name="grafeas.v1.Note.vulnerability", + index=9, + number=10, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="build", + full_name="grafeas.v1.Note.build", + index=10, + number=11, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="image", + full_name="grafeas.v1.Note.image", + index=11, + number=12, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="package", + full_name="grafeas.v1.Note.package", + index=12, + number=13, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="deployment", + full_name="grafeas.v1.Note.deployment", + index=13, + number=14, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="discovery", + full_name="grafeas.v1.Note.discovery", + index=14, + number=15, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="attestation", + full_name="grafeas.v1.Note.attestation", + index=15, + number=16, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="type", + full_name="grafeas.v1.Note.type", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=1082, + serialized_end=1753, +) + + +_GETOCCURRENCEREQUEST = _descriptor.Descriptor( + name="GetOccurrenceRequest", + full_name="grafeas.v1.GetOccurrenceRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.GetOccurrenceRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1755, + serialized_end=1791, +) + + +_LISTOCCURRENCESREQUEST = _descriptor.Descriptor( + name="ListOccurrencesRequest", + full_name="grafeas.v1.ListOccurrencesRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="grafeas.v1.ListOccurrencesRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="filter", + full_name="grafeas.v1.ListOccurrencesRequest.filter", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_size", + full_name="grafeas.v1.ListOccurrencesRequest.page_size", + index=2, + number=3, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_token", + full_name="grafeas.v1.ListOccurrencesRequest.page_token", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1793, + serialized_end=1888, +) + + +_LISTOCCURRENCESRESPONSE = _descriptor.Descriptor( + name="ListOccurrencesResponse", + full_name="grafeas.v1.ListOccurrencesResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="occurrences", + full_name="grafeas.v1.ListOccurrencesResponse.occurrences", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="next_page_token", + full_name="grafeas.v1.ListOccurrencesResponse.next_page_token", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1890, + serialized_end=1985, +) + + +_DELETEOCCURRENCEREQUEST = _descriptor.Descriptor( + name="DeleteOccurrenceRequest", + full_name="grafeas.v1.DeleteOccurrenceRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.DeleteOccurrenceRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1987, + serialized_end=2026, +) + + +_CREATEOCCURRENCEREQUEST = _descriptor.Descriptor( + name="CreateOccurrenceRequest", + full_name="grafeas.v1.CreateOccurrenceRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="grafeas.v1.CreateOccurrenceRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="occurrence", + full_name="grafeas.v1.CreateOccurrenceRequest.occurrence", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2028, + serialized_end=2113, +) + + +_UPDATEOCCURRENCEREQUEST = _descriptor.Descriptor( + name="UpdateOccurrenceRequest", + full_name="grafeas.v1.UpdateOccurrenceRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.UpdateOccurrenceRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="occurrence", + full_name="grafeas.v1.UpdateOccurrenceRequest.occurrence", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="update_mask", + full_name="grafeas.v1.UpdateOccurrenceRequest.update_mask", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2116, + serialized_end=2248, +) + + +_GETNOTEREQUEST = _descriptor.Descriptor( + name="GetNoteRequest", + full_name="grafeas.v1.GetNoteRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.GetNoteRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2250, + serialized_end=2280, +) + + +_GETOCCURRENCENOTEREQUEST = _descriptor.Descriptor( + name="GetOccurrenceNoteRequest", + full_name="grafeas.v1.GetOccurrenceNoteRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.GetOccurrenceNoteRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2282, + serialized_end=2322, +) + + +_LISTNOTESREQUEST = _descriptor.Descriptor( + name="ListNotesRequest", + full_name="grafeas.v1.ListNotesRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="grafeas.v1.ListNotesRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="filter", + full_name="grafeas.v1.ListNotesRequest.filter", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_size", + full_name="grafeas.v1.ListNotesRequest.page_size", + index=2, + number=3, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_token", + full_name="grafeas.v1.ListNotesRequest.page_token", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2324, + serialized_end=2413, +) + + +_LISTNOTESRESPONSE = _descriptor.Descriptor( + name="ListNotesResponse", + full_name="grafeas.v1.ListNotesResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="notes", + full_name="grafeas.v1.ListNotesResponse.notes", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="next_page_token", + full_name="grafeas.v1.ListNotesResponse.next_page_token", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2415, + serialized_end=2492, +) + + +_DELETENOTEREQUEST = _descriptor.Descriptor( + name="DeleteNoteRequest", + full_name="grafeas.v1.DeleteNoteRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.DeleteNoteRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2494, + serialized_end=2527, +) + + +_CREATENOTEREQUEST = _descriptor.Descriptor( + name="CreateNoteRequest", + full_name="grafeas.v1.CreateNoteRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="grafeas.v1.CreateNoteRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="note_id", + full_name="grafeas.v1.CreateNoteRequest.note_id", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="note", + full_name="grafeas.v1.CreateNoteRequest.note", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2529, + serialized_end=2613, +) + + +_UPDATENOTEREQUEST = _descriptor.Descriptor( + name="UpdateNoteRequest", + full_name="grafeas.v1.UpdateNoteRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.UpdateNoteRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="note", + full_name="grafeas.v1.UpdateNoteRequest.note", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="update_mask", + full_name="grafeas.v1.UpdateNoteRequest.update_mask", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2615, + serialized_end=2729, +) + + +_LISTNOTEOCCURRENCESREQUEST = _descriptor.Descriptor( + name="ListNoteOccurrencesRequest", + full_name="grafeas.v1.ListNoteOccurrencesRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.ListNoteOccurrencesRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="filter", + full_name="grafeas.v1.ListNoteOccurrencesRequest.filter", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_size", + full_name="grafeas.v1.ListNoteOccurrencesRequest.page_size", + index=2, + number=3, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_token", + full_name="grafeas.v1.ListNoteOccurrencesRequest.page_token", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2731, + serialized_end=2828, +) + + +_LISTNOTEOCCURRENCESRESPONSE = _descriptor.Descriptor( + name="ListNoteOccurrencesResponse", + full_name="grafeas.v1.ListNoteOccurrencesResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="occurrences", + full_name="grafeas.v1.ListNoteOccurrencesResponse.occurrences", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="next_page_token", + full_name="grafeas.v1.ListNoteOccurrencesResponse.next_page_token", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2830, + serialized_end=2929, +) + + +_BATCHCREATENOTESREQUEST_NOTESENTRY = _descriptor.Descriptor( + name="NotesEntry", + full_name="grafeas.v1.BatchCreateNotesRequest.NotesEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="grafeas.v1.BatchCreateNotesRequest.NotesEntry.key", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="grafeas.v1.BatchCreateNotesRequest.NotesEntry.value", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=_b("8\001"), + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=3038, + serialized_end=3100, +) + +_BATCHCREATENOTESREQUEST = _descriptor.Descriptor( + name="BatchCreateNotesRequest", + full_name="grafeas.v1.BatchCreateNotesRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="grafeas.v1.BatchCreateNotesRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="notes", + full_name="grafeas.v1.BatchCreateNotesRequest.notes", + index=1, + number=2, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_BATCHCREATENOTESREQUEST_NOTESENTRY], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2932, + serialized_end=3100, +) + + +_BATCHCREATENOTESRESPONSE = _descriptor.Descriptor( + name="BatchCreateNotesResponse", + full_name="grafeas.v1.BatchCreateNotesResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="notes", + full_name="grafeas.v1.BatchCreateNotesResponse.notes", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=3102, + serialized_end=3161, +) + + +_BATCHCREATEOCCURRENCESREQUEST = _descriptor.Descriptor( + name="BatchCreateOccurrencesRequest", + full_name="grafeas.v1.BatchCreateOccurrencesRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="grafeas.v1.BatchCreateOccurrencesRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="occurrences", + full_name="grafeas.v1.BatchCreateOccurrencesRequest.occurrences", + index=1, + number=2, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=3163, + serialized_end=3255, +) + + +_BATCHCREATEOCCURRENCESRESPONSE = _descriptor.Descriptor( + name="BatchCreateOccurrencesResponse", + full_name="grafeas.v1.BatchCreateOccurrencesResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="occurrences", + full_name="grafeas.v1.BatchCreateOccurrencesResponse.occurrences", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=3257, + serialized_end=3334, +) + +_OCCURRENCE.fields_by_name[ + "kind" +].enum_type = grafeas__v1_dot_proto_dot_common__pb2._NOTEKIND +_OCCURRENCE.fields_by_name[ + "create_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_OCCURRENCE.fields_by_name[ + "update_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_OCCURRENCE.fields_by_name[ + "vulnerability" +].message_type = grafeas__v1_dot_proto_dot_vulnerability__pb2._VULNERABILITYOCCURRENCE +_OCCURRENCE.fields_by_name[ + "build" +].message_type = grafeas__v1_dot_proto_dot_build__pb2._BUILDOCCURRENCE +_OCCURRENCE.fields_by_name[ + "image" +].message_type = grafeas__v1_dot_proto_dot_image__pb2._IMAGEOCCURRENCE +_OCCURRENCE.fields_by_name[ + "package" +].message_type = grafeas__v1_dot_proto_dot_package__pb2._PACKAGEOCCURRENCE +_OCCURRENCE.fields_by_name[ + "deployment" +].message_type = grafeas__v1_dot_proto_dot_deployment__pb2._DEPLOYMENTOCCURRENCE +_OCCURRENCE.fields_by_name[ + "discovery" +].message_type = grafeas__v1_dot_proto_dot_discovery__pb2._DISCOVERYOCCURRENCE +_OCCURRENCE.fields_by_name[ + "attestation" +].message_type = grafeas__v1_dot_proto_dot_attestation__pb2._ATTESTATIONOCCURRENCE +_OCCURRENCE.oneofs_by_name["details"].fields.append( + _OCCURRENCE.fields_by_name["vulnerability"] +) +_OCCURRENCE.fields_by_name[ + "vulnerability" +].containing_oneof = _OCCURRENCE.oneofs_by_name["details"] +_OCCURRENCE.oneofs_by_name["details"].fields.append(_OCCURRENCE.fields_by_name["build"]) +_OCCURRENCE.fields_by_name["build"].containing_oneof = _OCCURRENCE.oneofs_by_name[ + "details" +] +_OCCURRENCE.oneofs_by_name["details"].fields.append(_OCCURRENCE.fields_by_name["image"]) +_OCCURRENCE.fields_by_name["image"].containing_oneof = _OCCURRENCE.oneofs_by_name[ + "details" +] +_OCCURRENCE.oneofs_by_name["details"].fields.append( + _OCCURRENCE.fields_by_name["package"] +) +_OCCURRENCE.fields_by_name["package"].containing_oneof = _OCCURRENCE.oneofs_by_name[ + "details" +] +_OCCURRENCE.oneofs_by_name["details"].fields.append( + _OCCURRENCE.fields_by_name["deployment"] +) +_OCCURRENCE.fields_by_name["deployment"].containing_oneof = _OCCURRENCE.oneofs_by_name[ + "details" +] +_OCCURRENCE.oneofs_by_name["details"].fields.append( + _OCCURRENCE.fields_by_name["discovery"] +) +_OCCURRENCE.fields_by_name["discovery"].containing_oneof = _OCCURRENCE.oneofs_by_name[ + "details" +] +_OCCURRENCE.oneofs_by_name["details"].fields.append( + _OCCURRENCE.fields_by_name["attestation"] +) +_OCCURRENCE.fields_by_name["attestation"].containing_oneof = _OCCURRENCE.oneofs_by_name[ + "details" +] +_NOTE.fields_by_name["kind"].enum_type = grafeas__v1_dot_proto_dot_common__pb2._NOTEKIND +_NOTE.fields_by_name[ + "related_url" +].message_type = grafeas__v1_dot_proto_dot_common__pb2._RELATEDURL +_NOTE.fields_by_name[ + "expiration_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_NOTE.fields_by_name[ + "create_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_NOTE.fields_by_name[ + "update_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_NOTE.fields_by_name[ + "vulnerability" +].message_type = grafeas__v1_dot_proto_dot_vulnerability__pb2._VULNERABILITYNOTE +_NOTE.fields_by_name[ + "build" +].message_type = grafeas__v1_dot_proto_dot_build__pb2._BUILDNOTE +_NOTE.fields_by_name[ + "image" +].message_type = grafeas__v1_dot_proto_dot_image__pb2._IMAGENOTE +_NOTE.fields_by_name[ + "package" +].message_type = grafeas__v1_dot_proto_dot_package__pb2._PACKAGENOTE +_NOTE.fields_by_name[ + "deployment" +].message_type = grafeas__v1_dot_proto_dot_deployment__pb2._DEPLOYMENTNOTE +_NOTE.fields_by_name[ + "discovery" +].message_type = grafeas__v1_dot_proto_dot_discovery__pb2._DISCOVERYNOTE +_NOTE.fields_by_name[ + "attestation" +].message_type = grafeas__v1_dot_proto_dot_attestation__pb2._ATTESTATIONNOTE +_NOTE.oneofs_by_name["type"].fields.append(_NOTE.fields_by_name["vulnerability"]) +_NOTE.fields_by_name["vulnerability"].containing_oneof = _NOTE.oneofs_by_name["type"] +_NOTE.oneofs_by_name["type"].fields.append(_NOTE.fields_by_name["build"]) +_NOTE.fields_by_name["build"].containing_oneof = _NOTE.oneofs_by_name["type"] +_NOTE.oneofs_by_name["type"].fields.append(_NOTE.fields_by_name["image"]) +_NOTE.fields_by_name["image"].containing_oneof = _NOTE.oneofs_by_name["type"] +_NOTE.oneofs_by_name["type"].fields.append(_NOTE.fields_by_name["package"]) +_NOTE.fields_by_name["package"].containing_oneof = _NOTE.oneofs_by_name["type"] +_NOTE.oneofs_by_name["type"].fields.append(_NOTE.fields_by_name["deployment"]) +_NOTE.fields_by_name["deployment"].containing_oneof = _NOTE.oneofs_by_name["type"] +_NOTE.oneofs_by_name["type"].fields.append(_NOTE.fields_by_name["discovery"]) +_NOTE.fields_by_name["discovery"].containing_oneof = _NOTE.oneofs_by_name["type"] +_NOTE.oneofs_by_name["type"].fields.append(_NOTE.fields_by_name["attestation"]) +_NOTE.fields_by_name["attestation"].containing_oneof = _NOTE.oneofs_by_name["type"] +_LISTOCCURRENCESRESPONSE.fields_by_name["occurrences"].message_type = _OCCURRENCE +_CREATEOCCURRENCEREQUEST.fields_by_name["occurrence"].message_type = _OCCURRENCE +_UPDATEOCCURRENCEREQUEST.fields_by_name["occurrence"].message_type = _OCCURRENCE +_UPDATEOCCURRENCEREQUEST.fields_by_name[ + "update_mask" +].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK +_LISTNOTESRESPONSE.fields_by_name["notes"].message_type = _NOTE +_CREATENOTEREQUEST.fields_by_name["note"].message_type = _NOTE +_UPDATENOTEREQUEST.fields_by_name["note"].message_type = _NOTE +_UPDATENOTEREQUEST.fields_by_name[ + "update_mask" +].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK +_LISTNOTEOCCURRENCESRESPONSE.fields_by_name["occurrences"].message_type = _OCCURRENCE +_BATCHCREATENOTESREQUEST_NOTESENTRY.fields_by_name["value"].message_type = _NOTE +_BATCHCREATENOTESREQUEST_NOTESENTRY.containing_type = _BATCHCREATENOTESREQUEST +_BATCHCREATENOTESREQUEST.fields_by_name[ + "notes" +].message_type = _BATCHCREATENOTESREQUEST_NOTESENTRY +_BATCHCREATENOTESRESPONSE.fields_by_name["notes"].message_type = _NOTE +_BATCHCREATEOCCURRENCESREQUEST.fields_by_name["occurrences"].message_type = _OCCURRENCE +_BATCHCREATEOCCURRENCESRESPONSE.fields_by_name["occurrences"].message_type = _OCCURRENCE +DESCRIPTOR.message_types_by_name["Occurrence"] = _OCCURRENCE +DESCRIPTOR.message_types_by_name["Note"] = _NOTE +DESCRIPTOR.message_types_by_name["GetOccurrenceRequest"] = _GETOCCURRENCEREQUEST +DESCRIPTOR.message_types_by_name["ListOccurrencesRequest"] = _LISTOCCURRENCESREQUEST +DESCRIPTOR.message_types_by_name["ListOccurrencesResponse"] = _LISTOCCURRENCESRESPONSE +DESCRIPTOR.message_types_by_name["DeleteOccurrenceRequest"] = _DELETEOCCURRENCEREQUEST +DESCRIPTOR.message_types_by_name["CreateOccurrenceRequest"] = _CREATEOCCURRENCEREQUEST +DESCRIPTOR.message_types_by_name["UpdateOccurrenceRequest"] = _UPDATEOCCURRENCEREQUEST +DESCRIPTOR.message_types_by_name["GetNoteRequest"] = _GETNOTEREQUEST +DESCRIPTOR.message_types_by_name["GetOccurrenceNoteRequest"] = _GETOCCURRENCENOTEREQUEST +DESCRIPTOR.message_types_by_name["ListNotesRequest"] = _LISTNOTESREQUEST +DESCRIPTOR.message_types_by_name["ListNotesResponse"] = _LISTNOTESRESPONSE +DESCRIPTOR.message_types_by_name["DeleteNoteRequest"] = _DELETENOTEREQUEST +DESCRIPTOR.message_types_by_name["CreateNoteRequest"] = _CREATENOTEREQUEST +DESCRIPTOR.message_types_by_name["UpdateNoteRequest"] = _UPDATENOTEREQUEST +DESCRIPTOR.message_types_by_name[ + "ListNoteOccurrencesRequest" +] = _LISTNOTEOCCURRENCESREQUEST +DESCRIPTOR.message_types_by_name[ + "ListNoteOccurrencesResponse" +] = _LISTNOTEOCCURRENCESRESPONSE +DESCRIPTOR.message_types_by_name["BatchCreateNotesRequest"] = _BATCHCREATENOTESREQUEST +DESCRIPTOR.message_types_by_name["BatchCreateNotesResponse"] = _BATCHCREATENOTESRESPONSE +DESCRIPTOR.message_types_by_name[ + "BatchCreateOccurrencesRequest" +] = _BATCHCREATEOCCURRENCESREQUEST +DESCRIPTOR.message_types_by_name[ + "BatchCreateOccurrencesResponse" +] = _BATCHCREATEOCCURRENCESRESPONSE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Occurrence = _reflection.GeneratedProtocolMessageType( + "Occurrence", + (_message.Message,), + dict( + DESCRIPTOR=_OCCURRENCE, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""An instance of an analysis type that has been found on a resource. + + + Attributes: + name: + Output only. The name of the occurrence in the form of + ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]``. + resource_uri: + Required. Immutable. A URI that represents the resource for + which the occurrence applies. For example, + ``https://gcr.io/project/image@sha256:123abc`` for a Docker + image. + note_name: + Required. Immutable. The analysis note associated with this + occurrence, in the form of + ``projects/[PROVIDER_ID]/notes/[NOTE_ID]``. This field can be + used as a filter in list requests. + kind: + Output only. This explicitly denotes which of the occurrence + details are specified. This field can be used as a filter in + list requests. + remediation: + A description of actions that can be taken to remedy the note. + create_time: + Output only. The time this occurrence was created. + update_time: + Output only. The time this occurrence was last updated. + details: + Required. Immutable. Describes the details of the note kind + found on this resource. + vulnerability: + Describes a security vulnerability. + build: + Describes a verifiable build. + image: + Describes how this resource derives from the basis in the + associated note. + package: + Describes the installation of a package on the linked + resource. + deployment: + Describes the deployment of an artifact on a runtime. + discovery: + Describes when a resource was discovered. + attestation: + Describes an attestation of an artifact. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.Occurrence) + ), +) +_sym_db.RegisterMessage(Occurrence) + +Note = _reflection.GeneratedProtocolMessageType( + "Note", + (_message.Message,), + dict( + DESCRIPTOR=_NOTE, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""A type of analysis that can be done for a resource. + + + Attributes: + name: + Output only. The name of the note in the form of + ``projects/[PROVIDER_ID]/notes/[NOTE_ID]``. + short_description: + A one sentence description of this note. + long_description: + A detailed description of this note. + kind: + Output only. The type of analysis. This field can be used as a + filter in list requests. + related_url: + URLs associated with this note. + expiration_time: + Time of expiration for this note. Empty if note does not + expire. + create_time: + Output only. The time this note was created. This field can be + used as a filter in list requests. + update_time: + Output only. The time this note was last updated. This field + can be used as a filter in list requests. + related_note_names: + Other notes related to this note. + type: + Required. Immutable. The type of analysis this note + represents. + vulnerability: + A note describing a package vulnerability. + build: + A note describing build provenance for a verifiable build. + image: + A note describing a base image. + package: + A note describing a package hosted by various package + managers. + deployment: + A note describing something that can be deployed. + discovery: + A note describing the initial analysis of a resource. + attestation: + A note describing an attestation role. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.Note) + ), +) +_sym_db.RegisterMessage(Note) + +GetOccurrenceRequest = _reflection.GeneratedProtocolMessageType( + "GetOccurrenceRequest", + (_message.Message,), + dict( + DESCRIPTOR=_GETOCCURRENCEREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to get an occurrence. + + + Attributes: + name: + The name of the occurrence in the form of + ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]``. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.GetOccurrenceRequest) + ), +) +_sym_db.RegisterMessage(GetOccurrenceRequest) + +ListOccurrencesRequest = _reflection.GeneratedProtocolMessageType( + "ListOccurrencesRequest", + (_message.Message,), + dict( + DESCRIPTOR=_LISTOCCURRENCESREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to list occurrences. + + + Attributes: + parent: + The name of the project to list occurrences for in the form of + ``projects/[PROJECT_ID]``. + filter: + The filter expression. + page_size: + Number of occurrences to return in the list. Must be positive. + Max allowed page size is 1000. If not specified, page size + defaults to 20. + page_token: + Token to provide to skip to a particular spot in the list. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.ListOccurrencesRequest) + ), +) +_sym_db.RegisterMessage(ListOccurrencesRequest) + +ListOccurrencesResponse = _reflection.GeneratedProtocolMessageType( + "ListOccurrencesResponse", + (_message.Message,), + dict( + DESCRIPTOR=_LISTOCCURRENCESRESPONSE, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Response for listing occurrences. + + + Attributes: + occurrences: + The occurrences requested. + next_page_token: + The next pagination token in the list response. It should be + used as ``page_token`` for the following request. An empty + value means no more results. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.ListOccurrencesResponse) + ), +) +_sym_db.RegisterMessage(ListOccurrencesResponse) + +DeleteOccurrenceRequest = _reflection.GeneratedProtocolMessageType( + "DeleteOccurrenceRequest", + (_message.Message,), + dict( + DESCRIPTOR=_DELETEOCCURRENCEREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to delete a occurrence. + + + Attributes: + name: + The name of the occurrence in the form of + ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]``. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.DeleteOccurrenceRequest) + ), +) +_sym_db.RegisterMessage(DeleteOccurrenceRequest) + +CreateOccurrenceRequest = _reflection.GeneratedProtocolMessageType( + "CreateOccurrenceRequest", + (_message.Message,), + dict( + DESCRIPTOR=_CREATEOCCURRENCEREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to create a new occurrence. + + + Attributes: + parent: + The name of the project in the form of + ``projects/[PROJECT_ID]``, under which the occurrence is to be + created. + occurrence: + The occurrence to create. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.CreateOccurrenceRequest) + ), +) +_sym_db.RegisterMessage(CreateOccurrenceRequest) + +UpdateOccurrenceRequest = _reflection.GeneratedProtocolMessageType( + "UpdateOccurrenceRequest", + (_message.Message,), + dict( + DESCRIPTOR=_UPDATEOCCURRENCEREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to update an occurrence. + + + Attributes: + name: + The name of the occurrence in the form of + ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]``. + occurrence: + The updated occurrence. + update_mask: + The fields to update. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.UpdateOccurrenceRequest) + ), +) +_sym_db.RegisterMessage(UpdateOccurrenceRequest) + +GetNoteRequest = _reflection.GeneratedProtocolMessageType( + "GetNoteRequest", + (_message.Message,), + dict( + DESCRIPTOR=_GETNOTEREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to get a note. + + + Attributes: + name: + The name of the note in the form of + ``projects/[PROVIDER_ID]/notes/[NOTE_ID]``. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.GetNoteRequest) + ), +) +_sym_db.RegisterMessage(GetNoteRequest) + +GetOccurrenceNoteRequest = _reflection.GeneratedProtocolMessageType( + "GetOccurrenceNoteRequest", + (_message.Message,), + dict( + DESCRIPTOR=_GETOCCURRENCENOTEREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to get the note to which the specified occurrence is attached. + + + Attributes: + name: + The name of the occurrence in the form of + ``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]``. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.GetOccurrenceNoteRequest) + ), +) +_sym_db.RegisterMessage(GetOccurrenceNoteRequest) + +ListNotesRequest = _reflection.GeneratedProtocolMessageType( + "ListNotesRequest", + (_message.Message,), + dict( + DESCRIPTOR=_LISTNOTESREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to list notes. + + + Attributes: + parent: + The name of the project to list notes for in the form of + ``projects/[PROJECT_ID]``. + filter: + The filter expression. + page_size: + Number of notes to return in the list. Must be positive. Max + allowed page size is 1000. If not specified, page size + defaults to 20. + page_token: + Token to provide to skip to a particular spot in the list. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.ListNotesRequest) + ), +) +_sym_db.RegisterMessage(ListNotesRequest) + +ListNotesResponse = _reflection.GeneratedProtocolMessageType( + "ListNotesResponse", + (_message.Message,), + dict( + DESCRIPTOR=_LISTNOTESRESPONSE, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Response for listing notes. + + + Attributes: + notes: + The notes requested. + next_page_token: + The next pagination token in the list response. It should be + used as ``page_token`` for the following request. An empty + value means no more results. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.ListNotesResponse) + ), +) +_sym_db.RegisterMessage(ListNotesResponse) + +DeleteNoteRequest = _reflection.GeneratedProtocolMessageType( + "DeleteNoteRequest", + (_message.Message,), + dict( + DESCRIPTOR=_DELETENOTEREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to delete a note. + + + Attributes: + name: + The name of the note in the form of + ``projects/[PROVIDER_ID]/notes/[NOTE_ID]``. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.DeleteNoteRequest) + ), +) +_sym_db.RegisterMessage(DeleteNoteRequest) + +CreateNoteRequest = _reflection.GeneratedProtocolMessageType( + "CreateNoteRequest", + (_message.Message,), + dict( + DESCRIPTOR=_CREATENOTEREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to create a new note. + + + Attributes: + parent: + The name of the project in the form of + ``projects/[PROJECT_ID]``, under which the note is to be + created. + note_id: + The ID to use for this note. + note: + The note to create. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.CreateNoteRequest) + ), +) +_sym_db.RegisterMessage(CreateNoteRequest) + +UpdateNoteRequest = _reflection.GeneratedProtocolMessageType( + "UpdateNoteRequest", + (_message.Message,), + dict( + DESCRIPTOR=_UPDATENOTEREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to update a note. + + + Attributes: + name: + The name of the note in the form of + ``projects/[PROVIDER_ID]/notes/[NOTE_ID]``. + note: + The updated note. + update_mask: + The fields to update. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.UpdateNoteRequest) + ), +) +_sym_db.RegisterMessage(UpdateNoteRequest) + +ListNoteOccurrencesRequest = _reflection.GeneratedProtocolMessageType( + "ListNoteOccurrencesRequest", + (_message.Message,), + dict( + DESCRIPTOR=_LISTNOTEOCCURRENCESREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to list occurrences for a note. + + + Attributes: + name: + The name of the note to list occurrences for in the form of + ``projects/[PROVIDER_ID]/notes/[NOTE_ID]``. + filter: + The filter expression. + page_size: + Number of occurrences to return in the list. + page_token: + Token to provide to skip to a particular spot in the list. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.ListNoteOccurrencesRequest) + ), +) +_sym_db.RegisterMessage(ListNoteOccurrencesRequest) + +ListNoteOccurrencesResponse = _reflection.GeneratedProtocolMessageType( + "ListNoteOccurrencesResponse", + (_message.Message,), + dict( + DESCRIPTOR=_LISTNOTEOCCURRENCESRESPONSE, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Response for listing occurrences for a note. + + + Attributes: + occurrences: + The occurrences attached to the specified note. + next_page_token: + Token to provide to skip to a particular spot in the list. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.ListNoteOccurrencesResponse) + ), +) +_sym_db.RegisterMessage(ListNoteOccurrencesResponse) + +BatchCreateNotesRequest = _reflection.GeneratedProtocolMessageType( + "BatchCreateNotesRequest", + (_message.Message,), + dict( + NotesEntry=_reflection.GeneratedProtocolMessageType( + "NotesEntry", + (_message.Message,), + dict( + DESCRIPTOR=_BATCHCREATENOTESREQUEST_NOTESENTRY, + __module__="grafeas_v1.proto.grafeas_pb2" + # @@protoc_insertion_point(class_scope:grafeas.v1.BatchCreateNotesRequest.NotesEntry) + ), + ), + DESCRIPTOR=_BATCHCREATENOTESREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to create notes in batch. + + + Attributes: + parent: + The name of the project in the form of + ``projects/[PROJECT_ID]``, under which the notes are to be + created. + notes: + The notes to create. Max allowed length is 1000. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.BatchCreateNotesRequest) + ), +) +_sym_db.RegisterMessage(BatchCreateNotesRequest) +_sym_db.RegisterMessage(BatchCreateNotesRequest.NotesEntry) + +BatchCreateNotesResponse = _reflection.GeneratedProtocolMessageType( + "BatchCreateNotesResponse", + (_message.Message,), + dict( + DESCRIPTOR=_BATCHCREATENOTESRESPONSE, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Response for creating notes in batch. + + + Attributes: + notes: + The notes that were created. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.BatchCreateNotesResponse) + ), +) +_sym_db.RegisterMessage(BatchCreateNotesResponse) + +BatchCreateOccurrencesRequest = _reflection.GeneratedProtocolMessageType( + "BatchCreateOccurrencesRequest", + (_message.Message,), + dict( + DESCRIPTOR=_BATCHCREATEOCCURRENCESREQUEST, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Request to create occurrences in batch. + + + Attributes: + parent: + The name of the project in the form of + ``projects/[PROJECT_ID]``, under which the occurrences are to + be created. + occurrences: + The occurrences to create. Max allowed length is 1000. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.BatchCreateOccurrencesRequest) + ), +) +_sym_db.RegisterMessage(BatchCreateOccurrencesRequest) + +BatchCreateOccurrencesResponse = _reflection.GeneratedProtocolMessageType( + "BatchCreateOccurrencesResponse", + (_message.Message,), + dict( + DESCRIPTOR=_BATCHCREATEOCCURRENCESRESPONSE, + __module__="grafeas_v1.proto.grafeas_pb2", + __doc__="""Response for creating occurrences in batch. + + + Attributes: + occurrences: + The occurrences that were created. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.BatchCreateOccurrencesResponse) + ), +) +_sym_db.RegisterMessage(BatchCreateOccurrencesResponse) + + +DESCRIPTOR._options = None +_BATCHCREATENOTESREQUEST_NOTESENTRY._options = None + +_GRAFEAS = _descriptor.ServiceDescriptor( + name="Grafeas", + full_name="grafeas.v1.Grafeas", + file=DESCRIPTOR, + index=0, + serialized_options=None, + serialized_start=3337, + serialized_end=5149, + methods=[ + _descriptor.MethodDescriptor( + name="GetOccurrence", + full_name="grafeas.v1.Grafeas.GetOccurrence", + index=0, + containing_service=None, + input_type=_GETOCCURRENCEREQUEST, + output_type=_OCCURRENCE, + serialized_options=_b( + "\202\323\344\223\002%\022#/v1/{name=projects/*/occurrences/*}" + ), + ), + _descriptor.MethodDescriptor( + name="ListOccurrences", + full_name="grafeas.v1.Grafeas.ListOccurrences", + index=1, + containing_service=None, + input_type=_LISTOCCURRENCESREQUEST, + output_type=_LISTOCCURRENCESRESPONSE, + serialized_options=_b( + "\202\323\344\223\002%\022#/v1/{parent=projects/*}/occurrences" + ), + ), + _descriptor.MethodDescriptor( + name="DeleteOccurrence", + full_name="grafeas.v1.Grafeas.DeleteOccurrence", + index=2, + containing_service=None, + input_type=_DELETEOCCURRENCEREQUEST, + output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, + serialized_options=_b( + "\202\323\344\223\002%*#/v1/{name=projects/*/occurrences/*}" + ), + ), + _descriptor.MethodDescriptor( + name="CreateOccurrence", + full_name="grafeas.v1.Grafeas.CreateOccurrence", + index=3, + containing_service=None, + input_type=_CREATEOCCURRENCEREQUEST, + output_type=_OCCURRENCE, + serialized_options=_b( + '\202\323\344\223\0021"#/v1/{parent=projects/*}/occurrences:\noccurrence' + ), + ), + _descriptor.MethodDescriptor( + name="BatchCreateOccurrences", + full_name="grafeas.v1.Grafeas.BatchCreateOccurrences", + index=4, + containing_service=None, + input_type=_BATCHCREATEOCCURRENCESREQUEST, + output_type=_BATCHCREATEOCCURRENCESRESPONSE, + serialized_options=_b( + '\202\323\344\223\0024"//v1/{parent=projects/*}/occurrences:batchCreate:\001*' + ), + ), + _descriptor.MethodDescriptor( + name="UpdateOccurrence", + full_name="grafeas.v1.Grafeas.UpdateOccurrence", + index=5, + containing_service=None, + input_type=_UPDATEOCCURRENCEREQUEST, + output_type=_OCCURRENCE, + serialized_options=_b( + "\202\323\344\223\00212#/v1/{name=projects/*/occurrences/*}:\noccurrence" + ), + ), + _descriptor.MethodDescriptor( + name="GetOccurrenceNote", + full_name="grafeas.v1.Grafeas.GetOccurrenceNote", + index=6, + containing_service=None, + input_type=_GETOCCURRENCENOTEREQUEST, + output_type=_NOTE, + serialized_options=_b( + "\202\323\344\223\002+\022)/v1/{name=projects/*/occurrences/*}/notes" + ), + ), + _descriptor.MethodDescriptor( + name="GetNote", + full_name="grafeas.v1.Grafeas.GetNote", + index=7, + containing_service=None, + input_type=_GETNOTEREQUEST, + output_type=_NOTE, + serialized_options=_b( + "\202\323\344\223\002\037\022\035/v1/{name=projects/*/notes/*}" + ), + ), + _descriptor.MethodDescriptor( + name="ListNotes", + full_name="grafeas.v1.Grafeas.ListNotes", + index=8, + containing_service=None, + input_type=_LISTNOTESREQUEST, + output_type=_LISTNOTESRESPONSE, + serialized_options=_b( + "\202\323\344\223\002\037\022\035/v1/{parent=projects/*}/notes" + ), + ), + _descriptor.MethodDescriptor( + name="DeleteNote", + full_name="grafeas.v1.Grafeas.DeleteNote", + index=9, + containing_service=None, + input_type=_DELETENOTEREQUEST, + output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, + serialized_options=_b( + "\202\323\344\223\002\037*\035/v1/{name=projects/*/notes/*}" + ), + ), + _descriptor.MethodDescriptor( + name="CreateNote", + full_name="grafeas.v1.Grafeas.CreateNote", + index=10, + containing_service=None, + input_type=_CREATENOTEREQUEST, + output_type=_NOTE, + serialized_options=_b( + '\202\323\344\223\002%"\035/v1/{parent=projects/*}/notes:\004note' + ), + ), + _descriptor.MethodDescriptor( + name="BatchCreateNotes", + full_name="grafeas.v1.Grafeas.BatchCreateNotes", + index=11, + containing_service=None, + input_type=_BATCHCREATENOTESREQUEST, + output_type=_BATCHCREATENOTESRESPONSE, + serialized_options=_b( + '\202\323\344\223\002.")/v1/{parent=projects/*}/notes:batchCreate:\001*' + ), + ), + _descriptor.MethodDescriptor( + name="UpdateNote", + full_name="grafeas.v1.Grafeas.UpdateNote", + index=12, + containing_service=None, + input_type=_UPDATENOTEREQUEST, + output_type=_NOTE, + serialized_options=_b( + "\202\323\344\223\002%2\035/v1/{name=projects/*/notes/*}:\004note" + ), + ), + _descriptor.MethodDescriptor( + name="ListNoteOccurrences", + full_name="grafeas.v1.Grafeas.ListNoteOccurrences", + index=13, + containing_service=None, + input_type=_LISTNOTEOCCURRENCESREQUEST, + output_type=_LISTNOTEOCCURRENCESRESPONSE, + serialized_options=_b( + "\202\323\344\223\002+\022)/v1/{name=projects/*/notes/*}/occurrences" + ), + ), + ], +) +_sym_db.RegisterServiceDescriptor(_GRAFEAS) + +DESCRIPTOR.services_by_name["Grafeas"] = _GRAFEAS + +# @@protoc_insertion_point(module_scope) diff --git a/grafeas/grafeas/grafeas_v1/proto/grafeas_pb2_grpc.py b/grafeas/grafeas/grafeas_v1/proto/grafeas_pb2_grpc.py new file mode 100644 index 000000000000..70057e822c51 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/grafeas_pb2_grpc.py @@ -0,0 +1,302 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc + +from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 +from grafeas.grafeas_v1.proto import ( + grafeas_pb2 as grafeas__v1_dot_proto_dot_grafeas__pb2, +) + + +class GrafeasStub(object): + """[Grafeas](https://grafeas.io) API. + + Retrieves analysis results of Cloud components such as Docker container + images. + + Analysis results are stored as a series of occurrences. An `Occurrence` + contains information about a specific analysis instance on a resource. An + occurrence refers to a `Note`. A note contains details describing the + analysis and is generally stored in a separate project, called a `Provider`. + Multiple occurrences can refer to the same note. + + For example, an SSL vulnerability could affect multiple images. In this case, + there would be one note for the vulnerability and an occurrence for each + image with the vulnerability referring to that note. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.GetOccurrence = channel.unary_unary( + "/grafeas.v1.Grafeas/GetOccurrence", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.GetOccurrenceRequest.SerializeToString, + response_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Occurrence.FromString, + ) + self.ListOccurrences = channel.unary_unary( + "/grafeas.v1.Grafeas/ListOccurrences", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.ListOccurrencesRequest.SerializeToString, + response_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.ListOccurrencesResponse.FromString, + ) + self.DeleteOccurrence = channel.unary_unary( + "/grafeas.v1.Grafeas/DeleteOccurrence", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.DeleteOccurrenceRequest.SerializeToString, + response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, + ) + self.CreateOccurrence = channel.unary_unary( + "/grafeas.v1.Grafeas/CreateOccurrence", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.CreateOccurrenceRequest.SerializeToString, + response_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Occurrence.FromString, + ) + self.BatchCreateOccurrences = channel.unary_unary( + "/grafeas.v1.Grafeas/BatchCreateOccurrences", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.BatchCreateOccurrencesRequest.SerializeToString, + response_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.BatchCreateOccurrencesResponse.FromString, + ) + self.UpdateOccurrence = channel.unary_unary( + "/grafeas.v1.Grafeas/UpdateOccurrence", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.UpdateOccurrenceRequest.SerializeToString, + response_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Occurrence.FromString, + ) + self.GetOccurrenceNote = channel.unary_unary( + "/grafeas.v1.Grafeas/GetOccurrenceNote", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.GetOccurrenceNoteRequest.SerializeToString, + response_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Note.FromString, + ) + self.GetNote = channel.unary_unary( + "/grafeas.v1.Grafeas/GetNote", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.GetNoteRequest.SerializeToString, + response_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Note.FromString, + ) + self.ListNotes = channel.unary_unary( + "/grafeas.v1.Grafeas/ListNotes", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.ListNotesRequest.SerializeToString, + response_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.ListNotesResponse.FromString, + ) + self.DeleteNote = channel.unary_unary( + "/grafeas.v1.Grafeas/DeleteNote", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.DeleteNoteRequest.SerializeToString, + response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, + ) + self.CreateNote = channel.unary_unary( + "/grafeas.v1.Grafeas/CreateNote", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.CreateNoteRequest.SerializeToString, + response_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Note.FromString, + ) + self.BatchCreateNotes = channel.unary_unary( + "/grafeas.v1.Grafeas/BatchCreateNotes", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.BatchCreateNotesRequest.SerializeToString, + response_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.BatchCreateNotesResponse.FromString, + ) + self.UpdateNote = channel.unary_unary( + "/grafeas.v1.Grafeas/UpdateNote", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.UpdateNoteRequest.SerializeToString, + response_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Note.FromString, + ) + self.ListNoteOccurrences = channel.unary_unary( + "/grafeas.v1.Grafeas/ListNoteOccurrences", + request_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.ListNoteOccurrencesRequest.SerializeToString, + response_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.ListNoteOccurrencesResponse.FromString, + ) + + +class GrafeasServicer(object): + """[Grafeas](https://grafeas.io) API. + + Retrieves analysis results of Cloud components such as Docker container + images. + + Analysis results are stored as a series of occurrences. An `Occurrence` + contains information about a specific analysis instance on a resource. An + occurrence refers to a `Note`. A note contains details describing the + analysis and is generally stored in a separate project, called a `Provider`. + Multiple occurrences can refer to the same note. + + For example, an SSL vulnerability could affect multiple images. In this case, + there would be one note for the vulnerability and an occurrence for each + image with the vulnerability referring to that note. + """ + + def GetOccurrence(self, request, context): + """Gets the specified occurrence. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def ListOccurrences(self, request, context): + """Lists occurrences for the specified project. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def DeleteOccurrence(self, request, context): + """Deletes the specified occurrence. For example, use this method to delete an + occurrence when the occurrence is no longer applicable for the given + resource. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def CreateOccurrence(self, request, context): + """Creates a new occurrence. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def BatchCreateOccurrences(self, request, context): + """Creates new occurrences in batch. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def UpdateOccurrence(self, request, context): + """Updates the specified occurrence. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def GetOccurrenceNote(self, request, context): + """Gets the note attached to the specified occurrence. Consumer projects can + use this method to get a note that belongs to a provider project. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def GetNote(self, request, context): + """Gets the specified note. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def ListNotes(self, request, context): + """Lists notes for the specified project. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def DeleteNote(self, request, context): + """Deletes the specified note. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def CreateNote(self, request, context): + """Creates a new note. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def BatchCreateNotes(self, request, context): + """Creates new notes in batch. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def UpdateNote(self, request, context): + """Updates the specified note. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def ListNoteOccurrences(self, request, context): + """Lists occurrences referencing the specified note. Provider projects can use + this method to get all occurrences across consumer projects referencing the + specified note. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + +def add_GrafeasServicer_to_server(servicer, server): + rpc_method_handlers = { + "GetOccurrence": grpc.unary_unary_rpc_method_handler( + servicer.GetOccurrence, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.GetOccurrenceRequest.FromString, + response_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Occurrence.SerializeToString, + ), + "ListOccurrences": grpc.unary_unary_rpc_method_handler( + servicer.ListOccurrences, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.ListOccurrencesRequest.FromString, + response_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.ListOccurrencesResponse.SerializeToString, + ), + "DeleteOccurrence": grpc.unary_unary_rpc_method_handler( + servicer.DeleteOccurrence, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.DeleteOccurrenceRequest.FromString, + response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, + ), + "CreateOccurrence": grpc.unary_unary_rpc_method_handler( + servicer.CreateOccurrence, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.CreateOccurrenceRequest.FromString, + response_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Occurrence.SerializeToString, + ), + "BatchCreateOccurrences": grpc.unary_unary_rpc_method_handler( + servicer.BatchCreateOccurrences, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.BatchCreateOccurrencesRequest.FromString, + response_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.BatchCreateOccurrencesResponse.SerializeToString, + ), + "UpdateOccurrence": grpc.unary_unary_rpc_method_handler( + servicer.UpdateOccurrence, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.UpdateOccurrenceRequest.FromString, + response_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Occurrence.SerializeToString, + ), + "GetOccurrenceNote": grpc.unary_unary_rpc_method_handler( + servicer.GetOccurrenceNote, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.GetOccurrenceNoteRequest.FromString, + response_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Note.SerializeToString, + ), + "GetNote": grpc.unary_unary_rpc_method_handler( + servicer.GetNote, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.GetNoteRequest.FromString, + response_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Note.SerializeToString, + ), + "ListNotes": grpc.unary_unary_rpc_method_handler( + servicer.ListNotes, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.ListNotesRequest.FromString, + response_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.ListNotesResponse.SerializeToString, + ), + "DeleteNote": grpc.unary_unary_rpc_method_handler( + servicer.DeleteNote, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.DeleteNoteRequest.FromString, + response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, + ), + "CreateNote": grpc.unary_unary_rpc_method_handler( + servicer.CreateNote, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.CreateNoteRequest.FromString, + response_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Note.SerializeToString, + ), + "BatchCreateNotes": grpc.unary_unary_rpc_method_handler( + servicer.BatchCreateNotes, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.BatchCreateNotesRequest.FromString, + response_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.BatchCreateNotesResponse.SerializeToString, + ), + "UpdateNote": grpc.unary_unary_rpc_method_handler( + servicer.UpdateNote, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.UpdateNoteRequest.FromString, + response_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.Note.SerializeToString, + ), + "ListNoteOccurrences": grpc.unary_unary_rpc_method_handler( + servicer.ListNoteOccurrences, + request_deserializer=grafeas__v1_dot_proto_dot_grafeas__pb2.ListNoteOccurrencesRequest.FromString, + response_serializer=grafeas__v1_dot_proto_dot_grafeas__pb2.ListNoteOccurrencesResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + "grafeas.v1.Grafeas", rpc_method_handlers + ) + server.add_generic_rpc_handlers((generic_handler,)) diff --git a/grafeas/grafeas/grafeas_v1/proto/image.proto b/grafeas/grafeas/grafeas_v1/proto/image.proto new file mode 100644 index 000000000000..9ac162cec22f --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/image.proto @@ -0,0 +1,83 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// 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. + +syntax = "proto3"; + +package grafeas.v1; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// Layer holds metadata specific to a layer of a Docker image. +message Layer { + // Required. The recovered Dockerfile directive used to construct this layer. + // See https://docs.docker.com/engine/reference/builder/ for more information. + string directive = 1; + + // The recovered arguments to the Dockerfile directive. + string arguments = 2; +} + +// A set of properties that uniquely identify a given Docker image. +message Fingerprint { + // Required. The layer ID of the final layer in the Docker image's v1 + // representation. + string v1_name = 1; + + // Required. The ordered list of v2 blobs that represent a given image. + repeated string v2_blob = 2; + + // Output only. The name of the image's v2 blobs computed via: + // [bottom] := v2_blob[bottom] + // [N] := sha256(v2_blob[N] + " " + v2_name[N+1]) + // Only the name of the final blob is kept. + string v2_name = 3; +} + +// Basis describes the base image portion (Note) of the DockerImage +// relationship. Linked occurrences are derived from this or an equivalent image +// via: +// FROM +// Or an equivalent reference, e.g., a tag of the resource_url. +message ImageNote { + // Required. Immutable. The resource_url for the resource representing the + // basis of associated occurrence images. + string resource_url = 1; + + // Required. Immutable. The fingerprint of the base image. + Fingerprint fingerprint = 2; +} + +// Details of the derived image portion of the DockerImage relationship. This +// image would be produced from a Dockerfile with FROM . +message ImageOccurrence { + // Required. The fingerprint of the derived image. + Fingerprint fingerprint = 1; + + // Output only. The number of layers by which this image differs from the + // associated image basis. + int32 distance = 2; + + // This contains layer-specific metadata, if populated it has length + // "distance" and is ordered with [distance] being the layer immediately + // following the base image and [1] being the final layer. + repeated Layer layer_info = 3; + + // Output only. This contains the base image URL for the derived image + // occurrence. + string base_resource_url = 4; +} diff --git a/grafeas/grafeas/grafeas_v1/proto/image_pb2.py b/grafeas/grafeas/grafeas_v1/proto/image_pb2.py new file mode 100644 index 000000000000..77cb92fff98c --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/image_pb2.py @@ -0,0 +1,425 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: grafeas_v1/proto/image.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="grafeas_v1/proto/image.proto", + package="grafeas.v1", + syntax="proto3", + serialized_options=_b( + "\n\rio.grafeas.v1P\001Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\242\002\003GRA" + ), + serialized_pb=_b( + '\n\x1cgrafeas_v1/proto/image.proto\x12\ngrafeas.v1"-\n\x05Layer\x12\x11\n\tdirective\x18\x01 \x01(\t\x12\x11\n\targuments\x18\x02 \x01(\t"@\n\x0b\x46ingerprint\x12\x0f\n\x07v1_name\x18\x01 \x01(\t\x12\x0f\n\x07v2_blob\x18\x02 \x03(\t\x12\x0f\n\x07v2_name\x18\x03 \x01(\t"O\n\tImageNote\x12\x14\n\x0cresource_url\x18\x01 \x01(\t\x12,\n\x0b\x66ingerprint\x18\x02 \x01(\x0b\x32\x17.grafeas.v1.Fingerprint"\x93\x01\n\x0fImageOccurrence\x12,\n\x0b\x66ingerprint\x18\x01 \x01(\x0b\x32\x17.grafeas.v1.Fingerprint\x12\x10\n\x08\x64istance\x18\x02 \x01(\x05\x12%\n\nlayer_info\x18\x03 \x03(\x0b\x32\x11.grafeas.v1.Layer\x12\x19\n\x11\x62\x61se_resource_url\x18\x04 \x01(\tBQ\n\rio.grafeas.v1P\x01Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\xa2\x02\x03GRAb\x06proto3' + ), +) + + +_LAYER = _descriptor.Descriptor( + name="Layer", + full_name="grafeas.v1.Layer", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="directive", + full_name="grafeas.v1.Layer.directive", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="arguments", + full_name="grafeas.v1.Layer.arguments", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=44, + serialized_end=89, +) + + +_FINGERPRINT = _descriptor.Descriptor( + name="Fingerprint", + full_name="grafeas.v1.Fingerprint", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="v1_name", + full_name="grafeas.v1.Fingerprint.v1_name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="v2_blob", + full_name="grafeas.v1.Fingerprint.v2_blob", + index=1, + number=2, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="v2_name", + full_name="grafeas.v1.Fingerprint.v2_name", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=91, + serialized_end=155, +) + + +_IMAGENOTE = _descriptor.Descriptor( + name="ImageNote", + full_name="grafeas.v1.ImageNote", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="resource_url", + full_name="grafeas.v1.ImageNote.resource_url", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="fingerprint", + full_name="grafeas.v1.ImageNote.fingerprint", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=157, + serialized_end=236, +) + + +_IMAGEOCCURRENCE = _descriptor.Descriptor( + name="ImageOccurrence", + full_name="grafeas.v1.ImageOccurrence", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="fingerprint", + full_name="grafeas.v1.ImageOccurrence.fingerprint", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="distance", + full_name="grafeas.v1.ImageOccurrence.distance", + index=1, + number=2, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="layer_info", + full_name="grafeas.v1.ImageOccurrence.layer_info", + index=2, + number=3, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="base_resource_url", + full_name="grafeas.v1.ImageOccurrence.base_resource_url", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=239, + serialized_end=386, +) + +_IMAGENOTE.fields_by_name["fingerprint"].message_type = _FINGERPRINT +_IMAGEOCCURRENCE.fields_by_name["fingerprint"].message_type = _FINGERPRINT +_IMAGEOCCURRENCE.fields_by_name["layer_info"].message_type = _LAYER +DESCRIPTOR.message_types_by_name["Layer"] = _LAYER +DESCRIPTOR.message_types_by_name["Fingerprint"] = _FINGERPRINT +DESCRIPTOR.message_types_by_name["ImageNote"] = _IMAGENOTE +DESCRIPTOR.message_types_by_name["ImageOccurrence"] = _IMAGEOCCURRENCE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Layer = _reflection.GeneratedProtocolMessageType( + "Layer", + (_message.Message,), + dict( + DESCRIPTOR=_LAYER, + __module__="grafeas_v1.proto.image_pb2", + __doc__="""Layer holds metadata specific to a layer of a Docker image. + + + Attributes: + directive: + Required. The recovered Dockerfile directive used to construct + this layer. See + https://docs.docker.com/engine/reference/builder/ for more + information. + arguments: + The recovered arguments to the Dockerfile directive. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.Layer) + ), +) +_sym_db.RegisterMessage(Layer) + +Fingerprint = _reflection.GeneratedProtocolMessageType( + "Fingerprint", + (_message.Message,), + dict( + DESCRIPTOR=_FINGERPRINT, + __module__="grafeas_v1.proto.image_pb2", + __doc__="""A set of properties that uniquely identify a given Docker image. + + + Attributes: + v1_name: + Required. The layer ID of the final layer in the Docker + image's v1 representation. + v2_blob: + Required. The ordered list of v2 blobs that represent a given + image. + v2_name: + Output only. The name of the image's v2 blobs computed via: + [bottom] := v2\_blob[bottom][N] := sha256(v2\_blob[N] + " " + + v2\_name[N+1]) Only the name of the final blob is kept. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.Fingerprint) + ), +) +_sym_db.RegisterMessage(Fingerprint) + +ImageNote = _reflection.GeneratedProtocolMessageType( + "ImageNote", + (_message.Message,), + dict( + DESCRIPTOR=_IMAGENOTE, + __module__="grafeas_v1.proto.image_pb2", + __doc__="""Basis describes the base image portion (Note) of the DockerImage + relationship. Linked occurrences are derived from this or an equivalent + image via: FROM Or an equivalent reference, e.g., a tag of the + resource\_url. + + + Attributes: + resource_url: + Required. Immutable. The resource\_url for the resource + representing the basis of associated occurrence images. + fingerprint: + Required. Immutable. The fingerprint of the base image. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.ImageNote) + ), +) +_sym_db.RegisterMessage(ImageNote) + +ImageOccurrence = _reflection.GeneratedProtocolMessageType( + "ImageOccurrence", + (_message.Message,), + dict( + DESCRIPTOR=_IMAGEOCCURRENCE, + __module__="grafeas_v1.proto.image_pb2", + __doc__="""Details of the derived image portion of the DockerImage relationship. + This image would be produced from a Dockerfile with FROM . + + + Attributes: + fingerprint: + Required. The fingerprint of the derived image. + distance: + Output only. The number of layers by which this image differs + from the associated image basis. + layer_info: + This contains layer-specific metadata, if populated it has + length "distance" and is ordered with [distance] being the + layer immediately following the base image and [1] being the + final layer. + base_resource_url: + Output only. This contains the base image URL for the derived + image occurrence. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.ImageOccurrence) + ), +) +_sym_db.RegisterMessage(ImageOccurrence) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/grafeas/grafeas/grafeas_v1/proto/image_pb2_grpc.py b/grafeas/grafeas/grafeas_v1/proto/image_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/image_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/grafeas/grafeas/grafeas_v1/proto/package.proto b/grafeas/grafeas/grafeas_v1/proto/package.proto new file mode 100644 index 000000000000..b04686d9fc33 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/package.proto @@ -0,0 +1,124 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// 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. + +syntax = "proto3"; + +package grafeas.v1; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// Instruction set architectures supported by various package managers. +enum Architecture { + // Unknown architecture. + ARCHITECTURE_UNSPECIFIED = 0; + // X86 architecture. + X86 = 1; + // X64 architecture. + X64 = 2; +} + +// This represents a particular channel of distribution for a given package. +// E.g., Debian's jessie-backports dpkg mirror. +message Distribution { + // Required. The cpe_uri in [CPE format](https://cpe.mitre.org/specification/) + // denoting the package manager version distributing a package. + string cpe_uri = 1; + + // The CPU architecture for which packages in this distribution channel were + // built. + Architecture architecture = 2; + + // The latest available version of this package in this distribution channel. + Version latest_version = 3; + + // A freeform string denoting the maintainer of this package. + string maintainer = 4; + + // The distribution channel-specific homepage for this package. + string url = 5; + + // The distribution channel-specific description of this package. + string description = 6; +} + +// An occurrence of a particular package installation found within a system's +// filesystem. E.g., glibc was found in `/var/lib/dpkg/status`. +message Location { + // Required. The CPE URI in [CPE format](https://cpe.mitre.org/specification/) + // denoting the package manager version distributing a package. + string cpe_uri = 1; + + // The version installed at this location. + Version version = 2; + + // The path from which we gathered that this package/version is installed. + string path = 3; +} + +// This represents a particular package that is distributed over various +// channels. E.g., glibc (aka libc6) is distributed by many, at various +// versions. +message PackageNote { + // Required. Immutable. The name of the package. + string name = 1; + + // The various channels by which a package is distributed. + repeated Distribution distribution = 10; +} + +// Details on how a particular software package was installed on a system. +message PackageOccurrence { + // Output only. The name of the installed package. + string name = 1; + + // Required. All of the places within the filesystem versions of this package + // have been found. + repeated Location location = 2; +} + +// Version contains structured information about the version of a package. +message Version { + // Used to correct mistakes in the version numbering scheme. + int32 epoch = 1; + + // Required only when version kind is NORMAL. The main part of the version + // name. + string name = 2; + + // The iteration of the package build from the above version. + string revision = 3; + + // Whether this is an ordinary package version or a sentinel MIN/MAX version. + enum VersionKind { + // Unknown. + VERSION_KIND_UNSPECIFIED = 0; + // A standard package version. + NORMAL = 1; + // A special version representing negative infinity. + MINIMUM = 2; + // A special version representing positive infinity. + MAXIMUM = 3; + }; + + // Required. Distinguishes between sentinel MIN/MAX versions and normal + // versions. + VersionKind kind = 4; + + // Human readable version string. This string is of the form + // :- and is only set when kind is NORMAL. + string full_name = 5; +} diff --git a/grafeas/grafeas/grafeas_v1/proto/package_pb2.py b/grafeas/grafeas/grafeas_v1/proto/package_pb2.py new file mode 100644 index 000000000000..4cb3349bb9c1 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/package_pb2.py @@ -0,0 +1,670 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: grafeas_v1/proto/package.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="grafeas_v1/proto/package.proto", + package="grafeas.v1", + syntax="proto3", + serialized_options=_b( + "\n\rio.grafeas.v1P\001Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\242\002\003GRA" + ), + serialized_pb=_b( + '\n\x1egrafeas_v1/proto/package.proto\x12\ngrafeas.v1"\xb2\x01\n\x0c\x44istribution\x12\x0f\n\x07\x63pe_uri\x18\x01 \x01(\t\x12.\n\x0c\x61rchitecture\x18\x02 \x01(\x0e\x32\x18.grafeas.v1.Architecture\x12+\n\x0elatest_version\x18\x03 \x01(\x0b\x32\x13.grafeas.v1.Version\x12\x12\n\nmaintainer\x18\x04 \x01(\t\x12\x0b\n\x03url\x18\x05 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x06 \x01(\t"O\n\x08Location\x12\x0f\n\x07\x63pe_uri\x18\x01 \x01(\t\x12$\n\x07version\x18\x02 \x01(\x0b\x32\x13.grafeas.v1.Version\x12\x0c\n\x04path\x18\x03 \x01(\t"K\n\x0bPackageNote\x12\x0c\n\x04name\x18\x01 \x01(\t\x12.\n\x0c\x64istribution\x18\n \x03(\x0b\x32\x18.grafeas.v1.Distribution"I\n\x11PackageOccurrence\x12\x0c\n\x04name\x18\x01 \x01(\t\x12&\n\x08location\x18\x02 \x03(\x0b\x32\x14.grafeas.v1.Location"\xcd\x01\n\x07Version\x12\r\n\x05\x65poch\x18\x01 \x01(\x05\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x10\n\x08revision\x18\x03 \x01(\t\x12-\n\x04kind\x18\x04 \x01(\x0e\x32\x1f.grafeas.v1.Version.VersionKind\x12\x11\n\tfull_name\x18\x05 \x01(\t"Q\n\x0bVersionKind\x12\x1c\n\x18VERSION_KIND_UNSPECIFIED\x10\x00\x12\n\n\x06NORMAL\x10\x01\x12\x0b\n\x07MINIMUM\x10\x02\x12\x0b\n\x07MAXIMUM\x10\x03*>\n\x0c\x41rchitecture\x12\x1c\n\x18\x41RCHITECTURE_UNSPECIFIED\x10\x00\x12\x07\n\x03X86\x10\x01\x12\x07\n\x03X64\x10\x02\x42Q\n\rio.grafeas.v1P\x01Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\xa2\x02\x03GRAb\x06proto3' + ), +) + +_ARCHITECTURE = _descriptor.EnumDescriptor( + name="Architecture", + full_name="grafeas.v1.Architecture", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="ARCHITECTURE_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="X86", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="X64", index=2, number=2, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=668, + serialized_end=730, +) +_sym_db.RegisterEnumDescriptor(_ARCHITECTURE) + +Architecture = enum_type_wrapper.EnumTypeWrapper(_ARCHITECTURE) +ARCHITECTURE_UNSPECIFIED = 0 +X86 = 1 +X64 = 2 + + +_VERSION_VERSIONKIND = _descriptor.EnumDescriptor( + name="VersionKind", + full_name="grafeas.v1.Version.VersionKind", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="VERSION_KIND_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="NORMAL", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="MINIMUM", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="MAXIMUM", index=3, number=3, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=585, + serialized_end=666, +) +_sym_db.RegisterEnumDescriptor(_VERSION_VERSIONKIND) + + +_DISTRIBUTION = _descriptor.Descriptor( + name="Distribution", + full_name="grafeas.v1.Distribution", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="cpe_uri", + full_name="grafeas.v1.Distribution.cpe_uri", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="architecture", + full_name="grafeas.v1.Distribution.architecture", + index=1, + number=2, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="latest_version", + full_name="grafeas.v1.Distribution.latest_version", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="maintainer", + full_name="grafeas.v1.Distribution.maintainer", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="url", + full_name="grafeas.v1.Distribution.url", + index=4, + number=5, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="description", + full_name="grafeas.v1.Distribution.description", + index=5, + number=6, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=47, + serialized_end=225, +) + + +_LOCATION = _descriptor.Descriptor( + name="Location", + full_name="grafeas.v1.Location", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="cpe_uri", + full_name="grafeas.v1.Location.cpe_uri", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="version", + full_name="grafeas.v1.Location.version", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="path", + full_name="grafeas.v1.Location.path", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=227, + serialized_end=306, +) + + +_PACKAGENOTE = _descriptor.Descriptor( + name="PackageNote", + full_name="grafeas.v1.PackageNote", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.PackageNote.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="distribution", + full_name="grafeas.v1.PackageNote.distribution", + index=1, + number=10, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=308, + serialized_end=383, +) + + +_PACKAGEOCCURRENCE = _descriptor.Descriptor( + name="PackageOccurrence", + full_name="grafeas.v1.PackageOccurrence", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.PackageOccurrence.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="location", + full_name="grafeas.v1.PackageOccurrence.location", + index=1, + number=2, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=385, + serialized_end=458, +) + + +_VERSION = _descriptor.Descriptor( + name="Version", + full_name="grafeas.v1.Version", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="epoch", + full_name="grafeas.v1.Version.epoch", + index=0, + number=1, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.Version.name", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="revision", + full_name="grafeas.v1.Version.revision", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="kind", + full_name="grafeas.v1.Version.kind", + index=3, + number=4, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="full_name", + full_name="grafeas.v1.Version.full_name", + index=4, + number=5, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[_VERSION_VERSIONKIND], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=461, + serialized_end=666, +) + +_DISTRIBUTION.fields_by_name["architecture"].enum_type = _ARCHITECTURE +_DISTRIBUTION.fields_by_name["latest_version"].message_type = _VERSION +_LOCATION.fields_by_name["version"].message_type = _VERSION +_PACKAGENOTE.fields_by_name["distribution"].message_type = _DISTRIBUTION +_PACKAGEOCCURRENCE.fields_by_name["location"].message_type = _LOCATION +_VERSION.fields_by_name["kind"].enum_type = _VERSION_VERSIONKIND +_VERSION_VERSIONKIND.containing_type = _VERSION +DESCRIPTOR.message_types_by_name["Distribution"] = _DISTRIBUTION +DESCRIPTOR.message_types_by_name["Location"] = _LOCATION +DESCRIPTOR.message_types_by_name["PackageNote"] = _PACKAGENOTE +DESCRIPTOR.message_types_by_name["PackageOccurrence"] = _PACKAGEOCCURRENCE +DESCRIPTOR.message_types_by_name["Version"] = _VERSION +DESCRIPTOR.enum_types_by_name["Architecture"] = _ARCHITECTURE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Distribution = _reflection.GeneratedProtocolMessageType( + "Distribution", + (_message.Message,), + dict( + DESCRIPTOR=_DISTRIBUTION, + __module__="grafeas_v1.proto.package_pb2", + __doc__="""This represents a particular channel of distribution for a given + package. E.g., Debian's jessie-backports dpkg mirror. + + + Attributes: + cpe_uri: + Required. The cpe\_uri in `CPE format + `__ denoting the package + manager version distributing a package. + architecture: + The CPU architecture for which packages in this distribution + channel were built. + latest_version: + The latest available version of this package in this + distribution channel. + maintainer: + A freeform string denoting the maintainer of this package. + url: + The distribution channel-specific homepage for this package. + description: + The distribution channel-specific description of this package. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.Distribution) + ), +) +_sym_db.RegisterMessage(Distribution) + +Location = _reflection.GeneratedProtocolMessageType( + "Location", + (_message.Message,), + dict( + DESCRIPTOR=_LOCATION, + __module__="grafeas_v1.proto.package_pb2", + __doc__="""An occurrence of a particular package installation found within a + system's filesystem. E.g., glibc was found in ``/var/lib/dpkg/status``. + + + Attributes: + cpe_uri: + Required. The CPE URI in `CPE format + `__ denoting the package + manager version distributing a package. + version: + The version installed at this location. + path: + The path from which we gathered that this package/version is + installed. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.Location) + ), +) +_sym_db.RegisterMessage(Location) + +PackageNote = _reflection.GeneratedProtocolMessageType( + "PackageNote", + (_message.Message,), + dict( + DESCRIPTOR=_PACKAGENOTE, + __module__="grafeas_v1.proto.package_pb2", + __doc__="""This represents a particular package that is distributed over various + channels. E.g., glibc (aka libc6) is distributed by many, at various + versions. + + + Attributes: + name: + Required. Immutable. The name of the package. + distribution: + The various channels by which a package is distributed. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.PackageNote) + ), +) +_sym_db.RegisterMessage(PackageNote) + +PackageOccurrence = _reflection.GeneratedProtocolMessageType( + "PackageOccurrence", + (_message.Message,), + dict( + DESCRIPTOR=_PACKAGEOCCURRENCE, + __module__="grafeas_v1.proto.package_pb2", + __doc__="""Details on how a particular software package was installed on a system. + + + Attributes: + name: + Output only. The name of the installed package. + location: + Required. All of the places within the filesystem versions of + this package have been found. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.PackageOccurrence) + ), +) +_sym_db.RegisterMessage(PackageOccurrence) + +Version = _reflection.GeneratedProtocolMessageType( + "Version", + (_message.Message,), + dict( + DESCRIPTOR=_VERSION, + __module__="grafeas_v1.proto.package_pb2", + __doc__="""Version contains structured information about the version of a package. + + + Attributes: + epoch: + Used to correct mistakes in the version numbering scheme. + name: + Required only when version kind is NORMAL. The main part of + the version name. + revision: + The iteration of the package build from the above version. + kind: + Required. Distinguishes between sentinel MIN/MAX versions and + normal versions. + full_name: + Human readable version string. This string is of the form :- + and is only set when kind is NORMAL. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.Version) + ), +) +_sym_db.RegisterMessage(Version) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/grafeas/grafeas/grafeas_v1/proto/package_pb2_grpc.py b/grafeas/grafeas/grafeas_v1/proto/package_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/package_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/grafeas/grafeas/grafeas_v1/proto/provenance.proto b/grafeas/grafeas/grafeas_v1/proto/provenance.proto new file mode 100644 index 000000000000..06b109785f8a --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/provenance.proto @@ -0,0 +1,265 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// 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. + +syntax = "proto3"; + +package grafeas.v1; + +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// Provenance of a build. Contains all information needed to verify the full +// details about the build from source to completion. +message BuildProvenance { + // Required. Unique identifier of the build. + string id = 1; + + // ID of the project. + string project_id = 2; + + // Commands requested by the build. + repeated Command commands = 3; + + // Output of the build. + repeated Artifact built_artifacts = 4; + + // Time at which the build was created. + google.protobuf.Timestamp create_time = 5; + + // Time at which execution of the build was started. + google.protobuf.Timestamp start_time = 6; + + // Time at which execution of the build was finished. + google.protobuf.Timestamp end_time = 7; + + // E-mail address of the user who initiated this build. Note that this was the + // user's e-mail address at the time the build was initiated; this address may + // not represent the same end-user for all time. + string creator = 8; + + // URI where any logs for this provenance were written. + string logs_uri = 9; + + // Details of the Source input to the build. + Source source_provenance = 10; + + // Trigger identifier if the build was triggered automatically; empty if not. + string trigger_id = 11; + + // Special options applied to this build. This is a catch-all field where + // build providers can enter any desired additional details. + map build_options = 12; + + // Version string of the builder at the time this build was executed. + string builder_version = 13; +} + +// Source describes the location of the source used for the build. +message Source { + // If provided, the input binary artifacts for the build came from this + // location. + string artifact_storage_source_uri = 1; + + // Hash(es) of the build source, which can be used to verify that the original + // source integrity was maintained in the build. + // + // The keys to this map are file paths used as build source and the values + // contain the hash values for those files. + // + // If the build source came in a single package such as a gzipped tarfile + // (.tar.gz), the FileHash will be for the single path to that file. + map file_hashes = 2; + + // If provided, the source code used for the build came from this location. + SourceContext context = 3; + + // If provided, some of the source code used for the build may be found in + // these locations, in the case where the source repository had multiple + // remotes or submodules. This list will not include the context specified in + // the context field. + repeated SourceContext additional_contexts = 4; +} + +// Container message for hashes of byte content of files, used in source +// messages to verify integrity of source input to the build. +message FileHashes { + // Required. Collection of file hashes. + repeated Hash file_hash = 1; +} + +// Container message for hash values. +message Hash { + // Required. The type of hash that was performed, e.g. "SHA-256". + string type = 1; + // Required. The hash value. + bytes value = 2; +} + +// Command describes a step performed as part of the build pipeline. +message Command { + // Required. Name of the command, as presented on the command line, or if the + // command is packaged as a Docker container, as presented to `docker pull`. + string name = 1; + + // Environment variables set before running this command. + repeated string env = 2; + + // Command-line arguments used when executing this command. + repeated string args = 3; + + // Working directory (relative to project source root) used when running this + // command. + string dir = 4; + + // Optional unique identifier for this command, used in wait_for to reference + // this command as a dependency. + string id = 5; + + // The ID(s) of the command(s) that this command depends on. + repeated string wait_for = 6; +} + +// Artifact describes a build product. +message Artifact { + // Hash or checksum value of a binary, or Docker Registry 2.0 digest of a + // container. + string checksum = 1; + + // Artifact ID, if any; for container images, this will be a URL by digest + // like `gcr.io/projectID/imagename@sha256:123456`. + string id = 2; + + // Related artifact names. This may be the path to a binary or jar file, or in + // the case of a container build, the name used to push the container image to + // Google Container Registry, as presented to `docker push`. Note that a + // single Artifact ID can have multiple names, for example if two tags are + // applied to one image. + repeated string names = 3; +} + +// A SourceContext is a reference to a tree of files. A SourceContext together +// with a path point to a unique revision of a single file or directory. +message SourceContext { + // A SourceContext can refer any one of the following types of repositories. + oneof context { + // A SourceContext referring to a revision in a Google Cloud Source Repo. + CloudRepoSourceContext cloud_repo = 1; + + // A SourceContext referring to a Gerrit project. + GerritSourceContext gerrit = 2; + + // A SourceContext referring to any third party Git repo (e.g., GitHub). + GitSourceContext git = 3; + } + + // Labels with user defined metadata. + map labels = 4; +} + +// An alias to a repo revision. +message AliasContext { + // The type of an alias. + enum Kind { + // Unknown. + KIND_UNSPECIFIED = 0; + // Git tag. + FIXED = 1; + // Git branch. + MOVABLE = 2; + // Used to specify non-standard aliases. For example, if a Git repo has a + // ref named "refs/foo/bar". + OTHER = 4; + } + + // The alias kind. + Kind kind = 1; + + // The alias name. + string name = 2; +} + +// A CloudRepoSourceContext denotes a particular revision in a Google Cloud +// Source Repo. +message CloudRepoSourceContext { + // The ID of the repo. + RepoId repo_id = 1; + + // A revision in a Cloud Repo can be identified by either its revision ID or + // its alias. + oneof revision { + // A revision ID. + string revision_id = 2; + + // An alias, which may be a branch or tag. + AliasContext alias_context = 3; + } +} + +// A SourceContext referring to a Gerrit project. +message GerritSourceContext { + // The URI of a running Gerrit instance. + string host_uri = 1; + + // The full project name within the host. Projects may be nested, so + // "project/subproject" is a valid project name. The "repo name" is the + // hostURI/project. + string gerrit_project = 2; + + // A revision in a Gerrit project can be identified by either its revision ID + // or its alias. + oneof revision { + // A revision (commit) ID. + string revision_id = 3; + + // An alias, which may be a branch or tag. + AliasContext alias_context = 4; + } +} + +// A GitSourceContext denotes a particular revision in a third party Git +// repository (e.g., GitHub). +message GitSourceContext { + // Git repository URL. + string url = 1; + + // Git commit hash. + string revision_id = 2; +} + +// A unique identifier for a Cloud Repo. +message RepoId { + // A cloud repo can be identified by either its project ID and repository name + // combination, or its globally unique identifier. + oneof id { + // A combination of a project ID and a repo name. + ProjectRepoId project_repo_id = 1; + + // A server-assigned, globally unique identifier. + string uid = 2; + } +} + +// Selects a repo using a Google Cloud Platform project ID (e.g., +// winged-cargo-31) and a repo name within that project. +message ProjectRepoId { + // The ID of the project. + string project_id = 1; + + // The name of the repo. Leave empty for the default repo. + string repo_name = 2; +} diff --git a/grafeas/grafeas/grafeas_v1/proto/provenance_pb2.py b/grafeas/grafeas/grafeas_v1/proto/provenance_pb2.py new file mode 100644 index 000000000000..86f03fce3f00 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/provenance_pb2.py @@ -0,0 +1,1889 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: grafeas_v1/proto/provenance.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="grafeas_v1/proto/provenance.proto", + package="grafeas.v1", + syntax="proto3", + serialized_options=_b( + "\n\rio.grafeas.v1P\001Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\242\002\003GRA" + ), + serialized_pb=_b( + '\n!grafeas_v1/proto/provenance.proto\x12\ngrafeas.v1\x1a\x1fgoogle/protobuf/timestamp.proto"\x90\x04\n\x0f\x42uildProvenance\x12\n\n\x02id\x18\x01 \x01(\t\x12\x12\n\nproject_id\x18\x02 \x01(\t\x12%\n\x08\x63ommands\x18\x03 \x03(\x0b\x32\x13.grafeas.v1.Command\x12-\n\x0f\x62uilt_artifacts\x18\x04 \x03(\x0b\x32\x14.grafeas.v1.Artifact\x12/\n\x0b\x63reate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nstart_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0f\n\x07\x63reator\x18\x08 \x01(\t\x12\x10\n\x08logs_uri\x18\t \x01(\t\x12-\n\x11source_provenance\x18\n \x01(\x0b\x32\x12.grafeas.v1.Source\x12\x12\n\ntrigger_id\x18\x0b \x01(\t\x12\x44\n\rbuild_options\x18\x0c \x03(\x0b\x32-.grafeas.v1.BuildProvenance.BuildOptionsEntry\x12\x17\n\x0f\x62uilder_version\x18\r \x01(\t\x1a\x33\n\x11\x42uildOptionsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x95\x02\n\x06Source\x12#\n\x1b\x61rtifact_storage_source_uri\x18\x01 \x01(\t\x12\x37\n\x0b\x66ile_hashes\x18\x02 \x03(\x0b\x32".grafeas.v1.Source.FileHashesEntry\x12*\n\x07\x63ontext\x18\x03 \x01(\x0b\x32\x19.grafeas.v1.SourceContext\x12\x36\n\x13\x61\x64\x64itional_contexts\x18\x04 \x03(\x0b\x32\x19.grafeas.v1.SourceContext\x1aI\n\x0f\x46ileHashesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.grafeas.v1.FileHashes:\x02\x38\x01"1\n\nFileHashes\x12#\n\tfile_hash\x18\x01 \x03(\x0b\x32\x10.grafeas.v1.Hash"#\n\x04Hash\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c"]\n\x07\x43ommand\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0b\n\x03\x65nv\x18\x02 \x03(\t\x12\x0c\n\x04\x61rgs\x18\x03 \x03(\t\x12\x0b\n\x03\x64ir\x18\x04 \x01(\t\x12\n\n\x02id\x18\x05 \x01(\t\x12\x10\n\x08wait_for\x18\x06 \x03(\t"7\n\x08\x41rtifact\x12\x10\n\x08\x63hecksum\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\t\x12\r\n\x05names\x18\x03 \x03(\t"\x9a\x02\n\rSourceContext\x12\x38\n\ncloud_repo\x18\x01 \x01(\x0b\x32".grafeas.v1.CloudRepoSourceContextH\x00\x12\x31\n\x06gerrit\x18\x02 \x01(\x0b\x32\x1f.grafeas.v1.GerritSourceContextH\x00\x12+\n\x03git\x18\x03 \x01(\x0b\x32\x1c.grafeas.v1.GitSourceContextH\x00\x12\x35\n\x06labels\x18\x04 \x03(\x0b\x32%.grafeas.v1.SourceContext.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\t\n\x07\x63ontext"\x8a\x01\n\x0c\x41liasContext\x12+\n\x04kind\x18\x01 \x01(\x0e\x32\x1d.grafeas.v1.AliasContext.Kind\x12\x0c\n\x04name\x18\x02 \x01(\t"?\n\x04Kind\x12\x14\n\x10KIND_UNSPECIFIED\x10\x00\x12\t\n\x05\x46IXED\x10\x01\x12\x0b\n\x07MOVABLE\x10\x02\x12\t\n\x05OTHER\x10\x04"\x93\x01\n\x16\x43loudRepoSourceContext\x12#\n\x07repo_id\x18\x01 \x01(\x0b\x32\x12.grafeas.v1.RepoId\x12\x15\n\x0brevision_id\x18\x02 \x01(\tH\x00\x12\x31\n\ralias_context\x18\x03 \x01(\x0b\x32\x18.grafeas.v1.AliasContextH\x00\x42\n\n\x08revision"\x95\x01\n\x13GerritSourceContext\x12\x10\n\x08host_uri\x18\x01 \x01(\t\x12\x16\n\x0egerrit_project\x18\x02 \x01(\t\x12\x15\n\x0brevision_id\x18\x03 \x01(\tH\x00\x12\x31\n\ralias_context\x18\x04 \x01(\x0b\x32\x18.grafeas.v1.AliasContextH\x00\x42\n\n\x08revision"4\n\x10GitSourceContext\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x13\n\x0brevision_id\x18\x02 \x01(\t"S\n\x06RepoId\x12\x34\n\x0fproject_repo_id\x18\x01 \x01(\x0b\x32\x19.grafeas.v1.ProjectRepoIdH\x00\x12\r\n\x03uid\x18\x02 \x01(\tH\x00\x42\x04\n\x02id"6\n\rProjectRepoId\x12\x12\n\nproject_id\x18\x01 \x01(\t\x12\x11\n\trepo_name\x18\x02 \x01(\tBQ\n\rio.grafeas.v1P\x01Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\xa2\x02\x03GRAb\x06proto3' + ), + dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR], +) + + +_ALIASCONTEXT_KIND = _descriptor.EnumDescriptor( + name="Kind", + full_name="grafeas.v1.AliasContext.Kind", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="KIND_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="FIXED", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="MOVABLE", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="OTHER", index=3, number=4, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=1494, + serialized_end=1557, +) +_sym_db.RegisterEnumDescriptor(_ALIASCONTEXT_KIND) + + +_BUILDPROVENANCE_BUILDOPTIONSENTRY = _descriptor.Descriptor( + name="BuildOptionsEntry", + full_name="grafeas.v1.BuildProvenance.BuildOptionsEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="grafeas.v1.BuildProvenance.BuildOptionsEntry.key", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="grafeas.v1.BuildProvenance.BuildOptionsEntry.value", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=_b("8\001"), + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=560, + serialized_end=611, +) + +_BUILDPROVENANCE = _descriptor.Descriptor( + name="BuildProvenance", + full_name="grafeas.v1.BuildProvenance", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="id", + full_name="grafeas.v1.BuildProvenance.id", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="project_id", + full_name="grafeas.v1.BuildProvenance.project_id", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="commands", + full_name="grafeas.v1.BuildProvenance.commands", + index=2, + number=3, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="built_artifacts", + full_name="grafeas.v1.BuildProvenance.built_artifacts", + index=3, + number=4, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="create_time", + full_name="grafeas.v1.BuildProvenance.create_time", + index=4, + number=5, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="start_time", + full_name="grafeas.v1.BuildProvenance.start_time", + index=5, + number=6, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="end_time", + full_name="grafeas.v1.BuildProvenance.end_time", + index=6, + number=7, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="creator", + full_name="grafeas.v1.BuildProvenance.creator", + index=7, + number=8, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="logs_uri", + full_name="grafeas.v1.BuildProvenance.logs_uri", + index=8, + number=9, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="source_provenance", + full_name="grafeas.v1.BuildProvenance.source_provenance", + index=9, + number=10, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="trigger_id", + full_name="grafeas.v1.BuildProvenance.trigger_id", + index=10, + number=11, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="build_options", + full_name="grafeas.v1.BuildProvenance.build_options", + index=11, + number=12, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="builder_version", + full_name="grafeas.v1.BuildProvenance.builder_version", + index=12, + number=13, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_BUILDPROVENANCE_BUILDOPTIONSENTRY], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=83, + serialized_end=611, +) + + +_SOURCE_FILEHASHESENTRY = _descriptor.Descriptor( + name="FileHashesEntry", + full_name="grafeas.v1.Source.FileHashesEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="grafeas.v1.Source.FileHashesEntry.key", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="grafeas.v1.Source.FileHashesEntry.value", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=_b("8\001"), + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=818, + serialized_end=891, +) + +_SOURCE = _descriptor.Descriptor( + name="Source", + full_name="grafeas.v1.Source", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="artifact_storage_source_uri", + full_name="grafeas.v1.Source.artifact_storage_source_uri", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="file_hashes", + full_name="grafeas.v1.Source.file_hashes", + index=1, + number=2, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="context", + full_name="grafeas.v1.Source.context", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="additional_contexts", + full_name="grafeas.v1.Source.additional_contexts", + index=3, + number=4, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_SOURCE_FILEHASHESENTRY], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=614, + serialized_end=891, +) + + +_FILEHASHES = _descriptor.Descriptor( + name="FileHashes", + full_name="grafeas.v1.FileHashes", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="file_hash", + full_name="grafeas.v1.FileHashes.file_hash", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=893, + serialized_end=942, +) + + +_HASH = _descriptor.Descriptor( + name="Hash", + full_name="grafeas.v1.Hash", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="type", + full_name="grafeas.v1.Hash.type", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="grafeas.v1.Hash.value", + index=1, + number=2, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=944, + serialized_end=979, +) + + +_COMMAND = _descriptor.Descriptor( + name="Command", + full_name="grafeas.v1.Command", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.Command.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="env", + full_name="grafeas.v1.Command.env", + index=1, + number=2, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="args", + full_name="grafeas.v1.Command.args", + index=2, + number=3, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="dir", + full_name="grafeas.v1.Command.dir", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="id", + full_name="grafeas.v1.Command.id", + index=4, + number=5, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="wait_for", + full_name="grafeas.v1.Command.wait_for", + index=5, + number=6, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=981, + serialized_end=1074, +) + + +_ARTIFACT = _descriptor.Descriptor( + name="Artifact", + full_name="grafeas.v1.Artifact", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="checksum", + full_name="grafeas.v1.Artifact.checksum", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="id", + full_name="grafeas.v1.Artifact.id", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="names", + full_name="grafeas.v1.Artifact.names", + index=2, + number=3, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1076, + serialized_end=1131, +) + + +_SOURCECONTEXT_LABELSENTRY = _descriptor.Descriptor( + name="LabelsEntry", + full_name="grafeas.v1.SourceContext.LabelsEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="grafeas.v1.SourceContext.LabelsEntry.key", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="value", + full_name="grafeas.v1.SourceContext.LabelsEntry.value", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=_b("8\001"), + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1360, + serialized_end=1405, +) + +_SOURCECONTEXT = _descriptor.Descriptor( + name="SourceContext", + full_name="grafeas.v1.SourceContext", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="cloud_repo", + full_name="grafeas.v1.SourceContext.cloud_repo", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="gerrit", + full_name="grafeas.v1.SourceContext.gerrit", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="git", + full_name="grafeas.v1.SourceContext.git", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="labels", + full_name="grafeas.v1.SourceContext.labels", + index=3, + number=4, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_SOURCECONTEXT_LABELSENTRY], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="context", + full_name="grafeas.v1.SourceContext.context", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=1134, + serialized_end=1416, +) + + +_ALIASCONTEXT = _descriptor.Descriptor( + name="AliasContext", + full_name="grafeas.v1.AliasContext", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="kind", + full_name="grafeas.v1.AliasContext.kind", + index=0, + number=1, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.AliasContext.name", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[_ALIASCONTEXT_KIND], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1419, + serialized_end=1557, +) + + +_CLOUDREPOSOURCECONTEXT = _descriptor.Descriptor( + name="CloudRepoSourceContext", + full_name="grafeas.v1.CloudRepoSourceContext", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="repo_id", + full_name="grafeas.v1.CloudRepoSourceContext.repo_id", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="revision_id", + full_name="grafeas.v1.CloudRepoSourceContext.revision_id", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="alias_context", + full_name="grafeas.v1.CloudRepoSourceContext.alias_context", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="revision", + full_name="grafeas.v1.CloudRepoSourceContext.revision", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=1560, + serialized_end=1707, +) + + +_GERRITSOURCECONTEXT = _descriptor.Descriptor( + name="GerritSourceContext", + full_name="grafeas.v1.GerritSourceContext", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="host_uri", + full_name="grafeas.v1.GerritSourceContext.host_uri", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="gerrit_project", + full_name="grafeas.v1.GerritSourceContext.gerrit_project", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="revision_id", + full_name="grafeas.v1.GerritSourceContext.revision_id", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="alias_context", + full_name="grafeas.v1.GerritSourceContext.alias_context", + index=3, + number=4, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="revision", + full_name="grafeas.v1.GerritSourceContext.revision", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=1710, + serialized_end=1859, +) + + +_GITSOURCECONTEXT = _descriptor.Descriptor( + name="GitSourceContext", + full_name="grafeas.v1.GitSourceContext", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="url", + full_name="grafeas.v1.GitSourceContext.url", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="revision_id", + full_name="grafeas.v1.GitSourceContext.revision_id", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1861, + serialized_end=1913, +) + + +_REPOID = _descriptor.Descriptor( + name="RepoId", + full_name="grafeas.v1.RepoId", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="project_repo_id", + full_name="grafeas.v1.RepoId.project_repo_id", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="uid", + full_name="grafeas.v1.RepoId.uid", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="id", + full_name="grafeas.v1.RepoId.id", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=1915, + serialized_end=1998, +) + + +_PROJECTREPOID = _descriptor.Descriptor( + name="ProjectRepoId", + full_name="grafeas.v1.ProjectRepoId", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="project_id", + full_name="grafeas.v1.ProjectRepoId.project_id", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="repo_name", + full_name="grafeas.v1.ProjectRepoId.repo_name", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=2000, + serialized_end=2054, +) + +_BUILDPROVENANCE_BUILDOPTIONSENTRY.containing_type = _BUILDPROVENANCE +_BUILDPROVENANCE.fields_by_name["commands"].message_type = _COMMAND +_BUILDPROVENANCE.fields_by_name["built_artifacts"].message_type = _ARTIFACT +_BUILDPROVENANCE.fields_by_name[ + "create_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_BUILDPROVENANCE.fields_by_name[ + "start_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_BUILDPROVENANCE.fields_by_name[ + "end_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_BUILDPROVENANCE.fields_by_name["source_provenance"].message_type = _SOURCE +_BUILDPROVENANCE.fields_by_name[ + "build_options" +].message_type = _BUILDPROVENANCE_BUILDOPTIONSENTRY +_SOURCE_FILEHASHESENTRY.fields_by_name["value"].message_type = _FILEHASHES +_SOURCE_FILEHASHESENTRY.containing_type = _SOURCE +_SOURCE.fields_by_name["file_hashes"].message_type = _SOURCE_FILEHASHESENTRY +_SOURCE.fields_by_name["context"].message_type = _SOURCECONTEXT +_SOURCE.fields_by_name["additional_contexts"].message_type = _SOURCECONTEXT +_FILEHASHES.fields_by_name["file_hash"].message_type = _HASH +_SOURCECONTEXT_LABELSENTRY.containing_type = _SOURCECONTEXT +_SOURCECONTEXT.fields_by_name["cloud_repo"].message_type = _CLOUDREPOSOURCECONTEXT +_SOURCECONTEXT.fields_by_name["gerrit"].message_type = _GERRITSOURCECONTEXT +_SOURCECONTEXT.fields_by_name["git"].message_type = _GITSOURCECONTEXT +_SOURCECONTEXT.fields_by_name["labels"].message_type = _SOURCECONTEXT_LABELSENTRY +_SOURCECONTEXT.oneofs_by_name["context"].fields.append( + _SOURCECONTEXT.fields_by_name["cloud_repo"] +) +_SOURCECONTEXT.fields_by_name[ + "cloud_repo" +].containing_oneof = _SOURCECONTEXT.oneofs_by_name["context"] +_SOURCECONTEXT.oneofs_by_name["context"].fields.append( + _SOURCECONTEXT.fields_by_name["gerrit"] +) +_SOURCECONTEXT.fields_by_name[ + "gerrit" +].containing_oneof = _SOURCECONTEXT.oneofs_by_name["context"] +_SOURCECONTEXT.oneofs_by_name["context"].fields.append( + _SOURCECONTEXT.fields_by_name["git"] +) +_SOURCECONTEXT.fields_by_name["git"].containing_oneof = _SOURCECONTEXT.oneofs_by_name[ + "context" +] +_ALIASCONTEXT.fields_by_name["kind"].enum_type = _ALIASCONTEXT_KIND +_ALIASCONTEXT_KIND.containing_type = _ALIASCONTEXT +_CLOUDREPOSOURCECONTEXT.fields_by_name["repo_id"].message_type = _REPOID +_CLOUDREPOSOURCECONTEXT.fields_by_name["alias_context"].message_type = _ALIASCONTEXT +_CLOUDREPOSOURCECONTEXT.oneofs_by_name["revision"].fields.append( + _CLOUDREPOSOURCECONTEXT.fields_by_name["revision_id"] +) +_CLOUDREPOSOURCECONTEXT.fields_by_name[ + "revision_id" +].containing_oneof = _CLOUDREPOSOURCECONTEXT.oneofs_by_name["revision"] +_CLOUDREPOSOURCECONTEXT.oneofs_by_name["revision"].fields.append( + _CLOUDREPOSOURCECONTEXT.fields_by_name["alias_context"] +) +_CLOUDREPOSOURCECONTEXT.fields_by_name[ + "alias_context" +].containing_oneof = _CLOUDREPOSOURCECONTEXT.oneofs_by_name["revision"] +_GERRITSOURCECONTEXT.fields_by_name["alias_context"].message_type = _ALIASCONTEXT +_GERRITSOURCECONTEXT.oneofs_by_name["revision"].fields.append( + _GERRITSOURCECONTEXT.fields_by_name["revision_id"] +) +_GERRITSOURCECONTEXT.fields_by_name[ + "revision_id" +].containing_oneof = _GERRITSOURCECONTEXT.oneofs_by_name["revision"] +_GERRITSOURCECONTEXT.oneofs_by_name["revision"].fields.append( + _GERRITSOURCECONTEXT.fields_by_name["alias_context"] +) +_GERRITSOURCECONTEXT.fields_by_name[ + "alias_context" +].containing_oneof = _GERRITSOURCECONTEXT.oneofs_by_name["revision"] +_REPOID.fields_by_name["project_repo_id"].message_type = _PROJECTREPOID +_REPOID.oneofs_by_name["id"].fields.append(_REPOID.fields_by_name["project_repo_id"]) +_REPOID.fields_by_name["project_repo_id"].containing_oneof = _REPOID.oneofs_by_name[ + "id" +] +_REPOID.oneofs_by_name["id"].fields.append(_REPOID.fields_by_name["uid"]) +_REPOID.fields_by_name["uid"].containing_oneof = _REPOID.oneofs_by_name["id"] +DESCRIPTOR.message_types_by_name["BuildProvenance"] = _BUILDPROVENANCE +DESCRIPTOR.message_types_by_name["Source"] = _SOURCE +DESCRIPTOR.message_types_by_name["FileHashes"] = _FILEHASHES +DESCRIPTOR.message_types_by_name["Hash"] = _HASH +DESCRIPTOR.message_types_by_name["Command"] = _COMMAND +DESCRIPTOR.message_types_by_name["Artifact"] = _ARTIFACT +DESCRIPTOR.message_types_by_name["SourceContext"] = _SOURCECONTEXT +DESCRIPTOR.message_types_by_name["AliasContext"] = _ALIASCONTEXT +DESCRIPTOR.message_types_by_name["CloudRepoSourceContext"] = _CLOUDREPOSOURCECONTEXT +DESCRIPTOR.message_types_by_name["GerritSourceContext"] = _GERRITSOURCECONTEXT +DESCRIPTOR.message_types_by_name["GitSourceContext"] = _GITSOURCECONTEXT +DESCRIPTOR.message_types_by_name["RepoId"] = _REPOID +DESCRIPTOR.message_types_by_name["ProjectRepoId"] = _PROJECTREPOID +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +BuildProvenance = _reflection.GeneratedProtocolMessageType( + "BuildProvenance", + (_message.Message,), + dict( + BuildOptionsEntry=_reflection.GeneratedProtocolMessageType( + "BuildOptionsEntry", + (_message.Message,), + dict( + DESCRIPTOR=_BUILDPROVENANCE_BUILDOPTIONSENTRY, + __module__="grafeas_v1.proto.provenance_pb2" + # @@protoc_insertion_point(class_scope:grafeas.v1.BuildProvenance.BuildOptionsEntry) + ), + ), + DESCRIPTOR=_BUILDPROVENANCE, + __module__="grafeas_v1.proto.provenance_pb2", + __doc__="""Provenance of a build. Contains all information needed to verify the + full details about the build from source to completion. + + + Attributes: + id: + Required. Unique identifier of the build. + project_id: + ID of the project. + commands: + Commands requested by the build. + built_artifacts: + Output of the build. + create_time: + Time at which the build was created. + start_time: + Time at which execution of the build was started. + end_time: + Time at which execution of the build was finished. + creator: + E-mail address of the user who initiated this build. Note that + this was the user's e-mail address at the time the build was + initiated; this address may not represent the same end-user + for all time. + logs_uri: + URI where any logs for this provenance were written. + source_provenance: + Details of the Source input to the build. + trigger_id: + Trigger identifier if the build was triggered automatically; + empty if not. + build_options: + Special options applied to this build. This is a catch-all + field where build providers can enter any desired additional + details. + builder_version: + Version string of the builder at the time this build was + executed. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.BuildProvenance) + ), +) +_sym_db.RegisterMessage(BuildProvenance) +_sym_db.RegisterMessage(BuildProvenance.BuildOptionsEntry) + +Source = _reflection.GeneratedProtocolMessageType( + "Source", + (_message.Message,), + dict( + FileHashesEntry=_reflection.GeneratedProtocolMessageType( + "FileHashesEntry", + (_message.Message,), + dict( + DESCRIPTOR=_SOURCE_FILEHASHESENTRY, + __module__="grafeas_v1.proto.provenance_pb2" + # @@protoc_insertion_point(class_scope:grafeas.v1.Source.FileHashesEntry) + ), + ), + DESCRIPTOR=_SOURCE, + __module__="grafeas_v1.proto.provenance_pb2", + __doc__="""Source describes the location of the source used for the build. + + + Attributes: + artifact_storage_source_uri: + If provided, the input binary artifacts for the build came + from this location. + file_hashes: + Hash(es) of the build source, which can be used to verify that + the original source integrity was maintained in the build. + The keys to this map are file paths used as build source and + the values contain the hash values for those files. If the + build source came in a single package such as a gzipped + tarfile (.tar.gz), the FileHash will be for the single path to + that file. + context: + If provided, the source code used for the build came from this + location. + additional_contexts: + If provided, some of the source code used for the build may be + found in these locations, in the case where the source + repository had multiple remotes or submodules. This list will + not include the context specified in the context field. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.Source) + ), +) +_sym_db.RegisterMessage(Source) +_sym_db.RegisterMessage(Source.FileHashesEntry) + +FileHashes = _reflection.GeneratedProtocolMessageType( + "FileHashes", + (_message.Message,), + dict( + DESCRIPTOR=_FILEHASHES, + __module__="grafeas_v1.proto.provenance_pb2", + __doc__="""Container message for hashes of byte content of files, used in source + messages to verify integrity of source input to the build. + + + Attributes: + file_hash: + Required. Collection of file hashes. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.FileHashes) + ), +) +_sym_db.RegisterMessage(FileHashes) + +Hash = _reflection.GeneratedProtocolMessageType( + "Hash", + (_message.Message,), + dict( + DESCRIPTOR=_HASH, + __module__="grafeas_v1.proto.provenance_pb2", + __doc__="""Container message for hash values. + + + Attributes: + type: + Required. The type of hash that was performed, e.g. "SHA-256". + value: + Required. The hash value. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.Hash) + ), +) +_sym_db.RegisterMessage(Hash) + +Command = _reflection.GeneratedProtocolMessageType( + "Command", + (_message.Message,), + dict( + DESCRIPTOR=_COMMAND, + __module__="grafeas_v1.proto.provenance_pb2", + __doc__="""Command describes a step performed as part of the build pipeline. + + + Attributes: + name: + Required. Name of the command, as presented on the command + line, or if the command is packaged as a Docker container, as + presented to ``docker pull``. + env: + Environment variables set before running this command. + args: + Command-line arguments used when executing this command. + dir: + Working directory (relative to project source root) used when + running this command. + id: + Optional unique identifier for this command, used in wait\_for + to reference this command as a dependency. + wait_for: + The ID(s) of the command(s) that this command depends on. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.Command) + ), +) +_sym_db.RegisterMessage(Command) + +Artifact = _reflection.GeneratedProtocolMessageType( + "Artifact", + (_message.Message,), + dict( + DESCRIPTOR=_ARTIFACT, + __module__="grafeas_v1.proto.provenance_pb2", + __doc__="""Artifact describes a build product. + + + Attributes: + checksum: + Hash or checksum value of a binary, or Docker Registry 2.0 + digest of a container. + id: + Artifact ID, if any; for container images, this will be a URL + by digest like ``gcr.io/projectID/imagename@sha256:123456``. + names: + Related artifact names. This may be the path to a binary or + jar file, or in the case of a container build, the name used + to push the container image to Google Container Registry, as + presented to ``docker push``. Note that a single Artifact ID + can have multiple names, for example if two tags are applied + to one image. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.Artifact) + ), +) +_sym_db.RegisterMessage(Artifact) + +SourceContext = _reflection.GeneratedProtocolMessageType( + "SourceContext", + (_message.Message,), + dict( + LabelsEntry=_reflection.GeneratedProtocolMessageType( + "LabelsEntry", + (_message.Message,), + dict( + DESCRIPTOR=_SOURCECONTEXT_LABELSENTRY, + __module__="grafeas_v1.proto.provenance_pb2" + # @@protoc_insertion_point(class_scope:grafeas.v1.SourceContext.LabelsEntry) + ), + ), + DESCRIPTOR=_SOURCECONTEXT, + __module__="grafeas_v1.proto.provenance_pb2", + __doc__="""A SourceContext is a reference to a tree of files. A SourceContext + together with a path point to a unique revision of a single file or + directory. + + + Attributes: + context: + A SourceContext can refer any one of the following types of + repositories. + cloud_repo: + A SourceContext referring to a revision in a Google Cloud + Source Repo. + gerrit: + A SourceContext referring to a Gerrit project. + git: + A SourceContext referring to any third party Git repo (e.g., + GitHub). + labels: + Labels with user defined metadata. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.SourceContext) + ), +) +_sym_db.RegisterMessage(SourceContext) +_sym_db.RegisterMessage(SourceContext.LabelsEntry) + +AliasContext = _reflection.GeneratedProtocolMessageType( + "AliasContext", + (_message.Message,), + dict( + DESCRIPTOR=_ALIASCONTEXT, + __module__="grafeas_v1.proto.provenance_pb2", + __doc__="""An alias to a repo revision. + + + Attributes: + kind: + The alias kind. + name: + The alias name. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.AliasContext) + ), +) +_sym_db.RegisterMessage(AliasContext) + +CloudRepoSourceContext = _reflection.GeneratedProtocolMessageType( + "CloudRepoSourceContext", + (_message.Message,), + dict( + DESCRIPTOR=_CLOUDREPOSOURCECONTEXT, + __module__="grafeas_v1.proto.provenance_pb2", + __doc__="""A CloudRepoSourceContext denotes a particular revision in a Google Cloud + Source Repo. + + + Attributes: + repo_id: + The ID of the repo. + revision: + A revision in a Cloud Repo can be identified by either its + revision ID or its alias. + revision_id: + A revision ID. + alias_context: + An alias, which may be a branch or tag. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.CloudRepoSourceContext) + ), +) +_sym_db.RegisterMessage(CloudRepoSourceContext) + +GerritSourceContext = _reflection.GeneratedProtocolMessageType( + "GerritSourceContext", + (_message.Message,), + dict( + DESCRIPTOR=_GERRITSOURCECONTEXT, + __module__="grafeas_v1.proto.provenance_pb2", + __doc__="""A SourceContext referring to a Gerrit project. + + + Attributes: + host_uri: + The URI of a running Gerrit instance. + gerrit_project: + The full project name within the host. Projects may be nested, + so "project/subproject" is a valid project name. The "repo + name" is the hostURI/project. + revision: + A revision in a Gerrit project can be identified by either its + revision ID or its alias. + revision_id: + A revision (commit) ID. + alias_context: + An alias, which may be a branch or tag. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.GerritSourceContext) + ), +) +_sym_db.RegisterMessage(GerritSourceContext) + +GitSourceContext = _reflection.GeneratedProtocolMessageType( + "GitSourceContext", + (_message.Message,), + dict( + DESCRIPTOR=_GITSOURCECONTEXT, + __module__="grafeas_v1.proto.provenance_pb2", + __doc__="""A GitSourceContext denotes a particular revision in a third party Git + repository (e.g., GitHub). + + + Attributes: + url: + Git repository URL. + revision_id: + Git commit hash. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.GitSourceContext) + ), +) +_sym_db.RegisterMessage(GitSourceContext) + +RepoId = _reflection.GeneratedProtocolMessageType( + "RepoId", + (_message.Message,), + dict( + DESCRIPTOR=_REPOID, + __module__="grafeas_v1.proto.provenance_pb2", + __doc__="""A unique identifier for a Cloud Repo. + + + Attributes: + id: + A cloud repo can be identified by either its project ID and + repository name combination, or its globally unique + identifier. + project_repo_id: + A combination of a project ID and a repo name. + uid: + A server-assigned, globally unique identifier. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.RepoId) + ), +) +_sym_db.RegisterMessage(RepoId) + +ProjectRepoId = _reflection.GeneratedProtocolMessageType( + "ProjectRepoId", + (_message.Message,), + dict( + DESCRIPTOR=_PROJECTREPOID, + __module__="grafeas_v1.proto.provenance_pb2", + __doc__="""Selects a repo using a Google Cloud Platform project ID (e.g., + winged-cargo-31) and a repo name within that project. + + + Attributes: + project_id: + The ID of the project. + repo_name: + The name of the repo. Leave empty for the default repo. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.ProjectRepoId) + ), +) +_sym_db.RegisterMessage(ProjectRepoId) + + +DESCRIPTOR._options = None +_BUILDPROVENANCE_BUILDOPTIONSENTRY._options = None +_SOURCE_FILEHASHESENTRY._options = None +_SOURCECONTEXT_LABELSENTRY._options = None +# @@protoc_insertion_point(module_scope) diff --git a/grafeas/grafeas/grafeas_v1/proto/provenance_pb2_grpc.py b/grafeas/grafeas/grafeas_v1/proto/provenance_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/provenance_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/grafeas/grafeas/grafeas_v1/proto/vulnerability.proto b/grafeas/grafeas/grafeas_v1/proto/vulnerability.proto new file mode 100644 index 000000000000..f6543a8f6af9 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/vulnerability.proto @@ -0,0 +1,199 @@ +// Copyright 2019 The Grafeas Authors. All rights reserved. +// +// 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. + +syntax = "proto3"; + +package grafeas.v1; + +import "grafeas/v1/common.proto"; +import "grafeas/v1/cvss.proto"; +import "grafeas/v1/package.proto"; + +option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas"; +option java_multiple_files = true; +option java_package = "io.grafeas.v1"; +option objc_class_prefix = "GRA"; + +// Note provider assigned severity/impact ranking. +enum Severity { + // Unknown. + SEVERITY_UNSPECIFIED = 0; + // Minimal severity. + MINIMAL = 1; + // Low severity. + LOW = 2; + // Medium severity. + MEDIUM = 3; + // High severity. + HIGH = 4; + // Critical severity. + CRITICAL = 5; +} + +// A security vulnerability that can be found in resources. +message VulnerabilityNote { + // The CVSS score of this vulnerability. CVSS score is on a scale of 0 - 10 + // where 0 indicates low severity and 10 indicates high severity. + float cvss_score = 1; + + // The note provider assigned severity of this vulnerability. + Severity severity = 2; + + // Details of all known distros and packages affected by this vulnerability. + repeated Detail details = 3; + + // A detail for a distro and package affected by this vulnerability and its + // associated fix (if one is available). + message Detail { + // The distro assigned severity of this vulnerability. + string severity_name = 1; + + // A vendor-specific description of this vulnerability. + string description = 2; + + // The type of package; whether native or non native (e.g., ruby gems, + // node.js packages, etc.). + string package_type = 3; + + // Required. The [CPE URI](https://cpe.mitre.org/specification/) this + // vulnerability affects. + string affected_cpe_uri = 4; + + // Required. The package this vulnerability affects. + string affected_package = 5; + + // Required. The minimum version of the package this vulnerability affects. + grafeas.v1.Version min_affected_version = 6; + + // The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability + // was fixed in. It is possible for this to be different from the + // affected_cpe_uri. + string fixed_cpe_uri = 7; + + // The package this vulnerability was fixed in. It is possible for this to + // be different from the affected_package. + string fixed_package = 8; + + // Required. The version of the package this vulnerability was fixed in. + // Setting this to VersionKind.MAXIMUM means no fix is yet available. + grafeas.v1.Version fixed_version = 9; + + // Whether this detail is obsolete. Occurrences are expected not to point to + // obsolete details. + bool is_obsolete = 10; + } + + // The full description of the CVSSv3 for this vulnerability. + CVSSv3 cvss_v3 = 4; + + // Windows details get their own format because the information format and + // model don't match a normal detail. Specifically Windows updates are done as + // patches, thus Windows vulnerabilities really are a missing package, rather + // than a package being at an incorrect version. + repeated WindowsDetail windows_details = 5; + + message WindowsDetail { + // Required. The [CPE URI](https://cpe.mitre.org/specification/) this + // vulnerability affects. + string cpe_uri = 1; + + // Required. The name of this vulnerability. + string name = 2; + + // The description of this vulnerability. + string description = 3; + + // Required. The names of the KBs which have hotfixes to mitigate this + // vulnerability. Note that there may be multiple hotfixes (and thus + // multiple KBs) that mitigate a given vulnerability. Currently any listed + // KBs presence is considered a fix. + repeated KnowledgeBase fixing_kbs = 4; + + message KnowledgeBase { + // The KB name (generally of the form KB[0-9]+ (e.g., KB123456)). + string name = 1; + // A link to the KB in the [Windows update catalog] + // (https://www.catalog.update.microsoft.com/). + string url = 2; + } + } +} + +// An occurrence of a severity vulnerability on a resource. +message VulnerabilityOccurrence { + // The type of package; whether native or non native (e.g., ruby gems, node.js + // packages, etc.). + string type = 1; + + // Output only. The note provider assigned severity of this vulnerability. + Severity severity = 2; + + // Output only. The CVSS score of this vulnerability. CVSS score is on a + // scale of 0 - 10 where 0 indicates low severity and 10 indicates high + // severity. + float cvss_score = 3; + + // Required. The set of affected locations and their fixes (if available) + // within the associated resource. + repeated PackageIssue package_issue = 4; + + // A detail for a distro and package this vulnerability occurrence was found + // in and its associated fix (if one is available). + message PackageIssue { + // Required. The [CPE URI](https://cpe.mitre.org/specification/) this + // vulnerability was found in. + string affected_cpe_uri = 1; + + // Required. The package this vulnerability was found in. + string affected_package = 2; + + // Required. The minimum version of the package this vulnerability exists + // in. + grafeas.v1.Version min_affected_version = 3; + + // The [CPE URI](https://cpe.mitre.org/specification/) this vulnerability + // was fixed in. It is possible for this to be different from the + // affected_cpe_uri. + string fixed_cpe_uri = 4; + + // The package this vulnerability was fixed in. It is possible for this to + // be different from the affected_package. + string fixed_package = 5; + + // Required. The version of the package this vulnerability was fixed in. + // Setting this to VersionKind.MAXIMUM means no fix is yet available. + grafeas.v1.Version fixed_version = 6; + + // Output only. Whether a fix is available for this package. + bool fix_available = 7; + } + + // Output only. A one sentence description of this vulnerability. + string short_description = 5; + + // Output only. A detailed description of this vulnerability. + string long_description = 6; + + // Output only. URLs related to this vulnerability. + repeated grafeas.v1.RelatedUrl related_urls = 7; + + // The distro assigned severity for this vulnerability when it is available, + // and note provider assigned severity when distro has not yet assigned a + // severity for this vulnerability. + Severity effective_severity = 8; + + // Output only. Whether at least one of the affected packages has a fix + // available. + bool fix_available = 9; +} diff --git a/grafeas/grafeas/grafeas_v1/proto/vulnerability_pb2.py b/grafeas/grafeas/grafeas_v1/proto/vulnerability_pb2.py new file mode 100644 index 000000000000..407f8fa2a0f7 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/vulnerability_pb2.py @@ -0,0 +1,1121 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: grafeas_v1/proto/vulnerability.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from grafeas.grafeas_v1.proto import common_pb2 as grafeas__v1_dot_proto_dot_common__pb2 +from grafeas.grafeas_v1.proto import cvss_pb2 as grafeas__v1_dot_proto_dot_cvss__pb2 +from grafeas.grafeas_v1.proto import ( + package_pb2 as grafeas__v1_dot_proto_dot_package__pb2, +) + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="grafeas_v1/proto/vulnerability.proto", + package="grafeas.v1", + syntax="proto3", + serialized_options=_b( + "\n\rio.grafeas.v1P\001Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\242\002\003GRA" + ), + serialized_pb=_b( + '\n$grafeas_v1/proto/vulnerability.proto\x12\ngrafeas.v1\x1a\x1dgrafeas_v1/proto/common.proto\x1a\x1bgrafeas_v1/proto/cvss.proto\x1a\x1egrafeas_v1/proto/package.proto"\xd5\x05\n\x11VulnerabilityNote\x12\x12\n\ncvss_score\x18\x01 \x01(\x02\x12&\n\x08severity\x18\x02 \x01(\x0e\x32\x14.grafeas.v1.Severity\x12\x35\n\x07\x64\x65tails\x18\x03 \x03(\x0b\x32$.grafeas.v1.VulnerabilityNote.Detail\x12#\n\x07\x63vss_v3\x18\x04 \x01(\x0b\x32\x12.grafeas.v1.CVSSv3\x12\x44\n\x0fwindows_details\x18\x05 \x03(\x0b\x32+.grafeas.v1.VulnerabilityNote.WindowsDetail\x1a\xa0\x02\n\x06\x44\x65tail\x12\x15\n\rseverity_name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x14\n\x0cpackage_type\x18\x03 \x01(\t\x12\x18\n\x10\x61\x66\x66\x65\x63ted_cpe_uri\x18\x04 \x01(\t\x12\x18\n\x10\x61\x66\x66\x65\x63ted_package\x18\x05 \x01(\t\x12\x31\n\x14min_affected_version\x18\x06 \x01(\x0b\x32\x13.grafeas.v1.Version\x12\x15\n\rfixed_cpe_uri\x18\x07 \x01(\t\x12\x15\n\rfixed_package\x18\x08 \x01(\t\x12*\n\rfixed_version\x18\t \x01(\x0b\x32\x13.grafeas.v1.Version\x12\x13\n\x0bis_obsolete\x18\n \x01(\x08\x1a\xbe\x01\n\rWindowsDetail\x12\x0f\n\x07\x63pe_uri\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12M\n\nfixing_kbs\x18\x04 \x03(\x0b\x32\x39.grafeas.v1.VulnerabilityNote.WindowsDetail.KnowledgeBase\x1a*\n\rKnowledgeBase\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t"\xc1\x04\n\x17VulnerabilityOccurrence\x12\x0c\n\x04type\x18\x01 \x01(\t\x12&\n\x08severity\x18\x02 \x01(\x0e\x32\x14.grafeas.v1.Severity\x12\x12\n\ncvss_score\x18\x03 \x01(\x02\x12G\n\rpackage_issue\x18\x04 \x03(\x0b\x32\x30.grafeas.v1.VulnerabilityOccurrence.PackageIssue\x12\x19\n\x11short_description\x18\x05 \x01(\t\x12\x18\n\x10long_description\x18\x06 \x01(\t\x12,\n\x0crelated_urls\x18\x07 \x03(\x0b\x32\x16.grafeas.v1.RelatedUrl\x12\x30\n\x12\x65\x66\x66\x65\x63tive_severity\x18\x08 \x01(\x0e\x32\x14.grafeas.v1.Severity\x12\x15\n\rfix_available\x18\t \x01(\x08\x1a\xe6\x01\n\x0cPackageIssue\x12\x18\n\x10\x61\x66\x66\x65\x63ted_cpe_uri\x18\x01 \x01(\t\x12\x18\n\x10\x61\x66\x66\x65\x63ted_package\x18\x02 \x01(\t\x12\x31\n\x14min_affected_version\x18\x03 \x01(\x0b\x32\x13.grafeas.v1.Version\x12\x15\n\rfixed_cpe_uri\x18\x04 \x01(\t\x12\x15\n\rfixed_package\x18\x05 \x01(\t\x12*\n\rfixed_version\x18\x06 \x01(\x0b\x32\x13.grafeas.v1.Version\x12\x15\n\rfix_available\x18\x07 \x01(\x08*^\n\x08Severity\x12\x18\n\x14SEVERITY_UNSPECIFIED\x10\x00\x12\x0b\n\x07MINIMAL\x10\x01\x12\x07\n\x03LOW\x10\x02\x12\n\n\x06MEDIUM\x10\x03\x12\x08\n\x04HIGH\x10\x04\x12\x0c\n\x08\x43RITICAL\x10\x05\x42Q\n\rio.grafeas.v1P\x01Z8google.golang.org/genproto/googleapis/grafeas/v1;grafeas\xa2\x02\x03GRAb\x06proto3' + ), + dependencies=[ + grafeas__v1_dot_proto_dot_common__pb2.DESCRIPTOR, + grafeas__v1_dot_proto_dot_cvss__pb2.DESCRIPTOR, + grafeas__v1_dot_proto_dot_package__pb2.DESCRIPTOR, + ], +) + +_SEVERITY = _descriptor.EnumDescriptor( + name="Severity", + full_name="grafeas.v1.Severity", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="SEVERITY_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="MINIMAL", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="LOW", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="MEDIUM", index=3, number=3, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="HIGH", index=4, number=4, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="CRITICAL", index=5, number=5, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=1452, + serialized_end=1546, +) +_sym_db.RegisterEnumDescriptor(_SEVERITY) + +Severity = enum_type_wrapper.EnumTypeWrapper(_SEVERITY) +SEVERITY_UNSPECIFIED = 0 +MINIMAL = 1 +LOW = 2 +MEDIUM = 3 +HIGH = 4 +CRITICAL = 5 + + +_VULNERABILITYNOTE_DETAIL = _descriptor.Descriptor( + name="Detail", + full_name="grafeas.v1.VulnerabilityNote.Detail", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="severity_name", + full_name="grafeas.v1.VulnerabilityNote.Detail.severity_name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="description", + full_name="grafeas.v1.VulnerabilityNote.Detail.description", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="package_type", + full_name="grafeas.v1.VulnerabilityNote.Detail.package_type", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="affected_cpe_uri", + full_name="grafeas.v1.VulnerabilityNote.Detail.affected_cpe_uri", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="affected_package", + full_name="grafeas.v1.VulnerabilityNote.Detail.affected_package", + index=4, + number=5, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="min_affected_version", + full_name="grafeas.v1.VulnerabilityNote.Detail.min_affected_version", + index=5, + number=6, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="fixed_cpe_uri", + full_name="grafeas.v1.VulnerabilityNote.Detail.fixed_cpe_uri", + index=6, + number=7, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="fixed_package", + full_name="grafeas.v1.VulnerabilityNote.Detail.fixed_package", + index=7, + number=8, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="fixed_version", + full_name="grafeas.v1.VulnerabilityNote.Detail.fixed_version", + index=8, + number=9, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="is_obsolete", + full_name="grafeas.v1.VulnerabilityNote.Detail.is_obsolete", + index=9, + number=10, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=389, + serialized_end=677, +) + +_VULNERABILITYNOTE_WINDOWSDETAIL_KNOWLEDGEBASE = _descriptor.Descriptor( + name="KnowledgeBase", + full_name="grafeas.v1.VulnerabilityNote.WindowsDetail.KnowledgeBase", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.VulnerabilityNote.WindowsDetail.KnowledgeBase.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="url", + full_name="grafeas.v1.VulnerabilityNote.WindowsDetail.KnowledgeBase.url", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=828, + serialized_end=870, +) + +_VULNERABILITYNOTE_WINDOWSDETAIL = _descriptor.Descriptor( + name="WindowsDetail", + full_name="grafeas.v1.VulnerabilityNote.WindowsDetail", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="cpe_uri", + full_name="grafeas.v1.VulnerabilityNote.WindowsDetail.cpe_uri", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="name", + full_name="grafeas.v1.VulnerabilityNote.WindowsDetail.name", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="description", + full_name="grafeas.v1.VulnerabilityNote.WindowsDetail.description", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="fixing_kbs", + full_name="grafeas.v1.VulnerabilityNote.WindowsDetail.fixing_kbs", + index=3, + number=4, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_VULNERABILITYNOTE_WINDOWSDETAIL_KNOWLEDGEBASE], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=680, + serialized_end=870, +) + +_VULNERABILITYNOTE = _descriptor.Descriptor( + name="VulnerabilityNote", + full_name="grafeas.v1.VulnerabilityNote", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="cvss_score", + full_name="grafeas.v1.VulnerabilityNote.cvss_score", + index=0, + number=1, + type=2, + cpp_type=6, + label=1, + has_default_value=False, + default_value=float(0), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="severity", + full_name="grafeas.v1.VulnerabilityNote.severity", + index=1, + number=2, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="details", + full_name="grafeas.v1.VulnerabilityNote.details", + index=2, + number=3, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="cvss_v3", + full_name="grafeas.v1.VulnerabilityNote.cvss_v3", + index=3, + number=4, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="windows_details", + full_name="grafeas.v1.VulnerabilityNote.windows_details", + index=4, + number=5, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_VULNERABILITYNOTE_DETAIL, _VULNERABILITYNOTE_WINDOWSDETAIL], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=145, + serialized_end=870, +) + + +_VULNERABILITYOCCURRENCE_PACKAGEISSUE = _descriptor.Descriptor( + name="PackageIssue", + full_name="grafeas.v1.VulnerabilityOccurrence.PackageIssue", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="affected_cpe_uri", + full_name="grafeas.v1.VulnerabilityOccurrence.PackageIssue.affected_cpe_uri", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="affected_package", + full_name="grafeas.v1.VulnerabilityOccurrence.PackageIssue.affected_package", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="min_affected_version", + full_name="grafeas.v1.VulnerabilityOccurrence.PackageIssue.min_affected_version", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="fixed_cpe_uri", + full_name="grafeas.v1.VulnerabilityOccurrence.PackageIssue.fixed_cpe_uri", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="fixed_package", + full_name="grafeas.v1.VulnerabilityOccurrence.PackageIssue.fixed_package", + index=4, + number=5, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="fixed_version", + full_name="grafeas.v1.VulnerabilityOccurrence.PackageIssue.fixed_version", + index=5, + number=6, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="fix_available", + full_name="grafeas.v1.VulnerabilityOccurrence.PackageIssue.fix_available", + index=6, + number=7, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1220, + serialized_end=1450, +) + +_VULNERABILITYOCCURRENCE = _descriptor.Descriptor( + name="VulnerabilityOccurrence", + full_name="grafeas.v1.VulnerabilityOccurrence", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="type", + full_name="grafeas.v1.VulnerabilityOccurrence.type", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="severity", + full_name="grafeas.v1.VulnerabilityOccurrence.severity", + index=1, + number=2, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="cvss_score", + full_name="grafeas.v1.VulnerabilityOccurrence.cvss_score", + index=2, + number=3, + type=2, + cpp_type=6, + label=1, + has_default_value=False, + default_value=float(0), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="package_issue", + full_name="grafeas.v1.VulnerabilityOccurrence.package_issue", + index=3, + number=4, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="short_description", + full_name="grafeas.v1.VulnerabilityOccurrence.short_description", + index=4, + number=5, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="long_description", + full_name="grafeas.v1.VulnerabilityOccurrence.long_description", + index=5, + number=6, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="related_urls", + full_name="grafeas.v1.VulnerabilityOccurrence.related_urls", + index=6, + number=7, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="effective_severity", + full_name="grafeas.v1.VulnerabilityOccurrence.effective_severity", + index=7, + number=8, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="fix_available", + full_name="grafeas.v1.VulnerabilityOccurrence.fix_available", + index=8, + number=9, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_VULNERABILITYOCCURRENCE_PACKAGEISSUE], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=873, + serialized_end=1450, +) + +_VULNERABILITYNOTE_DETAIL.fields_by_name[ + "min_affected_version" +].message_type = grafeas__v1_dot_proto_dot_package__pb2._VERSION +_VULNERABILITYNOTE_DETAIL.fields_by_name[ + "fixed_version" +].message_type = grafeas__v1_dot_proto_dot_package__pb2._VERSION +_VULNERABILITYNOTE_DETAIL.containing_type = _VULNERABILITYNOTE +_VULNERABILITYNOTE_WINDOWSDETAIL_KNOWLEDGEBASE.containing_type = ( + _VULNERABILITYNOTE_WINDOWSDETAIL +) +_VULNERABILITYNOTE_WINDOWSDETAIL.fields_by_name[ + "fixing_kbs" +].message_type = _VULNERABILITYNOTE_WINDOWSDETAIL_KNOWLEDGEBASE +_VULNERABILITYNOTE_WINDOWSDETAIL.containing_type = _VULNERABILITYNOTE +_VULNERABILITYNOTE.fields_by_name["severity"].enum_type = _SEVERITY +_VULNERABILITYNOTE.fields_by_name["details"].message_type = _VULNERABILITYNOTE_DETAIL +_VULNERABILITYNOTE.fields_by_name[ + "cvss_v3" +].message_type = grafeas__v1_dot_proto_dot_cvss__pb2._CVSSV3 +_VULNERABILITYNOTE.fields_by_name[ + "windows_details" +].message_type = _VULNERABILITYNOTE_WINDOWSDETAIL +_VULNERABILITYOCCURRENCE_PACKAGEISSUE.fields_by_name[ + "min_affected_version" +].message_type = grafeas__v1_dot_proto_dot_package__pb2._VERSION +_VULNERABILITYOCCURRENCE_PACKAGEISSUE.fields_by_name[ + "fixed_version" +].message_type = grafeas__v1_dot_proto_dot_package__pb2._VERSION +_VULNERABILITYOCCURRENCE_PACKAGEISSUE.containing_type = _VULNERABILITYOCCURRENCE +_VULNERABILITYOCCURRENCE.fields_by_name["severity"].enum_type = _SEVERITY +_VULNERABILITYOCCURRENCE.fields_by_name[ + "package_issue" +].message_type = _VULNERABILITYOCCURRENCE_PACKAGEISSUE +_VULNERABILITYOCCURRENCE.fields_by_name[ + "related_urls" +].message_type = grafeas__v1_dot_proto_dot_common__pb2._RELATEDURL +_VULNERABILITYOCCURRENCE.fields_by_name["effective_severity"].enum_type = _SEVERITY +DESCRIPTOR.message_types_by_name["VulnerabilityNote"] = _VULNERABILITYNOTE +DESCRIPTOR.message_types_by_name["VulnerabilityOccurrence"] = _VULNERABILITYOCCURRENCE +DESCRIPTOR.enum_types_by_name["Severity"] = _SEVERITY +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +VulnerabilityNote = _reflection.GeneratedProtocolMessageType( + "VulnerabilityNote", + (_message.Message,), + dict( + Detail=_reflection.GeneratedProtocolMessageType( + "Detail", + (_message.Message,), + dict( + DESCRIPTOR=_VULNERABILITYNOTE_DETAIL, + __module__="grafeas_v1.proto.vulnerability_pb2", + __doc__="""A detail for a distro and package affected by this vulnerability and its + associated fix (if one is available). + + + Attributes: + severity_name: + The distro assigned severity of this vulnerability. + description: + A vendor-specific description of this vulnerability. + package_type: + The type of package; whether native or non native (e.g., ruby + gems, node.js packages, etc.). + affected_cpe_uri: + Required. The `CPE URI + `__ this vulnerability + affects. + affected_package: + Required. The package this vulnerability affects. + min_affected_version: + Required. The minimum version of the package this + vulnerability affects. + fixed_cpe_uri: + The `CPE URI `__ this + vulnerability was fixed in. It is possible for this to be + different from the affected\_cpe\_uri. + fixed_package: + The package this vulnerability was fixed in. It is possible + for this to be different from the affected\_package. + fixed_version: + Required. The version of the package this vulnerability was + fixed in. Setting this to VersionKind.MAXIMUM means no fix is + yet available. + is_obsolete: + Whether this detail is obsolete. Occurrences are expected not + to point to obsolete details. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.VulnerabilityNote.Detail) + ), + ), + WindowsDetail=_reflection.GeneratedProtocolMessageType( + "WindowsDetail", + (_message.Message,), + dict( + KnowledgeBase=_reflection.GeneratedProtocolMessageType( + "KnowledgeBase", + (_message.Message,), + dict( + DESCRIPTOR=_VULNERABILITYNOTE_WINDOWSDETAIL_KNOWLEDGEBASE, + __module__="grafeas_v1.proto.vulnerability_pb2", + __doc__=""" + Attributes: + name: + The KB name (generally of the form KB[0-9]+ (e.g., KB123456)). + url: + A link to the KB in the [Windows update catalog] + (https://www.catalog.update.microsoft.com/). + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.VulnerabilityNote.WindowsDetail.KnowledgeBase) + ), + ), + DESCRIPTOR=_VULNERABILITYNOTE_WINDOWSDETAIL, + __module__="grafeas_v1.proto.vulnerability_pb2", + __doc__=""" + Attributes: + cpe_uri: + Required. The `CPE URI + `__ this vulnerability + affects. + name: + Required. The name of this vulnerability. + description: + The description of this vulnerability. + fixing_kbs: + Required. The names of the KBs which have hotfixes to mitigate + this vulnerability. Note that there may be multiple hotfixes + (and thus multiple KBs) that mitigate a given vulnerability. + Currently any listed KBs presence is considered a fix. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.VulnerabilityNote.WindowsDetail) + ), + ), + DESCRIPTOR=_VULNERABILITYNOTE, + __module__="grafeas_v1.proto.vulnerability_pb2", + __doc__="""A security vulnerability that can be found in resources. + + + Attributes: + cvss_score: + The CVSS score of this vulnerability. CVSS score is on a scale + of 0 - 10 where 0 indicates low severity and 10 indicates high + severity. + severity: + The note provider assigned severity of this vulnerability. + details: + Details of all known distros and packages affected by this + vulnerability. + cvss_v3: + The full description of the CVSSv3 for this vulnerability. + windows_details: + Windows details get their own format because the information + format and model don't match a normal detail. Specifically + Windows updates are done as patches, thus Windows + vulnerabilities really are a missing package, rather than a + package being at an incorrect version. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.VulnerabilityNote) + ), +) +_sym_db.RegisterMessage(VulnerabilityNote) +_sym_db.RegisterMessage(VulnerabilityNote.Detail) +_sym_db.RegisterMessage(VulnerabilityNote.WindowsDetail) +_sym_db.RegisterMessage(VulnerabilityNote.WindowsDetail.KnowledgeBase) + +VulnerabilityOccurrence = _reflection.GeneratedProtocolMessageType( + "VulnerabilityOccurrence", + (_message.Message,), + dict( + PackageIssue=_reflection.GeneratedProtocolMessageType( + "PackageIssue", + (_message.Message,), + dict( + DESCRIPTOR=_VULNERABILITYOCCURRENCE_PACKAGEISSUE, + __module__="grafeas_v1.proto.vulnerability_pb2", + __doc__="""A detail for a distro and package this vulnerability occurrence was + found in and its associated fix (if one is available). + + + Attributes: + affected_cpe_uri: + Required. The `CPE URI + `__ this vulnerability + was found in. + affected_package: + Required. The package this vulnerability was found in. + min_affected_version: + Required. The minimum version of the package this + vulnerability exists in. + fixed_cpe_uri: + The `CPE URI `__ this + vulnerability was fixed in. It is possible for this to be + different from the affected\_cpe\_uri. + fixed_package: + The package this vulnerability was fixed in. It is possible + for this to be different from the affected\_package. + fixed_version: + Required. The version of the package this vulnerability was + fixed in. Setting this to VersionKind.MAXIMUM means no fix is + yet available. + fix_available: + Output only. Whether a fix is available for this package. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.VulnerabilityOccurrence.PackageIssue) + ), + ), + DESCRIPTOR=_VULNERABILITYOCCURRENCE, + __module__="grafeas_v1.proto.vulnerability_pb2", + __doc__="""An occurrence of a severity vulnerability on a resource. + + + Attributes: + type: + The type of package; whether native or non native (e.g., ruby + gems, node.js packages, etc.). + severity: + Output only. The note provider assigned severity of this + vulnerability. + cvss_score: + Output only. The CVSS score of this vulnerability. CVSS score + is on a scale of 0 - 10 where 0 indicates low severity and 10 + indicates high severity. + package_issue: + Required. The set of affected locations and their fixes (if + available) within the associated resource. + short_description: + Output only. A one sentence description of this vulnerability. + long_description: + Output only. A detailed description of this vulnerability. + related_urls: + Output only. URLs related to this vulnerability. + effective_severity: + The distro assigned severity for this vulnerability when it is + available, and note provider assigned severity when distro has + not yet assigned a severity for this vulnerability. + fix_available: + Output only. Whether at least one of the affected packages has + a fix available. + """, + # @@protoc_insertion_point(class_scope:grafeas.v1.VulnerabilityOccurrence) + ), +) +_sym_db.RegisterMessage(VulnerabilityOccurrence) +_sym_db.RegisterMessage(VulnerabilityOccurrence.PackageIssue) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/grafeas/grafeas/grafeas_v1/proto/vulnerability_pb2_grpc.py b/grafeas/grafeas/grafeas_v1/proto/vulnerability_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/proto/vulnerability_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/grafeas/grafeas/grafeas_v1/types.py b/grafeas/grafeas/grafeas_v1/types.py new file mode 100644 index 000000000000..253b6cadc65f --- /dev/null +++ b/grafeas/grafeas/grafeas_v1/types.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + + +from __future__ import absolute_import +import sys + +from google.api_core.protobuf_helpers import get_messages + +from google.protobuf import any_pb2 +from google.protobuf import empty_pb2 +from google.protobuf import field_mask_pb2 +from google.protobuf import timestamp_pb2 +from google.rpc import status_pb2 +from grafeas.grafeas_v1.proto import attestation_pb2 +from grafeas.grafeas_v1.proto import build_pb2 +from grafeas.grafeas_v1.proto import common_pb2 +from grafeas.grafeas_v1.proto import cvss_pb2 +from grafeas.grafeas_v1.proto import deployment_pb2 +from grafeas.grafeas_v1.proto import discovery_pb2 +from grafeas.grafeas_v1.proto import grafeas_pb2 +from grafeas.grafeas_v1.proto import image_pb2 +from grafeas.grafeas_v1.proto import package_pb2 +from grafeas.grafeas_v1.proto import provenance_pb2 +from grafeas.grafeas_v1.proto import vulnerability_pb2 + + +_shared_modules = [any_pb2, empty_pb2, field_mask_pb2, timestamp_pb2, status_pb2] + +_local_modules = [ + attestation_pb2, + build_pb2, + common_pb2, + cvss_pb2, + deployment_pb2, + discovery_pb2, + grafeas_pb2, + image_pb2, + package_pb2, + provenance_pb2, + vulnerability_pb2, +] + +names = [] + +for module in _shared_modules: # pragma: NO COVER + for name, message in get_messages(module).items(): + setattr(sys.modules[__name__], name, message) + names.append(name) +for module in _local_modules: + for name, message in get_messages(module).items(): + message.__module__ = "grafeas.grafeas_v1.types" + setattr(sys.modules[__name__], name, message) + names.append(name) + + +__all__ = tuple(sorted(names)) diff --git a/grafeas/noxfile.py b/grafeas/noxfile.py new file mode 100644 index 000000000000..cc5bea5ec83a --- /dev/null +++ b/grafeas/noxfile.py @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2018 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. + +from __future__ import absolute_import +import os +import shutil + +import nox + + +LOCAL_DEPS = (os.path.join("..", "api_core"), os.path.join("..", "core")) + +@nox.session(python="3.7") +def lint(session): + """Run linters. + + Returns a failure if the linters find linting errors or sufficiently + serious code quality issues. + """ + session.install("flake8", "black", *LOCAL_DEPS) + session.run( + "black", + "--check", + "grafeas", + "tests", + "docs", + ) + session.run("flake8", "grafeas", "tests") + + +@nox.session(python="3.6") +def blacken(session): + """Run black. + + Format code to uniform standard. + + This currently uses Python 3.6 due to the automated Kokoro run of synthtool. + That run uses an image that doesn't have 3.6 installed. Before updating this + check the state of the `gcp_ubuntu_config` we use for that Kokoro run. + """ + session.install("black") + session.run( + "black", + "grafeas", + "tests", + "docs", + ) + + +@nox.session(python="3.7") +def lint_setup_py(session): + """Verify that setup.py is valid (including RST check).""" + session.install("docutils", "pygments") + session.run("python", "setup.py", "check", "--restructuredtext", "--strict") + + +def default(session): + # Install all test dependencies, then install this package in-place. + session.install("mock", "pytest", "pytest-cov") + for local_dep in LOCAL_DEPS: + session.install("-e", local_dep) + session.install("-e", ".") + + # Run py.test against the unit tests. + session.run( + "py.test", + "--quiet", + "--cov=grafeas", + "--cov=tests.unit", + "--cov-append", + "--cov-config=.coveragerc", + "--cov-report=", + "--cov-fail-under=78", + os.path.join("tests", "unit"), + *session.posargs, + ) + + +@nox.session(python=["2.7", "3.5", "3.6", "3.7"]) +def unit(session): + """Run the unit test suite.""" + default(session) + + +@nox.session(python=["2.7", "3.7"]) +def system(session): + """Run the system test suite.""" + system_test_path = os.path.join("tests", "system.py") + system_test_folder_path = os.path.join("tests", "system") + # Sanity check: Only run tests if the environment variable is set. + if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): + session.skip("Credentials must be set via environment variable") + + system_test_exists = os.path.exists(system_test_path) + system_test_folder_exists = os.path.exists(system_test_folder_path) + # Sanity check: only run tests if found. + if not system_test_exists and not system_test_folder_exists: + session.skip("System tests were not found") + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + # Install all test dependencies, then install this package into the + # virtualenv's dist-packages. + session.install("mock", "pytest") + for local_dep in LOCAL_DEPS: + session.install("-e", local_dep) + session.install("-e", "../test_utils/") + session.install("-e", ".") + + # Run py.test against the system tests. + if system_test_exists: + session.run("py.test", "--quiet", system_test_path, *session.posargs) + if system_test_folder_exists: + session.run("py.test", "--quiet", system_test_folder_path, *session.posargs) + + +@nox.session(python="3.7") +def cover(session): + """Run the final coverage report. + + This outputs the coverage report aggregating coverage from the unit + test runs (not system test runs), and then erases coverage data. + """ + session.install("coverage", "pytest-cov") + session.run("coverage", "report", "--show-missing", "--fail-under=78") + + session.run("coverage", "erase") + +@nox.session(python="3.7") +def docs(session): + """Build the docs for this library.""" + + session.install('-e', '.') + session.install('sphinx', 'alabaster', 'recommonmark') + + shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True) + session.run( + 'sphinx-build', + '-W', # warnings as errors + '-T', # show full traceback on exception + '-N', # no colors + '-b', 'html', + '-d', os.path.join('docs', '_build', 'doctrees', ''), + os.path.join('docs', ''), + os.path.join('docs', '_build', 'html', ''), + ) diff --git a/grafeas/setup.cfg b/grafeas/setup.cfg new file mode 100644 index 000000000000..2a9acf13daa9 --- /dev/null +++ b/grafeas/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1 diff --git a/grafeas/setup.py b/grafeas/setup.py new file mode 100644 index 000000000000..d8163f361c3d --- /dev/null +++ b/grafeas/setup.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2018 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. + +import io +import os + +import setuptools + +name = "grafeas" +description = "Grafeas API client library" +version = "0.1.0" +release_status = "Development Status :: 3 - Alpha" +dependencies = [ + "google-api-core[grpc] >= 1.6.0, < 2.0.0dev", + 'enum34; python_version < "3.4"', +] + +package_root = os.path.abspath(os.path.dirname(__file__)) + +readme_filename = os.path.join(package_root, "README.rst") +with io.open(readme_filename, encoding="utf-8") as readme_file: + readme = readme_file.read() + +packages = [ + package for package in setuptools.find_packages() if package.startswith("grafeas") +] + +namespaces = ["grafeas"] + +setuptools.setup( + name=name, + version=version, + description=description, + long_description=readme, + author="Google LLC", + author_email="googleapis-packages@google.com", + license="Apache 2.0", + url="https://github.com/GoogleCloudPlatform/google-cloud-python", + classifiers=[ + release_status, + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Operating System :: OS Independent", + "Topic :: Internet", + ], + platforms="Posix; MacOS X; Windows", + packages=packages, + namespace_packages=namespaces, + install_requires=dependencies, + python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", + include_package_data=True, + zip_safe=False, +) diff --git a/grafeas/synth.metadata b/grafeas/synth.metadata new file mode 100644 index 000000000000..c1956002554a --- /dev/null +++ b/grafeas/synth.metadata @@ -0,0 +1,39 @@ +{ + "updateTime": "2019-06-14T18:08:01.487630Z", + "sources": [ + { + "generator": { + "name": "artman", + "version": "0.25.0", + "dockerImage": "googleapis/artman@sha256:ef1a98ab1e2b8f05f4d9a56f27d63347aefe14020e5f2d585172b14ca76f1d90" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "dd923f121fd85bad0c19720134e7e4b3dda0efb0", + "internalRef": "253251111" + } + }, + { + "template": { + "name": "python_library", + "origin": "synthtool.gcp", + "version": "2019.5.2" + } + } + ], + "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "grafeas", + "apiVersion": "v1", + "language": "python", + "generator": "gapic", + "config": "grafeas/artman_grafeas_v1.yaml" + } + } + ] +} \ No newline at end of file diff --git a/grafeas/synth.py b/grafeas/synth.py new file mode 100644 index 000000000000..ea981dca359b --- /dev/null +++ b/grafeas/synth.py @@ -0,0 +1,336 @@ +# Copyright 2018 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. + +"""This script is used to synthesize generated parts of this library.""" + +import synthtool as s +import synthtool.gcp as gcp +import logging + +logging.basicConfig(level=logging.DEBUG) + +gapic = gcp.GAPICGenerator() +common = gcp.CommonTemplates() + +# ---------------------------------------------------------------------------- +# Generate Grafeas GAPIC layer +# ---------------------------------------------------------------------------- +library = gapic.py_library( + "grafeas", "v1", config_path="/grafeas/artman_grafeas_v1.yaml", include_protos=True +) + +excludes = ["README.rst", "nox.py", "setup.py", "docs/index.rst"] + +# Make 'grafeas' a namespace +s.move(library / "grafeas", excludes=["__init__.py"]) +s.move(library / "docs", excludes=["conf.py", "index.rst"]) +s.move( + library / "google/cloud/grafeas_v1/proto", + "grafeas/grafeas_v1/proto", + excludes=excludes, +) +s.move(library / "tests") + + +# Fix proto imports +s.replace( + ["grafeas/**/*.py", "tests/**/*.py"], + "from grafeas\.v1( import \w*_pb2)", + "from grafeas.grafeas_v1.proto\g<1>", +) +s.replace( + "grafeas/**/*_pb2.py", + "from grafeas_v1\.proto( import \w*_pb2)", + "from grafeas.grafeas_v1.proto\g<1>", +) +s.replace( + "grafeas/**/grafeas_pb2_grpc.py", + "from grafeas_v1\.proto", + "from grafeas.grafeas_v1.proto", +) + +# Make package name 'grafeas' +s.replace( + "grafeas/grafeas_v1/gapic/grafeas_client.py", "google-cloud-grafeas", "grafeas" +) + +# Fix docstrings with no summary lines +s.replace( + "grafeas/grafeas_v1/proto/vulnerability_pb2.py", + r"""(\s+)__doc__ = \"\"\"Attributes:""", + """\g<1>__doc__=\"\"\" + Attributes:""", +) + +# Replace mentions of 'Container Analysis' with 'Grafeas' in the docs +s.replace("docs/**/v*/*.rst", "Container Analysis", "Grafeas") + + +# ---------------------------------------------------------------------------- +# Remove google-specific portions of library +# ---------------------------------------------------------------------------- + +# Please see this PR https://github.com/googleapis/google-cloud-python/pull/8186/ + +# Remove default service address, default scopes, default credentials +# Update tests and code in docstrings showing client instantiation. + + +s.replace( + "grafeas/**/grafeas_client.py", + r""" SERVICE_ADDRESS = 'containeranalysis\.googleapis\.com:443' + \"\"\"The default address of the service\.\"\"\"""", + "", +) + +s.replace( + "grafeas/**/grafeas_client.py", + r""" def __init__\(self, transport=None, channel=None, credentials=None, + client_config=None, client_info=None\):""", + " def __init__(self, transport, client_config=None, client_info=None):", +) + +s.replace( + "grafeas/**/grafeas_client.py", + r"""Union\[~\.GrafeasGrpcTransport, + Callable\[\[~\.Credentials, type], ~\.GrafeasGrpcTransport\]""", + """~.GrafeasGrpcTransport""", +) + +s.replace( + "grafeas/**/grafeas_client.py", + r""" channel \(grpc\.Channel\): DEPRECATED\. A ``Channel`` instance + through which to make calls\. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception\. + credentials \(google\.auth\.credentials\.Credentials\): The + authorization credentials to attach to requests\. These + credentials identify this application to the service\. If none + are specified, the client will attempt to ascertain the + credentials from the environment\. + This argument is mutually exclusive with providing a + transport instance to ``transport``; doing so will raise + an exception\.""", + "", +) + +s.replace( + "grafeas/**/grafeas_client.py", + r"""if channel: + warnings\.warn\('The `channel` argument is deprecated; use ' + '`transport` instead\.', + PendingDeprecationWarning, stacklevel=2\) + + \# Instantiate the transport\. + \# The transport is responsible for handling serialization and + \# deserialization and actually sending data to the service\. + if transport: + if callable\(transport\): + self\.transport = transport\( + credentials=credentials, + default_class=grafeas_grpc_transport\.GrafeasGrpcTransport, + \) + else: + if credentials: + raise ValueError\( + 'Received both a transport instance and ' + 'credentials; these are mutually exclusive\.' + \) + self\.transport = transport + else: + self\.transport = grafeas_grpc_transport\.GrafeasGrpcTransport\( + address=self\.SERVICE_ADDRESS, + channel=channel, + credentials=credentials, + \)""", + """# Instantiate the transport. + # The transport is responsible for handling serialization and + # deserialization and actually sending data to the service. + self.transport = transport""", +) + +s.replace( + "grafeas/**/grafeas_client.py", + r""" Example: + >>> from grafeas import grafeas_v1 + >>> + >>> client = grafeas_v1\.GrafeasClient\(\)""", + """ Example: + >>> from grafeas import grafeas_v1 + >>> from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + >>> + >>> address = "[SERVICE_ADDRESS]" + >>> scopes = ("[SCOPE]") + >>> transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + >>> client = grafeas_v1.GrafeasClient(transport)""", +) + +s.replace( + "grafeas/**/grafeas_client.py", + r''' @classmethod + def from_service_account_file\(cls, filename, \*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: + GrafeasClient: 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''', + "") + +s.replace( + "grafeas/**/grafeas_grpc_transport.py", + r""" \# The scopes needed to make gRPC calls to all of the methods defined + \# in this service\. + _OAUTH_SCOPES = \( + 'https://www\.googleapis\.com/auth/cloud-platform', + \)""", + "", +) + +s.replace( + "grafeas/**/grafeas_grpc_transport.py", + r""" def __init__\(self, channel=None, credentials=None, + address='containeranalysis\.googleapis\.com:443'\):""", + """ def __init__(self, address, scopes, channel=None, credentials=None):""", +) + +s.replace( + "grafeas/**/grafeas_grpc_transport.py", + r""" \# Create the channel\. + if channel is None: + channel = self\.create_channel\( + address=address, + credentials=credentials, + \) +""", + """ # Create the channel. + if channel is None: + channel = self.create_channel( + address, + scopes, + credentials=credentials, + ) +""", +) + +s.replace( + "grafeas/**/grafeas_grpc_transport.py", + r""" def create_channel\( + cls, + address='containeranalysis\.googleapis\.com:443', + credentials=None\):""", + """ def create_channel( + cls, + address, + scopes, + credentials=None):""", +) + +s.replace( + "grafeas/**/grafeas_grpc_transport.py", + r""" Args: + address \(str\): The host for the channel to use\. + credentials \(~\.Credentials\): The + authorization credentials to attach to requests\. These + credentials identify this application to the service\. If + none are specified, the client will attempt to ascertain + the credentials from the environment\.""", + """ Args: + address (str): The host for the channel to use. + scopes (Sequence[str]): The scopes needed to make gRPC calls. + credentials (~.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment.""", +) + +s.replace( + "grafeas/**/grafeas_grpc_transport.py", + r""" return google\.api_core\.grpc_helpers\.create_channel\( + address, + credentials=credentials, + scopes=cls\._OAUTH_SCOPES, + \)""", + """ return google.api_core.grpc_helpers.create_channel( + address, + credentials=credentials, + scopes=scopes, + )""", +) + +s.replace( + "grafeas/**/grafeas_grpc_transport.py", + r""" \"\"\"Instantiate the transport class\. + + Args: + channel \(grpc\.Channel\): A ``Channel`` instance through + which to make calls\. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception\. + credentials \(google\.auth\.credentials\.Credentials\): The + authorization credentials to attach to requests\. These + credentials identify this application to the service\. If none + are specified, the client will attempt to ascertain the + credentials from the environment\. + address \(str\): The address where the service is hosted\.""", + ''' """Instantiate the transport class. + + Args: + address (str): The address where the service is hosted. + scopes (Sequence[str]): The scopes needed to make gRPC calls. + channel (grpc.Channel): A ``Channel`` instance through + which to make calls. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception. + credentials (google.auth.credentials.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If none + are specified, the client will attempt to ascertain the + credentials from the environment. + ''', +) + +s.replace( + "tests/**/test_grafeas_client_v1.py", + r"""from grafeas\.grafeas_v1\.proto import grafeas_pb2""", + r"""from grafeas.grafeas_v1.proto import grafeas_pb2 +from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport""", +) + +s.replace( + "tests/**/test_grafeas_client_v1.py", + r"(\s+)client = grafeas_v1\.GrafeasClient\(\)", + r"""\g<1>address = "[SERVICE_ADDRESS]" +\g<1>scopes = ("SCOPE") +\g<1>transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) +\g<1>client=grafeas_v1.GrafeasClient(transport)""", +) + +# ---------------------------------------------------------------------------- +# Add templated files +# ---------------------------------------------------------------------------- +templated_files = common.py_library(unit_cov_level=78, cov_level=78) +s.move(templated_files, excludes=["noxfile.py"]) + +s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/grafeas/tests/unit/gapic/v1/test_grafeas_client_v1.py b/grafeas/tests/unit/gapic/v1/test_grafeas_client_v1.py new file mode 100644 index 000000000000..74613726dc5b --- /dev/null +++ b/grafeas/tests/unit/gapic/v1/test_grafeas_client_v1.py @@ -0,0 +1,842 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 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. + +"""Unit tests.""" + +import mock +import pytest + +from google.protobuf import empty_pb2 +from grafeas import grafeas_v1 +from grafeas.grafeas_v1.proto import grafeas_pb2 +from grafeas.grafeas_v1.gapic.transports import grafeas_grpc_transport + + +class MultiCallableStub(object): + """Stub for the grpc.UnaryUnaryMultiCallable interface.""" + + def __init__(self, method, channel_stub): + self.method = method + self.channel_stub = channel_stub + + def __call__(self, request, timeout=None, metadata=None, credentials=None): + self.channel_stub.requests.append((self.method, request)) + + response = None + if self.channel_stub.responses: + response = self.channel_stub.responses.pop() + + if isinstance(response, Exception): + raise response + + if response: + return response + + +class ChannelStub(object): + """Stub for the grpc.Channel interface.""" + + def __init__(self, responses=[]): + self.responses = responses + self.requests = [] + + def unary_unary(self, method, request_serializer=None, response_deserializer=None): + return MultiCallableStub(method, self) + + +class CustomException(Exception): + pass + + +class TestGrafeasClient(object): + def test_get_occurrence(self): + # Setup Expected Response + name_2 = "name2-1052831874" + resource_uri = "resourceUri-384040517" + note_name = "noteName1780787896" + remediation = "remediation779381797" + expected_response = { + "name": name_2, + "resource_uri": resource_uri, + "note_name": note_name, + "remediation": remediation, + } + expected_response = grafeas_pb2.Occurrence(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + name = client.occurrence_path("[PROJECT]", "[OCCURRENCE]") + + response = client.get_occurrence(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.GetOccurrenceRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_get_occurrence_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + name = client.occurrence_path("[PROJECT]", "[OCCURRENCE]") + + with pytest.raises(CustomException): + client.get_occurrence(name) + + def test_list_occurrences(self): + # Setup Expected Response + next_page_token = "" + occurrences_element = {} + occurrences = [occurrences_element] + expected_response = { + "next_page_token": next_page_token, + "occurrences": occurrences, + } + expected_response = grafeas_pb2.ListOccurrencesResponse(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + parent = client.project_path("[PROJECT]") + + paged_list_response = client.list_occurrences(parent) + resources = list(paged_list_response) + assert len(resources) == 1 + + assert expected_response.occurrences[0] == resources[0] + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.ListOccurrencesRequest(parent=parent) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_list_occurrences_exception(self): + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + parent = client.project_path("[PROJECT]") + + paged_list_response = client.list_occurrences(parent) + with pytest.raises(CustomException): + list(paged_list_response) + + def test_delete_occurrence(self): + channel = ChannelStub() + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + name = client.occurrence_path("[PROJECT]", "[OCCURRENCE]") + + client.delete_occurrence(name) + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.DeleteOccurrenceRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_delete_occurrence_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + name = client.occurrence_path("[PROJECT]", "[OCCURRENCE]") + + with pytest.raises(CustomException): + client.delete_occurrence(name) + + def test_create_occurrence(self): + # Setup Expected Response + name = "name3373707" + resource_uri = "resourceUri-384040517" + note_name = "noteName1780787896" + remediation = "remediation779381797" + expected_response = { + "name": name, + "resource_uri": resource_uri, + "note_name": note_name, + "remediation": remediation, + } + expected_response = grafeas_pb2.Occurrence(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + parent = client.project_path("[PROJECT]") + occurrence = {} + + response = client.create_occurrence(parent, occurrence) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.CreateOccurrenceRequest( + parent=parent, occurrence=occurrence + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_create_occurrence_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + parent = client.project_path("[PROJECT]") + occurrence = {} + + with pytest.raises(CustomException): + client.create_occurrence(parent, occurrence) + + def test_batch_create_occurrences(self): + # Setup Expected Response + expected_response = {} + expected_response = grafeas_pb2.BatchCreateOccurrencesResponse( + **expected_response + ) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + parent = client.project_path("[PROJECT]") + occurrences = [] + + response = client.batch_create_occurrences(parent, occurrences) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.BatchCreateOccurrencesRequest( + parent=parent, occurrences=occurrences + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_batch_create_occurrences_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + parent = client.project_path("[PROJECT]") + occurrences = [] + + with pytest.raises(CustomException): + client.batch_create_occurrences(parent, occurrences) + + def test_update_occurrence(self): + # Setup Expected Response + name_2 = "name2-1052831874" + resource_uri = "resourceUri-384040517" + note_name = "noteName1780787896" + remediation = "remediation779381797" + expected_response = { + "name": name_2, + "resource_uri": resource_uri, + "note_name": note_name, + "remediation": remediation, + } + expected_response = grafeas_pb2.Occurrence(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + name = client.occurrence_path("[PROJECT]", "[OCCURRENCE]") + occurrence = {} + + response = client.update_occurrence(name, occurrence) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.UpdateOccurrenceRequest( + name=name, occurrence=occurrence + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_update_occurrence_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + name = client.occurrence_path("[PROJECT]", "[OCCURRENCE]") + occurrence = {} + + with pytest.raises(CustomException): + client.update_occurrence(name, occurrence) + + def test_get_occurrence_note(self): + # Setup Expected Response + name_2 = "name2-1052831874" + short_description = "shortDescription-235369287" + long_description = "longDescription-1747792199" + expected_response = { + "name": name_2, + "short_description": short_description, + "long_description": long_description, + } + expected_response = grafeas_pb2.Note(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + name = client.occurrence_path("[PROJECT]", "[OCCURRENCE]") + + response = client.get_occurrence_note(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.GetOccurrenceNoteRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_get_occurrence_note_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + name = client.occurrence_path("[PROJECT]", "[OCCURRENCE]") + + with pytest.raises(CustomException): + client.get_occurrence_note(name) + + def test_get_note(self): + # Setup Expected Response + name_2 = "name2-1052831874" + short_description = "shortDescription-235369287" + long_description = "longDescription-1747792199" + expected_response = { + "name": name_2, + "short_description": short_description, + "long_description": long_description, + } + expected_response = grafeas_pb2.Note(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + name = client.note_path("[PROJECT]", "[NOTE]") + + response = client.get_note(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.GetNoteRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_get_note_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + name = client.note_path("[PROJECT]", "[NOTE]") + + with pytest.raises(CustomException): + client.get_note(name) + + def test_list_notes(self): + # Setup Expected Response + next_page_token = "" + notes_element = {} + notes = [notes_element] + expected_response = {"next_page_token": next_page_token, "notes": notes} + expected_response = grafeas_pb2.ListNotesResponse(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + parent = client.project_path("[PROJECT]") + + paged_list_response = client.list_notes(parent) + resources = list(paged_list_response) + assert len(resources) == 1 + + assert expected_response.notes[0] == resources[0] + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.ListNotesRequest(parent=parent) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_list_notes_exception(self): + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + parent = client.project_path("[PROJECT]") + + paged_list_response = client.list_notes(parent) + with pytest.raises(CustomException): + list(paged_list_response) + + def test_delete_note(self): + channel = ChannelStub() + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + name = client.note_path("[PROJECT]", "[NOTE]") + + client.delete_note(name) + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.DeleteNoteRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_delete_note_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + name = client.note_path("[PROJECT]", "[NOTE]") + + with pytest.raises(CustomException): + client.delete_note(name) + + def test_create_note(self): + # Setup Expected Response + name = "name3373707" + short_description = "shortDescription-235369287" + long_description = "longDescription-1747792199" + expected_response = { + "name": name, + "short_description": short_description, + "long_description": long_description, + } + expected_response = grafeas_pb2.Note(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + parent = client.project_path("[PROJECT]") + note_id = "noteId2129224840" + note = {} + + response = client.create_note(parent, note_id, note) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.CreateNoteRequest( + parent=parent, note_id=note_id, note=note + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_create_note_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + parent = client.project_path("[PROJECT]") + note_id = "noteId2129224840" + note = {} + + with pytest.raises(CustomException): + client.create_note(parent, note_id, note) + + def test_batch_create_notes(self): + # Setup Expected Response + expected_response = {} + expected_response = grafeas_pb2.BatchCreateNotesResponse(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + parent = client.project_path("[PROJECT]") + notes = {} + + response = client.batch_create_notes(parent, notes) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.BatchCreateNotesRequest( + parent=parent, notes=notes + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_batch_create_notes_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + parent = client.project_path("[PROJECT]") + notes = {} + + with pytest.raises(CustomException): + client.batch_create_notes(parent, notes) + + def test_update_note(self): + # Setup Expected Response + name_2 = "name2-1052831874" + short_description = "shortDescription-235369287" + long_description = "longDescription-1747792199" + expected_response = { + "name": name_2, + "short_description": short_description, + "long_description": long_description, + } + expected_response = grafeas_pb2.Note(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + name = client.note_path("[PROJECT]", "[NOTE]") + note = {} + + response = client.update_note(name, note) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.UpdateNoteRequest(name=name, note=note) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_update_note_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + name = client.note_path("[PROJECT]", "[NOTE]") + note = {} + + with pytest.raises(CustomException): + client.update_note(name, note) + + def test_list_note_occurrences(self): + # Setup Expected Response + next_page_token = "" + occurrences_element = {} + occurrences = [occurrences_element] + expected_response = { + "next_page_token": next_page_token, + "occurrences": occurrences, + } + expected_response = grafeas_pb2.ListNoteOccurrencesResponse(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup Request + name = client.note_path("[PROJECT]", "[NOTE]") + + paged_list_response = client.list_note_occurrences(name) + resources = list(paged_list_response) + assert len(resources) == 1 + + assert expected_response.occurrences[0] == resources[0] + + assert len(channel.requests) == 1 + expected_request = grafeas_pb2.ListNoteOccurrencesRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_list_note_occurrences_exception(self): + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + address = "[SERVICE_ADDRESS]" + + scopes = "SCOPE" + + transport = grafeas_grpc_transport.GrafeasGrpcTransport(address, scopes) + + client = grafeas_v1.GrafeasClient(transport) + + # Setup request + name = client.note_path("[PROJECT]", "[NOTE]") + + paged_list_response = client.list_note_occurrences(name) + with pytest.raises(CustomException): + list(paged_list_response)