@@ -3339,6 +3339,9 @@ def create(
3339
3339
encryption_spec_key_name : Optional [str ] = None ,
3340
3340
sync = True ,
3341
3341
private_service_connect_config : Optional [PrivateServiceConnectConfig ] = None ,
3342
+ enable_request_response_logging = False ,
3343
+ request_response_logging_sampling_rate : Optional [float ] = None ,
3344
+ request_response_logging_bq_destination_table : Optional [str ] = None ,
3342
3345
inference_timeout : Optional [int ] = None ,
3343
3346
) -> "PrivateEndpoint" :
3344
3347
"""Creates a new PrivateEndpoint.
@@ -3376,64 +3379,68 @@ def create(
3376
3379
project_allowlist=["test-project"]),
3377
3380
)
3378
3381
Args:
3379
- display_name (str):
3380
- Required. The user-defined name of the Endpoint.
3381
- The name can be up to 128 characters long and can be consist
3382
- of any UTF-8 characters.
3383
- project (str):
3384
- Optional. Project to retrieve endpoint from. If not set, project
3385
- set in aiplatform.init will be used.
3386
- location (str):
3387
- Optional. Location to retrieve endpoint from. If not set, location
3388
- set in aiplatform.init will be used.
3389
- network (str):
3390
- Optional. The full name of the Compute Engine network to which
3391
- this Endpoint will be peered. E.g. "projects/123456789123/global/networks/my_vpc".
3392
- Private services access must already be configured for the network.
3393
- If left unspecified, the network set with aiplatform.init will be used.
3394
- Cannot be set together with private_service_connect_config.
3395
- description (str):
3396
- Optional. The description of the Endpoint.
3397
- labels (Dict[str, str]):
3398
- Optional. The labels with user-defined metadata to
3399
- organize your Endpoints.
3400
- Label keys and values can be no longer than 64
3401
- characters (Unicode codepoints), can only
3402
- contain lowercase letters, numeric characters,
3403
- underscores and dashes. International characters
3404
- are allowed.
3405
- See https://goo.gl/xmQnxf for more information
3406
- and examples of labels.
3407
- credentials (auth_credentials.Credentials):
3408
- Optional. Custom credentials to use to upload this model. Overrides
3409
- credentials set in aiplatform.init.
3410
- encryption_spec_key_name (str):
3411
- Optional. The Cloud KMS resource identifier of the customer
3412
- managed encryption key used to protect the model. Has the
3382
+ display_name (str): Required. The user-defined name of the Endpoint. The
3383
+ name can be up to 128 characters long and can be consist of any UTF-8
3384
+ characters.
3385
+ project (str): Optional. Project to retrieve endpoint from. If not set,
3386
+ project set in aiplatform.init will be used.
3387
+ location (str): Optional. Location to retrieve endpoint from. If not
3388
+ set, location set in aiplatform.init will be used.
3389
+ network (str): Optional. The full name of the Compute Engine network to
3390
+ which this Endpoint will be peered. E.g.
3391
+ "projects/123456789123/global/networks/my_vpc". Private services
3392
+ access must already be configured for the network. If left
3393
+ unspecified, the network set with aiplatform.init will be used. Cannot
3394
+ be set together with private_service_connect_config.
3395
+ description (str): Optional. The description of the Endpoint.
3396
+ labels (Dict[str, str]): Optional. The labels with user-defined metadata
3397
+ to organize your Endpoints. Label keys and values can be no longer
3398
+ than 64 characters (Unicode codepoints), can only contain lowercase
3399
+ letters, numeric characters, underscores and dashes. International
3400
+ characters are allowed. See https://goo.gl/xmQnxf for more information
3401
+ and examples of labels.
3402
+ credentials (auth_credentials.Credentials): Optional. Custom credentials
3403
+ to use to upload this model. Overrides credentials set in
3404
+ aiplatform.init.
3405
+ encryption_spec_key_name (str): Optional. The Cloud KMS resource
3406
+ identifier of the customer managed encryption key used to protect the
3407
+ model. Has the
3413
3408
form:
3414
- ``projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key``.
3415
- The key needs to be in the same region as where the compute
3416
- resource is created.
3417
-
3418
- If set, this Model and all sub-resources of this Model will be secured by this key.
3419
-
3420
- Overrides encryption_spec_key_name set in aiplatform.init.
3421
- sync (bool):
3422
- Whether to execute this method synchronously. If False, this method
3423
- will be executed in concurrent Future and any downstream object will
3424
- be immediately returned and synced when the Future has completed.
3425
- private_service_connect_config (aiplatform.PrivateEndpoint.PrivateServiceConnectConfig):
3426
- [Private Service Connect](https://cloud.google.com/vpc/docs/private-service-connect) configuration for the endpoint.
3427
- Cannot be set when network is specified.
3428
- inference_timeout (int):
3429
- Optional. It defines the prediction timeout, in seconds, for online predictions using cloud-based endpoints. This applies to either PSC endpoints, when private_service_connect_config is set, or dedicated endpoints, when dedicated_endpoint_enabled is true.
3409
+ ``projects/my-project/locations/my-region/keyRings/my-kr/cryptoKeys/my-key``.
3410
+ The key needs to be in the same region as where the compute
3411
+ resource is created. If set, this Model and all sub-resources of
3412
+ this Model will be secured by this key. Overrides
3413
+ encryption_spec_key_name set in aiplatform.init.
3414
+ sync (bool): Whether to execute this method synchronously. If False,
3415
+ this method will be executed in concurrent Future and any downstream
3416
+ object will be immediately returned and synced when the Future has
3417
+ completed. private_service_connect_config
3418
+ (aiplatform.PrivateEndpoint.PrivateServiceConnectConfig): [Private
3419
+ Service
3420
+ Connect](https://cloud.google.com/vpc/docs/private-service-connect)
3421
+ configuration for the endpoint. Cannot be set when network is
3422
+ specified.
3423
+ enable_request_response_logging (bool): Optional. Whether to enable
3424
+ request & response logging for this endpoint.
3425
+ request_response_logging_sampling_rate (float): Optional. The request
3426
+ response logging sampling rate. If not set, default is 0.0.
3427
+ request_response_logging_bq_destination_table (str): Optional. The
3428
+ request response logging bigquery destination. If not set, will create
3429
+ a table with name:
3430
+ ``bq://{project_id}.logging_{endpoint_display_name}_{endpoint_id}.request_response_logging``.
3431
+ inference_timeout (int): Optional. It defines the prediction timeout, in
3432
+ seconds, for online predictions using cloud-based endpoints. This
3433
+ applies to either PSC endpoints, when private_service_connect_config
3434
+ is set, or dedicated endpoints, when dedicated_endpoint_enabled is
3435
+ true.
3430
3436
3431
3437
Returns:
3432
3438
endpoint (aiplatform.PrivateEndpoint):
3433
3439
Created endpoint.
3434
3440
3435
3441
Raises:
3436
- ValueError: A network must be instantiated when creating a PrivateEndpoint.
3442
+ ValueError: A network must be instantiated when creating a
3443
+ PrivateEndpoint.
3437
3444
"""
3438
3445
api_client = cls ._instantiate_client (location = location , credentials = credentials )
3439
3446
@@ -3463,6 +3470,18 @@ def create(
3463
3470
private_service_connect_config ._gapic_private_service_connect_config
3464
3471
)
3465
3472
3473
+ predict_request_response_logging_config = None
3474
+ if enable_request_response_logging :
3475
+ predict_request_response_logging_config = (
3476
+ gca_endpoint_compat .PredictRequestResponseLoggingConfig (
3477
+ enabled = True ,
3478
+ sampling_rate = request_response_logging_sampling_rate ,
3479
+ bigquery_destination = gca_io_compat .BigQueryDestination (
3480
+ output_uri = request_response_logging_bq_destination_table
3481
+ ),
3482
+ )
3483
+ )
3484
+
3466
3485
client_connection_config = None
3467
3486
if private_service_connect_config and inference_timeout :
3468
3487
client_connection_config = gca_endpoint_compat .ClientConnectionConfig (
@@ -3483,6 +3502,7 @@ def create(
3483
3502
network = network ,
3484
3503
sync = sync ,
3485
3504
private_service_connect_config = config ,
3505
+ predict_request_response_logging_config = predict_request_response_logging_config ,
3486
3506
client_connection_config = client_connection_config ,
3487
3507
)
3488
3508
0 commit comments