Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Commit

Permalink
Re-generate library using kms/synth.py (#5951)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpebot authored and tseaver committed Sep 12, 2018
1 parent 6c68bbf commit 5a35dd9
Show file tree
Hide file tree
Showing 20 changed files with 1,757 additions and 127 deletions.
26 changes: 11 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Python Client for Google Cloud Key Management Service (KMS) API (`Alpha`_)
==========================================================================
Python Client for Cloud Key Management Service (KMS) API (`Alpha`_)
===================================================================

`Google Cloud Key Management Service (KMS) API`_: Manages encryption for your cloud services the same way you do on-premises.
You can generate, use, rotate, and destroy AES256 encryption keys.
`Cloud Key Management Service (KMS) API`_: Manages keys and performs cryptographic operations in a central cloud
service, for direct use by other cloud resources and applications.

- `Client Library Documentation`_
- `Product Documentation`_

.. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
.. _Google Cloud Key Management Service (KMS) API: https://cloud.google.com/kms
.. _Cloud Key Management Service (KMS) API: https://cloud.google.com/kms
.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/kms/index.html
.. _Product Documentation: https://cloud.google.com/kms

Expand All @@ -19,12 +19,12 @@ In order to use this library, you first need to go through the following steps:

1. `Select or create a Cloud Platform project.`_
2. `Enable billing for your project.`_
3. `Enable the Google Cloud Key Management Service (KMS) API.`_
3. `Enable the Cloud Key Management Service (KMS) 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 Google Cloud Key Management Service (KMS) API.: https://cloud.google.com/kms
.. _Enable the Cloud Key Management Service (KMS) API.: https://cloud.google.com/kms
.. _Setup Authentication.: https://googlecloudplatform.github.io/google-cloud-python/latest/core/auth.html

Installation
Expand Down Expand Up @@ -65,12 +65,8 @@ Windows
Next Steps
~~~~~~~~~~

- Read the `Client Library Documentation`_ for Google Cloud Key Management Service (KMS) API
API to see other available methods on the client.
- Read the `Google Cloud Key Management Service (KMS) 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.
- Read the `Client Library Documentation`_ to see other available methods on
the client.
- Read the `Product Documentation`_ to learn more about the product and see
How-to Guides.

.. _Google Cloud Key Management Service (KMS) API Product documentation: https://cloud.google.com/kms
.. _repository’s main README: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
4 changes: 2 additions & 2 deletions docs/gapic/v1/api.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Client for Google Cloud Key Management Service (KMS) API
========================================================
Client for Cloud Key Management Service (KMS) API
=================================================

.. automodule:: google.cloud.kms_v1
:members:
Expand Down
4 changes: 2 additions & 2 deletions docs/gapic/v1/types.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Types for Google Cloud Key Management Service (KMS) API Client
==============================================================
Types for Cloud Key Management Service (KMS) API Client
=======================================================

.. automodule:: google.cloud.kms_v1.types
:members:
77 changes: 76 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,79 @@
.. include:: /../kms/README.rst
Python Client for Cloud Key Management Service (KMS) API (`Alpha`_)
===================================================================

`Cloud Key Management Service (KMS) API`_: Manages keys and performs cryptographic operations in a central cloud
service, for direct use by other cloud resources and applications.

- `Client Library Documentation`_
- `Product Documentation`_

.. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
.. _Cloud Key Management Service (KMS) API: https://cloud.google.com/kms
.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/kms/index.html
.. _Product Documentation: https://cloud.google.com/kms

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 Cloud Key Management Service (KMS) 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 Cloud Key Management Service (KMS) API.: https://cloud.google.com/kms
.. _Setup Authentication.: https://googlecloudplatform.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 <your-env>
source <your-env>/bin/activate
<your-env>/bin/pip install google-cloud-kms
Windows
^^^^^^^

.. code-block:: console
pip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activate
<your-env>\Scripts\pip.exe install google-cloud-kms
Next Steps
~~~~~~~~~~

- Read the `Client Library Documentation`_ for Cloud Key Management Service (KMS) API
API to see other available methods on the client.
- Read the `Cloud Key Management Service (KMS) 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.

.. _Cloud Key Management Service (KMS) API Product documentation: https://cloud.google.com/kms
.. _repository’s main README: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst

Api Reference
-------------
Expand Down
4 changes: 3 additions & 1 deletion google/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,4 +19,4 @@
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
__path__ = pkgutil.extend_path(__path__, __name__)
4 changes: 3 additions & 1 deletion google/cloud/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,4 +19,4 @@
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
__path__ = pkgutil.extend_path(__path__, __name__)
2 changes: 2 additions & 0 deletions google/cloud/kms.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/kms_v1/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
130 changes: 125 additions & 5 deletions google/cloud/kms_v1/gapic/enums.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -16,32 +18,133 @@
import enum


class ProtectionLevel(enum.IntEnum):
"""
``ProtectionLevel`` specifies how cryptographic operations are performed.
Attributes:
PROTECTION_LEVEL_UNSPECIFIED (int): Not specified.
SOFTWARE (int): Crypto operations are performed in software.
HSM (int): Crypto operations are performed in a Hardware Security Module.
"""
PROTECTION_LEVEL_UNSPECIFIED = 0
SOFTWARE = 1
HSM = 2


class CryptoKey(object):
class CryptoKeyPurpose(enum.IntEnum):
"""
``CryptoKeyPurpose`` describes the capabilities of a ``CryptoKey``. Two
keys with the same purpose may use different underlying algorithms, but
must support the same set of operations.
``CryptoKeyPurpose`` describes the cryptographic capabilities of a
``CryptoKey``. A given key can only be used for the operations allowed by
its purpose.
Attributes:
CRYPTO_KEY_PURPOSE_UNSPECIFIED (int): Not specified.
ENCRYPT_DECRYPT (int): ``CryptoKeys`` with this purpose may be used with
``Encrypt`` and
``Decrypt``.
ASYMMETRIC_SIGN (int): ``CryptoKeys`` with this purpose may be used with
``AsymmetricSign`` and
``GetPublicKey``.
ASYMMETRIC_DECRYPT (int): ``CryptoKeys`` with this purpose may be used with
``AsymmetricDecrypt`` and
``GetPublicKey``.
"""
CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0
ENCRYPT_DECRYPT = 1
ASYMMETRIC_SIGN = 5
ASYMMETRIC_DECRYPT = 6


class KeyOperationAttestation(object):
class AttestationFormat(enum.IntEnum):
"""
Attestion formats provided by the HSM.
Attributes:
ATTESTATION_FORMAT_UNSPECIFIED (int)
CAVIUM_V1_COMPRESSED (int): Cavium HSM attestation compressed with gzip. Note that this format is
defined by Cavium and subject to change at any time.
"""
ATTESTATION_FORMAT_UNSPECIFIED = 0
CAVIUM_V1_COMPRESSED = 3


class CryptoKeyVersion(object):
class CryptoKeyVersionAlgorithm(enum.IntEnum):
"""
The algorithm of the ``CryptoKeyVersion``, indicating what
parameters must be used for each cryptographic operation.
The
``GOOGLE_SYMMETRIC_ENCRYPTION``
algorithm is usable with ``CryptoKey.purpose``
``ENCRYPT_DECRYPT``.
Algorithms beginning with \"RSA_SIGN_\" are usable with ``CryptoKey.purpose``
``ASYMMETRIC_SIGN``.
The fields in the name after \"RSA_SIGN_\" correspond to the following
parameters: padding algorithm, modulus bit length, and digest algorithm.
For PSS, the salt length used is equal to the length of digest
algorithm. For example,
``RSA_SIGN_PSS_2048_SHA256``
will use PSS with a salt length of 256 bits or 32 bytes.
Algorithms beginning with \"RSA_DECRYPT_\" are usable with
``CryptoKey.purpose``
``ASYMMETRIC_DECRYPT``.
The fields in the name after \"RSA_DECRYPT_\" correspond to the following
parameters: padding algorithm, modulus bit length, and digest algorithm.
Algorithms beginning with \"EC_SIGN_\" are usable with ``CryptoKey.purpose``
``ASYMMETRIC_SIGN``.
The fields in the name after \"EC_SIGN_\" correspond to the following
parameters: elliptic curve, digest algorithm.
Attributes:
CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED (int): Not specified.
GOOGLE_SYMMETRIC_ENCRYPTION (int): Creates symmetric encryption keys.
RSA_SIGN_PSS_2048_SHA256 (int): RSASSA-PSS 2048 bit key with a SHA256 digest.
RSA_SIGN_PSS_3072_SHA256 (int): RSASSA-PSS 3072 bit key with a SHA256 digest.
RSA_SIGN_PSS_4096_SHA256 (int): RSASSA-PSS 4096 bit key with a SHA256 digest.
RSA_SIGN_PKCS1_2048_SHA256 (int): RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
RSA_SIGN_PKCS1_3072_SHA256 (int): RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
RSA_SIGN_PKCS1_4096_SHA256 (int): RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
RSA_DECRYPT_OAEP_2048_SHA256 (int): RSAES-OAEP 2048 bit key with a SHA256 digest.
RSA_DECRYPT_OAEP_3072_SHA256 (int): RSAES-OAEP 3072 bit key with a SHA256 digest.
RSA_DECRYPT_OAEP_4096_SHA256 (int): RSAES-OAEP 4096 bit key with a SHA256 digest.
EC_SIGN_P256_SHA256 (int): ECDSA on the NIST P-256 curve with a SHA256 digest.
EC_SIGN_P384_SHA384 (int): ECDSA on the NIST P-384 curve with a SHA384 digest.
"""
CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED = 0
GOOGLE_SYMMETRIC_ENCRYPTION = 1
RSA_SIGN_PSS_2048_SHA256 = 2
RSA_SIGN_PSS_3072_SHA256 = 3
RSA_SIGN_PSS_4096_SHA256 = 4
RSA_SIGN_PKCS1_2048_SHA256 = 5
RSA_SIGN_PKCS1_3072_SHA256 = 6
RSA_SIGN_PKCS1_4096_SHA256 = 7
RSA_DECRYPT_OAEP_2048_SHA256 = 8
RSA_DECRYPT_OAEP_3072_SHA256 = 9
RSA_DECRYPT_OAEP_4096_SHA256 = 10
EC_SIGN_P256_SHA256 = 12
EC_SIGN_P384_SHA384 = 13

class CryptoKeyVersionState(enum.IntEnum):
"""
The state of a ``CryptoKeyVersion``, indicating if it can be used.
Attributes:
CRYPTO_KEY_VERSION_STATE_UNSPECIFIED (int): Not specified.
ENABLED (int): This version may be used in ``Encrypt`` and
``Decrypt`` requests.
PENDING_GENERATION (int): This version is still being generated. It may not be used, enabled,
disabled, or destroyed yet. Cloud KMS will automatically mark this
version ``ENABLED`` as soon as the version is ready.
ENABLED (int): This version may be used for cryptographic operations.
DISABLED (int): This version may not be used, but the key material is still available,
and the version can be placed back into the ``ENABLED`` state.
DESTROYED (int): This version is destroyed, and the key material is no longer stored.
Expand All @@ -52,7 +155,24 @@ class CryptoKeyVersionState(enum.IntEnum):
to put it back into the ``DISABLED`` state.
"""
CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0
PENDING_GENERATION = 5
ENABLED = 1
DISABLED = 2
DESTROYED = 3
DESTROY_SCHEDULED = 4

class CryptoKeyVersionView(enum.IntEnum):
"""
A view for ``CryptoKeyVersion``s. Controls the level of detail returned
for ``CryptoKeyVersions`` in
``KeyManagementService.ListCryptoKeyVersions`` and
``KeyManagementService.ListCryptoKeys``.
Attributes:
CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED (int): Default view for each ``CryptoKeyVersion``. Does not include
the ``attestation`` field.
FULL (int): Provides all fields in each ``CryptoKeyVersion``, including the
``attestation``.
"""
CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0
FULL = 1
Loading

0 comments on commit 5a35dd9

Please sign in to comment.