diff --git a/Chronicle/metadata/V1/DataTable.php b/Chronicle/metadata/V1/DataTable.php new file mode 100644 index 000000000000..101c9111f097 --- /dev/null +++ b/Chronicle/metadata/V1/DataTable.php @@ -0,0 +1,32 @@ +internalAddGeneratedFile( + "\x0A\xF3E\x0A*google/cloud/chronicle/v1/data_table.proto\x12\x19google.cloud.chronicle.v1\x1A\x17google/api/client.proto\x1A\x1Fgoogle/api/field_behavior.proto\x1A\x19google/api/resource.proto\x1A\x1Bgoogle/protobuf/empty.proto\x1A google/protobuf/field_mask.proto\x1A\x1Fgoogle/protobuf/timestamp.proto\x1A\x17google/rpc/status.proto\"\xAF\x01\x0A\x16CreateDataTableRequest\x12:\x0A\x06parent\x18\x01 \x01(\x09B*\xE0A\x02\xFAA\$\x12\"chronicle.googleapis.com/DataTable\x12=\x0A\x0Adata_table\x18\x02 \x01(\x0B2\$.google.cloud.chronicle.v1.DataTableB\x03\xE0A\x02\x12\x1A\x0A\x0Ddata_table_id\x18\x03 \x01(\x09B\x03\xE0A\x02\"O\x0A\x13GetDataTableRequest\x128\x0A\x04name\x18\x01 \x01(\x09B*\xE0A\x02\xFAA\$\x0A\"chronicle.googleapis.com/DataTable\"\x8D\x01\x0A\x16UpdateDataTableRequest\x12=\x0A\x0Adata_table\x18\x01 \x01(\x0B2\$.google.cloud.chronicle.v1.DataTableB\x03\xE0A\x02\x124\x0A\x0Bupdate_mask\x18\x02 \x01(\x0B2\x1A.google.protobuf.FieldMaskB\x03\xE0A\x01\"\x9B\x01\x0A\x15ListDataTablesRequest\x12:\x0A\x06parent\x18\x01 \x01(\x09B*\xE0A\x02\xFAA\$\x12\"chronicle.googleapis.com/DataTable\x12\x16\x0A\x09page_size\x18\x02 \x01(\x05B\x03\xE0A\x01\x12\x17\x0A\x0Apage_token\x18\x03 \x01(\x09B\x03\xE0A\x01\x12\x15\x0A\x08order_by\x18\x04 \x01(\x09B\x03\xE0A\x01\"f\x0A\x16DeleteDataTableRequest\x128\x0A\x04name\x18\x01 \x01(\x09B*\xE0A\x02\xFAA\$\x0A\"chronicle.googleapis.com/DataTable\x12\x12\x0A\x05force\x18\x02 \x01(\x08B\x03\xE0A\x01\"l\x0A\x16ListDataTablesResponse\x129\x0A\x0Bdata_tables\x18\x01 \x03(\x0B2\$.google.cloud.chronicle.v1.DataTable\x12\x17\x0A\x0Fnext_page_token\x18\x02 \x01(\x09\"\xA0\x01\x0A\x19CreateDataTableRowRequest\x12=\x0A\x06parent\x18\x01 \x01(\x09B-\xE0A\x02\xFAA'\x12%chronicle.googleapis.com/DataTableRow\x12D\x0A\x0Edata_table_row\x18\x02 \x01(\x0B2'.google.cloud.chronicle.v1.DataTableRowB\x03\xE0A\x02\"\x97\x01\x0A\x19UpdateDataTableRowRequest\x12D\x0A\x0Edata_table_row\x18\x01 \x01(\x0B2'.google.cloud.chronicle.v1.DataTableRowB\x03\xE0A\x02\x124\x0A\x0Bupdate_mask\x18\x02 \x01(\x0B2\x1A.google.protobuf.FieldMaskB\x03\xE0A\x01\"\xB6\x01\x0A\x18ListDataTableRowsRequest\x12=\x0A\x06parent\x18\x01 \x01(\x09B-\xE0A\x02\xFAA'\x12%chronicle.googleapis.com/DataTableRow\x12\x16\x0A\x09page_size\x18\x02 \x01(\x05B\x03\xE0A\x01\x12\x17\x0A\x0Apage_token\x18\x03 \x01(\x09B\x03\xE0A\x01\x12\x15\x0A\x08order_by\x18\x04 \x01(\x09B\x03\xE0A\x01\x12\x13\x0A\x06filter\x18\x05 \x01(\x09B\x03\xE0A\x01\"{\x0A\x19ListDataTableRowsResponse\x12@\x0A\x0Fdata_table_rows\x18\x01 \x03(\x0B2'.google.cloud.chronicle.v1.DataTableRow\x12\x1C\x0A\x0Fnext_page_token\x18\x02 \x01(\x09B\x03\xE0A\x01\"U\x0A\x16GetDataTableRowRequest\x12;\x0A\x04name\x18\x01 \x01(\x09B-\xE0A\x02\xFAA'\x0A%chronicle.googleapis.com/DataTableRow\"X\x0A\x19DeleteDataTableRowRequest\x12;\x0A\x04name\x18\x01 \x01(\x09B-\xE0A\x02\xFAA'\x0A%chronicle.googleapis.com/DataTableRow\"\xAC\x01\x0A\x1EBulkCreateDataTableRowsRequest\x12=\x0A\x06parent\x18\x01 \x01(\x09B-\xE0A\x02\xFAA'\x12%chronicle.googleapis.com/DataTableRow\x12K\x0A\x08requests\x18\x02 \x03(\x0B24.google.cloud.chronicle.v1.CreateDataTableRowRequestB\x03\xE0A\x02\"c\x0A\x1FBulkCreateDataTableRowsResponse\x12@\x0A\x0Fdata_table_rows\x18\x01 \x03(\x0B2'.google.cloud.chronicle.v1.DataTableRow\"\xA6\x01\x0A\x1BBulkGetDataTableRowsRequest\x12=\x0A\x06parent\x18\x01 \x01(\x09B-\xE0A\x02\xFAA'\x12%chronicle.googleapis.com/DataTableRow\x12H\x0A\x08requests\x18\x02 \x03(\x0B21.google.cloud.chronicle.v1.GetDataTableRowRequestB\x03\xE0A\x02\"`\x0A\x1CBulkGetDataTableRowsResponse\x12@\x0A\x0Fdata_table_rows\x18\x01 \x03(\x0B2'.google.cloud.chronicle.v1.DataTableRow\"\xAD\x01\x0A\x1FBulkReplaceDataTableRowsRequest\x12=\x0A\x06parent\x18\x01 \x01(\x09B-\xE0A\x02\xFAA'\x12%chronicle.googleapis.com/DataTableRow\x12K\x0A\x08requests\x18\x02 \x03(\x0B24.google.cloud.chronicle.v1.CreateDataTableRowRequestB\x03\xE0A\x02\"d\x0A BulkReplaceDataTableRowsResponse\x12@\x0A\x0Fdata_table_rows\x18\x01 \x03(\x0B2'.google.cloud.chronicle.v1.DataTableRow\"\xAC\x01\x0A\x1EBulkUpdateDataTableRowsRequest\x12=\x0A\x06parent\x18\x01 \x01(\x09B-\xE0A\x02\xFAA'\x12%chronicle.googleapis.com/DataTableRow\x12K\x0A\x08requests\x18\x02 \x03(\x0B24.google.cloud.chronicle.v1.UpdateDataTableRowRequestB\x03\xE0A\x02\"c\x0A\x1FBulkUpdateDataTableRowsResponse\x12@\x0A\x0Fdata_table_rows\x18\x01 \x03(\x0B2'.google.cloud.chronicle.v1.DataTableRow\"b\x0A\x12DataTableScopeInfo\x12L\x0A\x12data_access_scopes\x18\x01 \x03(\x09B0\xE0A\x02\xFAA*\x0A(chronicle.googleapis.com/DataAccessScope\"\x99\x06\x0A\x09DataTable\x12\x11\x0A\x04name\x18\x01 \x01(\x09B\x03\xE0A\x08\x12\x19\x0A\x0Cdisplay_name\x18\x02 \x01(\x09B\x03\xE0A\x03\x12\x18\x0A\x0Bdescription\x18\x03 \x01(\x09B\x03\xE0A\x02\x124\x0A\x0Bcreate_time\x18\x04 \x01(\x0B2\x1A.google.protobuf.TimestampB\x03\xE0A\x03\x124\x0A\x0Bupdate_time\x18\x05 \x01(\x0B2\x1A.google.protobuf.TimestampB\x03\xE0A\x03\x12H\x0A\x0Bcolumn_info\x18\x06 \x03(\x0B2..google.cloud.chronicle.v1.DataTableColumnInfoB\x03\xE0A\x05\x12\x1C\x0A\x0Fdata_table_uuid\x18\x07 \x01(\x09B\x03\xE0A\x03\x12\x12\x0A\x05rules\x18\x08 \x03(\x09B\x03\xE0A\x03\x12\$\x0A\x17rule_associations_count\x18\x09 \x01(\x05B\x03\xE0A\x03\x12\x1D\x0A\x10row_time_to_live\x18\x0A \x01(\x09B\x03\xE0A\x01\x12\"\x0A\x15approximate_row_count\x18\x0B \x01(\x03B\x03\xE0A\x03\x12F\x0A\x0Ascope_info\x18\x0C \x01(\x0B2-.google.cloud.chronicle.v1.DataTableScopeInfoB\x03\xE0A\x01\x12L\x0A\x0Dupdate_source\x18\x0D \x01(\x0E20.google.cloud.chronicle.v1.DataTableUpdateSourceB\x03\xE0A\x03\x12E\x0A\x1Crow_time_to_live_update_time\x18\x0E \x01(\x0B2\x1A.google.protobuf.TimestampB\x03\xE0A\x03:\x95\x01\xEAA\x91\x01\x0A\"chronicle.googleapis.com/DataTable\x12Tprojects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}*\x0AdataTables2\x09dataTable\"\x81\x03\x0A\x0CDataTableRow\x12\x11\x0A\x04name\x18\x01 \x01(\x09B\x03\xE0A\x08\x12\x13\x0A\x06values\x18\x02 \x03(\x09B\x03\xE0A\x02\x124\x0A\x0Bcreate_time\x18\x03 \x01(\x0B2\x1A.google.protobuf.TimestampB\x03\xE0A\x03\x124\x0A\x0Bupdate_time\x18\x04 \x01(\x0B2\x1A.google.protobuf.TimestampB\x03\xE0A\x03\x12\x1D\x0A\x10row_time_to_live\x18\x05 \x01(\x09B\x03\xE0A\x01:\xBD\x01\xEAA\xB9\x01\x0A%chronicle.googleapis.com/DataTableRow\x12sprojects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row}*\x0DdataTableRows2\x0CdataTableRow\"\xFA\x02\x0A\x13DataTableColumnInfo\x12\x1C\x0A\x12mapped_column_path\x18\x03 \x01(\x09H\x00\x12Y\x0A\x0Bcolumn_type\x18\x04 \x01(\x0E2B.google.cloud.chronicle.v1.DataTableColumnInfo.DataTableColumnTypeH\x00\x12\x19\x0A\x0Ccolumn_index\x18\x01 \x01(\x05B\x03\xE0A\x02\x12\x1C\x0A\x0Foriginal_column\x18\x02 \x01(\x09B\x03\xE0A\x02\x12\x17\x0A\x0Akey_column\x18\x05 \x01(\x08B\x03\xE0A\x01\x12\x1C\x0A\x0Frepeated_values\x18\x06 \x01(\x08B\x03\xE0A\x01\"j\x0A\x13DataTableColumnType\x12&\x0A\"DATA_TABLE_COLUMN_TYPE_UNSPECIFIED\x10\x00\x12\x0A\x0A\x06STRING\x10\x01\x12\x09\x0A\x05REGEX\x10\x02\x12\x08\x0A\x04CIDR\x10\x03\x12\x0A\x0A\x06NUMBER\x10\x04B\x0E\x0A\x0Cpath_or_type\"m\x0A\"GetDataTableOperationErrorsRequest\x12G\x0A\x04name\x18\x01 \x01(\x09B9\xE0A\x02\xFAA3\x0A1chronicle.googleapis.com/DataTableOperationErrors\"\xB8\x02\x0A\x18DataTableOperationErrors\x12\x11\x0A\x04name\x18\x01 \x01(\x09B\x03\xE0A\x08\x12&\x0A\x0Arpc_errors\x18\x03 \x03(\x0B2\x12.google.rpc.Status:\xE0\x01\xEAA\xDC\x01\x0A1chronicle.googleapis.com/DataTableOperationErrors\x12sprojects/{project}/locations/{location}/instances/{instance}/dataTableOperationErrors/{data_table_operation_errors}*\x18dataTableOperationErrors2\x18dataTableOperationErrors*a\x0A\x15DataTableUpdateSource\x12(\x0A\$DATA_TABLE_UPDATE_SOURCE_UNSPECIFIED\x10\x00\x12\x08\x0A\x04USER\x10\x01\x12\x08\x0A\x04RULE\x10\x02\x12\x0A\x0A\x06SEARCH\x10\x032\x89\x1C\x0A\x10DataTableService\x12\xDC\x01\x0A\x0FCreateDataTable\x121.google.cloud.chronicle.v1.CreateDataTableRequest\x1A\$.google.cloud.chronicle.v1.DataTable\"p\xDAA\x1Fparent,data_table,data_table_id\x82\xD3\xE4\x93\x02H\":/v1/{parent=projects/*/locations/*/instances/*}/dataTables:\x0Adata_table\x12\xC2\x01\x0A\x0EListDataTables\x120.google.cloud.chronicle.v1.ListDataTablesRequest\x1A1.google.cloud.chronicle.v1.ListDataTablesResponse\"K\xDAA\x06parent\x82\xD3\xE4\x93\x02<\x12:/v1/{parent=projects/*/locations/*/instances/*}/dataTables\x12\xAF\x01\x0A\x0CGetDataTable\x12..google.cloud.chronicle.v1.GetDataTableRequest\x1A\$.google.cloud.chronicle.v1.DataTable\"I\xDAA\x04name\x82\xD3\xE4\x93\x02<\x12:/v1/{name=projects/*/locations/*/instances/*/dataTables/*}\x12\xDE\x01\x0A\x0FUpdateDataTable\x121.google.cloud.chronicle.v1.UpdateDataTableRequest\x1A\$.google.cloud.chronicle.v1.DataTable\"r\xDAA\x16data_table,update_mask\x82\xD3\xE4\x93\x02S2E/v1/{data_table.name=projects/*/locations/*/instances/*/dataTables/*}:\x0Adata_table\x12\xAD\x01\x0A\x0FDeleteDataTable\x121.google.cloud.chronicle.v1.DeleteDataTableRequest\x1A\x16.google.protobuf.Empty\"O\xDAA\x0Aname,force\x82\xD3\xE4\x93\x02<*:/v1/{name=projects/*/locations/*/instances/*/dataTables/*}\x12\xEF\x01\x0A\x12CreateDataTableRow\x124.google.cloud.chronicle.v1.CreateDataTableRowRequest\x1A'.google.cloud.chronicle.v1.DataTableRow\"z\xDAA\x15parent,data_table_row\x82\xD3\xE4\x93\x02\\\"J/v1/{parent=projects/*/locations/*/instances/*/dataTables/*}/dataTableRows:\x0Edata_table_row\x12\x84\x02\x0A\x12UpdateDataTableRow\x124.google.cloud.chronicle.v1.UpdateDataTableRowRequest\x1A'.google.cloud.chronicle.v1.DataTableRow\"\x8E\x01\xDAA\x1Adata_table_row,update_mask\x82\xD3\xE4\x93\x02k2Y/v1/{data_table_row.name=projects/*/locations/*/instances/*/dataTables/*/dataTableRows/*}:\x0Edata_table_row\x12\xDB\x01\x0A\x11ListDataTableRows\x123.google.cloud.chronicle.v1.ListDataTableRowsRequest\x1A4.google.cloud.chronicle.v1.ListDataTableRowsResponse\"[\xDAA\x06parent\x82\xD3\xE4\x93\x02L\x12J/v1/{parent=projects/*/locations/*/instances/*/dataTables/*}/dataTableRows\x12\xC8\x01\x0A\x0FGetDataTableRow\x121.google.cloud.chronicle.v1.GetDataTableRowRequest\x1A'.google.cloud.chronicle.v1.DataTableRow\"Y\xDAA\x04name\x82\xD3\xE4\x93\x02L\x12J/v1/{name=projects/*/locations/*/instances/*/dataTables/*/dataTableRows/*}\x12\xBD\x01\x0A\x12DeleteDataTableRow\x124.google.cloud.chronicle.v1.DeleteDataTableRowRequest\x1A\x16.google.protobuf.Empty\"Y\xDAA\x04name\x82\xD3\xE4\x93\x02L*J/v1/{name=projects/*/locations/*/instances/*/dataTables/*/dataTableRows/*}\x12\x84\x02\x0A\x17BulkCreateDataTableRows\x129.google.cloud.chronicle.v1.BulkCreateDataTableRowsRequest\x1A:.google.cloud.chronicle.v1.BulkCreateDataTableRowsResponse\"r\xDAA\x0Fparent,requests\x82\xD3\xE4\x93\x02Z\"U/v1/{parent=projects/*/locations/*/instances/*/dataTables/*}/dataTableRows:bulkCreate:\x01*\x12\xF8\x01\x0A\x14BulkGetDataTableRows\x126.google.cloud.chronicle.v1.BulkGetDataTableRowsRequest\x1A7.google.cloud.chronicle.v1.BulkGetDataTableRowsResponse\"o\xDAA\x0Fparent,requests\x82\xD3\xE4\x93\x02W\"R/v1/{parent=projects/*/locations/*/instances/*/dataTables/*}/dataTableRows:bulkGet:\x01*\x12\x88\x02\x0A\x18BulkReplaceDataTableRows\x12:.google.cloud.chronicle.v1.BulkReplaceDataTableRowsRequest\x1A;.google.cloud.chronicle.v1.BulkReplaceDataTableRowsResponse\"s\xDAA\x0Fparent,requests\x82\xD3\xE4\x93\x02[\"V/v1/{parent=projects/*/locations/*/instances/*/dataTables/*}/dataTableRows:bulkReplace:\x01*\x12\x84\x02\x0A\x17BulkUpdateDataTableRows\x129.google.cloud.chronicle.v1.BulkUpdateDataTableRowsRequest\x1A:.google.cloud.chronicle.v1.BulkUpdateDataTableRowsResponse\"r\xDAA\x0Fparent,requests\x82\xD3\xE4\x93\x02Z\"U/v1/{parent=projects/*/locations/*/instances/*/dataTables/*}/dataTableRows:bulkUpdate:\x01*\x12\xEA\x01\x0A\x1BGetDataTableOperationErrors\x12=.google.cloud.chronicle.v1.GetDataTableOperationErrorsRequest\x1A3.google.cloud.chronicle.v1.DataTableOperationErrors\"W\xDAA\x04name\x82\xD3\xE4\x93\x02J\x12H/v1/{name=projects/*/locations/*/instances/*/dataTableOperationErrors/*}\x1A\xAA\x01\xCAA\x18chronicle.googleapis.com\xD2A\x8B\x01https://www.googleapis.com/auth/chronicle,https://www.googleapis.com/auth/chronicle.readonly,https://www.googleapis.com/auth/cloud-platformB\xC5\x01\x0A\x1Dcom.google.cloud.chronicle.v1B\x0EDataTableProtoP\x01Z;cloud.google.com/go/chronicle/apiv1/chroniclepb;chroniclepb\xAA\x02\x19Google.Cloud.Chronicle.V1\xCA\x02\x19Google\\Cloud\\Chronicle\\V1\xEA\x02\x1CGoogle::Cloud::Chronicle::V1b\x06proto3" + , true); + + static::$is_initialized = true; + } +} + diff --git a/Chronicle/samples/V1/DataTableServiceClient/bulk_create_data_table_rows.php b/Chronicle/samples/V1/DataTableServiceClient/bulk_create_data_table_rows.php new file mode 100644 index 000000000000..1f64d05306a3 --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/bulk_create_data_table_rows.php @@ -0,0 +1,108 @@ +setValues($requestsDataTableRowValues); + $createDataTableRowRequest = (new CreateDataTableRowRequest()) + ->setParent($formattedRequestsParent) + ->setDataTableRow($requestsDataTableRow); + $requests = [$createDataTableRowRequest,]; + $request = (new BulkCreateDataTableRowsRequest()) + ->setParent($formattedParent) + ->setRequests($requests); + + // Call the API and handle any network failures. + try { + /** @var BulkCreateDataTableRowsResponse $response */ + $response = $dataTableServiceClient->bulkCreateDataTableRows($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DataTableServiceClient::dataTableName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]' + ); + $formattedRequestsParent = DataTableServiceClient::dataTableName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]' + ); + $requestsDataTableRowValuesElement = '[VALUES]'; + + bulk_create_data_table_rows_sample( + $formattedParent, + $formattedRequestsParent, + $requestsDataTableRowValuesElement + ); +} +// [END chronicle_v1_generated_DataTableService_BulkCreateDataTableRows_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/bulk_get_data_table_rows.php b/Chronicle/samples/V1/DataTableServiceClient/bulk_get_data_table_rows.php new file mode 100644 index 000000000000..5dff1680a8d2 --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/bulk_get_data_table_rows.php @@ -0,0 +1,96 @@ +setName($formattedRequestsName); + $requests = [$getDataTableRowRequest,]; + $request = (new BulkGetDataTableRowsRequest()) + ->setParent($formattedParent) + ->setRequests($requests); + + // Call the API and handle any network failures. + try { + /** @var BulkGetDataTableRowsResponse $response */ + $response = $dataTableServiceClient->bulkGetDataTableRows($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DataTableServiceClient::dataTableName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]' + ); + $formattedRequestsName = DataTableServiceClient::dataTableRowName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]', + '[DATA_TABLE_ROW]' + ); + + bulk_get_data_table_rows_sample($formattedParent, $formattedRequestsName); +} +// [END chronicle_v1_generated_DataTableService_BulkGetDataTableRows_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/bulk_replace_data_table_rows.php b/Chronicle/samples/V1/DataTableServiceClient/bulk_replace_data_table_rows.php new file mode 100644 index 000000000000..719f12db7676 --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/bulk_replace_data_table_rows.php @@ -0,0 +1,108 @@ +setValues($requestsDataTableRowValues); + $createDataTableRowRequest = (new CreateDataTableRowRequest()) + ->setParent($formattedRequestsParent) + ->setDataTableRow($requestsDataTableRow); + $requests = [$createDataTableRowRequest,]; + $request = (new BulkReplaceDataTableRowsRequest()) + ->setParent($formattedParent) + ->setRequests($requests); + + // Call the API and handle any network failures. + try { + /** @var BulkReplaceDataTableRowsResponse $response */ + $response = $dataTableServiceClient->bulkReplaceDataTableRows($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DataTableServiceClient::dataTableName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]' + ); + $formattedRequestsParent = DataTableServiceClient::dataTableName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]' + ); + $requestsDataTableRowValuesElement = '[VALUES]'; + + bulk_replace_data_table_rows_sample( + $formattedParent, + $formattedRequestsParent, + $requestsDataTableRowValuesElement + ); +} +// [END chronicle_v1_generated_DataTableService_BulkReplaceDataTableRows_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/bulk_update_data_table_rows.php b/Chronicle/samples/V1/DataTableServiceClient/bulk_update_data_table_rows.php new file mode 100644 index 000000000000..c5b35718149f --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/bulk_update_data_table_rows.php @@ -0,0 +1,92 @@ +setValues($requestsDataTableRowValues); + $updateDataTableRowRequest = (new UpdateDataTableRowRequest()) + ->setDataTableRow($requestsDataTableRow); + $requests = [$updateDataTableRowRequest,]; + $request = (new BulkUpdateDataTableRowsRequest()) + ->setParent($formattedParent) + ->setRequests($requests); + + // Call the API and handle any network failures. + try { + /** @var BulkUpdateDataTableRowsResponse $response */ + $response = $dataTableServiceClient->bulkUpdateDataTableRows($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DataTableServiceClient::dataTableName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]' + ); + $requestsDataTableRowValuesElement = '[VALUES]'; + + bulk_update_data_table_rows_sample($formattedParent, $requestsDataTableRowValuesElement); +} +// [END chronicle_v1_generated_DataTableService_BulkUpdateDataTableRows_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/create_data_table.php b/Chronicle/samples/V1/DataTableServiceClient/create_data_table.php new file mode 100644 index 000000000000..bca1084349da --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/create_data_table.php @@ -0,0 +1,87 @@ +setDescription($dataTableDescription); + $request = (new CreateDataTableRequest()) + ->setParent($formattedParent) + ->setDataTable($dataTable) + ->setDataTableId($dataTableId); + + // Call the API and handle any network failures. + try { + /** @var DataTable $response */ + $response = $dataTableServiceClient->createDataTable($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DataTableServiceClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]'); + $dataTableDescription = '[DESCRIPTION]'; + $dataTableId = '[DATA_TABLE_ID]'; + + create_data_table_sample($formattedParent, $dataTableDescription, $dataTableId); +} +// [END chronicle_v1_generated_DataTableService_CreateDataTable_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/create_data_table_row.php b/Chronicle/samples/V1/DataTableServiceClient/create_data_table_row.php new file mode 100644 index 000000000000..4c2f774cc155 --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/create_data_table_row.php @@ -0,0 +1,87 @@ +setValues($dataTableRowValues); + $request = (new CreateDataTableRowRequest()) + ->setParent($formattedParent) + ->setDataTableRow($dataTableRow); + + // Call the API and handle any network failures. + try { + /** @var DataTableRow $response */ + $response = $dataTableServiceClient->createDataTableRow($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DataTableServiceClient::dataTableName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]' + ); + $dataTableRowValuesElement = '[VALUES]'; + + create_data_table_row_sample($formattedParent, $dataTableRowValuesElement); +} +// [END chronicle_v1_generated_DataTableService_CreateDataTableRow_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/delete_data_table.php b/Chronicle/samples/V1/DataTableServiceClient/delete_data_table.php new file mode 100644 index 000000000000..28c77cdb6435 --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/delete_data_table.php @@ -0,0 +1,76 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $dataTableServiceClient->deleteDataTable($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DataTableServiceClient::dataTableName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]' + ); + + delete_data_table_sample($formattedName); +} +// [END chronicle_v1_generated_DataTableService_DeleteDataTable_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/delete_data_table_row.php b/Chronicle/samples/V1/DataTableServiceClient/delete_data_table_row.php new file mode 100644 index 000000000000..82188421d34a --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/delete_data_table_row.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $dataTableServiceClient->deleteDataTableRow($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DataTableServiceClient::dataTableRowName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]', + '[DATA_TABLE_ROW]' + ); + + delete_data_table_row_sample($formattedName); +} +// [END chronicle_v1_generated_DataTableService_DeleteDataTableRow_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/get_data_table.php b/Chronicle/samples/V1/DataTableServiceClient/get_data_table.php new file mode 100644 index 000000000000..f8c92cf8d5be --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/get_data_table.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var DataTable $response */ + $response = $dataTableServiceClient->getDataTable($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DataTableServiceClient::dataTableName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]' + ); + + get_data_table_sample($formattedName); +} +// [END chronicle_v1_generated_DataTableService_GetDataTable_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/get_data_table_operation_errors.php b/Chronicle/samples/V1/DataTableServiceClient/get_data_table_operation_errors.php new file mode 100644 index 000000000000..354a4397517f --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/get_data_table_operation_errors.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var DataTableOperationErrors $response */ + $response = $dataTableServiceClient->getDataTableOperationErrors($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DataTableServiceClient::dataTableOperationErrorsName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE_OPERATION_ERRORS]' + ); + + get_data_table_operation_errors_sample($formattedName); +} +// [END chronicle_v1_generated_DataTableService_GetDataTableOperationErrors_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/get_data_table_row.php b/Chronicle/samples/V1/DataTableServiceClient/get_data_table_row.php new file mode 100644 index 000000000000..90790e1fd6b3 --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/get_data_table_row.php @@ -0,0 +1,79 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var DataTableRow $response */ + $response = $dataTableServiceClient->getDataTableRow($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DataTableServiceClient::dataTableRowName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]', + '[DATA_TABLE_ROW]' + ); + + get_data_table_row_sample($formattedName); +} +// [END chronicle_v1_generated_DataTableService_GetDataTableRow_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/list_data_table_rows.php b/Chronicle/samples/V1/DataTableServiceClient/list_data_table_rows.php new file mode 100644 index 000000000000..d38cc698f7fd --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/list_data_table_rows.php @@ -0,0 +1,83 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $dataTableServiceClient->listDataTableRows($request); + + /** @var DataTableRow $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DataTableServiceClient::dataTableName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]' + ); + + list_data_table_rows_sample($formattedParent); +} +// [END chronicle_v1_generated_DataTableService_ListDataTableRows_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/list_data_tables.php b/Chronicle/samples/V1/DataTableServiceClient/list_data_tables.php new file mode 100644 index 000000000000..87d6c459c2f2 --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/list_data_tables.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $dataTableServiceClient->listDataTables($request); + + /** @var DataTable $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DataTableServiceClient::instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]'); + + list_data_tables_sample($formattedParent); +} +// [END chronicle_v1_generated_DataTableService_ListDataTables_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/update_data_table.php b/Chronicle/samples/V1/DataTableServiceClient/update_data_table.php new file mode 100644 index 000000000000..56d2a5d3e41c --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/update_data_table.php @@ -0,0 +1,72 @@ +setDescription($dataTableDescription); + $request = (new UpdateDataTableRequest()) + ->setDataTable($dataTable); + + // Call the API and handle any network failures. + try { + /** @var DataTable $response */ + $response = $dataTableServiceClient->updateDataTable($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $dataTableDescription = '[DESCRIPTION]'; + + update_data_table_sample($dataTableDescription); +} +// [END chronicle_v1_generated_DataTableService_UpdateDataTable_sync] diff --git a/Chronicle/samples/V1/DataTableServiceClient/update_data_table_row.php b/Chronicle/samples/V1/DataTableServiceClient/update_data_table_row.php new file mode 100644 index 000000000000..a3b430d80898 --- /dev/null +++ b/Chronicle/samples/V1/DataTableServiceClient/update_data_table_row.php @@ -0,0 +1,74 @@ +setValues($dataTableRowValues); + $request = (new UpdateDataTableRowRequest()) + ->setDataTableRow($dataTableRow); + + // Call the API and handle any network failures. + try { + /** @var DataTableRow $response */ + $response = $dataTableServiceClient->updateDataTableRow($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $dataTableRowValuesElement = '[VALUES]'; + + update_data_table_row_sample($dataTableRowValuesElement); +} +// [END chronicle_v1_generated_DataTableService_UpdateDataTableRow_sync] diff --git a/Chronicle/src/V1/BulkCreateDataTableRowsRequest.php b/Chronicle/src/V1/BulkCreateDataTableRowsRequest.php new file mode 100644 index 000000000000..dac0cbb7ab42 --- /dev/null +++ b/Chronicle/src/V1/BulkCreateDataTableRowsRequest.php @@ -0,0 +1,137 @@ +google.cloud.chronicle.v1.BulkCreateDataTableRowsRequest + */ +class BulkCreateDataTableRowsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Data table rows to create. A maximum of 1000 rows (for sync + * requests) or 2000 rows (for async requests) can be created in a single + * request. Total size of the rows should be less than 4MB. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.CreateDataTableRowRequest requests = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $requests; + + /** + * @param string $parent Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * Please see {@see DataTableServiceClient::dataTableName()} for help formatting this field. + * @param \Google\Cloud\Chronicle\V1\CreateDataTableRowRequest[] $requests Required. Data table rows to create. A maximum of 1000 rows (for sync + * requests) or 2000 rows (for async requests) can be created in a single + * request. Total size of the rows should be less than 4MB. + * + * @return \Google\Cloud\Chronicle\V1\BulkCreateDataTableRowsRequest + * + * @experimental + */ + public static function build(string $parent, array $requests): self + { + return (new self()) + ->setParent($parent) + ->setRequests($requests); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * @type \Google\Cloud\Chronicle\V1\CreateDataTableRowRequest[] $requests + * Required. Data table rows to create. A maximum of 1000 rows (for sync + * requests) or 2000 rows (for async requests) can be created in a single + * request. Total size of the rows should be less than 4MB. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Data table rows to create. A maximum of 1000 rows (for sync + * requests) or 2000 rows (for async requests) can be created in a single + * request. Total size of the rows should be less than 4MB. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.CreateDataTableRowRequest requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return RepeatedField<\Google\Cloud\Chronicle\V1\CreateDataTableRowRequest> + */ + public function getRequests() + { + return $this->requests; + } + + /** + * Required. Data table rows to create. A maximum of 1000 rows (for sync + * requests) or 2000 rows (for async requests) can be created in a single + * request. Total size of the rows should be less than 4MB. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.CreateDataTableRowRequest requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Chronicle\V1\CreateDataTableRowRequest[] $var + * @return $this + */ + public function setRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Chronicle\V1\CreateDataTableRowRequest::class); + $this->requests = $arr; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/BulkCreateDataTableRowsResponse.php b/Chronicle/src/V1/BulkCreateDataTableRowsResponse.php new file mode 100644 index 000000000000..ec0e78d92832 --- /dev/null +++ b/Chronicle/src/V1/BulkCreateDataTableRowsResponse.php @@ -0,0 +1,67 @@ +google.cloud.chronicle.v1.BulkCreateDataTableRowsResponse + */ +class BulkCreateDataTableRowsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * DataTableRows created + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + */ + private $data_table_rows; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Chronicle\V1\DataTableRow[] $data_table_rows + * DataTableRows created + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * DataTableRows created + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + * @return RepeatedField<\Google\Cloud\Chronicle\V1\DataTableRow> + */ + public function getDataTableRows() + { + return $this->data_table_rows; + } + + /** + * DataTableRows created + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + * @param \Google\Cloud\Chronicle\V1\DataTableRow[] $var + * @return $this + */ + public function setDataTableRows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Chronicle\V1\DataTableRow::class); + $this->data_table_rows = $arr; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/BulkGetDataTableRowsRequest.php b/Chronicle/src/V1/BulkGetDataTableRowsRequest.php new file mode 100644 index 000000000000..6c824543b91b --- /dev/null +++ b/Chronicle/src/V1/BulkGetDataTableRowsRequest.php @@ -0,0 +1,132 @@ +google.cloud.chronicle.v1.BulkGetDataTableRowsRequest + */ +class BulkGetDataTableRowsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Data table rows to get. At max 1,000 rows can be there in a + * request. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.GetDataTableRowRequest requests = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $requests; + + /** + * @param string $parent Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * Please see {@see DataTableServiceClient::dataTableName()} for help formatting this field. + * @param \Google\Cloud\Chronicle\V1\GetDataTableRowRequest[] $requests Required. Data table rows to get. At max 1,000 rows can be there in a + * request. + * + * @return \Google\Cloud\Chronicle\V1\BulkGetDataTableRowsRequest + * + * @experimental + */ + public static function build(string $parent, array $requests): self + { + return (new self()) + ->setParent($parent) + ->setRequests($requests); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * @type \Google\Cloud\Chronicle\V1\GetDataTableRowRequest[] $requests + * Required. Data table rows to get. At max 1,000 rows can be there in a + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Data table rows to get. At max 1,000 rows can be there in a + * request. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.GetDataTableRowRequest requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return RepeatedField<\Google\Cloud\Chronicle\V1\GetDataTableRowRequest> + */ + public function getRequests() + { + return $this->requests; + } + + /** + * Required. Data table rows to get. At max 1,000 rows can be there in a + * request. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.GetDataTableRowRequest requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Chronicle\V1\GetDataTableRowRequest[] $var + * @return $this + */ + public function setRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Chronicle\V1\GetDataTableRowRequest::class); + $this->requests = $arr; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/BulkGetDataTableRowsResponse.php b/Chronicle/src/V1/BulkGetDataTableRowsResponse.php new file mode 100644 index 000000000000..b4bc937ab8bb --- /dev/null +++ b/Chronicle/src/V1/BulkGetDataTableRowsResponse.php @@ -0,0 +1,67 @@ +google.cloud.chronicle.v1.BulkGetDataTableRowsResponse + */ +class BulkGetDataTableRowsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The requested data table rows. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + */ + private $data_table_rows; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Chronicle\V1\DataTableRow[] $data_table_rows + * The requested data table rows. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * The requested data table rows. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + * @return RepeatedField<\Google\Cloud\Chronicle\V1\DataTableRow> + */ + public function getDataTableRows() + { + return $this->data_table_rows; + } + + /** + * The requested data table rows. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + * @param \Google\Cloud\Chronicle\V1\DataTableRow[] $var + * @return $this + */ + public function setDataTableRows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Chronicle\V1\DataTableRow::class); + $this->data_table_rows = $arr; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/BulkReplaceDataTableRowsRequest.php b/Chronicle/src/V1/BulkReplaceDataTableRowsRequest.php new file mode 100644 index 000000000000..8389b6eecd77 --- /dev/null +++ b/Chronicle/src/V1/BulkReplaceDataTableRowsRequest.php @@ -0,0 +1,142 @@ +google.cloud.chronicle.v1.BulkReplaceDataTableRowsRequest + */ +class BulkReplaceDataTableRowsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Data table rows to replace the existing data table rows. A + * maximum of 1000 rows (for sync requests) or 2000 rows (for async requests) + * can be replaced in a single request. Total size of the rows should be less + * than 4MB. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.CreateDataTableRowRequest requests = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $requests; + + /** + * @param string $parent Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * Please see {@see DataTableServiceClient::dataTableName()} for help formatting this field. + * @param \Google\Cloud\Chronicle\V1\CreateDataTableRowRequest[] $requests Required. Data table rows to replace the existing data table rows. A + * maximum of 1000 rows (for sync requests) or 2000 rows (for async requests) + * can be replaced in a single request. Total size of the rows should be less + * than 4MB. + * + * @return \Google\Cloud\Chronicle\V1\BulkReplaceDataTableRowsRequest + * + * @experimental + */ + public static function build(string $parent, array $requests): self + { + return (new self()) + ->setParent($parent) + ->setRequests($requests); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * @type \Google\Cloud\Chronicle\V1\CreateDataTableRowRequest[] $requests + * Required. Data table rows to replace the existing data table rows. A + * maximum of 1000 rows (for sync requests) or 2000 rows (for async requests) + * can be replaced in a single request. Total size of the rows should be less + * than 4MB. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Data table rows to replace the existing data table rows. A + * maximum of 1000 rows (for sync requests) or 2000 rows (for async requests) + * can be replaced in a single request. Total size of the rows should be less + * than 4MB. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.CreateDataTableRowRequest requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return RepeatedField<\Google\Cloud\Chronicle\V1\CreateDataTableRowRequest> + */ + public function getRequests() + { + return $this->requests; + } + + /** + * Required. Data table rows to replace the existing data table rows. A + * maximum of 1000 rows (for sync requests) or 2000 rows (for async requests) + * can be replaced in a single request. Total size of the rows should be less + * than 4MB. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.CreateDataTableRowRequest requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Chronicle\V1\CreateDataTableRowRequest[] $var + * @return $this + */ + public function setRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Chronicle\V1\CreateDataTableRowRequest::class); + $this->requests = $arr; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/BulkReplaceDataTableRowsResponse.php b/Chronicle/src/V1/BulkReplaceDataTableRowsResponse.php new file mode 100644 index 000000000000..2dc0f909f77a --- /dev/null +++ b/Chronicle/src/V1/BulkReplaceDataTableRowsResponse.php @@ -0,0 +1,67 @@ +google.cloud.chronicle.v1.BulkReplaceDataTableRowsResponse + */ +class BulkReplaceDataTableRowsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * DataTableRows that replaced existing data table rows + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + */ + private $data_table_rows; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Chronicle\V1\DataTableRow[] $data_table_rows + * DataTableRows that replaced existing data table rows + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * DataTableRows that replaced existing data table rows + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + * @return RepeatedField<\Google\Cloud\Chronicle\V1\DataTableRow> + */ + public function getDataTableRows() + { + return $this->data_table_rows; + } + + /** + * DataTableRows that replaced existing data table rows + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + * @param \Google\Cloud\Chronicle\V1\DataTableRow[] $var + * @return $this + */ + public function setDataTableRows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Chronicle\V1\DataTableRow::class); + $this->data_table_rows = $arr; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/BulkUpdateDataTableRowsRequest.php b/Chronicle/src/V1/BulkUpdateDataTableRowsRequest.php new file mode 100644 index 000000000000..a635d9e33430 --- /dev/null +++ b/Chronicle/src/V1/BulkUpdateDataTableRowsRequest.php @@ -0,0 +1,132 @@ +google.cloud.chronicle.v1.BulkUpdateDataTableRowsRequest + */ +class BulkUpdateDataTableRowsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Data table rows to update. At max 1,000 rows (or rows with size + * less than 2MB) can be there in a request. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.UpdateDataTableRowRequest requests = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $requests; + + /** + * @param string $parent Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * Please see {@see DataTableServiceClient::dataTableName()} for help formatting this field. + * @param \Google\Cloud\Chronicle\V1\UpdateDataTableRowRequest[] $requests Required. Data table rows to update. At max 1,000 rows (or rows with size + * less than 2MB) can be there in a request. + * + * @return \Google\Cloud\Chronicle\V1\BulkUpdateDataTableRowsRequest + * + * @experimental + */ + public static function build(string $parent, array $requests): self + { + return (new self()) + ->setParent($parent) + ->setRequests($requests); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * @type \Google\Cloud\Chronicle\V1\UpdateDataTableRowRequest[] $requests + * Required. Data table rows to update. At max 1,000 rows (or rows with size + * less than 2MB) can be there in a request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Data table rows to update. At max 1,000 rows (or rows with size + * less than 2MB) can be there in a request. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.UpdateDataTableRowRequest requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return RepeatedField<\Google\Cloud\Chronicle\V1\UpdateDataTableRowRequest> + */ + public function getRequests() + { + return $this->requests; + } + + /** + * Required. Data table rows to update. At max 1,000 rows (or rows with size + * less than 2MB) can be there in a request. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.UpdateDataTableRowRequest requests = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Chronicle\V1\UpdateDataTableRowRequest[] $var + * @return $this + */ + public function setRequests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Chronicle\V1\UpdateDataTableRowRequest::class); + $this->requests = $arr; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/BulkUpdateDataTableRowsResponse.php b/Chronicle/src/V1/BulkUpdateDataTableRowsResponse.php new file mode 100644 index 000000000000..903503608d86 --- /dev/null +++ b/Chronicle/src/V1/BulkUpdateDataTableRowsResponse.php @@ -0,0 +1,67 @@ +google.cloud.chronicle.v1.BulkUpdateDataTableRowsResponse + */ +class BulkUpdateDataTableRowsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * DataTableRows updated + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + */ + private $data_table_rows; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Chronicle\V1\DataTableRow[] $data_table_rows + * DataTableRows updated + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * DataTableRows updated + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + * @return RepeatedField<\Google\Cloud\Chronicle\V1\DataTableRow> + */ + public function getDataTableRows() + { + return $this->data_table_rows; + } + + /** + * DataTableRows updated + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + * @param \Google\Cloud\Chronicle\V1\DataTableRow[] $var + * @return $this + */ + public function setDataTableRows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Chronicle\V1\DataTableRow::class); + $this->data_table_rows = $arr; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/Client/DataTableServiceClient.php b/Chronicle/src/V1/Client/DataTableServiceClient.php new file mode 100644 index 000000000000..908ee7eecb3d --- /dev/null +++ b/Chronicle/src/V1/Client/DataTableServiceClient.php @@ -0,0 +1,770 @@ + bulkCreateDataTableRowsAsync(BulkCreateDataTableRowsRequest $request, array $optionalArgs = []) + * @method PromiseInterface bulkGetDataTableRowsAsync(BulkGetDataTableRowsRequest $request, array $optionalArgs = []) + * @method PromiseInterface bulkReplaceDataTableRowsAsync(BulkReplaceDataTableRowsRequest $request, array $optionalArgs = []) + * @method PromiseInterface bulkUpdateDataTableRowsAsync(BulkUpdateDataTableRowsRequest $request, array $optionalArgs = []) + * @method PromiseInterface createDataTableAsync(CreateDataTableRequest $request, array $optionalArgs = []) + * @method PromiseInterface createDataTableRowAsync(CreateDataTableRowRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteDataTableAsync(DeleteDataTableRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteDataTableRowAsync(DeleteDataTableRowRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDataTableAsync(GetDataTableRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDataTableOperationErrorsAsync(GetDataTableOperationErrorsRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDataTableRowAsync(GetDataTableRowRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDataTableRowsAsync(ListDataTableRowsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDataTablesAsync(ListDataTablesRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateDataTableAsync(UpdateDataTableRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateDataTableRowAsync(UpdateDataTableRowRequest $request, array $optionalArgs = []) + */ +final class DataTableServiceClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.cloud.chronicle.v1.DataTableService'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'chronicle.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'chronicle.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/chronicle', + 'https://www.googleapis.com/auth/chronicle.readonly', + 'https://www.googleapis.com/auth/cloud-platform', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/data_table_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/data_table_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/data_table_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/data_table_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * data_access_scope resource. + * + * @param string $project + * @param string $location + * @param string $instance + * @param string $dataAccessScope + * + * @return string The formatted data_access_scope resource. + */ + public static function dataAccessScopeName( + string $project, + string $location, + string $instance, + string $dataAccessScope + ): string { + return self::getPathTemplate('dataAccessScope')->render([ + 'project' => $project, + 'location' => $location, + 'instance' => $instance, + 'data_access_scope' => $dataAccessScope, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a data_table + * resource. + * + * @param string $project + * @param string $location + * @param string $instance + * @param string $dataTable + * + * @return string The formatted data_table resource. + */ + public static function dataTableName(string $project, string $location, string $instance, string $dataTable): string + { + return self::getPathTemplate('dataTable')->render([ + 'project' => $project, + 'location' => $location, + 'instance' => $instance, + 'data_table' => $dataTable, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * data_table_operation_errors resource. + * + * @param string $project + * @param string $location + * @param string $instance + * @param string $dataTableOperationErrors + * + * @return string The formatted data_table_operation_errors resource. + */ + public static function dataTableOperationErrorsName( + string $project, + string $location, + string $instance, + string $dataTableOperationErrors + ): string { + return self::getPathTemplate('dataTableOperationErrors')->render([ + 'project' => $project, + 'location' => $location, + 'instance' => $instance, + 'data_table_operation_errors' => $dataTableOperationErrors, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * data_table_row resource. + * + * @param string $project + * @param string $location + * @param string $instance + * @param string $dataTable + * @param string $dataTableRow + * + * @return string The formatted data_table_row resource. + */ + public static function dataTableRowName( + string $project, + string $location, + string $instance, + string $dataTable, + string $dataTableRow + ): string { + return self::getPathTemplate('dataTableRow')->render([ + 'project' => $project, + 'location' => $location, + 'instance' => $instance, + 'data_table' => $dataTable, + 'data_table_row' => $dataTableRow, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a instance + * resource. + * + * @param string $project + * @param string $location + * @param string $instance + * + * @return string The formatted instance resource. + */ + public static function instanceName(string $project, string $location, string $instance): string + { + return self::getPathTemplate('instance')->render([ + 'project' => $project, + 'location' => $location, + 'instance' => $instance, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - dataAccessScope: projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{data_access_scope} + * - dataTable: projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * - dataTableOperationErrors: projects/{project}/locations/{location}/instances/{instance}/dataTableOperationErrors/{data_table_operation_errors} + * - dataTableRow: projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * - instance: projects/{project}/locations/{location}/instances/{instance} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array|ClientOptions $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'chronicle.googleapis.com:443'. + * @type FetchAuthTokenInterface|CredentialsWrapper $credentials + * This option should only be used with a pre-constructed + * {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that + * when one of these objects are provided, any settings in $credentialsConfig will + * be ignored. + * **Important**: If you are providing a path to a credentials file, or a decoded + * credentials file as a PHP array, this usage is now DEPRECATED. Providing an + * unvalidated credential configuration to Google APIs can compromise the security + * of your systems and data. It is recommended to create the credentials explicitly + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * use Google\Cloud\Chronicle\V1\DataTableServiceClient; + * $creds = new ServiceAccountCredentials($scopes, $json); + * $options = new DataTableServiceClient(['credentials' => $creds]); + * ``` + * {@see + * https://cloud.google.com/docs/authentication/external/externally-sourced-credentials} + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * @type string $universeDomain + * The service domain for the client. Defaults to 'googleapis.com'. + * } + * + * @throws ValidationException + */ + public function __construct(array|ClientOptions $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Create data table rows in bulk. + * + * The async variant is + * {@see DataTableServiceClient::bulkCreateDataTableRowsAsync()} . + * + * @example samples/V1/DataTableServiceClient/bulk_create_data_table_rows.php + * + * @param BulkCreateDataTableRowsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BulkCreateDataTableRowsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function bulkCreateDataTableRows( + BulkCreateDataTableRowsRequest $request, + array $callOptions = [] + ): BulkCreateDataTableRowsResponse { + return $this->startApiCall('BulkCreateDataTableRows', $request, $callOptions)->wait(); + } + + /** + * Get data table rows in bulk. + * + * The async variant is {@see DataTableServiceClient::bulkGetDataTableRowsAsync()} + * . + * + * @example samples/V1/DataTableServiceClient/bulk_get_data_table_rows.php + * + * @param BulkGetDataTableRowsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BulkGetDataTableRowsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function bulkGetDataTableRows( + BulkGetDataTableRowsRequest $request, + array $callOptions = [] + ): BulkGetDataTableRowsResponse { + return $this->startApiCall('BulkGetDataTableRows', $request, $callOptions)->wait(); + } + + /** + * Replace all existing data table rows with new data table rows. + * + * The async variant is + * {@see DataTableServiceClient::bulkReplaceDataTableRowsAsync()} . + * + * @example samples/V1/DataTableServiceClient/bulk_replace_data_table_rows.php + * + * @param BulkReplaceDataTableRowsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BulkReplaceDataTableRowsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function bulkReplaceDataTableRows( + BulkReplaceDataTableRowsRequest $request, + array $callOptions = [] + ): BulkReplaceDataTableRowsResponse { + return $this->startApiCall('BulkReplaceDataTableRows', $request, $callOptions)->wait(); + } + + /** + * Update data table rows in bulk. + * + * The async variant is + * {@see DataTableServiceClient::bulkUpdateDataTableRowsAsync()} . + * + * @example samples/V1/DataTableServiceClient/bulk_update_data_table_rows.php + * + * @param BulkUpdateDataTableRowsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return BulkUpdateDataTableRowsResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function bulkUpdateDataTableRows( + BulkUpdateDataTableRowsRequest $request, + array $callOptions = [] + ): BulkUpdateDataTableRowsResponse { + return $this->startApiCall('BulkUpdateDataTableRows', $request, $callOptions)->wait(); + } + + /** + * Create a new data table. + * + * The async variant is {@see DataTableServiceClient::createDataTableAsync()} . + * + * @example samples/V1/DataTableServiceClient/create_data_table.php + * + * @param CreateDataTableRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return DataTable + * + * @throws ApiException Thrown if the API call fails. + */ + public function createDataTable(CreateDataTableRequest $request, array $callOptions = []): DataTable + { + return $this->startApiCall('CreateDataTable', $request, $callOptions)->wait(); + } + + /** + * Create a new data table row. + * + * The async variant is {@see DataTableServiceClient::createDataTableRowAsync()} . + * + * @example samples/V1/DataTableServiceClient/create_data_table_row.php + * + * @param CreateDataTableRowRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return DataTableRow + * + * @throws ApiException Thrown if the API call fails. + */ + public function createDataTableRow(CreateDataTableRowRequest $request, array $callOptions = []): DataTableRow + { + return $this->startApiCall('CreateDataTableRow', $request, $callOptions)->wait(); + } + + /** + * Delete data table. + * + * The async variant is {@see DataTableServiceClient::deleteDataTableAsync()} . + * + * @example samples/V1/DataTableServiceClient/delete_data_table.php + * + * @param DeleteDataTableRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteDataTable(DeleteDataTableRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteDataTable', $request, $callOptions)->wait(); + } + + /** + * Delete data table row. + * + * The async variant is {@see DataTableServiceClient::deleteDataTableRowAsync()} . + * + * @example samples/V1/DataTableServiceClient/delete_data_table_row.php + * + * @param DeleteDataTableRowRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteDataTableRow(DeleteDataTableRowRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteDataTableRow', $request, $callOptions)->wait(); + } + + /** + * Get data table info. + * + * The async variant is {@see DataTableServiceClient::getDataTableAsync()} . + * + * @example samples/V1/DataTableServiceClient/get_data_table.php + * + * @param GetDataTableRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return DataTable + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDataTable(GetDataTableRequest $request, array $callOptions = []): DataTable + { + return $this->startApiCall('GetDataTable', $request, $callOptions)->wait(); + } + + /** + * Get the error for a data table operation. + * + * The async variant is + * {@see DataTableServiceClient::getDataTableOperationErrorsAsync()} . + * + * @example samples/V1/DataTableServiceClient/get_data_table_operation_errors.php + * + * @param GetDataTableOperationErrorsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return DataTableOperationErrors + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDataTableOperationErrors( + GetDataTableOperationErrorsRequest $request, + array $callOptions = [] + ): DataTableOperationErrors { + return $this->startApiCall('GetDataTableOperationErrors', $request, $callOptions)->wait(); + } + + /** + * Get data table row + * + * The async variant is {@see DataTableServiceClient::getDataTableRowAsync()} . + * + * @example samples/V1/DataTableServiceClient/get_data_table_row.php + * + * @param GetDataTableRowRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return DataTableRow + * + * @throws ApiException Thrown if the API call fails. + */ + public function getDataTableRow(GetDataTableRowRequest $request, array $callOptions = []): DataTableRow + { + return $this->startApiCall('GetDataTableRow', $request, $callOptions)->wait(); + } + + /** + * List data table rows. + * + * The async variant is {@see DataTableServiceClient::listDataTableRowsAsync()} . + * + * @example samples/V1/DataTableServiceClient/list_data_table_rows.php + * + * @param ListDataTableRowsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDataTableRows(ListDataTableRowsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListDataTableRows', $request, $callOptions); + } + + /** + * List data tables. + * + * The async variant is {@see DataTableServiceClient::listDataTablesAsync()} . + * + * @example samples/V1/DataTableServiceClient/list_data_tables.php + * + * @param ListDataTablesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listDataTables(ListDataTablesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListDataTables', $request, $callOptions); + } + + /** + * Update data table. + * + * The async variant is {@see DataTableServiceClient::updateDataTableAsync()} . + * + * @example samples/V1/DataTableServiceClient/update_data_table.php + * + * @param UpdateDataTableRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return DataTable + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateDataTable(UpdateDataTableRequest $request, array $callOptions = []): DataTable + { + return $this->startApiCall('UpdateDataTable', $request, $callOptions)->wait(); + } + + /** + * Update data table row + * + * The async variant is {@see DataTableServiceClient::updateDataTableRowAsync()} . + * + * @example samples/V1/DataTableServiceClient/update_data_table_row.php + * + * @param UpdateDataTableRowRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return DataTableRow + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateDataTableRow(UpdateDataTableRowRequest $request, array $callOptions = []): DataTableRow + { + return $this->startApiCall('UpdateDataTableRow', $request, $callOptions)->wait(); + } +} diff --git a/Chronicle/src/V1/CreateDataTableRequest.php b/Chronicle/src/V1/CreateDataTableRequest.php new file mode 100644 index 000000000000..01a4b78c238a --- /dev/null +++ b/Chronicle/src/V1/CreateDataTableRequest.php @@ -0,0 +1,188 @@ +google.cloud.chronicle.v1.CreateDataTableRequest + */ +class CreateDataTableRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource where this data table will be created. + * Format: projects/{project}/locations/{location}/instances/{instance} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The data table being created. + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTable data_table = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $data_table = null; + /** + * Required. The ID to use for the data table. This is also the display name + * for the data table. It must satisfy the following requirements: + * - Starts with letter. + * - Contains only letters, numbers and underscore. + * - Must be unique and has length < 256. + * + * Generated from protobuf field string data_table_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $data_table_id = ''; + + /** + * @param string $parent Required. The parent resource where this data table will be created. + * Format: projects/{project}/locations/{location}/instances/{instance} + * Please see {@see DataTableServiceClient::instanceName()} for help formatting this field. + * @param \Google\Cloud\Chronicle\V1\DataTable $dataTable Required. The data table being created. + * @param string $dataTableId Required. The ID to use for the data table. This is also the display name + * for the data table. It must satisfy the following requirements: + * - Starts with letter. + * - Contains only letters, numbers and underscore. + * - Must be unique and has length < 256. + * + * @return \Google\Cloud\Chronicle\V1\CreateDataTableRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Chronicle\V1\DataTable $dataTable, string $dataTableId): self + { + return (new self()) + ->setParent($parent) + ->setDataTable($dataTable) + ->setDataTableId($dataTableId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource where this data table will be created. + * Format: projects/{project}/locations/{location}/instances/{instance} + * @type \Google\Cloud\Chronicle\V1\DataTable $data_table + * Required. The data table being created. + * @type string $data_table_id + * Required. The ID to use for the data table. This is also the display name + * for the data table. It must satisfy the following requirements: + * - Starts with letter. + * - Contains only letters, numbers and underscore. + * - Must be unique and has length < 256. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource where this data table will be created. + * Format: projects/{project}/locations/{location}/instances/{instance} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource where this data table will be created. + * Format: projects/{project}/locations/{location}/instances/{instance} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The data table being created. + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTable data_table = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Chronicle\V1\DataTable|null + */ + public function getDataTable() + { + return $this->data_table; + } + + public function hasDataTable() + { + return isset($this->data_table); + } + + public function clearDataTable() + { + unset($this->data_table); + } + + /** + * Required. The data table being created. + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTable data_table = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Chronicle\V1\DataTable $var + * @return $this + */ + public function setDataTable($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Chronicle\V1\DataTable::class); + $this->data_table = $var; + + return $this; + } + + /** + * Required. The ID to use for the data table. This is also the display name + * for the data table. It must satisfy the following requirements: + * - Starts with letter. + * - Contains only letters, numbers and underscore. + * - Must be unique and has length < 256. + * + * Generated from protobuf field string data_table_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDataTableId() + { + return $this->data_table_id; + } + + /** + * Required. The ID to use for the data table. This is also the display name + * for the data table. It must satisfy the following requirements: + * - Starts with letter. + * - Contains only letters, numbers and underscore. + * - Must be unique and has length < 256. + * + * Generated from protobuf field string data_table_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDataTableId($var) + { + GPBUtil::checkString($var, True); + $this->data_table_id = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/CreateDataTableRowRequest.php b/Chronicle/src/V1/CreateDataTableRowRequest.php new file mode 100644 index 000000000000..61d1e625e79e --- /dev/null +++ b/Chronicle/src/V1/CreateDataTableRowRequest.php @@ -0,0 +1,137 @@ +google.cloud.chronicle.v1.CreateDataTableRowRequest + */ +class CreateDataTableRowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The data table row to create. + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableRow data_table_row = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $data_table_row = null; + + /** + * @param string $parent Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * Please see {@see DataTableServiceClient::dataTableName()} for help formatting this field. + * @param \Google\Cloud\Chronicle\V1\DataTableRow $dataTableRow Required. The data table row to create. + * + * @return \Google\Cloud\Chronicle\V1\CreateDataTableRowRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Chronicle\V1\DataTableRow $dataTableRow): self + { + return (new self()) + ->setParent($parent) + ->setDataTableRow($dataTableRow); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * @type \Google\Cloud\Chronicle\V1\DataTableRow $data_table_row + * Required. The data table row to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource id of the data table. + * Format: + * /projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The data table row to create. + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableRow data_table_row = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Chronicle\V1\DataTableRow|null + */ + public function getDataTableRow() + { + return $this->data_table_row; + } + + public function hasDataTableRow() + { + return isset($this->data_table_row); + } + + public function clearDataTableRow() + { + unset($this->data_table_row); + } + + /** + * Required. The data table row to create. + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableRow data_table_row = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Chronicle\V1\DataTableRow $var + * @return $this + */ + public function setDataTableRow($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Chronicle\V1\DataTableRow::class); + $this->data_table_row = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/DataTable.php b/Chronicle/src/V1/DataTable.php new file mode 100644 index 000000000000..f2024c29a822 --- /dev/null +++ b/Chronicle/src/V1/DataTable.php @@ -0,0 +1,585 @@ +google.cloud.chronicle.v1.DataTable + */ +class DataTable extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The resource name of the data table + * Format: + * "{project}/locations/{location}/instances/{instance}/dataTables/{data_table}" + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Output only. The unique display name of the data table. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $display_name = ''; + /** + * Required. A user-provided description of the data table. + * + * Generated from protobuf field string description = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $description = ''; + /** + * Output only. Table create time + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Table update time + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Immutable. Details of all the columns in the table + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableColumnInfo column_info = 6 [(.google.api.field_behavior) = IMMUTABLE]; + */ + private $column_info; + /** + * Output only. Data table unique id + * + * Generated from protobuf field string data_table_uuid = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $data_table_uuid = ''; + /** + * Output only. The resource names for the associated Rules that use this + * data table. Format: + * projects/{project}/locations/{location}/instances/{instance}/rules/{rule}. + * {rule} here refers to the rule id. + * + * Generated from protobuf field repeated string rules = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $rules; + /** + * Output only. The count of rules using the data table. + * + * Generated from protobuf field int32 rule_associations_count = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $rule_associations_count = 0; + /** + * Optional. User-provided TTL of the data table. + * + * Generated from protobuf field string row_time_to_live = 10 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $row_time_to_live = ''; + /** + * Output only. The count of rows in the data table. + * + * Generated from protobuf field int64 approximate_row_count = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $approximate_row_count = 0; + /** + * Optional. The scope info of the data table. + * During data table creation, if this field is not set, the data + * table without scopes (an unscoped table) will be created for a global + * user. For a scoped user, this field must be set. During data table + * update, if scope_info is requested to be updated, this field must be set. + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableScopeInfo scope_info = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $scope_info = null; + /** + * Output only. Source of the data table update. + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableUpdateSource update_source = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_source = 0; + /** + * Output only. Last update time of the TTL of the data table. + * + * Generated from protobuf field .google.protobuf.Timestamp row_time_to_live_update_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $row_time_to_live_update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The resource name of the data table + * Format: + * "{project}/locations/{location}/instances/{instance}/dataTables/{data_table}" + * @type string $display_name + * Output only. The unique display name of the data table. + * @type string $description + * Required. A user-provided description of the data table. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Table create time + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Table update time + * @type \Google\Cloud\Chronicle\V1\DataTableColumnInfo[] $column_info + * Immutable. Details of all the columns in the table + * @type string $data_table_uuid + * Output only. Data table unique id + * @type string[] $rules + * Output only. The resource names for the associated Rules that use this + * data table. Format: + * projects/{project}/locations/{location}/instances/{instance}/rules/{rule}. + * {rule} here refers to the rule id. + * @type int $rule_associations_count + * Output only. The count of rules using the data table. + * @type string $row_time_to_live + * Optional. User-provided TTL of the data table. + * @type int|string $approximate_row_count + * Output only. The count of rows in the data table. + * @type \Google\Cloud\Chronicle\V1\DataTableScopeInfo $scope_info + * Optional. The scope info of the data table. + * During data table creation, if this field is not set, the data + * table without scopes (an unscoped table) will be created for a global + * user. For a scoped user, this field must be set. During data table + * update, if scope_info is requested to be updated, this field must be set. + * @type int $update_source + * Output only. Source of the data table update. + * @type \Google\Protobuf\Timestamp $row_time_to_live_update_time + * Output only. Last update time of the TTL of the data table. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The resource name of the data table + * Format: + * "{project}/locations/{location}/instances/{instance}/dataTables/{data_table}" + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The resource name of the data table + * Format: + * "{project}/locations/{location}/instances/{instance}/dataTables/{data_table}" + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The unique display name of the data table. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Output only. The unique display name of the data table. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Required. A user-provided description of the data table. + * + * Generated from protobuf field string description = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Required. A user-provided description of the data table. + * + * Generated from protobuf field string description = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. Table create time + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Table create time + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Table update time + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Table update time + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Immutable. Details of all the columns in the table + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableColumnInfo column_info = 6 [(.google.api.field_behavior) = IMMUTABLE]; + * @return RepeatedField<\Google\Cloud\Chronicle\V1\DataTableColumnInfo> + */ + public function getColumnInfo() + { + return $this->column_info; + } + + /** + * Immutable. Details of all the columns in the table + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableColumnInfo column_info = 6 [(.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Cloud\Chronicle\V1\DataTableColumnInfo[] $var + * @return $this + */ + public function setColumnInfo($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Chronicle\V1\DataTableColumnInfo::class); + $this->column_info = $arr; + + return $this; + } + + /** + * Output only. Data table unique id + * + * Generated from protobuf field string data_table_uuid = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDataTableUuid() + { + return $this->data_table_uuid; + } + + /** + * Output only. Data table unique id + * + * Generated from protobuf field string data_table_uuid = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDataTableUuid($var) + { + GPBUtil::checkString($var, True); + $this->data_table_uuid = $var; + + return $this; + } + + /** + * Output only. The resource names for the associated Rules that use this + * data table. Format: + * projects/{project}/locations/{location}/instances/{instance}/rules/{rule}. + * {rule} here refers to the rule id. + * + * Generated from protobuf field repeated string rules = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return RepeatedField + */ + public function getRules() + { + return $this->rules; + } + + /** + * Output only. The resource names for the associated Rules that use this + * data table. Format: + * projects/{project}/locations/{location}/instances/{instance}/rules/{rule}. + * {rule} here refers to the rule id. + * + * Generated from protobuf field repeated string rules = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string[] $var + * @return $this + */ + public function setRules($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->rules = $arr; + + return $this; + } + + /** + * Output only. The count of rules using the data table. + * + * Generated from protobuf field int32 rule_associations_count = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getRuleAssociationsCount() + { + return $this->rule_associations_count; + } + + /** + * Output only. The count of rules using the data table. + * + * Generated from protobuf field int32 rule_associations_count = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setRuleAssociationsCount($var) + { + GPBUtil::checkInt32($var); + $this->rule_associations_count = $var; + + return $this; + } + + /** + * Optional. User-provided TTL of the data table. + * + * Generated from protobuf field string row_time_to_live = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRowTimeToLive() + { + return $this->row_time_to_live; + } + + /** + * Optional. User-provided TTL of the data table. + * + * Generated from protobuf field string row_time_to_live = 10 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRowTimeToLive($var) + { + GPBUtil::checkString($var, True); + $this->row_time_to_live = $var; + + return $this; + } + + /** + * Output only. The count of rows in the data table. + * + * Generated from protobuf field int64 approximate_row_count = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getApproximateRowCount() + { + return $this->approximate_row_count; + } + + /** + * Output only. The count of rows in the data table. + * + * Generated from protobuf field int64 approximate_row_count = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setApproximateRowCount($var) + { + GPBUtil::checkInt64($var); + $this->approximate_row_count = $var; + + return $this; + } + + /** + * Optional. The scope info of the data table. + * During data table creation, if this field is not set, the data + * table without scopes (an unscoped table) will be created for a global + * user. For a scoped user, this field must be set. During data table + * update, if scope_info is requested to be updated, this field must be set. + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableScopeInfo scope_info = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Chronicle\V1\DataTableScopeInfo|null + */ + public function getScopeInfo() + { + return $this->scope_info; + } + + public function hasScopeInfo() + { + return isset($this->scope_info); + } + + public function clearScopeInfo() + { + unset($this->scope_info); + } + + /** + * Optional. The scope info of the data table. + * During data table creation, if this field is not set, the data + * table without scopes (an unscoped table) will be created for a global + * user. For a scoped user, this field must be set. During data table + * update, if scope_info is requested to be updated, this field must be set. + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableScopeInfo scope_info = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Chronicle\V1\DataTableScopeInfo $var + * @return $this + */ + public function setScopeInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Chronicle\V1\DataTableScopeInfo::class); + $this->scope_info = $var; + + return $this; + } + + /** + * Output only. Source of the data table update. + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableUpdateSource update_source = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getUpdateSource() + { + return $this->update_source; + } + + /** + * Output only. Source of the data table update. + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableUpdateSource update_source = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setUpdateSource($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Chronicle\V1\DataTableUpdateSource::class); + $this->update_source = $var; + + return $this; + } + + /** + * Output only. Last update time of the TTL of the data table. + * + * Generated from protobuf field .google.protobuf.Timestamp row_time_to_live_update_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getRowTimeToLiveUpdateTime() + { + return $this->row_time_to_live_update_time; + } + + public function hasRowTimeToLiveUpdateTime() + { + return isset($this->row_time_to_live_update_time); + } + + public function clearRowTimeToLiveUpdateTime() + { + unset($this->row_time_to_live_update_time); + } + + /** + * Output only. Last update time of the TTL of the data table. + * + * Generated from protobuf field .google.protobuf.Timestamp row_time_to_live_update_time = 14 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setRowTimeToLiveUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->row_time_to_live_update_time = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/DataTableColumnInfo.php b/Chronicle/src/V1/DataTableColumnInfo.php new file mode 100644 index 000000000000..e8d196b47d9e --- /dev/null +++ b/Chronicle/src/V1/DataTableColumnInfo.php @@ -0,0 +1,274 @@ +google.cloud.chronicle.v1.DataTableColumnInfo + */ +class DataTableColumnInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Column Index. 0,1,2... + * + * Generated from protobuf field int32 column_index = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $column_index = 0; + /** + * Required. Original column name of the Data Table (present in the CSV header + * in case of creation of data tables using file uploads). It must satisfy the + * following requirements: + * - Starts with letter. + * - Contains only letters, numbers and underscore. + * - Must be unique and has length < 256. + * + * Generated from protobuf field string original_column = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $original_column = ''; + /** + * Optional. Whether to include this column in the calculation of the row ID. + * If no columns have key_column = true, all columns will be included in the + * calculation of the row ID. + * + * Generated from protobuf field bool key_column = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $key_column = false; + /** + * Optional. Whether the column is a repeated values column. + * + * Generated from protobuf field bool repeated_values = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $repeated_values = false; + protected $path_or_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $mapped_column_path + * Entity proto field path that the column is mapped to + * @type int $column_type + * Column type can be STRING, CIDR (Ex- 10.1.1.0/24), REGEX + * @type int $column_index + * Required. Column Index. 0,1,2... + * @type string $original_column + * Required. Original column name of the Data Table (present in the CSV header + * in case of creation of data tables using file uploads). It must satisfy the + * following requirements: + * - Starts with letter. + * - Contains only letters, numbers and underscore. + * - Must be unique and has length < 256. + * @type bool $key_column + * Optional. Whether to include this column in the calculation of the row ID. + * If no columns have key_column = true, all columns will be included in the + * calculation of the row ID. + * @type bool $repeated_values + * Optional. Whether the column is a repeated values column. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Entity proto field path that the column is mapped to + * + * Generated from protobuf field string mapped_column_path = 3; + * @return string + */ + public function getMappedColumnPath() + { + return $this->readOneof(3); + } + + public function hasMappedColumnPath() + { + return $this->hasOneof(3); + } + + /** + * Entity proto field path that the column is mapped to + * + * Generated from protobuf field string mapped_column_path = 3; + * @param string $var + * @return $this + */ + public function setMappedColumnPath($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Column type can be STRING, CIDR (Ex- 10.1.1.0/24), REGEX + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableColumnInfo.DataTableColumnType column_type = 4; + * @return int + */ + public function getColumnType() + { + return $this->readOneof(4); + } + + public function hasColumnType() + { + return $this->hasOneof(4); + } + + /** + * Column type can be STRING, CIDR (Ex- 10.1.1.0/24), REGEX + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableColumnInfo.DataTableColumnType column_type = 4; + * @param int $var + * @return $this + */ + public function setColumnType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Chronicle\V1\DataTableColumnInfo\DataTableColumnType::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Required. Column Index. 0,1,2... + * + * Generated from protobuf field int32 column_index = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getColumnIndex() + { + return $this->column_index; + } + + /** + * Required. Column Index. 0,1,2... + * + * Generated from protobuf field int32 column_index = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setColumnIndex($var) + { + GPBUtil::checkInt32($var); + $this->column_index = $var; + + return $this; + } + + /** + * Required. Original column name of the Data Table (present in the CSV header + * in case of creation of data tables using file uploads). It must satisfy the + * following requirements: + * - Starts with letter. + * - Contains only letters, numbers and underscore. + * - Must be unique and has length < 256. + * + * Generated from protobuf field string original_column = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getOriginalColumn() + { + return $this->original_column; + } + + /** + * Required. Original column name of the Data Table (present in the CSV header + * in case of creation of data tables using file uploads). It must satisfy the + * following requirements: + * - Starts with letter. + * - Contains only letters, numbers and underscore. + * - Must be unique and has length < 256. + * + * Generated from protobuf field string original_column = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setOriginalColumn($var) + { + GPBUtil::checkString($var, True); + $this->original_column = $var; + + return $this; + } + + /** + * Optional. Whether to include this column in the calculation of the row ID. + * If no columns have key_column = true, all columns will be included in the + * calculation of the row ID. + * + * Generated from protobuf field bool key_column = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getKeyColumn() + { + return $this->key_column; + } + + /** + * Optional. Whether to include this column in the calculation of the row ID. + * If no columns have key_column = true, all columns will be included in the + * calculation of the row ID. + * + * Generated from protobuf field bool key_column = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setKeyColumn($var) + { + GPBUtil::checkBool($var); + $this->key_column = $var; + + return $this; + } + + /** + * Optional. Whether the column is a repeated values column. + * + * Generated from protobuf field bool repeated_values = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getRepeatedValues() + { + return $this->repeated_values; + } + + /** + * Optional. Whether the column is a repeated values column. + * + * Generated from protobuf field bool repeated_values = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setRepeatedValues($var) + { + GPBUtil::checkBool($var); + $this->repeated_values = $var; + + return $this; + } + + /** + * @return string + */ + public function getPathOrType() + { + return $this->whichOneof("path_or_type"); + } + +} + diff --git a/Chronicle/src/V1/DataTableColumnInfo/DataTableColumnType.php b/Chronicle/src/V1/DataTableColumnInfo/DataTableColumnType.php new file mode 100644 index 000000000000..66ce99ee22da --- /dev/null +++ b/Chronicle/src/V1/DataTableColumnInfo/DataTableColumnType.php @@ -0,0 +1,76 @@ +google.cloud.chronicle.v1.DataTableColumnInfo.DataTableColumnType + */ +class DataTableColumnType +{ + /** + * The default Data Table Column Type. + * + * Generated from protobuf enum DATA_TABLE_COLUMN_TYPE_UNSPECIFIED = 0; + */ + const DATA_TABLE_COLUMN_TYPE_UNSPECIFIED = 0; + /** + * Denotes the type of the column as STRING. + * + * Generated from protobuf enum STRING = 1; + */ + const STRING = 1; + /** + * Denotes the type of the column as REGEX. + * + * Generated from protobuf enum REGEX = 2; + */ + const REGEX = 2; + /** + * Denotes the type of the column as CIDR. + * + * Generated from protobuf enum CIDR = 3; + */ + const CIDR = 3; + /** + * Denotes the type of the column as NUMBER (includes int and float). + * + * Generated from protobuf enum NUMBER = 4; + */ + const NUMBER = 4; + + private static $valueToName = [ + self::DATA_TABLE_COLUMN_TYPE_UNSPECIFIED => 'DATA_TABLE_COLUMN_TYPE_UNSPECIFIED', + self::STRING => 'STRING', + self::REGEX => 'REGEX', + self::CIDR => 'CIDR', + self::NUMBER => 'NUMBER', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/Chronicle/src/V1/DataTableOperationErrors.php b/Chronicle/src/V1/DataTableOperationErrors.php new file mode 100644 index 000000000000..23120c0eb49b --- /dev/null +++ b/Chronicle/src/V1/DataTableOperationErrors.php @@ -0,0 +1,113 @@ +google.cloud.chronicle.v1.DataTableOperationErrors + */ +class DataTableOperationErrors extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. Resource name for the data table operation errors. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTableOperationErrors/{data_table_operation_errors} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * The list of errors. + * Replaces the deprecated `errors` field. + * + * Generated from protobuf field repeated .google.rpc.Status rpc_errors = 3; + */ + private $rpc_errors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. Resource name for the data table operation errors. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTableOperationErrors/{data_table_operation_errors} + * @type \Google\Rpc\Status[] $rpc_errors + * The list of errors. + * Replaces the deprecated `errors` field. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. Resource name for the data table operation errors. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTableOperationErrors/{data_table_operation_errors} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. Resource name for the data table operation errors. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTableOperationErrors/{data_table_operation_errors} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The list of errors. + * Replaces the deprecated `errors` field. + * + * Generated from protobuf field repeated .google.rpc.Status rpc_errors = 3; + * @return RepeatedField<\Google\Rpc\Status> + */ + public function getRpcErrors() + { + return $this->rpc_errors; + } + + /** + * The list of errors. + * Replaces the deprecated `errors` field. + * + * Generated from protobuf field repeated .google.rpc.Status rpc_errors = 3; + * @param \Google\Rpc\Status[] $var + * @return $this + */ + public function setRpcErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->rpc_errors = $arr; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/DataTableRow.php b/Chronicle/src/V1/DataTableRow.php new file mode 100644 index 000000000000..09f30b14ac0c --- /dev/null +++ b/Chronicle/src/V1/DataTableRow.php @@ -0,0 +1,235 @@ +google.cloud.chronicle.v1.DataTableRow + */ +class DataTableRow extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The resource name of the data table + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Required. All column values for a single row. The values should be in the + * same order as the columns of the data tables. + * + * Generated from protobuf field repeated string values = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $values; + /** + * Output only. DataTableRow create time + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. DataTableRow update time + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Optional. User-provided TTL of the data table row. + * + * Generated from protobuf field string row_time_to_live = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $row_time_to_live = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The resource name of the data table + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * @type string[] $values + * Required. All column values for a single row. The values should be in the + * same order as the columns of the data tables. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. DataTableRow create time + * @type \Google\Protobuf\Timestamp $update_time + * Output only. DataTableRow update time + * @type string $row_time_to_live + * Optional. User-provided TTL of the data table row. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The resource name of the data table + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The resource name of the data table + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. All column values for a single row. The values should be in the + * same order as the columns of the data tables. + * + * Generated from protobuf field repeated string values = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return RepeatedField + */ + public function getValues() + { + return $this->values; + } + + /** + * Required. All column values for a single row. The values should be in the + * same order as the columns of the data tables. + * + * Generated from protobuf field repeated string values = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string[] $var + * @return $this + */ + public function setValues($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->values = $arr; + + return $this; + } + + /** + * Output only. DataTableRow create time + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. DataTableRow create time + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. DataTableRow update time + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. DataTableRow update time + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Optional. User-provided TTL of the data table row. + * + * Generated from protobuf field string row_time_to_live = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getRowTimeToLive() + { + return $this->row_time_to_live; + } + + /** + * Optional. User-provided TTL of the data table row. + * + * Generated from protobuf field string row_time_to_live = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setRowTimeToLive($var) + { + GPBUtil::checkString($var, True); + $this->row_time_to_live = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/DataTableScopeInfo.php b/Chronicle/src/V1/DataTableScopeInfo.php new file mode 100644 index 000000000000..71088a6ffab9 --- /dev/null +++ b/Chronicle/src/V1/DataTableScopeInfo.php @@ -0,0 +1,79 @@ +google.cloud.chronicle.v1.DataTableScopeInfo + */ +class DataTableScopeInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Contains the list of scope names of the data table. If the list + * is empty, the data table is treated as unscoped. The scope names should be + * full resource names and should be of the format: + * "projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{scope_name}" + * + * Generated from protobuf field repeated string data_access_scopes = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $data_access_scopes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string[] $data_access_scopes + * Required. Contains the list of scope names of the data table. If the list + * is empty, the data table is treated as unscoped. The scope names should be + * full resource names and should be of the format: + * "projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{scope_name}" + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. Contains the list of scope names of the data table. If the list + * is empty, the data table is treated as unscoped. The scope names should be + * full resource names and should be of the format: + * "projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{scope_name}" + * + * Generated from protobuf field repeated string data_access_scopes = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return RepeatedField + */ + public function getDataAccessScopes() + { + return $this->data_access_scopes; + } + + /** + * Required. Contains the list of scope names of the data table. If the list + * is empty, the data table is treated as unscoped. The scope names should be + * full resource names and should be of the format: + * "projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{scope_name}" + * + * Generated from protobuf field repeated string data_access_scopes = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string[] $var + * @return $this + */ + public function setDataAccessScopes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->data_access_scopes = $arr; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/DataTableUpdateSource.php b/Chronicle/src/V1/DataTableUpdateSource.php new file mode 100644 index 000000000000..a2d2cbf75cc5 --- /dev/null +++ b/Chronicle/src/V1/DataTableUpdateSource.php @@ -0,0 +1,68 @@ +google.cloud.chronicle.v1.DataTableUpdateSource + */ +class DataTableUpdateSource +{ + /** + * The data table is updated by the user. + * + * Generated from protobuf enum DATA_TABLE_UPDATE_SOURCE_UNSPECIFIED = 0; + */ + const DATA_TABLE_UPDATE_SOURCE_UNSPECIFIED = 0; + /** + * The data table is updated by the user. + * + * Generated from protobuf enum USER = 1; + */ + const USER = 1; + /** + * The data table is updated by the rule. + * + * Generated from protobuf enum RULE = 2; + */ + const RULE = 2; + /** + * The data table is updated by the search. + * + * Generated from protobuf enum SEARCH = 3; + */ + const SEARCH = 3; + + private static $valueToName = [ + self::DATA_TABLE_UPDATE_SOURCE_UNSPECIFIED => 'DATA_TABLE_UPDATE_SOURCE_UNSPECIFIED', + self::USER => 'USER', + self::RULE => 'RULE', + self::SEARCH => 'SEARCH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/Chronicle/src/V1/DeleteDataTableRequest.php b/Chronicle/src/V1/DeleteDataTableRequest.php new file mode 100644 index 000000000000..5b6d521de2f3 --- /dev/null +++ b/Chronicle/src/V1/DeleteDataTableRequest.php @@ -0,0 +1,137 @@ +google.cloud.chronicle.v1.DeleteDataTableRequest + */ +class DeleteDataTableRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the data table to delete. + * Format + * projects/{project}/locations/{location}/instances/{instances}/dataTables/{data_table} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. If set to true, any rows under this data table will also be + * deleted. (Otherwise, the request will only work if the data table has no + * rows.) + * + * Generated from protobuf field bool force = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $force = false; + + /** + * @param string $name Required. The resource name of the data table to delete. + * Format + * projects/{project}/locations/{location}/instances/{instances}/dataTables/{data_table} + * Please see {@see DataTableServiceClient::dataTableName()} for help formatting this field. + * @param bool $force Optional. If set to true, any rows under this data table will also be + * deleted. (Otherwise, the request will only work if the data table has no + * rows.) + * + * @return \Google\Cloud\Chronicle\V1\DeleteDataTableRequest + * + * @experimental + */ + public static function build(string $name, bool $force): self + { + return (new self()) + ->setName($name) + ->setForce($force); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the data table to delete. + * Format + * projects/{project}/locations/{location}/instances/{instances}/dataTables/{data_table} + * @type bool $force + * Optional. If set to true, any rows under this data table will also be + * deleted. (Otherwise, the request will only work if the data table has no + * rows.) + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the data table to delete. + * Format + * projects/{project}/locations/{location}/instances/{instances}/dataTables/{data_table} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the data table to delete. + * Format + * projects/{project}/locations/{location}/instances/{instances}/dataTables/{data_table} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. If set to true, any rows under this data table will also be + * deleted. (Otherwise, the request will only work if the data table has no + * rows.) + * + * Generated from protobuf field bool force = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * Optional. If set to true, any rows under this data table will also be + * deleted. (Otherwise, the request will only work if the data table has no + * rows.) + * + * Generated from protobuf field bool force = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/DeleteDataTableRowRequest.php b/Chronicle/src/V1/DeleteDataTableRowRequest.php new file mode 100644 index 000000000000..90e6718b303a --- /dev/null +++ b/Chronicle/src/V1/DeleteDataTableRowRequest.php @@ -0,0 +1,91 @@ +google.cloud.chronicle.v1.DeleteDataTableRowRequest + */ +class DeleteDataTableRowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the data table row i,e row_id. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the data table row i,e row_id. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * Please see {@see DataTableServiceClient::dataTableRowName()} for help formatting this field. + * + * @return \Google\Cloud\Chronicle\V1\DeleteDataTableRowRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the data table row i,e row_id. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the data table row i,e row_id. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the data table row i,e row_id. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/GetDataTableOperationErrorsRequest.php b/Chronicle/src/V1/GetDataTableOperationErrorsRequest.php new file mode 100644 index 000000000000..b00e5d52ec7d --- /dev/null +++ b/Chronicle/src/V1/GetDataTableOperationErrorsRequest.php @@ -0,0 +1,91 @@ +google.cloud.chronicle.v1.GetDataTableOperationErrorsRequest + */ +class GetDataTableOperationErrorsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name for the data table operation errors. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTableOperationErrors/{data_table_operation_errors} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. Resource name for the data table operation errors. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTableOperationErrors/{data_table_operation_errors} + * Please see {@see DataTableServiceClient::dataTableOperationErrorsName()} for help formatting this field. + * + * @return \Google\Cloud\Chronicle\V1\GetDataTableOperationErrorsRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name for the data table operation errors. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTableOperationErrors/{data_table_operation_errors} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name for the data table operation errors. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTableOperationErrors/{data_table_operation_errors} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name for the data table operation errors. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTableOperationErrors/{data_table_operation_errors} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/GetDataTableRequest.php b/Chronicle/src/V1/GetDataTableRequest.php new file mode 100644 index 000000000000..ab2aac02a02c --- /dev/null +++ b/Chronicle/src/V1/GetDataTableRequest.php @@ -0,0 +1,91 @@ +google.cloud.chronicle.v1.GetDataTableRequest + */ +class GetDataTableRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the data table to retrieve. + * Format: + * projects/{project}/locations/{location}/instances/{instances}/dataTables/{data_table} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the data table to retrieve. + * Format: + * projects/{project}/locations/{location}/instances/{instances}/dataTables/{data_table} + * Please see {@see DataTableServiceClient::dataTableName()} for help formatting this field. + * + * @return \Google\Cloud\Chronicle\V1\GetDataTableRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the data table to retrieve. + * Format: + * projects/{project}/locations/{location}/instances/{instances}/dataTables/{data_table} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the data table to retrieve. + * Format: + * projects/{project}/locations/{location}/instances/{instances}/dataTables/{data_table} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the data table to retrieve. + * Format: + * projects/{project}/locations/{location}/instances/{instances}/dataTables/{data_table} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/GetDataTableRowRequest.php b/Chronicle/src/V1/GetDataTableRowRequest.php new file mode 100644 index 000000000000..3c1918a3f2be --- /dev/null +++ b/Chronicle/src/V1/GetDataTableRowRequest.php @@ -0,0 +1,91 @@ +google.cloud.chronicle.v1.GetDataTableRowRequest + */ +class GetDataTableRowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the data table row i,e row_id. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the data table row i,e row_id. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * Please see {@see DataTableServiceClient::dataTableRowName()} for help formatting this field. + * + * @return \Google\Cloud\Chronicle\V1\GetDataTableRowRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the data table row i,e row_id. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the data table row i,e row_id. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the data table row i,e row_id. + * Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/ListDataTableRowsRequest.php b/Chronicle/src/V1/ListDataTableRowsRequest.php new file mode 100644 index 000000000000..3289a1b5e1cc --- /dev/null +++ b/Chronicle/src/V1/ListDataTableRowsRequest.php @@ -0,0 +1,247 @@ +google.cloud.chronicle.v1.ListDataTableRowsRequest + */ +class ListDataTableRowsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource id of the data table. + * Format: + * projects/{project}/locations/{locations}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of data table rows to return. The service may + * return fewer than this value. If unspecified, at most 100 data table rows + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous `ListDataTableRows` call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Configures ordering of DataTables in the response. + * Note: Our implementation currently supports order by "create_time asc" only + * + * Generated from protobuf field string order_by = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + /** + * Optional. Filter facilitating search over data table rows. This filter + * performs a case-insensitive substring match on the row values. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The resource id of the data table. + * Format: + * projects/{project}/locations/{locations}/instances/{instance}/dataTables/{data_table} + * Please see {@see DataTableServiceClient::dataTableName()} for help formatting this field. + * + * @return \Google\Cloud\Chronicle\V1\ListDataTableRowsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The resource id of the data table. + * Format: + * projects/{project}/locations/{locations}/instances/{instance}/dataTables/{data_table} + * @type int $page_size + * Optional. The maximum number of data table rows to return. The service may + * return fewer than this value. If unspecified, at most 100 data table rows + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * @type string $page_token + * Optional. A page token, received from a previous `ListDataTableRows` call. + * @type string $order_by + * Optional. Configures ordering of DataTables in the response. + * Note: Our implementation currently supports order by "create_time asc" only + * @type string $filter + * Optional. Filter facilitating search over data table rows. This filter + * performs a case-insensitive substring match on the row values. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource id of the data table. + * Format: + * projects/{project}/locations/{locations}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The resource id of the data table. + * Format: + * projects/{project}/locations/{locations}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of data table rows to return. The service may + * return fewer than this value. If unspecified, at most 100 data table rows + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of data table rows to return. The service may + * return fewer than this value. If unspecified, at most 100 data table rows + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A page token, received from a previous `ListDataTableRows` call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous `ListDataTableRows` call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Configures ordering of DataTables in the response. + * Note: Our implementation currently supports order by "create_time asc" only + * + * Generated from protobuf field string order_by = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Configures ordering of DataTables in the response. + * Note: Our implementation currently supports order by "create_time asc" only + * + * Generated from protobuf field string order_by = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + + /** + * Optional. Filter facilitating search over data table rows. This filter + * performs a case-insensitive substring match on the row values. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. Filter facilitating search over data table rows. This filter + * performs a case-insensitive substring match on the row values. + * + * Generated from protobuf field string filter = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/ListDataTableRowsResponse.php b/Chronicle/src/V1/ListDataTableRowsResponse.php new file mode 100644 index 000000000000..7cde914b2a14 --- /dev/null +++ b/Chronicle/src/V1/ListDataTableRowsResponse.php @@ -0,0 +1,105 @@ +google.cloud.chronicle.v1.ListDataTableRowsResponse + */ +class ListDataTableRowsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of the data table rows returned. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + */ + private $data_table_rows; + /** + * Optional. A token, which can be sent as `page_token` to retrieve the next + * page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Chronicle\V1\DataTableRow[] $data_table_rows + * The list of the data table rows returned. + * @type string $next_page_token + * Optional. A token, which can be sent as `page_token` to retrieve the next + * page. If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * The list of the data table rows returned. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + * @return RepeatedField<\Google\Cloud\Chronicle\V1\DataTableRow> + */ + public function getDataTableRows() + { + return $this->data_table_rows; + } + + /** + * The list of the data table rows returned. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTableRow data_table_rows = 1; + * @param \Google\Cloud\Chronicle\V1\DataTableRow[] $var + * @return $this + */ + public function setDataTableRows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Chronicle\V1\DataTableRow::class); + $this->data_table_rows = $arr; + + return $this; + } + + /** + * Optional. A token, which can be sent as `page_token` to retrieve the next + * page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Optional. A token, which can be sent as `page_token` to retrieve the next + * page. If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/ListDataTablesRequest.php b/Chronicle/src/V1/ListDataTablesRequest.php new file mode 100644 index 000000000000..bb06c76adbf4 --- /dev/null +++ b/Chronicle/src/V1/ListDataTablesRequest.php @@ -0,0 +1,220 @@ +google.cloud.chronicle.v1.ListDataTablesRequest + */ +class ListDataTablesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent resource where this data table will be created. + * Format: projects/{project}/locations/{location}/instances/{instance} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of data tables to return. The service may + * return fewer than this value. If unspecified, at most 100 data tables will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous `ListDataTables` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListDataTables` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. Configures ordering of DataTables in the response. + * Note: Our implementation currently supports order by "create_time asc" only + * + * Generated from protobuf field string order_by = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The parent resource where this data table will be created. + * Format: projects/{project}/locations/{location}/instances/{instance} + * Please see {@see DataTableServiceClient::instanceName()} for help formatting this field. + * + * @return \Google\Cloud\Chronicle\V1\ListDataTablesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent resource where this data table will be created. + * Format: projects/{project}/locations/{location}/instances/{instance} + * @type int $page_size + * Optional. The maximum number of data tables to return. The service may + * return fewer than this value. If unspecified, at most 100 data tables will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * @type string $page_token + * Optional. A page token, received from a previous `ListDataTables` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListDataTables` must match the call that provided the page + * token. + * @type string $order_by + * Optional. Configures ordering of DataTables in the response. + * Note: Our implementation currently supports order by "create_time asc" only + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent resource where this data table will be created. + * Format: projects/{project}/locations/{location}/instances/{instance} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent resource where this data table will be created. + * Format: projects/{project}/locations/{location}/instances/{instance} + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of data tables to return. The service may + * return fewer than this value. If unspecified, at most 100 data tables will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of data tables to return. The service may + * return fewer than this value. If unspecified, at most 100 data tables will + * be returned. The maximum value is 1000; values above 1000 will be coerced + * to 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A page token, received from a previous `ListDataTables` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListDataTables` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous `ListDataTables` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListDataTables` must match the call that provided the page + * token. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. Configures ordering of DataTables in the response. + * Note: Our implementation currently supports order by "create_time asc" only + * + * Generated from protobuf field string order_by = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * Optional. Configures ordering of DataTables in the response. + * Note: Our implementation currently supports order by "create_time asc" only + * + * Generated from protobuf field string order_by = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/ListDataTablesResponse.php b/Chronicle/src/V1/ListDataTablesResponse.php new file mode 100644 index 000000000000..51e7bfc065c6 --- /dev/null +++ b/Chronicle/src/V1/ListDataTablesResponse.php @@ -0,0 +1,105 @@ +google.cloud.chronicle.v1.ListDataTablesResponse + */ +class ListDataTablesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of the data tables returned. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTable data_tables = 1; + */ + private $data_tables; + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Chronicle\V1\DataTable[] $data_tables + * The list of the data tables returned. + * @type string $next_page_token + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * The list of the data tables returned. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTable data_tables = 1; + * @return RepeatedField<\Google\Cloud\Chronicle\V1\DataTable> + */ + public function getDataTables() + { + return $this->data_tables; + } + + /** + * The list of the data tables returned. + * + * Generated from protobuf field repeated .google.cloud.chronicle.v1.DataTable data_tables = 1; + * @param \Google\Cloud\Chronicle\V1\DataTable[] $var + * @return $this + */ + public function setDataTables($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Chronicle\V1\DataTable::class); + $this->data_tables = $arr; + + return $this; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * A token, which can be sent as `page_token` to retrieve the next page. + * If this field is omitted, there are no subsequent pages. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/UpdateDataTableRequest.php b/Chronicle/src/V1/UpdateDataTableRequest.php new file mode 100644 index 000000000000..db7d985e7a3d --- /dev/null +++ b/Chronicle/src/V1/UpdateDataTableRequest.php @@ -0,0 +1,161 @@ +google.cloud.chronicle.v1.UpdateDataTableRequest + */ +class UpdateDataTableRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. This field is used to identify the datatable to update. + * Format: + * projects/{project}/locations/{locations}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTable data_table = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $data_table = null; + /** + * Optional. The list of metadata fields to update. Currently data tables only + * support updating the `description`, `row_time_to_live` and `scope_info` + * fields. When no field mask is supplied, all non-empty fields will be + * updated. A field mask of "*" will update all fields, whether empty or not. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Chronicle\V1\DataTable $dataTable Required. This field is used to identify the datatable to update. + * Format: + * projects/{project}/locations/{locations}/instances/{instance}/dataTables/{data_table} + * @param \Google\Protobuf\FieldMask $updateMask Optional. The list of metadata fields to update. Currently data tables only + * support updating the `description`, `row_time_to_live` and `scope_info` + * fields. When no field mask is supplied, all non-empty fields will be + * updated. A field mask of "*" will update all fields, whether empty or not. + * + * @return \Google\Cloud\Chronicle\V1\UpdateDataTableRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Chronicle\V1\DataTable $dataTable, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setDataTable($dataTable) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Chronicle\V1\DataTable $data_table + * Required. This field is used to identify the datatable to update. + * Format: + * projects/{project}/locations/{locations}/instances/{instance}/dataTables/{data_table} + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. The list of metadata fields to update. Currently data tables only + * support updating the `description`, `row_time_to_live` and `scope_info` + * fields. When no field mask is supplied, all non-empty fields will be + * updated. A field mask of "*" will update all fields, whether empty or not. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. This field is used to identify the datatable to update. + * Format: + * projects/{project}/locations/{locations}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTable data_table = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Chronicle\V1\DataTable|null + */ + public function getDataTable() + { + return $this->data_table; + } + + public function hasDataTable() + { + return isset($this->data_table); + } + + public function clearDataTable() + { + unset($this->data_table); + } + + /** + * Required. This field is used to identify the datatable to update. + * Format: + * projects/{project}/locations/{locations}/instances/{instance}/dataTables/{data_table} + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTable data_table = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Chronicle\V1\DataTable $var + * @return $this + */ + public function setDataTable($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Chronicle\V1\DataTable::class); + $this->data_table = $var; + + return $this; + } + + /** + * Optional. The list of metadata fields to update. Currently data tables only + * support updating the `description`, `row_time_to_live` and `scope_info` + * fields. When no field mask is supplied, all non-empty fields will be + * updated. A field mask of "*" will update all fields, whether empty or not. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. The list of metadata fields to update. Currently data tables only + * support updating the `description`, `row_time_to_live` and `scope_info` + * fields. When no field mask is supplied, all non-empty fields will be + * updated. A field mask of "*" will update all fields, whether empty or not. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/UpdateDataTableRowRequest.php b/Chronicle/src/V1/UpdateDataTableRowRequest.php new file mode 100644 index 000000000000..9f1bc32f4b5b --- /dev/null +++ b/Chronicle/src/V1/UpdateDataTableRowRequest.php @@ -0,0 +1,156 @@ +google.cloud.chronicle.v1.UpdateDataTableRowRequest + */ +class UpdateDataTableRowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableRow data_table_row = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $data_table_row = null; + /** + * Optional. The list of fields to update. Currently data table rows only + * support updating the `values` field. When no field mask is supplied, all + * non-empty fields will be updated. A field mask of "*" will update all + * fields, whether empty or not. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Chronicle\V1\DataTableRow $dataTableRow Required. Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * @param \Google\Protobuf\FieldMask $updateMask Optional. The list of fields to update. Currently data table rows only + * support updating the `values` field. When no field mask is supplied, all + * non-empty fields will be updated. A field mask of "*" will update all + * fields, whether empty or not. + * + * @return \Google\Cloud\Chronicle\V1\UpdateDataTableRowRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Chronicle\V1\DataTableRow $dataTableRow, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setDataTableRow($dataTableRow) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Chronicle\V1\DataTableRow $data_table_row + * Required. Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. The list of fields to update. Currently data table rows only + * support updating the `values` field. When no field mask is supplied, all + * non-empty fields will be updated. A field mask of "*" will update all + * fields, whether empty or not. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Chronicle\V1\DataTable::initOnce(); + parent::__construct($data); + } + + /** + * Required. Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableRow data_table_row = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Chronicle\V1\DataTableRow|null + */ + public function getDataTableRow() + { + return $this->data_table_row; + } + + public function hasDataTableRow() + { + return isset($this->data_table_row); + } + + public function clearDataTableRow() + { + unset($this->data_table_row); + } + + /** + * Required. Format: + * projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row} + * + * Generated from protobuf field .google.cloud.chronicle.v1.DataTableRow data_table_row = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Chronicle\V1\DataTableRow $var + * @return $this + */ + public function setDataTableRow($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Chronicle\V1\DataTableRow::class); + $this->data_table_row = $var; + + return $this; + } + + /** + * Optional. The list of fields to update. Currently data table rows only + * support updating the `values` field. When no field mask is supplied, all + * non-empty fields will be updated. A field mask of "*" will update all + * fields, whether empty or not. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. The list of fields to update. Currently data table rows only + * support updating the `values` field. When no field mask is supplied, all + * non-empty fields will be updated. A field mask of "*" will update all + * fields, whether empty or not. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/Chronicle/src/V1/gapic_metadata.json b/Chronicle/src/V1/gapic_metadata.json index 2e97bb2c5145..7edd4a684d59 100644 --- a/Chronicle/src/V1/gapic_metadata.json +++ b/Chronicle/src/V1/gapic_metadata.json @@ -64,6 +64,90 @@ } } }, + "DataTableService": { + "clients": { + "grpc": { + "libraryClient": "DataTableServiceGapicClient", + "rpcs": { + "BulkCreateDataTableRows": { + "methods": [ + "bulkCreateDataTableRows" + ] + }, + "BulkGetDataTableRows": { + "methods": [ + "bulkGetDataTableRows" + ] + }, + "BulkReplaceDataTableRows": { + "methods": [ + "bulkReplaceDataTableRows" + ] + }, + "BulkUpdateDataTableRows": { + "methods": [ + "bulkUpdateDataTableRows" + ] + }, + "CreateDataTable": { + "methods": [ + "createDataTable" + ] + }, + "CreateDataTableRow": { + "methods": [ + "createDataTableRow" + ] + }, + "DeleteDataTable": { + "methods": [ + "deleteDataTable" + ] + }, + "DeleteDataTableRow": { + "methods": [ + "deleteDataTableRow" + ] + }, + "GetDataTable": { + "methods": [ + "getDataTable" + ] + }, + "GetDataTableOperationErrors": { + "methods": [ + "getDataTableOperationErrors" + ] + }, + "GetDataTableRow": { + "methods": [ + "getDataTableRow" + ] + }, + "ListDataTableRows": { + "methods": [ + "listDataTableRows" + ] + }, + "ListDataTables": { + "methods": [ + "listDataTables" + ] + }, + "UpdateDataTable": { + "methods": [ + "updateDataTable" + ] + }, + "UpdateDataTableRow": { + "methods": [ + "updateDataTableRow" + ] + } + } + } + } + }, "EntityService": { "clients": { "grpc": { diff --git a/Chronicle/src/V1/resources/data_table_service_client_config.json b/Chronicle/src/V1/resources/data_table_service_client_config.json new file mode 100644 index 000000000000..8977263a9e42 --- /dev/null +++ b/Chronicle/src/V1/resources/data_table_service_client_config.json @@ -0,0 +1,119 @@ +{ + "interfaces": { + "google.cloud.chronicle.v1.DataTableService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_4_codes": [ + "UNAVAILABLE" + ], + "no_retry_4_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_4_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + }, + "no_retry_4_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 600000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 600000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "BulkCreateDataTableRows": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_4_codes", + "retry_params_name": "no_retry_4_params" + }, + "BulkGetDataTableRows": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_4_codes", + "retry_params_name": "retry_policy_4_params" + }, + "BulkReplaceDataTableRows": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_4_codes", + "retry_params_name": "no_retry_4_params" + }, + "BulkUpdateDataTableRows": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_4_codes", + "retry_params_name": "no_retry_4_params" + }, + "CreateDataTable": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_4_codes", + "retry_params_name": "no_retry_4_params" + }, + "CreateDataTableRow": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_4_codes", + "retry_params_name": "no_retry_4_params" + }, + "DeleteDataTable": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_4_codes", + "retry_params_name": "no_retry_4_params" + }, + "DeleteDataTableRow": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_4_codes", + "retry_params_name": "no_retry_4_params" + }, + "GetDataTable": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_4_codes", + "retry_params_name": "retry_policy_4_params" + }, + "GetDataTableOperationErrors": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_4_codes", + "retry_params_name": "retry_policy_4_params" + }, + "GetDataTableRow": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_4_codes", + "retry_params_name": "retry_policy_4_params" + }, + "ListDataTableRows": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_4_codes", + "retry_params_name": "retry_policy_4_params" + }, + "ListDataTables": { + "timeout_millis": 600000, + "retry_codes_name": "retry_policy_4_codes", + "retry_params_name": "retry_policy_4_params" + }, + "UpdateDataTable": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_4_codes", + "retry_params_name": "no_retry_4_params" + }, + "UpdateDataTableRow": { + "timeout_millis": 600000, + "retry_codes_name": "no_retry_4_codes", + "retry_params_name": "no_retry_4_params" + } + } + } + } +} diff --git a/Chronicle/src/V1/resources/data_table_service_descriptor_config.php b/Chronicle/src/V1/resources/data_table_service_descriptor_config.php new file mode 100644 index 000000000000..8e920d69d520 --- /dev/null +++ b/Chronicle/src/V1/resources/data_table_service_descriptor_config.php @@ -0,0 +1,233 @@ + [ + 'google.cloud.chronicle.v1.DataTableService' => [ + 'BulkCreateDataTableRows' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Chronicle\V1\BulkCreateDataTableRowsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'BulkGetDataTableRows' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Chronicle\V1\BulkGetDataTableRowsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'BulkReplaceDataTableRows' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Chronicle\V1\BulkReplaceDataTableRowsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'BulkUpdateDataTableRows' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Chronicle\V1\BulkUpdateDataTableRowsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateDataTable' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Chronicle\V1\DataTable', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateDataTableRow' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Chronicle\V1\DataTableRow', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteDataTable' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteDataTableRow' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetDataTable' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Chronicle\V1\DataTable', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetDataTableOperationErrors' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Chronicle\V1\DataTableOperationErrors', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetDataTableRow' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Chronicle\V1\DataTableRow', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListDataTableRows' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getDataTableRows', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Chronicle\V1\ListDataTableRowsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListDataTables' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getDataTables', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Chronicle\V1\ListDataTablesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateDataTable' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Chronicle\V1\DataTable', + 'headerParams' => [ + [ + 'keyName' => 'data_table.name', + 'fieldAccessors' => [ + 'getDataTable', + 'getName', + ], + ], + ], + ], + 'UpdateDataTableRow' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Chronicle\V1\DataTableRow', + 'headerParams' => [ + [ + 'keyName' => 'data_table_row.name', + 'fieldAccessors' => [ + 'getDataTableRow', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'dataAccessScope' => 'projects/{project}/locations/{location}/instances/{instance}/dataAccessScopes/{data_access_scope}', + 'dataTable' => 'projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}', + 'dataTableOperationErrors' => 'projects/{project}/locations/{location}/instances/{instance}/dataTableOperationErrors/{data_table_operation_errors}', + 'dataTableRow' => 'projects/{project}/locations/{location}/instances/{instance}/dataTables/{data_table}/dataTableRows/{data_table_row}', + 'instance' => 'projects/{project}/locations/{location}/instances/{instance}', + ], + ], + ], +]; diff --git a/Chronicle/src/V1/resources/data_table_service_rest_client_config.php b/Chronicle/src/V1/resources/data_table_service_rest_client_config.php new file mode 100644 index 000000000000..b16af4a2aa89 --- /dev/null +++ b/Chronicle/src/V1/resources/data_table_service_rest_client_config.php @@ -0,0 +1,254 @@ + [ + 'google.cloud.chronicle.v1.DataTableService' => [ + 'BulkCreateDataTableRows' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/instances/*/dataTables/*}/dataTableRows:bulkCreate', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'BulkGetDataTableRows' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/instances/*/dataTables/*}/dataTableRows:bulkGet', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'BulkReplaceDataTableRows' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/instances/*/dataTables/*}/dataTableRows:bulkReplace', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'BulkUpdateDataTableRows' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/instances/*/dataTables/*}/dataTableRows:bulkUpdate', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateDataTable' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/instances/*}/dataTables', + 'body' => 'data_table', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'data_table_id', + ], + ], + 'CreateDataTableRow' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/instances/*/dataTables/*}/dataTableRows', + 'body' => 'data_table_row', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteDataTable' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/instances/*/dataTables/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteDataTableRow' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/instances/*/dataTables/*/dataTableRows/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetDataTable' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/instances/*/dataTables/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetDataTableOperationErrors' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/instances/*/dataTableOperationErrors/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetDataTableRow' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/instances/*/dataTables/*/dataTableRows/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListDataTableRows' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/instances/*/dataTables/*}/dataTableRows', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListDataTables' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/instances/*}/dataTables', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateDataTable' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{data_table.name=projects/*/locations/*/instances/*/dataTables/*}', + 'body' => 'data_table', + 'placeholders' => [ + 'data_table.name' => [ + 'getters' => [ + 'getDataTable', + 'getName', + ], + ], + ], + ], + 'UpdateDataTableRow' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{data_table_row.name=projects/*/locations/*/instances/*/dataTables/*/dataTableRows/*}', + 'body' => 'data_table_row', + 'placeholders' => [ + 'data_table_row.name' => [ + 'getters' => [ + 'getDataTableRow', + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/instances/*/operations/*}:cancel', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteOperation' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/instances/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/instances/*/operations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/instances/*}/operations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/Chronicle/tests/Unit/V1/Client/DataTableServiceClientTest.php b/Chronicle/tests/Unit/V1/Client/DataTableServiceClientTest.php new file mode 100644 index 000000000000..7c143e80fb8a --- /dev/null +++ b/Chronicle/tests/Unit/V1/Client/DataTableServiceClientTest.php @@ -0,0 +1,1215 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return DataTableServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new DataTableServiceClient($options); + } + + /** @test */ + public function bulkCreateDataTableRowsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BulkCreateDataTableRowsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $requests = []; + $request = (new BulkCreateDataTableRowsRequest())->setParent($formattedParent)->setRequests($requests); + $response = $gapicClient->bulkCreateDataTableRows($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/BulkCreateDataTableRows', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function bulkCreateDataTableRowsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $requests = []; + $request = (new BulkCreateDataTableRowsRequest())->setParent($formattedParent)->setRequests($requests); + try { + $gapicClient->bulkCreateDataTableRows($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function bulkGetDataTableRowsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BulkGetDataTableRowsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $requests = []; + $request = (new BulkGetDataTableRowsRequest())->setParent($formattedParent)->setRequests($requests); + $response = $gapicClient->bulkGetDataTableRows($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/BulkGetDataTableRows', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function bulkGetDataTableRowsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $requests = []; + $request = (new BulkGetDataTableRowsRequest())->setParent($formattedParent)->setRequests($requests); + try { + $gapicClient->bulkGetDataTableRows($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function bulkReplaceDataTableRowsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BulkReplaceDataTableRowsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $requests = []; + $request = (new BulkReplaceDataTableRowsRequest())->setParent($formattedParent)->setRequests($requests); + $response = $gapicClient->bulkReplaceDataTableRows($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/BulkReplaceDataTableRows', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function bulkReplaceDataTableRowsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $requests = []; + $request = (new BulkReplaceDataTableRowsRequest())->setParent($formattedParent)->setRequests($requests); + try { + $gapicClient->bulkReplaceDataTableRows($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function bulkUpdateDataTableRowsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BulkUpdateDataTableRowsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $requests = []; + $request = (new BulkUpdateDataTableRowsRequest())->setParent($formattedParent)->setRequests($requests); + $response = $gapicClient->bulkUpdateDataTableRows($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/BulkUpdateDataTableRows', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function bulkUpdateDataTableRowsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $requests = []; + $request = (new BulkUpdateDataTableRowsRequest())->setParent($formattedParent)->setRequests($requests); + try { + $gapicClient->bulkUpdateDataTableRows($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createDataTableTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $dataTableUuid = 'dataTableUuid-1818199743'; + $ruleAssociationsCount = 1522562875; + $rowTimeToLive = 'rowTimeToLive1109069571'; + $approximateRowCount = 297926913; + $expectedResponse = new DataTable(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setDataTableUuid($dataTableUuid); + $expectedResponse->setRuleAssociationsCount($ruleAssociationsCount); + $expectedResponse->setRowTimeToLive($rowTimeToLive); + $expectedResponse->setApproximateRowCount($approximateRowCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]'); + $dataTable = new DataTable(); + $dataTableDescription = 'dataTableDescription924959512'; + $dataTable->setDescription($dataTableDescription); + $dataTableId = 'dataTableId-319210463'; + $request = (new CreateDataTableRequest()) + ->setParent($formattedParent) + ->setDataTable($dataTable) + ->setDataTableId($dataTableId); + $response = $gapicClient->createDataTable($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/CreateDataTable', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getDataTable(); + $this->assertProtobufEquals($dataTable, $actualValue); + $actualValue = $actualRequestObject->getDataTableId(); + $this->assertProtobufEquals($dataTableId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createDataTableExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]'); + $dataTable = new DataTable(); + $dataTableDescription = 'dataTableDescription924959512'; + $dataTable->setDescription($dataTableDescription); + $dataTableId = 'dataTableId-319210463'; + $request = (new CreateDataTableRequest()) + ->setParent($formattedParent) + ->setDataTable($dataTable) + ->setDataTableId($dataTableId); + try { + $gapicClient->createDataTable($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createDataTableRowTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $rowTimeToLive = 'rowTimeToLive1109069571'; + $expectedResponse = new DataTableRow(); + $expectedResponse->setName($name); + $expectedResponse->setRowTimeToLive($rowTimeToLive); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $dataTableRow = new DataTableRow(); + $dataTableRowValues = []; + $dataTableRow->setValues($dataTableRowValues); + $request = (new CreateDataTableRowRequest())->setParent($formattedParent)->setDataTableRow($dataTableRow); + $response = $gapicClient->createDataTableRow($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/CreateDataTableRow', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getDataTableRow(); + $this->assertProtobufEquals($dataTableRow, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createDataTableRowExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $dataTableRow = new DataTableRow(); + $dataTableRowValues = []; + $dataTableRow->setValues($dataTableRowValues); + $request = (new CreateDataTableRowRequest())->setParent($formattedParent)->setDataTableRow($dataTableRow); + try { + $gapicClient->createDataTableRow($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteDataTableTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $request = (new DeleteDataTableRequest())->setName($formattedName); + $gapicClient->deleteDataTable($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/DeleteDataTable', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteDataTableExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $request = (new DeleteDataTableRequest())->setName($formattedName); + try { + $gapicClient->deleteDataTable($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteDataTableRowTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->dataTableRowName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]', + '[DATA_TABLE_ROW]' + ); + $request = (new DeleteDataTableRowRequest())->setName($formattedName); + $gapicClient->deleteDataTableRow($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/DeleteDataTableRow', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteDataTableRowExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->dataTableRowName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]', + '[DATA_TABLE_ROW]' + ); + $request = (new DeleteDataTableRowRequest())->setName($formattedName); + try { + $gapicClient->deleteDataTableRow($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDataTableTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $dataTableUuid = 'dataTableUuid-1818199743'; + $ruleAssociationsCount = 1522562875; + $rowTimeToLive = 'rowTimeToLive1109069571'; + $approximateRowCount = 297926913; + $expectedResponse = new DataTable(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setDataTableUuid($dataTableUuid); + $expectedResponse->setRuleAssociationsCount($ruleAssociationsCount); + $expectedResponse->setRowTimeToLive($rowTimeToLive); + $expectedResponse->setApproximateRowCount($approximateRowCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $request = (new GetDataTableRequest())->setName($formattedName); + $response = $gapicClient->getDataTable($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/GetDataTable', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDataTableExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $request = (new GetDataTableRequest())->setName($formattedName); + try { + $gapicClient->getDataTable($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDataTableOperationErrorsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new DataTableOperationErrors(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->dataTableOperationErrorsName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE_OPERATION_ERRORS]' + ); + $request = (new GetDataTableOperationErrorsRequest())->setName($formattedName); + $response = $gapicClient->getDataTableOperationErrors($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/GetDataTableOperationErrors', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDataTableOperationErrorsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->dataTableOperationErrorsName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE_OPERATION_ERRORS]' + ); + $request = (new GetDataTableOperationErrorsRequest())->setName($formattedName); + try { + $gapicClient->getDataTableOperationErrors($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDataTableRowTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $rowTimeToLive = 'rowTimeToLive1109069571'; + $expectedResponse = new DataTableRow(); + $expectedResponse->setName($name2); + $expectedResponse->setRowTimeToLive($rowTimeToLive); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->dataTableRowName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]', + '[DATA_TABLE_ROW]' + ); + $request = (new GetDataTableRowRequest())->setName($formattedName); + $response = $gapicClient->getDataTableRow($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/GetDataTableRow', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getDataTableRowExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->dataTableRowName( + '[PROJECT]', + '[LOCATION]', + '[INSTANCE]', + '[DATA_TABLE]', + '[DATA_TABLE_ROW]' + ); + $request = (new GetDataTableRowRequest())->setName($formattedName); + try { + $gapicClient->getDataTableRow($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDataTableRowsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $dataTableRowsElement = new DataTableRow(); + $dataTableRows = [$dataTableRowsElement]; + $expectedResponse = new ListDataTableRowsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDataTableRows($dataTableRows); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $request = (new ListDataTableRowsRequest())->setParent($formattedParent); + $response = $gapicClient->listDataTableRows($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDataTableRows()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/ListDataTableRows', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDataTableRowsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $request = (new ListDataTableRowsRequest())->setParent($formattedParent); + try { + $gapicClient->listDataTableRows($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDataTablesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $dataTablesElement = new DataTable(); + $dataTables = [$dataTablesElement]; + $expectedResponse = new ListDataTablesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setDataTables($dataTables); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]'); + $request = (new ListDataTablesRequest())->setParent($formattedParent); + $response = $gapicClient->listDataTables($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getDataTables()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/ListDataTables', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listDataTablesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->instanceName('[PROJECT]', '[LOCATION]', '[INSTANCE]'); + $request = (new ListDataTablesRequest())->setParent($formattedParent); + try { + $gapicClient->listDataTables($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateDataTableTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $dataTableUuid = 'dataTableUuid-1818199743'; + $ruleAssociationsCount = 1522562875; + $rowTimeToLive = 'rowTimeToLive1109069571'; + $approximateRowCount = 297926913; + $expectedResponse = new DataTable(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setDataTableUuid($dataTableUuid); + $expectedResponse->setRuleAssociationsCount($ruleAssociationsCount); + $expectedResponse->setRowTimeToLive($rowTimeToLive); + $expectedResponse->setApproximateRowCount($approximateRowCount); + $transport->addResponse($expectedResponse); + // Mock request + $dataTable = new DataTable(); + $dataTableDescription = 'dataTableDescription924959512'; + $dataTable->setDescription($dataTableDescription); + $request = (new UpdateDataTableRequest())->setDataTable($dataTable); + $response = $gapicClient->updateDataTable($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/UpdateDataTable', $actualFuncCall); + $actualValue = $actualRequestObject->getDataTable(); + $this->assertProtobufEquals($dataTable, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateDataTableExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $dataTable = new DataTable(); + $dataTableDescription = 'dataTableDescription924959512'; + $dataTable->setDescription($dataTableDescription); + $request = (new UpdateDataTableRequest())->setDataTable($dataTable); + try { + $gapicClient->updateDataTable($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateDataTableRowTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $rowTimeToLive = 'rowTimeToLive1109069571'; + $expectedResponse = new DataTableRow(); + $expectedResponse->setName($name); + $expectedResponse->setRowTimeToLive($rowTimeToLive); + $transport->addResponse($expectedResponse); + // Mock request + $dataTableRow = new DataTableRow(); + $dataTableRowValues = []; + $dataTableRow->setValues($dataTableRowValues); + $request = (new UpdateDataTableRowRequest())->setDataTableRow($dataTableRow); + $response = $gapicClient->updateDataTableRow($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/UpdateDataTableRow', $actualFuncCall); + $actualValue = $actualRequestObject->getDataTableRow(); + $this->assertProtobufEquals($dataTableRow, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateDataTableRowExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $dataTableRow = new DataTableRow(); + $dataTableRowValues = []; + $dataTableRow->setValues($dataTableRowValues); + $request = (new UpdateDataTableRowRequest())->setDataTableRow($dataTableRow); + try { + $gapicClient->updateDataTableRow($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function bulkCreateDataTableRowsAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new BulkCreateDataTableRowsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataTableName('[PROJECT]', '[LOCATION]', '[INSTANCE]', '[DATA_TABLE]'); + $requests = []; + $request = (new BulkCreateDataTableRowsRequest())->setParent($formattedParent)->setRequests($requests); + $response = $gapicClient->bulkCreateDataTableRowsAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.chronicle.v1.DataTableService/BulkCreateDataTableRows', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getRequests(); + $this->assertProtobufEquals($requests, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +}