diff --git a/CHANGELOG.md b/CHANGELOG.md index 40b2efe..fa3b84d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.2.1](https://github.com/googleapis/python-binary-authorization/compare/v1.2.0...v1.2.1) (2022-02-11) + + +### Bug Fixes + +* resolve DuplicateCredentialArgs error when using credentials_file ([1f500f5](https://github.com/googleapis/python-binary-authorization/commit/1f500f506715e9028b98e7c42048aacc276fb9b4)) + ## [1.2.0](https://github.com/googleapis/python-binary-authorization/compare/v1.1.0...v1.2.0) (2022-01-25) diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py index 39dd270..387715e 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/async_client.py @@ -247,6 +247,26 @@ async def get_policy( [policy][google.cloud.binaryauthorization.v1.Policy] if the project does not have one. + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_get_policy(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.GetPolicyRequest( + name="name_value", + ) + + # Make the request + response = client.get_policy(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.GetPolicyRequest, dict]): The request object. Request message for @@ -272,7 +292,7 @@ async def get_policy( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -336,6 +356,30 @@ async def update_policy( NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed. + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_update_policy(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + policy = binaryauthorization_v1.Policy() + policy.default_admission_rule.evaluation_mode = "ALWAYS_DENY" + policy.default_admission_rule.enforcement_mode = "DRYRUN_AUDIT_LOG_ONLY" + + request = binaryauthorization_v1.UpdatePolicyRequest( + policy=policy, + ) + + # Make the request + response = client.update_policy(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.UpdatePolicyRequest, dict]): The request object. Request message for @@ -364,7 +408,7 @@ async def update_policy( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([policy]) if request is not None and has_flattened_params: @@ -432,6 +476,32 @@ async def create_attestor( the [attestor][google.cloud.binaryauthorization.v1.Attestor] already exists. + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_create_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + attestor = binaryauthorization_v1.Attestor() + attestor.user_owned_grafeas_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1.CreateAttestorRequest( + parent="parent_value", + attestor_id="attestor_id_value", + attestor=attestor, + ) + + # Make the request + response = client.create_attestor(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.CreateAttestorRequest, dict]): The request object. Request message for @@ -476,7 +546,7 @@ async def create_attestor( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, attestor_id, attestor]) if request is not None and has_flattened_params: @@ -531,6 +601,26 @@ async def get_attestor( [attestor][google.cloud.binaryauthorization.v1.Attestor] does not exist. + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_get_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.GetAttestorRequest( + name="name_value", + ) + + # Make the request + response = client.get_attestor(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.GetAttestorRequest, dict]): The request object. Request message for @@ -557,7 +647,7 @@ async def get_attestor( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -618,6 +708,30 @@ async def update_attestor( [attestor][google.cloud.binaryauthorization.v1.Attestor] does not exist. + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_update_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + attestor = binaryauthorization_v1.Attestor() + attestor.user_owned_grafeas_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1.UpdateAttestorRequest( + attestor=attestor, + ) + + # Make the request + response = client.update_attestor(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.UpdateAttestorRequest, dict]): The request object. Request message for @@ -647,7 +761,7 @@ async def update_attestor( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([attestor]) if request is not None and has_flattened_params: @@ -707,6 +821,27 @@ async def list_attestors( r"""Lists [attestors][google.cloud.binaryauthorization.v1.Attestor]. Returns INVALID_ARGUMENT if the project does not exist. + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_list_attestors(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.ListAttestorsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_attestors(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.ListAttestorsRequest, dict]): The request object. Request message for @@ -736,7 +871,7 @@ async def list_attestors( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -803,6 +938,23 @@ async def delete_attestor( [attestor][google.cloud.binaryauthorization.v1.Attestor] does not exist. + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_delete_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.DeleteAttestorRequest( + name="name_value", + ) + + # Make the request + client.delete_attestor(request=request) + Args: request (Union[google.cloud.binaryauthorization_v1.types.DeleteAttestorRequest, dict]): The request object. Request message for @@ -822,7 +974,7 @@ async def delete_attestor( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py index 3605a79..33b4ce2 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/client.py @@ -445,6 +445,27 @@ def get_policy( [policy][google.cloud.binaryauthorization.v1.Policy] if the project does not have one. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_get_policy(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.GetPolicyRequest( + name="name_value", + ) + + # Make the request + response = client.get_policy(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.GetPolicyRequest, dict]): The request object. Request message for @@ -470,7 +491,7 @@ def get_policy( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -524,6 +545,31 @@ def update_policy( NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_update_policy(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + policy = binaryauthorization_v1.Policy() + policy.default_admission_rule.evaluation_mode = "ALWAYS_DENY" + policy.default_admission_rule.enforcement_mode = "DRYRUN_AUDIT_LOG_ONLY" + + request = binaryauthorization_v1.UpdatePolicyRequest( + policy=policy, + ) + + # Make the request + response = client.update_policy(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.UpdatePolicyRequest, dict]): The request object. Request message for @@ -552,7 +598,7 @@ def update_policy( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([policy]) if request is not None and has_flattened_params: @@ -610,6 +656,33 @@ def create_attestor( the [attestor][google.cloud.binaryauthorization.v1.Attestor] already exists. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_create_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + attestor = binaryauthorization_v1.Attestor() + attestor.user_owned_grafeas_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1.CreateAttestorRequest( + parent="parent_value", + attestor_id="attestor_id_value", + attestor=attestor, + ) + + # Make the request + response = client.create_attestor(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.CreateAttestorRequest, dict]): The request object. Request message for @@ -654,7 +727,7 @@ def create_attestor( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, attestor_id, attestor]) if request is not None and has_flattened_params: @@ -709,6 +782,27 @@ def get_attestor( [attestor][google.cloud.binaryauthorization.v1.Attestor] does not exist. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_get_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.GetAttestorRequest( + name="name_value", + ) + + # Make the request + response = client.get_attestor(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.GetAttestorRequest, dict]): The request object. Request message for @@ -735,7 +829,7 @@ def get_attestor( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -786,6 +880,31 @@ def update_attestor( [attestor][google.cloud.binaryauthorization.v1.Attestor] does not exist. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_update_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + attestor = binaryauthorization_v1.Attestor() + attestor.user_owned_grafeas_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1.UpdateAttestorRequest( + attestor=attestor, + ) + + # Make the request + response = client.update_attestor(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.UpdateAttestorRequest, dict]): The request object. Request message for @@ -815,7 +934,7 @@ def update_attestor( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([attestor]) if request is not None and has_flattened_params: @@ -865,6 +984,28 @@ def list_attestors( r"""Lists [attestors][google.cloud.binaryauthorization.v1.Attestor]. Returns INVALID_ARGUMENT if the project does not exist. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_list_attestors(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.ListAttestorsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_attestors(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.ListAttestorsRequest, dict]): The request object. Request message for @@ -894,7 +1035,7 @@ def list_attestors( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -951,6 +1092,24 @@ def delete_attestor( [attestor][google.cloud.binaryauthorization.v1.Attestor] does not exist. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_delete_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.DeleteAttestorRequest( + name="name_value", + ) + + # Make the request + client.delete_attestor(request=request) + Args: request (Union[google.cloud.binaryauthorization_v1.types.DeleteAttestorRequest, dict]): The request object. Request message for @@ -970,7 +1129,7 @@ def delete_attestor( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py index e4678a2..6fc5a12 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc.py @@ -166,8 +166,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc_asyncio.py b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc_asyncio.py index dbb65d7..bd32619 100644 --- a/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc_asyncio.py +++ b/google/cloud/binaryauthorization_v1/services/binauthz_management_service_v1/transports/grpc_asyncio.py @@ -213,8 +213,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py index 90779aa..9fc18f2 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/async_client.py @@ -215,6 +215,26 @@ async def get_system_policy( r"""Gets the current system policy in the specified location. + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_get_system_policy(): + # Create a client + client = binaryauthorization_v1.SystemPolicyV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.GetSystemPolicyRequest( + name="name_value", + ) + + # Make the request + response = client.get_system_policy(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.GetSystemPolicyRequest, dict]): The request object. Request to read the current system @@ -240,7 +260,7 @@ async def get_system_policy( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py index 2d6daf3..d8f6d78 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/client.py @@ -407,6 +407,27 @@ def get_system_policy( r"""Gets the current system policy in the specified location. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_get_system_policy(): + # Create a client + client = binaryauthorization_v1.SystemPolicyV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.GetSystemPolicyRequest( + name="name_value", + ) + + # Make the request + response = client.get_system_policy(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.GetSystemPolicyRequest, dict]): The request object. Request to read the current system @@ -432,7 +453,7 @@ def get_system_policy( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py index d3f65a9..56c8d40 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc.py @@ -159,8 +159,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc_asyncio.py b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc_asyncio.py index 1459e72..646b1f3 100644 --- a/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc_asyncio.py +++ b/google/cloud/binaryauthorization_v1/services/system_policy_v1/transports/grpc_asyncio.py @@ -204,8 +204,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py index 4b8d070..8d9a2b0 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/async_client.py @@ -211,6 +211,28 @@ async def validate_attestation_occurrence( r"""Returns whether the given Attestation for the given image URI was signed by the given Attestor + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_validate_attestation_occurrence(): + # Create a client + client = binaryauthorization_v1.ValidationHelperV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.ValidateAttestationOccurrenceRequest( + attestor="attestor_value", + occurrence_note="occurrence_note_value", + occurrence_resource_uri="occurrence_resource_uri_value", + ) + + # Make the request + response = client.validate_attestation_occurrence(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.ValidateAttestationOccurrenceRequest, dict]): The request object. Request message for diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py index 9fd3c1a..3200756 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/client.py @@ -395,6 +395,29 @@ def validate_attestation_occurrence( r"""Returns whether the given Attestation for the given image URI was signed by the given Attestor + + + .. code-block:: + + from google.cloud import binaryauthorization_v1 + + def sample_validate_attestation_occurrence(): + # Create a client + client = binaryauthorization_v1.ValidationHelperV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.ValidateAttestationOccurrenceRequest( + attestor="attestor_value", + occurrence_note="occurrence_note_value", + occurrence_resource_uri="occurrence_resource_uri_value", + ) + + # Make the request + response = client.validate_attestation_occurrence(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1.types.ValidateAttestationOccurrenceRequest, dict]): The request object. Request message for diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py index 5e2ce89..ad6cc37 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc.py @@ -158,8 +158,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc_asyncio.py b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc_asyncio.py index 9f4dc93..1699853 100644 --- a/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc_asyncio.py +++ b/google/cloud/binaryauthorization_v1/services/validation_helper_v1/transports/grpc_asyncio.py @@ -203,8 +203,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/binaryauthorization_v1/types/resources.py b/google/cloud/binaryauthorization_v1/types/resources.py index 027d9ea..e1628cb 100644 --- a/google/cloud/binaryauthorization_v1/types/resources.py +++ b/google/cloud/binaryauthorization_v1/types/resources.py @@ -80,9 +80,9 @@ class Policy(proto.Message): e.g. spiffe://example.com/ns/test-ns/sa/default default_admission_rule (google.cloud.binaryauthorization_v1.types.AdmissionRule): Required. Default admission rule for a - cluster without a per-cluster, per- kubernetes- - service-account, or per-istio-service-identity - admission rule. + cluster without a per-cluster, per- + kubernetes-service-account, or + per-istio-service-identity admission rule. update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time when the policy was last updated. diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py index 43c9cba..a7f2761 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/async_client.py @@ -256,6 +256,26 @@ async def get_policy( [policy][google.cloud.binaryauthorization.v1beta1.Policy] if the project does not have one. + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_get_policy(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.GetPolicyRequest( + name="name_value", + ) + + # Make the request + response = client.get_policy(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.GetPolicyRequest, dict]): The request object. Request message for @@ -282,7 +302,7 @@ async def get_policy( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -346,6 +366,30 @@ async def update_policy( Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed. + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_update_policy(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + policy = binaryauthorization_v1beta1.Policy() + policy.default_admission_rule.evaluation_mode = "ALWAYS_DENY" + policy.default_admission_rule.enforcement_mode = "DRYRUN_AUDIT_LOG_ONLY" + + request = binaryauthorization_v1beta1.UpdatePolicyRequest( + policy=policy, + ) + + # Make the request + response = client.update_policy(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.UpdatePolicyRequest, dict]): The request object. Request message for @@ -375,7 +419,7 @@ async def update_policy( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([policy]) if request is not None and has_flattened_params: @@ -444,6 +488,32 @@ async def create_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] already exists. + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_create_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + attestor = binaryauthorization_v1beta1.Attestor() + attestor.user_owned_drydock_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1beta1.CreateAttestorRequest( + parent="parent_value", + attestor_id="attestor_id_value", + attestor=attestor, + ) + + # Make the request + response = client.create_attestor(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.CreateAttestorRequest, dict]): The request object. Request message for @@ -488,7 +558,7 @@ async def create_attestor( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, attestor_id, attestor]) if request is not None and has_flattened_params: @@ -543,6 +613,26 @@ async def get_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_get_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.GetAttestorRequest( + name="name_value", + ) + + # Make the request + response = client.get_attestor(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.GetAttestorRequest, dict]): The request object. Request message for @@ -569,7 +659,7 @@ async def get_attestor( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -630,6 +720,30 @@ async def update_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_update_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + attestor = binaryauthorization_v1beta1.Attestor() + attestor.user_owned_drydock_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1beta1.UpdateAttestorRequest( + attestor=attestor, + ) + + # Make the request + response = client.update_attestor(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.UpdateAttestorRequest, dict]): The request object. Request message for @@ -659,7 +773,7 @@ async def update_attestor( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([attestor]) if request is not None and has_flattened_params: @@ -720,6 +834,27 @@ async def list_attestors( [attestors][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns INVALID_ARGUMENT if the project does not exist. + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_list_attestors(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.ListAttestorsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_attestors(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.ListAttestorsRequest, dict]): The request object. Request message for @@ -749,7 +884,7 @@ async def list_attestors( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -816,6 +951,23 @@ async def delete_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_delete_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.DeleteAttestorRequest( + name="name_value", + ) + + # Make the request + client.delete_attestor(request=request) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.DeleteAttestorRequest, dict]): The request object. Request message for @@ -835,7 +987,7 @@ async def delete_attestor( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py index c943ee0..ba26f96 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/client.py @@ -452,6 +452,27 @@ def get_policy( [policy][google.cloud.binaryauthorization.v1beta1.Policy] if the project does not have one. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_get_policy(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.GetPolicyRequest( + name="name_value", + ) + + # Make the request + response = client.get_policy(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.GetPolicyRequest, dict]): The request object. Request message for @@ -478,7 +499,7 @@ def get_policy( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -532,6 +553,31 @@ def update_policy( Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the request is malformed. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_update_policy(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + policy = binaryauthorization_v1beta1.Policy() + policy.default_admission_rule.evaluation_mode = "ALWAYS_DENY" + policy.default_admission_rule.enforcement_mode = "DRYRUN_AUDIT_LOG_ONLY" + + request = binaryauthorization_v1beta1.UpdatePolicyRequest( + policy=policy, + ) + + # Make the request + response = client.update_policy(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.UpdatePolicyRequest, dict]): The request object. Request message for @@ -561,7 +607,7 @@ def update_policy( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([policy]) if request is not None and has_flattened_params: @@ -620,6 +666,33 @@ def create_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] already exists. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_create_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + attestor = binaryauthorization_v1beta1.Attestor() + attestor.user_owned_drydock_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1beta1.CreateAttestorRequest( + parent="parent_value", + attestor_id="attestor_id_value", + attestor=attestor, + ) + + # Make the request + response = client.create_attestor(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.CreateAttestorRequest, dict]): The request object. Request message for @@ -664,7 +737,7 @@ def create_attestor( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, attestor_id, attestor]) if request is not None and has_flattened_params: @@ -719,6 +792,27 @@ def get_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_get_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.GetAttestorRequest( + name="name_value", + ) + + # Make the request + response = client.get_attestor(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.GetAttestorRequest, dict]): The request object. Request message for @@ -745,7 +839,7 @@ def get_attestor( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -796,6 +890,31 @@ def update_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_update_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + attestor = binaryauthorization_v1beta1.Attestor() + attestor.user_owned_drydock_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1beta1.UpdateAttestorRequest( + attestor=attestor, + ) + + # Make the request + response = client.update_attestor(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.UpdateAttestorRequest, dict]): The request object. Request message for @@ -825,7 +944,7 @@ def update_attestor( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([attestor]) if request is not None and has_flattened_params: @@ -876,6 +995,28 @@ def list_attestors( [attestors][google.cloud.binaryauthorization.v1beta1.Attestor]. Returns INVALID_ARGUMENT if the project does not exist. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_list_attestors(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.ListAttestorsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_attestors(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.ListAttestorsRequest, dict]): The request object. Request message for @@ -905,7 +1046,7 @@ def list_attestors( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -962,6 +1103,24 @@ def delete_attestor( [attestor][google.cloud.binaryauthorization.v1beta1.Attestor] does not exist. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_delete_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.DeleteAttestorRequest( + name="name_value", + ) + + # Make the request + client.delete_attestor(request=request) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.DeleteAttestorRequest, dict]): The request object. Request message for @@ -981,7 +1140,7 @@ def delete_attestor( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py index 403e8cb..8c246b1 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc.py @@ -168,8 +168,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc_asyncio.py b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc_asyncio.py index 8c1926c..00cce20 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc_asyncio.py +++ b/google/cloud/binaryauthorization_v1beta1/services/binauthz_management_service_v1_beta1/transports/grpc_asyncio.py @@ -213,8 +213,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py index 574ffec..39c4e79 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/async_client.py @@ -216,6 +216,26 @@ async def get_system_policy( r"""Gets the current system policy in the specified location. + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_get_system_policy(): + # Create a client + client = binaryauthorization_v1beta1.SystemPolicyV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.GetSystemPolicyRequest( + name="name_value", + ) + + # Make the request + response = client.get_system_policy(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.GetSystemPolicyRequest, dict]): The request object. Request to read the current system @@ -242,7 +262,7 @@ async def get_system_policy( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py index dfa457d..f8ef374 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/client.py @@ -409,6 +409,27 @@ def get_system_policy( r"""Gets the current system policy in the specified location. + + + .. code-block:: + + from google.cloud import binaryauthorization_v1beta1 + + def sample_get_system_policy(): + # Create a client + client = binaryauthorization_v1beta1.SystemPolicyV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.GetSystemPolicyRequest( + name="name_value", + ) + + # Make the request + response = client.get_system_policy(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.binaryauthorization_v1beta1.types.GetSystemPolicyRequest, dict]): The request object. Request to read the current system @@ -435,7 +456,7 @@ def get_system_policy( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py index 05cbaef..ab71598 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc.py @@ -159,8 +159,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc_asyncio.py b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc_asyncio.py index 0502b9d..6998929 100644 --- a/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc_asyncio.py +++ b/google/cloud/binaryauthorization_v1beta1/services/system_policy_v1_beta1/transports/grpc_asyncio.py @@ -204,8 +204,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, diff --git a/google/cloud/binaryauthorization_v1beta1/types/resources.py b/google/cloud/binaryauthorization_v1beta1/types/resources.py index 617046a..92bc75d 100644 --- a/google/cloud/binaryauthorization_v1beta1/types/resources.py +++ b/google/cloud/binaryauthorization_v1beta1/types/resources.py @@ -79,9 +79,9 @@ class Policy(proto.Message): ``spiffe://example.com/ns/test-ns/sa/default`` default_admission_rule (google.cloud.binaryauthorization_v1beta1.types.AdmissionRule): Required. Default admission rule for a - cluster without a per-cluster, per- kubernetes- - service-account, or per-istio-service-identity - admission rule. + cluster without a per-cluster, per- + kubernetes-service-account, or + per-istio-service-identity admission rule. update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time when the policy was last updated. diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_create_attestor_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_create_attestor_async.py new file mode 100644 index 0000000..de267a6 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_create_attestor_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_CreateAttestor_async] +from google.cloud import binaryauthorization_v1 + + +async def sample_create_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() + + # Initialize request argument(s) + attestor = binaryauthorization_v1.Attestor() + attestor.user_owned_grafeas_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1.CreateAttestorRequest( + parent="parent_value", + attestor_id="attestor_id_value", + attestor=attestor, + ) + + # Make the request + response = await client.create_attestor(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_CreateAttestor_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_create_attestor_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_create_attestor_sync.py new file mode 100644 index 0000000..bf2943b --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_create_attestor_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_CreateAttestor_sync] +from google.cloud import binaryauthorization_v1 + + +def sample_create_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + attestor = binaryauthorization_v1.Attestor() + attestor.user_owned_grafeas_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1.CreateAttestorRequest( + parent="parent_value", + attestor_id="attestor_id_value", + attestor=attestor, + ) + + # Make the request + response = client.create_attestor(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_CreateAttestor_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_delete_attestor_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_delete_attestor_async.py new file mode 100644 index 0000000..e637f68 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_delete_attestor_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_DeleteAttestor_async] +from google.cloud import binaryauthorization_v1 + + +async def sample_delete_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() + + # Initialize request argument(s) + request = binaryauthorization_v1.DeleteAttestorRequest( + name="name_value", + ) + + # Make the request + await client.delete_attestor(request=request) + + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_DeleteAttestor_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_delete_attestor_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_delete_attestor_sync.py new file mode 100644 index 0000000..7621791 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_delete_attestor_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_DeleteAttestor_sync] +from google.cloud import binaryauthorization_v1 + + +def sample_delete_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.DeleteAttestorRequest( + name="name_value", + ) + + # Make the request + client.delete_attestor(request=request) + + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_DeleteAttestor_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_attestor_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_attestor_async.py new file mode 100644 index 0000000..5e3867e --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_attestor_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_GetAttestor_async] +from google.cloud import binaryauthorization_v1 + + +async def sample_get_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() + + # Initialize request argument(s) + request = binaryauthorization_v1.GetAttestorRequest( + name="name_value", + ) + + # Make the request + response = await client.get_attestor(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_GetAttestor_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_attestor_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_attestor_sync.py new file mode 100644 index 0000000..54883c7 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_attestor_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_GetAttestor_sync] +from google.cloud import binaryauthorization_v1 + + +def sample_get_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.GetAttestorRequest( + name="name_value", + ) + + # Make the request + response = client.get_attestor(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_GetAttestor_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_policy_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_policy_async.py new file mode 100644 index 0000000..a883c5d --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_policy_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetPolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_GetPolicy_async] +from google.cloud import binaryauthorization_v1 + + +async def sample_get_policy(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() + + # Initialize request argument(s) + request = binaryauthorization_v1.GetPolicyRequest( + name="name_value", + ) + + # Make the request + response = await client.get_policy(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_GetPolicy_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_policy_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_policy_sync.py new file mode 100644 index 0000000..1b854cd --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_policy_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetPolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_GetPolicy_sync] +from google.cloud import binaryauthorization_v1 + + +def sample_get_policy(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.GetPolicyRequest( + name="name_value", + ) + + # Make the request + response = client.get_policy(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_GetPolicy_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_list_attestors_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_list_attestors_async.py new file mode 100644 index 0000000..765725f --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_list_attestors_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListAttestors +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_ListAttestors_async] +from google.cloud import binaryauthorization_v1 + + +async def sample_list_attestors(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() + + # Initialize request argument(s) + request = binaryauthorization_v1.ListAttestorsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_attestors(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_ListAttestors_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_list_attestors_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_list_attestors_sync.py new file mode 100644 index 0000000..e58ea93 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_list_attestors_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListAttestors +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_ListAttestors_sync] +from google.cloud import binaryauthorization_v1 + + +def sample_list_attestors(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.ListAttestorsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_attestors(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_ListAttestors_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_attestor_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_attestor_async.py new file mode 100644 index 0000000..a8c05ad --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_attestor_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_UpdateAttestor_async] +from google.cloud import binaryauthorization_v1 + + +async def sample_update_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() + + # Initialize request argument(s) + attestor = binaryauthorization_v1.Attestor() + attestor.user_owned_grafeas_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1.UpdateAttestorRequest( + attestor=attestor, + ) + + # Make the request + response = await client.update_attestor(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_UpdateAttestor_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_attestor_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_attestor_sync.py new file mode 100644 index 0000000..f9f552c --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_attestor_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_UpdateAttestor_sync] +from google.cloud import binaryauthorization_v1 + + +def sample_update_attestor(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + attestor = binaryauthorization_v1.Attestor() + attestor.user_owned_grafeas_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1.UpdateAttestorRequest( + attestor=attestor, + ) + + # Make the request + response = client.update_attestor(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_UpdateAttestor_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_policy_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_policy_async.py new file mode 100644 index 0000000..93552fd --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_policy_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdatePolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_UpdatePolicy_async] +from google.cloud import binaryauthorization_v1 + + +async def sample_update_policy(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1AsyncClient() + + # Initialize request argument(s) + policy = binaryauthorization_v1.Policy() + policy.default_admission_rule.evaluation_mode = "ALWAYS_DENY" + policy.default_admission_rule.enforcement_mode = "DRYRUN_AUDIT_LOG_ONLY" + + request = binaryauthorization_v1.UpdatePolicyRequest( + policy=policy, + ) + + # Make the request + response = await client.update_policy(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_UpdatePolicy_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_policy_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_policy_sync.py new file mode 100644 index 0000000..919ebe8 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_policy_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdatePolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_UpdatePolicy_sync] +from google.cloud import binaryauthorization_v1 + + +def sample_update_policy(): + # Create a client + client = binaryauthorization_v1.BinauthzManagementServiceV1Client() + + # Initialize request argument(s) + policy = binaryauthorization_v1.Policy() + policy.default_admission_rule.evaluation_mode = "ALWAYS_DENY" + policy.default_admission_rule.enforcement_mode = "DRYRUN_AUDIT_LOG_ONLY" + + request = binaryauthorization_v1.UpdatePolicyRequest( + policy=policy, + ) + + # Make the request + response = client.update_policy(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_UpdatePolicy_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_system_policy_v1_get_system_policy_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_system_policy_v1_get_system_policy_async.py new file mode 100644 index 0000000..f0ed424 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_system_policy_v1_get_system_policy_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSystemPolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_SystemPolicyV1_GetSystemPolicy_async] +from google.cloud import binaryauthorization_v1 + + +async def sample_get_system_policy(): + # Create a client + client = binaryauthorization_v1.SystemPolicyV1AsyncClient() + + # Initialize request argument(s) + request = binaryauthorization_v1.GetSystemPolicyRequest( + name="name_value", + ) + + # Make the request + response = await client.get_system_policy(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_SystemPolicyV1_GetSystemPolicy_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_system_policy_v1_get_system_policy_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_system_policy_v1_get_system_policy_sync.py new file mode 100644 index 0000000..f1ffbd0 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_system_policy_v1_get_system_policy_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSystemPolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_SystemPolicyV1_GetSystemPolicy_sync] +from google.cloud import binaryauthorization_v1 + + +def sample_get_system_policy(): + # Create a client + client = binaryauthorization_v1.SystemPolicyV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.GetSystemPolicyRequest( + name="name_value", + ) + + # Make the request + response = client.get_system_policy(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_SystemPolicyV1_GetSystemPolicy_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_validation_helper_v1_validate_attestation_occurrence_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_validation_helper_v1_validate_attestation_occurrence_async.py new file mode 100644 index 0000000..8cd459e --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_validation_helper_v1_validate_attestation_occurrence_async.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ValidateAttestationOccurrence +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_ValidationHelperV1_ValidateAttestationOccurrence_async] +from google.cloud import binaryauthorization_v1 + + +async def sample_validate_attestation_occurrence(): + # Create a client + client = binaryauthorization_v1.ValidationHelperV1AsyncClient() + + # Initialize request argument(s) + request = binaryauthorization_v1.ValidateAttestationOccurrenceRequest( + attestor="attestor_value", + occurrence_note="occurrence_note_value", + occurrence_resource_uri="occurrence_resource_uri_value", + ) + + # Make the request + response = await client.validate_attestation_occurrence(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_ValidationHelperV1_ValidateAttestationOccurrence_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_validation_helper_v1_validate_attestation_occurrence_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_validation_helper_v1_validate_attestation_occurrence_sync.py new file mode 100644 index 0000000..8ba7df0 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1_validation_helper_v1_validate_attestation_occurrence_sync.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ValidateAttestationOccurrence +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1_ValidationHelperV1_ValidateAttestationOccurrence_sync] +from google.cloud import binaryauthorization_v1 + + +def sample_validate_attestation_occurrence(): + # Create a client + client = binaryauthorization_v1.ValidationHelperV1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1.ValidateAttestationOccurrenceRequest( + attestor="attestor_value", + occurrence_note="occurrence_note_value", + occurrence_resource_uri="occurrence_resource_uri_value", + ) + + # Make the request + response = client.validate_attestation_occurrence(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1_ValidationHelperV1_ValidateAttestationOccurrence_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_create_attestor_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_create_attestor_async.py new file mode 100644 index 0000000..fa78d6e --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_create_attestor_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_CreateAttestor_async] +from google.cloud import binaryauthorization_v1beta1 + + +async def sample_create_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() + + # Initialize request argument(s) + attestor = binaryauthorization_v1beta1.Attestor() + attestor.user_owned_drydock_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1beta1.CreateAttestorRequest( + parent="parent_value", + attestor_id="attestor_id_value", + attestor=attestor, + ) + + # Make the request + response = await client.create_attestor(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_CreateAttestor_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_create_attestor_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_create_attestor_sync.py new file mode 100644 index 0000000..c0a506a --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_create_attestor_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_CreateAttestor_sync] +from google.cloud import binaryauthorization_v1beta1 + + +def sample_create_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + attestor = binaryauthorization_v1beta1.Attestor() + attestor.user_owned_drydock_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1beta1.CreateAttestorRequest( + parent="parent_value", + attestor_id="attestor_id_value", + attestor=attestor, + ) + + # Make the request + response = client.create_attestor(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_CreateAttestor_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_delete_attestor_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_delete_attestor_async.py new file mode 100644 index 0000000..ac60091 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_delete_attestor_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_DeleteAttestor_async] +from google.cloud import binaryauthorization_v1beta1 + + +async def sample_delete_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.DeleteAttestorRequest( + name="name_value", + ) + + # Make the request + await client.delete_attestor(request=request) + + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_DeleteAttestor_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_delete_attestor_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_delete_attestor_sync.py new file mode 100644 index 0000000..5faffc3 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_delete_attestor_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_DeleteAttestor_sync] +from google.cloud import binaryauthorization_v1beta1 + + +def sample_delete_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.DeleteAttestorRequest( + name="name_value", + ) + + # Make the request + client.delete_attestor(request=request) + + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_DeleteAttestor_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_attestor_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_attestor_async.py new file mode 100644 index 0000000..0a88db1 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_attestor_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_GetAttestor_async] +from google.cloud import binaryauthorization_v1beta1 + + +async def sample_get_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.GetAttestorRequest( + name="name_value", + ) + + # Make the request + response = await client.get_attestor(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_GetAttestor_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_attestor_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_attestor_sync.py new file mode 100644 index 0000000..7a0616c --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_attestor_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_GetAttestor_sync] +from google.cloud import binaryauthorization_v1beta1 + + +def sample_get_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.GetAttestorRequest( + name="name_value", + ) + + # Make the request + response = client.get_attestor(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_GetAttestor_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_policy_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_policy_async.py new file mode 100644 index 0000000..0dbed45 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_policy_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetPolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_GetPolicy_async] +from google.cloud import binaryauthorization_v1beta1 + + +async def sample_get_policy(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.GetPolicyRequest( + name="name_value", + ) + + # Make the request + response = await client.get_policy(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_GetPolicy_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_policy_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_policy_sync.py new file mode 100644 index 0000000..e6b3b34 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_policy_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetPolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_GetPolicy_sync] +from google.cloud import binaryauthorization_v1beta1 + + +def sample_get_policy(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.GetPolicyRequest( + name="name_value", + ) + + # Make the request + response = client.get_policy(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_GetPolicy_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_list_attestors_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_list_attestors_async.py new file mode 100644 index 0000000..7ed88e4 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_list_attestors_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListAttestors +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_ListAttestors_async] +from google.cloud import binaryauthorization_v1beta1 + + +async def sample_list_attestors(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.ListAttestorsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_attestors(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_ListAttestors_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_list_attestors_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_list_attestors_sync.py new file mode 100644 index 0000000..142b452 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_list_attestors_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListAttestors +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_ListAttestors_sync] +from google.cloud import binaryauthorization_v1beta1 + + +def sample_list_attestors(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.ListAttestorsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_attestors(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_ListAttestors_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_attestor_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_attestor_async.py new file mode 100644 index 0000000..502ede9 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_attestor_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_UpdateAttestor_async] +from google.cloud import binaryauthorization_v1beta1 + + +async def sample_update_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() + + # Initialize request argument(s) + attestor = binaryauthorization_v1beta1.Attestor() + attestor.user_owned_drydock_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1beta1.UpdateAttestorRequest( + attestor=attestor, + ) + + # Make the request + response = await client.update_attestor(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_UpdateAttestor_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_attestor_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_attestor_sync.py new file mode 100644 index 0000000..96cdd3a --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_attestor_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateAttestor +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_UpdateAttestor_sync] +from google.cloud import binaryauthorization_v1beta1 + + +def sample_update_attestor(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + attestor = binaryauthorization_v1beta1.Attestor() + attestor.user_owned_drydock_note.note_reference = "note_reference_value" + attestor.name = "name_value" + + request = binaryauthorization_v1beta1.UpdateAttestorRequest( + attestor=attestor, + ) + + # Make the request + response = client.update_attestor(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_UpdateAttestor_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_policy_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_policy_async.py new file mode 100644 index 0000000..96bec06 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_policy_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdatePolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_UpdatePolicy_async] +from google.cloud import binaryauthorization_v1beta1 + + +async def sample_update_policy(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1AsyncClient() + + # Initialize request argument(s) + policy = binaryauthorization_v1beta1.Policy() + policy.default_admission_rule.evaluation_mode = "ALWAYS_DENY" + policy.default_admission_rule.enforcement_mode = "DRYRUN_AUDIT_LOG_ONLY" + + request = binaryauthorization_v1beta1.UpdatePolicyRequest( + policy=policy, + ) + + # Make the request + response = await client.update_policy(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_UpdatePolicy_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_policy_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_policy_sync.py new file mode 100644 index 0000000..9569014 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_policy_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdatePolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_UpdatePolicy_sync] +from google.cloud import binaryauthorization_v1beta1 + + +def sample_update_policy(): + # Create a client + client = binaryauthorization_v1beta1.BinauthzManagementServiceV1Beta1Client() + + # Initialize request argument(s) + policy = binaryauthorization_v1beta1.Policy() + policy.default_admission_rule.evaluation_mode = "ALWAYS_DENY" + policy.default_admission_rule.enforcement_mode = "DRYRUN_AUDIT_LOG_ONLY" + + request = binaryauthorization_v1beta1.UpdatePolicyRequest( + policy=policy, + ) + + # Make the request + response = client.update_policy(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_UpdatePolicy_sync] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_system_policy_v1_beta1_get_system_policy_async.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_system_policy_v1_beta1_get_system_policy_async.py new file mode 100644 index 0000000..1cb3670 --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_system_policy_v1_beta1_get_system_policy_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSystemPolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_SystemPolicyV1Beta1_GetSystemPolicy_async] +from google.cloud import binaryauthorization_v1beta1 + + +async def sample_get_system_policy(): + # Create a client + client = binaryauthorization_v1beta1.SystemPolicyV1Beta1AsyncClient() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.GetSystemPolicyRequest( + name="name_value", + ) + + # Make the request + response = await client.get_system_policy(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_SystemPolicyV1Beta1_GetSystemPolicy_async] diff --git a/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_system_policy_v1_beta1_get_system_policy_sync.py b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_system_policy_v1_beta1_get_system_policy_sync.py new file mode 100644 index 0000000..e4f92db --- /dev/null +++ b/samples/generated_samples/binaryauthorization_generated_binaryauthorization_v1beta1_system_policy_v1_beta1_get_system_policy_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# 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. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetSystemPolicy +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-binaryauthorization + + +# [START binaryauthorization_generated_binaryauthorization_v1beta1_SystemPolicyV1Beta1_GetSystemPolicy_sync] +from google.cloud import binaryauthorization_v1beta1 + + +def sample_get_system_policy(): + # Create a client + client = binaryauthorization_v1beta1.SystemPolicyV1Beta1Client() + + # Initialize request argument(s) + request = binaryauthorization_v1beta1.GetSystemPolicyRequest( + name="name_value", + ) + + # Make the request + response = client.get_system_policy(request=request) + + # Handle the response + print(response) + +# [END binaryauthorization_generated_binaryauthorization_v1beta1_SystemPolicyV1Beta1_GetSystemPolicy_sync] diff --git a/samples/generated_samples/snippet_metadata_binaryauthorization_v1.json b/samples/generated_samples/snippet_metadata_binaryauthorization_v1.json new file mode 100644 index 0000000..c83c420 --- /dev/null +++ b/samples/generated_samples/snippet_metadata_binaryauthorization_v1.json @@ -0,0 +1,801 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "CreateAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_create_attestor_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_CreateAttestor_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "CreateAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_create_attestor_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_CreateAttestor_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "DeleteAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_delete_attestor_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_DeleteAttestor_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "DeleteAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_delete_attestor_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_DeleteAttestor_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "GetAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_attestor_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_GetAttestor_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "GetAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_attestor_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_GetAttestor_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "GetPolicy" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_policy_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_GetPolicy_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "GetPolicy" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_get_policy_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_GetPolicy_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "ListAttestors" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_list_attestors_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_ListAttestors_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "ListAttestors" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_list_attestors_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_ListAttestors_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "UpdateAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_attestor_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_UpdateAttestor_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "UpdateAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_attestor_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_UpdateAttestor_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "UpdatePolicy" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_policy_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_UpdatePolicy_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1" + }, + "shortName": "UpdatePolicy" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_binauthz_management_service_v1_update_policy_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_BinauthzManagementServiceV1_UpdatePolicy_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "SystemPolicyV1" + }, + "shortName": "GetSystemPolicy" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_system_policy_v1_get_system_policy_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_SystemPolicyV1_GetSystemPolicy_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "SystemPolicyV1" + }, + "shortName": "GetSystemPolicy" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_system_policy_v1_get_system_policy_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_SystemPolicyV1_GetSystemPolicy_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "ValidationHelperV1" + }, + "shortName": "ValidateAttestationOccurrence" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_validation_helper_v1_validate_attestation_occurrence_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_ValidationHelperV1_ValidateAttestationOccurrence_async", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 40, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 43, + "start": 41, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "start": 44, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "ValidationHelperV1" + }, + "shortName": "ValidateAttestationOccurrence" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1_validation_helper_v1_validate_attestation_occurrence_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1_ValidationHelperV1_ValidateAttestationOccurrence_sync", + "segments": [ + { + "end": 46, + "start": 27, + "type": "FULL" + }, + { + "end": 46, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 40, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 43, + "start": 41, + "type": "REQUEST_EXECUTION" + }, + { + "end": 47, + "start": 44, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} diff --git a/samples/generated_samples/snippet_metadata_binaryauthorization_v1beta1.json b/samples/generated_samples/snippet_metadata_binaryauthorization_v1beta1.json new file mode 100644 index 0000000..1e7f06d --- /dev/null +++ b/samples/generated_samples/snippet_metadata_binaryauthorization_v1beta1.json @@ -0,0 +1,712 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "CreateAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_create_attestor_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_CreateAttestor_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "CreateAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_create_attestor_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_CreateAttestor_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "DeleteAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_delete_attestor_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_DeleteAttestor_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "DeleteAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_delete_attestor_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_DeleteAttestor_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "GetAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_attestor_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_GetAttestor_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "GetAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_attestor_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_GetAttestor_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "GetPolicy" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_policy_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_GetPolicy_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "GetPolicy" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_get_policy_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_GetPolicy_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "ListAttestors" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_list_attestors_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_ListAttestors_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "ListAttestors" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_list_attestors_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_ListAttestors_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "UpdateAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_attestor_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_UpdateAttestor_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "UpdateAttestor" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_attestor_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_UpdateAttestor_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "UpdatePolicy" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_policy_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_UpdatePolicy_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "BinauthzManagementServiceV1Beta1" + }, + "shortName": "UpdatePolicy" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_binauthz_management_service_v1_beta1_update_policy_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_BinauthzManagementServiceV1Beta1_UpdatePolicy_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "SystemPolicyV1Beta1" + }, + "shortName": "GetSystemPolicy" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_system_policy_v1_beta1_get_system_policy_async.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_SystemPolicyV1Beta1_GetSystemPolicy_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "SystemPolicyV1Beta1" + }, + "shortName": "GetSystemPolicy" + } + }, + "file": "binaryauthorization_generated_binaryauthorization_v1beta1_system_policy_v1_beta1_get_system_policy_sync.py", + "regionTag": "binaryauthorization_generated_binaryauthorization_v1beta1_SystemPolicyV1Beta1_GetSystemPolicy_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} diff --git a/setup.py b/setup.py index 164613e..21c2102 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # type: ignore -version = "1.2.0" +version = "1.2.1" package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py index 3df746e..133f360 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_binauthz_management_service_v1.py @@ -548,25 +548,28 @@ def test_binauthz_management_service_v1_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ ( BinauthzManagementServiceV1Client, transports.BinauthzManagementServiceV1GrpcTransport, "grpc", + grpc_helpers, ), ( BinauthzManagementServiceV1AsyncClient, transports.BinauthzManagementServiceV1GrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_binauthz_management_service_v1_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -602,6 +605,72 @@ def test_binauthz_management_service_v1_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + BinauthzManagementServiceV1Client, + transports.BinauthzManagementServiceV1GrpcTransport, + "grpc", + grpc_helpers, + ), + ( + BinauthzManagementServiceV1AsyncClient, + transports.BinauthzManagementServiceV1GrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_binauthz_management_service_v1_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "binaryauthorization.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=None, + default_host="binaryauthorization.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize("request_type", [service.GetPolicyRequest, dict,]) def test_get_policy(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Client( diff --git a/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py index a564134..1fbe6a1 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_system_policy_v1.py @@ -513,21 +513,28 @@ def test_system_policy_v1_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (SystemPolicyV1Client, transports.SystemPolicyV1GrpcTransport, "grpc"), + ( + SystemPolicyV1Client, + transports.SystemPolicyV1GrpcTransport, + "grpc", + grpc_helpers, + ), ( SystemPolicyV1AsyncClient, transports.SystemPolicyV1GrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_system_policy_v1_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -563,6 +570,72 @@ def test_system_policy_v1_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + SystemPolicyV1Client, + transports.SystemPolicyV1GrpcTransport, + "grpc", + grpc_helpers, + ), + ( + SystemPolicyV1AsyncClient, + transports.SystemPolicyV1GrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_system_policy_v1_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "binaryauthorization.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=None, + default_host="binaryauthorization.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize("request_type", [service.GetSystemPolicyRequest, dict,]) def test_get_system_policy(request_type, transport: str = "grpc"): client = SystemPolicyV1Client( diff --git a/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py index 5eee0b0..0a9d30a 100644 --- a/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py +++ b/tests/unit/gapic/binaryauthorization_v1/test_validation_helper_v1.py @@ -524,21 +524,28 @@ def test_validation_helper_v1_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (ValidationHelperV1Client, transports.ValidationHelperV1GrpcTransport, "grpc"), + ( + ValidationHelperV1Client, + transports.ValidationHelperV1GrpcTransport, + "grpc", + grpc_helpers, + ), ( ValidationHelperV1AsyncClient, transports.ValidationHelperV1GrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_validation_helper_v1_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -574,6 +581,72 @@ def test_validation_helper_v1_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + ValidationHelperV1Client, + transports.ValidationHelperV1GrpcTransport, + "grpc", + grpc_helpers, + ), + ( + ValidationHelperV1AsyncClient, + transports.ValidationHelperV1GrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_validation_helper_v1_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "binaryauthorization.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=None, + default_host="binaryauthorization.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize( "request_type", [service.ValidateAttestationOccurrenceRequest, dict,] ) diff --git a/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py index 121646e..aba6f54 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_binauthz_management_service_v1_beta1.py @@ -570,25 +570,28 @@ def test_binauthz_management_service_v1_beta1_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ ( BinauthzManagementServiceV1Beta1Client, transports.BinauthzManagementServiceV1Beta1GrpcTransport, "grpc", + grpc_helpers, ), ( BinauthzManagementServiceV1Beta1AsyncClient, transports.BinauthzManagementServiceV1Beta1GrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_binauthz_management_service_v1_beta1_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -624,6 +627,72 @@ def test_binauthz_management_service_v1_beta1_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + BinauthzManagementServiceV1Beta1Client, + transports.BinauthzManagementServiceV1Beta1GrpcTransport, + "grpc", + grpc_helpers, + ), + ( + BinauthzManagementServiceV1Beta1AsyncClient, + transports.BinauthzManagementServiceV1Beta1GrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_binauthz_management_service_v1_beta1_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "binaryauthorization.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=None, + default_host="binaryauthorization.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize("request_type", [service.GetPolicyRequest, dict,]) def test_get_policy(request_type, transport: str = "grpc"): client = BinauthzManagementServiceV1Beta1Client( diff --git a/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py index 315cd3b..6caefae 100644 --- a/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py +++ b/tests/unit/gapic/binaryauthorization_v1beta1/test_system_policy_v1_beta1.py @@ -534,25 +534,28 @@ def test_system_policy_v1_beta1_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ ( SystemPolicyV1Beta1Client, transports.SystemPolicyV1Beta1GrpcTransport, "grpc", + grpc_helpers, ), ( SystemPolicyV1Beta1AsyncClient, transports.SystemPolicyV1Beta1GrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_system_policy_v1_beta1_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -588,6 +591,72 @@ def test_system_policy_v1_beta1_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + SystemPolicyV1Beta1Client, + transports.SystemPolicyV1Beta1GrpcTransport, + "grpc", + grpc_helpers, + ), + ( + SystemPolicyV1Beta1AsyncClient, + transports.SystemPolicyV1Beta1GrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_system_policy_v1_beta1_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "binaryauthorization.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=None, + default_host="binaryauthorization.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize("request_type", [service.GetSystemPolicyRequest, dict,]) def test_get_system_policy(request_type, transport: str = "grpc"): client = SystemPolicyV1Beta1Client(