-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add support for EncryptionConfiguration #4845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| @property | ||
| def kms_key_name(self): | ||
| """See |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| if config.skip_leading_rows is None: | ||
| del config.skip_leading_rows | ||
| if 'destinationEncryptionConfiguration' in resource: | ||
| key = resource['destinationEncryptionConfiguration']['kmsKeyName'] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| @kms_key_name.setter | ||
| def kms_key_name(self, value): | ||
| if not isinstance(value, six.string_types) and value is not None: | ||
| raise ValueError("Pass a string, or None") |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| @property | ||
| def kms_key_name(self): | ||
| """See |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| config = cls() | ||
| config._properties = copy.deepcopy(resource) | ||
| if 'destinationEncryptionConfiguration' in resource: | ||
| key = resource['destinationEncryptionConfiguration']['kmsKeyName'] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| config._properties[prop] = from_resource(nested_resource) | ||
|
|
||
| if 'destinationEncryptionConfiguration' in resource: | ||
| key = resource['destinationEncryptionConfiguration']['kmsKeyName'] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| table = cls(dataset_ref.table(table_id)) | ||
| table._set_properties(resource) | ||
| if 'encryptionConfiguration' in resource: | ||
| key = resource['encryptionConfiguration']['kmsKeyName'] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| klass = self._get_target_class() | ||
| job = klass.from_api_repr(RESOURCE, client=client) | ||
| self.assertIs(job._client, client) | ||
| self._verifyResourceProperties(job, RESOURCE) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@vitaliili the documentation build is failing. There's some info in https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/CONTRIBUTING.rst to get your dev environment set up. The way to build the docs locally is to run |
| config.skip_leading_rows = _int_or_none(slr) | ||
| if config.skip_leading_rows is None: | ||
| del config.skip_leading_rows | ||
| if ('destinationEncryptionConfiguration' in resource |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| def __init__(self): | ||
| self._properties = {} | ||
| self._kms_key_name = None |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| @kms_key_name.setter | ||
| def kms_key_name(self, value): | ||
| if not isinstance(value, six.string_types) and value is not None: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
tswast
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unapproving, since I do agree with Jon's comments.
Include EncryptionConfiguration in BigQuery module. Use _properties for EncryptionConfiguration implementation.
Note: I use _properties and kwargs because we want to be able to explicitly set kmsKeyName to None to allow unsetting it.
Also, fix links to job configs for destination_encryption_configurations.
tswast
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @vitaliili, I've made a few additional changes to the docstrings and EncryptionConfiguration class.
@jonparrott I think this is ready for a second pass at review.
|
Note: I've added code sample snippets for all customer-managed encryption key operations in #4852, which should also serve well as system tests. (The tests all pass) |
|
|
||
| @destination_encryption_configuration.setter | ||
| def destination_encryption_configuration(self, value): | ||
| self._properties[ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| def __init__(self, **kwargs): | ||
| self._properties = {} | ||
| if 'kms_key_name' in kwargs: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
lgtm once you appease the ci |
As part of a query, load job, or create table request, you can specify the encryption configuration, which just consists of a single string field containing the KMS key to use.