From e64fcf9344377ddfc229ce674d744cbd2bbf0511 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 12 Apr 2024 23:17:34 +0000 Subject: [PATCH] feat: publish Automated Backups protos (#7118) PiperOrigin-RevId: 620381983 Source-Link: https://github.com/googleapis/googleapis/commit/a70aa2c04ddad801a518be4f5b67345cf758a6ba Source-Link: https://github.com/googleapis/googleapis-gen/commit/e3fb57f9dd4a10b6c20359ec92a72e87631991b8 Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6ImUzZmI1N2Y5ZGQ0YTEwYjZjMjAzNTllYzkyYTcyZTg3NjMxOTkxYjgifQ== feat: add feature flag for client side metrics PiperOrigin-RevId: 619540187 Source-Link: https://github.com/googleapis/googleapis/commit/cbe62016a4eb24e71186899b79b9a4736f858653 Source-Link: https://github.com/googleapis/googleapis-gen/commit/1587174866b7ab761aed1dbfb9588f5b36ee1590 Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6IjE1ODcxNzQ4NjZiN2FiNzYxYWVkMWRiZmI5NTg4ZjViMzZlZTE1OTAifQ== feat: add Data Boost configurations to admin API PiperOrigin-RevId: 617925342 Source-Link: https://github.com/googleapis/googleapis/commit/6f289d775912966eb0cf04bda91e5e355c998d30 Source-Link: https://github.com/googleapis/googleapis-gen/commit/92da6d5d435af533f726a97bcfff3c717832c877 Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6IjkyZGE2ZDVkNDM1YWY1MzNmNzI2YTk3YmNmZmYzYzcxNzgzMmM4NzcifQ== feat: Publish new bigtable APIs for types and aggregates Bigtable aggregates will allow users to configure column families whose cells accumulate values via an aggregation function rather than simply overwrite them PiperOrigin-RevId: 613716423 Source-Link: https://github.com/googleapis/googleapis/commit/66fc31d257cabb2d4462ce3149da9e3a232b3ad1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b983c8f87e6643d9a74d7b8183d66349943b436e Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6ImI5ODNjOGY4N2U2NjQzZDlhNzRkN2I4MTgzZDY2MzQ5OTQzYjQzNmUifQ== feat: Add authorized view bindings to Cloud Bigtable data APIs and messages docs: The field `table_name` in message `.google.bigtable.v2.ReadRowsRequest` is changed from required to optional docs: The field `table_name` in message `.google.bigtable.v2.SampleRowKeysRequest` is changed from required to optional docs: The field `table_name` in message `.google.bigtable.v2.MutateRowRequest` is changed from required to optional docs: The field `table_name` in message `.google.bigtable.v2.MutateRowsRequest` is changed from required to optional docs: The field `table_name` in message `.google.bigtable.v2.CheckAndMutateRowRequest` is changed from required to optional docs: The field `table_name` in message `.google.bigtable.v2.ReadModifyWriteRowRequest` is changed from required to optional PiperOrigin-RevId: 612537984 Source-Link: https://github.com/googleapis/googleapis/commit/6465963c92930626473457717ff697aeb1bf4a12 Source-Link: https://github.com/googleapis/googleapis-gen/commit/f4a996071801f559bb6f4d0c99bb9a3c0ecf4844 Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6ImY0YTk5NjA3MTgwMWY1NTliYjZmNGQwYzk5YmI5YTNjMGVjZjQ4NDQifQ== feat: Cloud Bigtable Authorized Views admin APIs protos PiperOrigin-RevId: 612537460 Source-Link: https://github.com/googleapis/googleapis/commit/b98fe7ff808454e9d11a83946f40259ea9c6a63b Source-Link: https://github.com/googleapis/googleapis-gen/commit/03d9b5c5517cf9123f120461180ebdd387a47bcc Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6IjAzZDliNWM1NTE3Y2Y5MTIzZjEyMDQ2MTE4MGViZGQzODdhNDdiY2MifQ== --- .../metadata/Admin/V2/BigtableTableAdmin.php | Bin 12664 -> 15592 bytes Bigtable/metadata/Admin/V2/Instance.php | Bin 4321 -> 4683 bytes Bigtable/metadata/Admin/V2/Table.php | Bin 4960 -> 6109 bytes Bigtable/metadata/Admin/V2/Types.php | Bin 0 -> 1736 bytes Bigtable/metadata/V2/Bigtable.php | Bin 9610 -> 11426 bytes Bigtable/metadata/V2/Data.php | Bin 3798 -> 4187 bytes Bigtable/metadata/V2/FeatureFlags.php | 7 +- .../BigtableClient/check_and_mutate_row.php | 6 +- .../samples/V2/BigtableClient/mutate_row.php | 6 +- .../samples/V2/BigtableClient/mutate_rows.php | 7 +- .../BigtableClient/read_modify_write_row.php | 6 +- .../samples/V2/BigtableClient/read_rows.php | 3 +- .../V2/BigtableClient/sample_row_keys.php | 3 +- Bigtable/src/Admin/V2/AppProfile.php | 36 ++ .../AppProfile/DataBoostIsolationReadOnly.php | 90 ++++ .../ComputeBillingOwner.php | 60 +++ Bigtable/src/Admin/V2/AuthorizedView.php | 203 ++++++++ .../Admin/V2/AuthorizedView/FamilySubsets.php | 120 +++++ .../Admin/V2/AuthorizedView/ResponseView.php | 72 +++ .../Admin/V2/AuthorizedView/SubsetView.php | 112 +++++ .../src/Admin/V2/CheckConsistencyRequest.php | 87 ++++ .../V2/Client/BigtableTableAdminClient.php | 165 ++++++ Bigtable/src/Admin/V2/ColumnFamily.php | 64 +++ .../Admin/V2/CreateAuthorizedViewMetadata.php | 165 ++++++ .../Admin/V2/CreateAuthorizedViewRequest.php | 189 +++++++ .../src/Admin/V2/DataBoostReadLocalWrites.php | 34 ++ .../Admin/V2/DeleteAuthorizedViewRequest.php | 138 +++++ .../Gapic/BigtableTableAdminGapicClient.php | 395 +++++++++++++++ .../src/Admin/V2/GetAuthorizedViewRequest.php | 130 +++++ .../Admin/V2/ListAuthorizedViewsRequest.php | 222 ++++++++ .../Admin/V2/ListAuthorizedViewsResponse.php | 110 ++++ .../Modification.php | 52 ++ .../src/Admin/V2/StandardReadRemoteWrites.php | 34 ++ Bigtable/src/Admin/V2/Table.php | 45 ++ .../Admin/V2/Table/AutomatedBackupPolicy.php | 132 +++++ Bigtable/src/Admin/V2/Type.php | 167 ++++++ Bigtable/src/Admin/V2/Type/Aggregate.php | 185 +++++++ Bigtable/src/Admin/V2/Type/Aggregate/Sum.php | 38 ++ Bigtable/src/Admin/V2/Type/Bytes.php | 81 +++ Bigtable/src/Admin/V2/Type/Bytes/Encoding.php | 78 +++ .../src/Admin/V2/Type/Bytes/Encoding/Raw.php | 39 ++ Bigtable/src/Admin/V2/Type/Int64.php | 81 +++ Bigtable/src/Admin/V2/Type/Int64/Encoding.php | 78 +++ .../V2/Type/Int64/Encoding/BigEndianBytes.php | 87 ++++ .../Admin/V2/UpdateAuthorizedViewMetadata.php | 170 +++++++ .../Admin/V2/UpdateAuthorizedViewRequest.php | 220 ++++++++ ...table_instance_admin_descriptor_config.php | 20 + ...able_instance_admin_rest_client_config.php | 20 + .../bigtable_table_admin_client_config.json | 25 + ...bigtable_table_admin_descriptor_config.php | 104 ++++ ...igtable_table_admin_rest_client_config.php | 81 +++ Bigtable/src/V2/CheckAndMutateRowRequest.php | 84 +++- Bigtable/src/V2/Client/BigtableClient.php | 22 + Bigtable/src/V2/FeatureFlags.php | 34 ++ Bigtable/src/V2/Gapic/BigtableGapicClient.php | 146 +++++- Bigtable/src/V2/MutateRowRequest.php | 84 +++- Bigtable/src/V2/MutateRowsRequest.php | 82 ++- Bigtable/src/V2/Mutation.php | 33 ++ Bigtable/src/V2/Mutation/AddToCell.php | 222 ++++++++ Bigtable/src/V2/ReadModifyWriteRowRequest.php | 84 +++- Bigtable/src/V2/ReadRowsRequest.php | 62 ++- Bigtable/src/V2/SampleRowKeysRequest.php | 66 ++- Bigtable/src/V2/Value.php | 153 ++++++ .../resources/bigtable_descriptor_config.php | 75 +++ .../resources/bigtable_rest_client_config.php | 91 ++++ .../Admin/V2/BigtableTableAdminClientTest.php | 445 ++++++++++++++++ .../Client/BigtableTableAdminClientTest.php | 474 ++++++++++++++++++ 67 files changed, 6228 insertions(+), 96 deletions(-) create mode 100644 Bigtable/metadata/Admin/V2/Types.php create mode 100644 Bigtable/src/Admin/V2/AppProfile/DataBoostIsolationReadOnly.php create mode 100644 Bigtable/src/Admin/V2/AppProfile/DataBoostIsolationReadOnly/ComputeBillingOwner.php create mode 100644 Bigtable/src/Admin/V2/AuthorizedView.php create mode 100644 Bigtable/src/Admin/V2/AuthorizedView/FamilySubsets.php create mode 100644 Bigtable/src/Admin/V2/AuthorizedView/ResponseView.php create mode 100644 Bigtable/src/Admin/V2/AuthorizedView/SubsetView.php create mode 100644 Bigtable/src/Admin/V2/CreateAuthorizedViewMetadata.php create mode 100644 Bigtable/src/Admin/V2/CreateAuthorizedViewRequest.php create mode 100644 Bigtable/src/Admin/V2/DataBoostReadLocalWrites.php create mode 100644 Bigtable/src/Admin/V2/DeleteAuthorizedViewRequest.php create mode 100644 Bigtable/src/Admin/V2/GetAuthorizedViewRequest.php create mode 100644 Bigtable/src/Admin/V2/ListAuthorizedViewsRequest.php create mode 100644 Bigtable/src/Admin/V2/ListAuthorizedViewsResponse.php create mode 100644 Bigtable/src/Admin/V2/StandardReadRemoteWrites.php create mode 100644 Bigtable/src/Admin/V2/Table/AutomatedBackupPolicy.php create mode 100644 Bigtable/src/Admin/V2/Type.php create mode 100644 Bigtable/src/Admin/V2/Type/Aggregate.php create mode 100644 Bigtable/src/Admin/V2/Type/Aggregate/Sum.php create mode 100644 Bigtable/src/Admin/V2/Type/Bytes.php create mode 100644 Bigtable/src/Admin/V2/Type/Bytes/Encoding.php create mode 100644 Bigtable/src/Admin/V2/Type/Bytes/Encoding/Raw.php create mode 100644 Bigtable/src/Admin/V2/Type/Int64.php create mode 100644 Bigtable/src/Admin/V2/Type/Int64/Encoding.php create mode 100644 Bigtable/src/Admin/V2/Type/Int64/Encoding/BigEndianBytes.php create mode 100644 Bigtable/src/Admin/V2/UpdateAuthorizedViewMetadata.php create mode 100644 Bigtable/src/Admin/V2/UpdateAuthorizedViewRequest.php create mode 100644 Bigtable/src/V2/Mutation/AddToCell.php create mode 100644 Bigtable/src/V2/Value.php diff --git a/Bigtable/metadata/Admin/V2/BigtableTableAdmin.php b/Bigtable/metadata/Admin/V2/BigtableTableAdmin.php index 2019865274276e1f55a6ea2f5580a75adfc77fc6..979499d062a6aa9cfe426725348c324bf22ba963 100644 GIT binary patch delta 1929 zcma)7&rcIU6n5Gzu|o>&fU@oKqb$nLN@GD{5H(u}5(SAh{=!3D>;xOyZs~3zV!U|w z;`{+<)OaP-XuJ^5dO~m211284axaifQSYgq};pb697Ov_XT`a!CuDvNH(!8zT{N)*p!8EaPGn7UQTp95izb zEx>k~N{=rZhG~^}QpQ6)RiTlpGz(J{7-cxdGs{pFnrH)*(nbQS0Vp4ojGZ0CQ26Le zy2sV804kHT7Yl27>yeR5uH(e*BwmZ*l{_{rGzlBBdJbnS8PKxa(UD!v@lQL0hR82( z$5nd_>Vin$XNj*;ns_oHJ9waz2BK-$TmvYJ*3U#6v(rUci24n{c2R+I*wUGdXr5d@ z;Roj!L8}Nzwp*9a{{%2Fn=~zZ2J=W=&f9~~N$Ae%OE_*)t$1@TRw+Pj5c2Pqv5Ygk zFL&u+21-l|nGLon!YjRR=NyhN-?}1($Fr3cb2rYLiaLN&UyAY_ju{ zy_Ue}I{@V?xJH7C0vePudK%lO4EdBh?OdqR4x8(d+xbL&c8jl=ovo5z;0$KC1KPRl z8KSP~XxP_@WKNnt`H2ccQ2bl$JK6+dWeIPS^9<_us@ZuTBu7LnYZBcp+Sk zVQw_XYgZQS0N5h%CK_csNL~&|vR#wPngzJ^8DOvuP_nf;SJcY)4X^7G+OMm>wl1^{ zps&u)h+n^fy6&c&IjKcUf%J#IVnoFST>AbR~lT0Iy#7#Wqk zxrDLE38``^I{W(ugoe1rJ9+x}c>1}=`-l6v2E~W^1qZk~d%AhLx(F}`@p5r`_y>o? Y2RKFs3rI6MNpOk9V|C}|13Zc>04z{&5&!@I delta 32 ocmX@D@=$TZDJG_4(womPRk1U@VB74$wSaMQFwc$6T6~Hu0NF?j!vFvP diff --git a/Bigtable/metadata/Admin/V2/Table.php b/Bigtable/metadata/Admin/V2/Table.php index d433da322c08d6080e72f5dbca4b4fff2ecbb366..75bebeee9abedf00eb410ef93277a289e89d934f 100644 GIT binary patch delta 833 zcmZ`&-)qxQ6y8nJ+MISZy-wSvbj&)WI9Rdb7-J&sXsva)xlY-GETrwt45mq%ADdBz zFFuMe;@==X2vhpM_$ChKlTZ5-yh+uzGN10{JKy=vch0%@kg3IR;@Up+l-NIG&q{85vz$+H%yF~AJ z{ty0YB!mZVFPx(7YW5r(9Ya^ty~1e(l2rYfVW}@k_lZgla0)nG?vV_l4*5VPhMN$# z-L_2}X`eDO%pCGlk=fUiiHog}5@AVL{VSdBQ~`{gW?$i7*)qJkg$w{ z-z-WRD(pg13Cl>sUWUo>a@|jH;_82US)A}z(;dqbHNfMjk76@I4I=xp=8|AKbhAr= z>Yaa7$CK<8W*HS8L1K&8rlH#;9DW|MTea5a#=}-k@;}51c^)FwO6&fbz~C5g^~dY$ z0=x1F{j7XMu;8bKyf9e<@A#`iQE}w9M(on7@H{NZ6Dy|p2nbhtc;n&-35?j~D!6{1uUx@pfUtAPp%TQAPSR^0~?c21301rw!FLX6p@neI-PiQC!D?kofi z*FK9rgHJ%>jZfgUiSOXd?DmHs6zNST?RU<1zB%8Vjm_{Vgh!}FIgN;*F6y2laYRuV z1tM?)A9a&nk4DG|`XTdagb~`>M{o8I(Dv5e!9xj+gCugOiM$~2d|K@?Pmr!W5Vy~G z^|)3Qry-58CIsN5Pvej{6t&vcYbuCK1hHEhYg-xCZYr#OSgQj#K8a&=pg7<&Ao&TC zuFo743nJuKnZ+H(nP9|cpQQc<>JdMt5_!3{mvBe0fFlLi=MJqbqm)zCmcu~K+du;~ zZFL25e0z@z8gb&=TQqhe7K$Kh%Tm+ys2E7mb?Qp)e8S z`?qkta^oq0db8Qy2kjdpL-^sz)oev6ZTUXel(9Tj@#`f?0V#;Egy2vyKJf^9MO!KhTozbG6 YEDa-QB@M-~481Zxb!D1zXK)7a7fyvNNB{r; literal 0 HcmV?d00001 diff --git a/Bigtable/metadata/V2/Bigtable.php b/Bigtable/metadata/V2/Bigtable.php index 46871a7e8d4403c495628aef1896079dcc00a07e..1d67086c27bd722549a5db7261890f5ce37775bb 100644 GIT binary patch delta 1623 zcmeD3UKF{(g@vUjfJ^tiUzAyuni5}@ znOYv7mzbL>!KuKg!RciDz>)Enqb`^BWJUp5K1aC1Frd24jBISoEC(66L?$1U5Sc8; zDM7$U7J^1jW@HndT*&Fh)X6k?Cnq5%vJq#V99KHiMW)H^T-pTO$4ZoWo8NMsVPt7! z=8~A4CnGWWG(m3@4oQ%=H*4_LGP2BM;*y*!C@)Ebu|)e`X0su`9S8q=MJ^7f%=D7P zq?}Zt+su>e#KV{xnJ0f&&|{g!sAM^LowT8HQEFmJP=0x_6{A*Elv1dEnUQ`qTI!fA zD50vRj}QcIU6-FsX4=3wd7qTOW&-x~CFFt4U%r=|m&SSFvAjAUBQJXuXD zh-D6=k`>T_R??tgj8+Q672R2x-40Hzo#vH$=8 delta 390 zcmZ1!+2y^#g@xstBbVYtZ^g}-EUt`yls_@uWtzN7rG)7@<75R@Z$^*FxvCyWN?3L?aj8yTC8)ajk6H{f`)ejHvE=;R S$%Y)ln~Ss}7$=A7_yPbF9D>9E diff --git a/Bigtable/metadata/V2/Data.php b/Bigtable/metadata/V2/Data.php index eaa31e50f7461db573459e78d9e6951045bfa0a7..a2ec6ded5e7638d51a6a571eeb0f29a174d819f4 100644 GIT binary patch delta 310 zcmca6ds|_{3`V0E_W&o~)RM%M#FE4q_x$|yoYWY{g3K7V%+#C|r__wZvdsJ&g9$7EE0-n@=)2Ge$*nv4$n)l%@&^b8!|WmdBTYI1(HRj2b*13_@~T zA|Sz%%-q!ClEmDC_}t9oqWoeBPM|z9P#&l$Gp_`yi47v?#Ky&votc-inVb158`BQ9 z$xK|XVzyk|i76@ZCHe8msW~|ktU#sQMrxBca>=qfrlf@AZ+77FX5?JU$i)ffPS)d= zk~ZcNNY2kG&CQE1EKSVGOv_9yl3)UBl$`vLT~bs?hl>;LG6`mcjG&MP7i(r-L1~Eu M3qo{r7q<^H0A7e#cK`qY delta 46 zcmV+}0MY;3Al4nQm;sa10WSo=844YdOC7T#0we*mq672>0?7oEm diff --git a/Bigtable/metadata/V2/FeatureFlags.php b/Bigtable/metadata/V2/FeatureFlags.php index d8a9b49e8810..58d9e1e6bd5a 100644 --- a/Bigtable/metadata/V2/FeatureFlags.php +++ b/Bigtable/metadata/V2/FeatureFlags.php @@ -16,8 +16,8 @@ public static function initOnce() { } $pool->internalAddGeneratedFile( ' -½ -&google/bigtable/v2/feature_flags.protogoogle.bigtable.v2"¶ +â +&google/bigtable/v2/feature_flags.protogoogle.bigtable.v2"Û FeatureFlags reverse_scans ( mutate_rows_rate_limit ( @@ -25,7 +25,8 @@ public static function initOnce() { last_scanned_row_responses ( routing_cookie ( -retry_info (B½ +retry_info (# +client_side_metrics_enabled (B½ com.google.bigtable.v2BFeatureFlagsProtoPZ:google.golang.org/genproto/googleapis/bigtable/v2;bigtableªGoogle.Cloud.Bigtable.V2ÊGoogle\\Cloud\\Bigtable\\V2êGoogle::Cloud::Bigtable::V2bproto3' , true); diff --git a/Bigtable/samples/V2/BigtableClient/check_and_mutate_row.php b/Bigtable/samples/V2/BigtableClient/check_and_mutate_row.php index fb4975790576..ed92aa99764a 100644 --- a/Bigtable/samples/V2/BigtableClient/check_and_mutate_row.php +++ b/Bigtable/samples/V2/BigtableClient/check_and_mutate_row.php @@ -31,8 +31,10 @@ /** * Mutates a row atomically based on the output of a predicate Reader filter. * - * @param string $formattedTableName The unique name of the table to which the conditional mutation - * should be applied. Values are of the form + * @param string $formattedTableName Optional. The unique name of the table to which the conditional mutation + * should be applied. + * + * Values are of the form * `projects//instances//tables/`. Please see * {@see BigtableClient::tableName()} for help formatting this field. * @param string $rowKey The key of the row to which the conditional mutation should be diff --git a/Bigtable/samples/V2/BigtableClient/mutate_row.php b/Bigtable/samples/V2/BigtableClient/mutate_row.php index ed55ef62abc8..82463a5a0a50 100644 --- a/Bigtable/samples/V2/BigtableClient/mutate_row.php +++ b/Bigtable/samples/V2/BigtableClient/mutate_row.php @@ -33,8 +33,10 @@ * Mutates a row atomically. Cells already present in the row are left * unchanged unless explicitly changed by `mutation`. * - * @param string $formattedTableName The unique name of the table to which the mutation should be - * applied. Values are of the form + * @param string $formattedTableName Optional. The unique name of the table to which the mutation should be + * applied. + * + * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. * @param string $rowKey The key of the row to which the mutation should be applied. diff --git a/Bigtable/samples/V2/BigtableClient/mutate_rows.php b/Bigtable/samples/V2/BigtableClient/mutate_rows.php index 2878c05d7275..8045a69af565 100644 --- a/Bigtable/samples/V2/BigtableClient/mutate_rows.php +++ b/Bigtable/samples/V2/BigtableClient/mutate_rows.php @@ -36,8 +36,11 @@ * atomically as in MutateRow, but the entire batch is not executed * atomically. * - * @param string $formattedTableName The unique name of the table to which the mutations should be - * applied. Please see + * @param string $formattedTableName Optional. The unique name of the table to which the mutations should be + * applied. + * + * Values are of the form + * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. */ function mutate_rows_sample(string $formattedTableName): void diff --git a/Bigtable/samples/V2/BigtableClient/read_modify_write_row.php b/Bigtable/samples/V2/BigtableClient/read_modify_write_row.php index 751582cb04eb..b744a5c8a7ef 100644 --- a/Bigtable/samples/V2/BigtableClient/read_modify_write_row.php +++ b/Bigtable/samples/V2/BigtableClient/read_modify_write_row.php @@ -36,8 +36,10 @@ * timestamp is the greater of the existing timestamp or the current server * time. The method returns the new contents of all modified cells. * - * @param string $formattedTableName The unique name of the table to which the read/modify/write rules - * should be applied. Values are of the form + * @param string $formattedTableName Optional. The unique name of the table to which the read/modify/write rules + * should be applied. + * + * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. * @param string $rowKey The key of the row to which the read/modify/write rules should be diff --git a/Bigtable/samples/V2/BigtableClient/read_rows.php b/Bigtable/samples/V2/BigtableClient/read_rows.php index d0dd122b1458..d2a3d207af5d 100644 --- a/Bigtable/samples/V2/BigtableClient/read_rows.php +++ b/Bigtable/samples/V2/BigtableClient/read_rows.php @@ -36,7 +36,8 @@ * atomicity of each row will still be preserved. See the * ReadRowsResponse documentation for details. * - * @param string $formattedTableName The unique name of the table from which to read. + * @param string $formattedTableName Optional. The unique name of the table from which to read. + * * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. diff --git a/Bigtable/samples/V2/BigtableClient/sample_row_keys.php b/Bigtable/samples/V2/BigtableClient/sample_row_keys.php index cc3efa77f103..5dc763092979 100644 --- a/Bigtable/samples/V2/BigtableClient/sample_row_keys.php +++ b/Bigtable/samples/V2/BigtableClient/sample_row_keys.php @@ -35,7 +35,8 @@ * which can be used to break up the data for distributed tasks like * mapreduces. * - * @param string $formattedTableName The unique name of the table from which to sample row keys. + * @param string $formattedTableName Optional. The unique name of the table from which to sample row keys. + * * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. diff --git a/Bigtable/src/Admin/V2/AppProfile.php b/Bigtable/src/Admin/V2/AppProfile.php index 645c6ac2a02d..7dca81d1a909 100644 --- a/Bigtable/src/Admin/V2/AppProfile.php +++ b/Bigtable/src/Admin/V2/AppProfile.php @@ -76,6 +76,9 @@ class AppProfile extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\Bigtable\Admin\V2\AppProfile\StandardIsolation $standard_isolation * The standard options used for isolating this app profile's traffic from * other use cases. + * @type \Google\Cloud\Bigtable\Admin\V2\AppProfile\DataBoostIsolationReadOnly $data_boost_isolation_read_only + * Specifies that this app profile is intended for read-only usage via the + * Data Boost feature. * } */ public function __construct($data = NULL) { @@ -312,6 +315,39 @@ public function setStandardIsolation($var) return $this; } + /** + * Specifies that this app profile is intended for read-only usage via the + * Data Boost feature. + * + * Generated from protobuf field .google.bigtable.admin.v2.AppProfile.DataBoostIsolationReadOnly data_boost_isolation_read_only = 10; + * @return \Google\Cloud\Bigtable\Admin\V2\AppProfile\DataBoostIsolationReadOnly|null + */ + public function getDataBoostIsolationReadOnly() + { + return $this->readOneof(10); + } + + public function hasDataBoostIsolationReadOnly() + { + return $this->hasOneof(10); + } + + /** + * Specifies that this app profile is intended for read-only usage via the + * Data Boost feature. + * + * Generated from protobuf field .google.bigtable.admin.v2.AppProfile.DataBoostIsolationReadOnly data_boost_isolation_read_only = 10; + * @param \Google\Cloud\Bigtable\Admin\V2\AppProfile\DataBoostIsolationReadOnly $var + * @return $this + */ + public function setDataBoostIsolationReadOnly($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\AppProfile\DataBoostIsolationReadOnly::class); + $this->writeOneof(10, $var); + + return $this; + } + /** * @return string */ diff --git a/Bigtable/src/Admin/V2/AppProfile/DataBoostIsolationReadOnly.php b/Bigtable/src/Admin/V2/AppProfile/DataBoostIsolationReadOnly.php new file mode 100644 index 000000000000..981244776615 --- /dev/null +++ b/Bigtable/src/Admin/V2/AppProfile/DataBoostIsolationReadOnly.php @@ -0,0 +1,90 @@ +google.bigtable.admin.v2.AppProfile.DataBoostIsolationReadOnly + */ +class DataBoostIsolationReadOnly extends \Google\Protobuf\Internal\Message +{ + /** + * The Compute Billing Owner for this Data Boost App Profile. + * + * Generated from protobuf field optional .google.bigtable.admin.v2.AppProfile.DataBoostIsolationReadOnly.ComputeBillingOwner compute_billing_owner = 1; + */ + private $compute_billing_owner = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $compute_billing_owner + * The Compute Billing Owner for this Data Boost App Profile. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Instance::initOnce(); + parent::__construct($data); + } + + /** + * The Compute Billing Owner for this Data Boost App Profile. + * + * Generated from protobuf field optional .google.bigtable.admin.v2.AppProfile.DataBoostIsolationReadOnly.ComputeBillingOwner compute_billing_owner = 1; + * @return int + */ + public function getComputeBillingOwner() + { + return isset($this->compute_billing_owner) ? $this->compute_billing_owner : 0; + } + + public function hasComputeBillingOwner() + { + return isset($this->compute_billing_owner); + } + + public function clearComputeBillingOwner() + { + unset($this->compute_billing_owner); + } + + /** + * The Compute Billing Owner for this Data Boost App Profile. + * + * Generated from protobuf field optional .google.bigtable.admin.v2.AppProfile.DataBoostIsolationReadOnly.ComputeBillingOwner compute_billing_owner = 1; + * @param int $var + * @return $this + */ + public function setComputeBillingOwner($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Bigtable\Admin\V2\AppProfile\DataBoostIsolationReadOnly\ComputeBillingOwner::class); + $this->compute_billing_owner = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(DataBoostIsolationReadOnly::class, \Google\Cloud\Bigtable\Admin\V2\AppProfile_DataBoostIsolationReadOnly::class); + diff --git a/Bigtable/src/Admin/V2/AppProfile/DataBoostIsolationReadOnly/ComputeBillingOwner.php b/Bigtable/src/Admin/V2/AppProfile/DataBoostIsolationReadOnly/ComputeBillingOwner.php new file mode 100644 index 000000000000..7da3c3942452 --- /dev/null +++ b/Bigtable/src/Admin/V2/AppProfile/DataBoostIsolationReadOnly/ComputeBillingOwner.php @@ -0,0 +1,60 @@ +google.bigtable.admin.v2.AppProfile.DataBoostIsolationReadOnly.ComputeBillingOwner + */ +class ComputeBillingOwner +{ + /** + * Unspecified value. + * + * Generated from protobuf enum COMPUTE_BILLING_OWNER_UNSPECIFIED = 0; + */ + const COMPUTE_BILLING_OWNER_UNSPECIFIED = 0; + /** + * The host Cloud Project containing the targeted Bigtable Instance / + * Table pays for compute. + * + * Generated from protobuf enum HOST_PAYS = 1; + */ + const HOST_PAYS = 1; + + private static $valueToName = [ + self::COMPUTE_BILLING_OWNER_UNSPECIFIED => 'COMPUTE_BILLING_OWNER_UNSPECIFIED', + self::HOST_PAYS => 'HOST_PAYS', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ComputeBillingOwner::class, \Google\Cloud\Bigtable\Admin\V2\AppProfile_DataBoostIsolationReadOnly_ComputeBillingOwner::class); + diff --git a/Bigtable/src/Admin/V2/AuthorizedView.php b/Bigtable/src/Admin/V2/AuthorizedView.php new file mode 100644 index 000000000000..f891a683d9f6 --- /dev/null +++ b/Bigtable/src/Admin/V2/AuthorizedView.php @@ -0,0 +1,203 @@ +google.bigtable.admin.v2.AuthorizedView + */ +class AuthorizedView extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The name of this AuthorizedView. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + private $name = ''; + /** + * The etag for this AuthorizedView. + * If this is provided on update, it must match the server's etag. The server + * returns ABORTED error on a mismatched etag. + * + * Generated from protobuf field string etag = 3; + */ + private $etag = ''; + /** + * Set to true to make the AuthorizedView protected against deletion. + * The parent Table and containing Instance cannot be deleted if an + * AuthorizedView has this bit set. + * + * Generated from protobuf field bool deletion_protection = 4; + */ + private $deletion_protection = false; + protected $authorized_view; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The name of this AuthorizedView. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}` + * @type \Google\Cloud\Bigtable\Admin\V2\AuthorizedView\SubsetView $subset_view + * An AuthorizedView permitting access to an explicit subset of a Table. + * @type string $etag + * The etag for this AuthorizedView. + * If this is provided on update, it must match the server's etag. The server + * returns ABORTED error on a mismatched etag. + * @type bool $deletion_protection + * Set to true to make the AuthorizedView protected against deletion. + * The parent Table and containing Instance cannot be deleted if an + * AuthorizedView has this bit set. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Table::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The name of this AuthorizedView. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The name of this AuthorizedView. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}` + * + * 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; + } + + /** + * An AuthorizedView permitting access to an explicit subset of a Table. + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView.SubsetView subset_view = 2; + * @return \Google\Cloud\Bigtable\Admin\V2\AuthorizedView\SubsetView|null + */ + public function getSubsetView() + { + return $this->readOneof(2); + } + + public function hasSubsetView() + { + return $this->hasOneof(2); + } + + /** + * An AuthorizedView permitting access to an explicit subset of a Table. + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView.SubsetView subset_view = 2; + * @param \Google\Cloud\Bigtable\Admin\V2\AuthorizedView\SubsetView $var + * @return $this + */ + public function setSubsetView($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\AuthorizedView\SubsetView::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The etag for this AuthorizedView. + * If this is provided on update, it must match the server's etag. The server + * returns ABORTED error on a mismatched etag. + * + * Generated from protobuf field string etag = 3; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * The etag for this AuthorizedView. + * If this is provided on update, it must match the server's etag. The server + * returns ABORTED error on a mismatched etag. + * + * Generated from protobuf field string etag = 3; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + + /** + * Set to true to make the AuthorizedView protected against deletion. + * The parent Table and containing Instance cannot be deleted if an + * AuthorizedView has this bit set. + * + * Generated from protobuf field bool deletion_protection = 4; + * @return bool + */ + public function getDeletionProtection() + { + return $this->deletion_protection; + } + + /** + * Set to true to make the AuthorizedView protected against deletion. + * The parent Table and containing Instance cannot be deleted if an + * AuthorizedView has this bit set. + * + * Generated from protobuf field bool deletion_protection = 4; + * @param bool $var + * @return $this + */ + public function setDeletionProtection($var) + { + GPBUtil::checkBool($var); + $this->deletion_protection = $var; + + return $this; + } + + /** + * @return string + */ + public function getAuthorizedView() + { + return $this->whichOneof("authorized_view"); + } + +} + diff --git a/Bigtable/src/Admin/V2/AuthorizedView/FamilySubsets.php b/Bigtable/src/Admin/V2/AuthorizedView/FamilySubsets.php new file mode 100644 index 000000000000..3a6359fca96d --- /dev/null +++ b/Bigtable/src/Admin/V2/AuthorizedView/FamilySubsets.php @@ -0,0 +1,120 @@ +google.bigtable.admin.v2.AuthorizedView.FamilySubsets + */ +class FamilySubsets extends \Google\Protobuf\Internal\Message +{ + /** + * Individual exact column qualifiers to be included in the AuthorizedView. + * + * Generated from protobuf field repeated bytes qualifiers = 1; + */ + private $qualifiers; + /** + * Prefixes for qualifiers to be included in the AuthorizedView. Every + * qualifier starting with one of these prefixes is included in the + * AuthorizedView. To provide access to all qualifiers, include the empty + * string as a prefix + * (""). + * + * Generated from protobuf field repeated bytes qualifier_prefixes = 2; + */ + private $qualifier_prefixes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $qualifiers + * Individual exact column qualifiers to be included in the AuthorizedView. + * @type array|\Google\Protobuf\Internal\RepeatedField $qualifier_prefixes + * Prefixes for qualifiers to be included in the AuthorizedView. Every + * qualifier starting with one of these prefixes is included in the + * AuthorizedView. To provide access to all qualifiers, include the empty + * string as a prefix + * (""). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Table::initOnce(); + parent::__construct($data); + } + + /** + * Individual exact column qualifiers to be included in the AuthorizedView. + * + * Generated from protobuf field repeated bytes qualifiers = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getQualifiers() + { + return $this->qualifiers; + } + + /** + * Individual exact column qualifiers to be included in the AuthorizedView. + * + * Generated from protobuf field repeated bytes qualifiers = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setQualifiers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BYTES); + $this->qualifiers = $arr; + + return $this; + } + + /** + * Prefixes for qualifiers to be included in the AuthorizedView. Every + * qualifier starting with one of these prefixes is included in the + * AuthorizedView. To provide access to all qualifiers, include the empty + * string as a prefix + * (""). + * + * Generated from protobuf field repeated bytes qualifier_prefixes = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getQualifierPrefixes() + { + return $this->qualifier_prefixes; + } + + /** + * Prefixes for qualifiers to be included in the AuthorizedView. Every + * qualifier starting with one of these prefixes is included in the + * AuthorizedView. To provide access to all qualifiers, include the empty + * string as a prefix + * (""). + * + * Generated from protobuf field repeated bytes qualifier_prefixes = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setQualifierPrefixes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BYTES); + $this->qualifier_prefixes = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(FamilySubsets::class, \Google\Cloud\Bigtable\Admin\V2\AuthorizedView_FamilySubsets::class); + diff --git a/Bigtable/src/Admin/V2/AuthorizedView/ResponseView.php b/Bigtable/src/Admin/V2/AuthorizedView/ResponseView.php new file mode 100644 index 000000000000..de81a7c072d4 --- /dev/null +++ b/Bigtable/src/Admin/V2/AuthorizedView/ResponseView.php @@ -0,0 +1,72 @@ +google.bigtable.admin.v2.AuthorizedView.ResponseView + */ +class ResponseView +{ + /** + * Uses the default view for each method as documented in the request. + * + * Generated from protobuf enum RESPONSE_VIEW_UNSPECIFIED = 0; + */ + const RESPONSE_VIEW_UNSPECIFIED = 0; + /** + * Only populates `name`. + * + * Generated from protobuf enum NAME_ONLY = 1; + */ + const NAME_ONLY = 1; + /** + * Only populates the AuthorizedView's basic metadata. This includes: + * name, deletion_protection, etag. + * + * Generated from protobuf enum BASIC = 2; + */ + const BASIC = 2; + /** + * Populates every fields. + * + * Generated from protobuf enum FULL = 3; + */ + const FULL = 3; + + private static $valueToName = [ + self::RESPONSE_VIEW_UNSPECIFIED => 'RESPONSE_VIEW_UNSPECIFIED', + self::NAME_ONLY => 'NAME_ONLY', + self::BASIC => 'BASIC', + self::FULL => 'FULL', + ]; + + 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); + } +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ResponseView::class, \Google\Cloud\Bigtable\Admin\V2\AuthorizedView_ResponseView::class); + diff --git a/Bigtable/src/Admin/V2/AuthorizedView/SubsetView.php b/Bigtable/src/Admin/V2/AuthorizedView/SubsetView.php new file mode 100644 index 000000000000..e20712a5b644 --- /dev/null +++ b/Bigtable/src/Admin/V2/AuthorizedView/SubsetView.php @@ -0,0 +1,112 @@ +google.bigtable.admin.v2.AuthorizedView.SubsetView + */ +class SubsetView extends \Google\Protobuf\Internal\Message +{ + /** + * Row prefixes to be included in the AuthorizedView. + * To provide access to all rows, include the empty string as a prefix (""). + * + * Generated from protobuf field repeated bytes row_prefixes = 1; + */ + private $row_prefixes; + /** + * Map from column family name to the columns in this family to be included + * in the AuthorizedView. + * + * Generated from protobuf field map family_subsets = 2; + */ + private $family_subsets; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $row_prefixes + * Row prefixes to be included in the AuthorizedView. + * To provide access to all rows, include the empty string as a prefix (""). + * @type array|\Google\Protobuf\Internal\MapField $family_subsets + * Map from column family name to the columns in this family to be included + * in the AuthorizedView. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Table::initOnce(); + parent::__construct($data); + } + + /** + * Row prefixes to be included in the AuthorizedView. + * To provide access to all rows, include the empty string as a prefix (""). + * + * Generated from protobuf field repeated bytes row_prefixes = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRowPrefixes() + { + return $this->row_prefixes; + } + + /** + * Row prefixes to be included in the AuthorizedView. + * To provide access to all rows, include the empty string as a prefix (""). + * + * Generated from protobuf field repeated bytes row_prefixes = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRowPrefixes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BYTES); + $this->row_prefixes = $arr; + + return $this; + } + + /** + * Map from column family name to the columns in this family to be included + * in the AuthorizedView. + * + * Generated from protobuf field map family_subsets = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getFamilySubsets() + { + return $this->family_subsets; + } + + /** + * Map from column family name to the columns in this family to be included + * in the AuthorizedView. + * + * Generated from protobuf field map family_subsets = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setFamilySubsets($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\Admin\V2\AuthorizedView\FamilySubsets::class); + $this->family_subsets = $arr; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SubsetView::class, \Google\Cloud\Bigtable\Admin\V2\AuthorizedView_SubsetView::class); + diff --git a/Bigtable/src/Admin/V2/CheckConsistencyRequest.php b/Bigtable/src/Admin/V2/CheckConsistencyRequest.php index 5e042b56f355..1a96e4a2a4af 100644 --- a/Bigtable/src/Admin/V2/CheckConsistencyRequest.php +++ b/Bigtable/src/Admin/V2/CheckConsistencyRequest.php @@ -30,6 +30,7 @@ class CheckConsistencyRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field string consistency_token = 2 [(.google.api.field_behavior) = REQUIRED]; */ private $consistency_token = ''; + protected $mode; /** * @param string $name Required. The unique name of the Table for which to check replication @@ -61,6 +62,14 @@ public static function build(string $name, string $consistencyToken): self * `projects/{project}/instances/{instance}/tables/{table}`. * @type string $consistency_token * Required. The token created using GenerateConsistencyToken for the Table. + * @type \Google\Cloud\Bigtable\Admin\V2\StandardReadRemoteWrites $standard_read_remote_writes + * Checks that reads using an app profile with `StandardIsolation` can + * see all writes committed before the token was created, even if the + * read and write target different clusters. + * @type \Google\Cloud\Bigtable\Admin\V2\DataBoostReadLocalWrites $data_boost_read_local_writes + * Checks that reads using an app profile with `DataBoostIsolationReadOnly` + * can see all writes committed before the token was created, but only if + * the read and write target the same cluster. * } */ public function __construct($data = NULL) { @@ -124,5 +133,83 @@ public function setConsistencyToken($var) return $this; } + /** + * Checks that reads using an app profile with `StandardIsolation` can + * see all writes committed before the token was created, even if the + * read and write target different clusters. + * + * Generated from protobuf field .google.bigtable.admin.v2.StandardReadRemoteWrites standard_read_remote_writes = 3; + * @return \Google\Cloud\Bigtable\Admin\V2\StandardReadRemoteWrites|null + */ + public function getStandardReadRemoteWrites() + { + return $this->readOneof(3); + } + + public function hasStandardReadRemoteWrites() + { + return $this->hasOneof(3); + } + + /** + * Checks that reads using an app profile with `StandardIsolation` can + * see all writes committed before the token was created, even if the + * read and write target different clusters. + * + * Generated from protobuf field .google.bigtable.admin.v2.StandardReadRemoteWrites standard_read_remote_writes = 3; + * @param \Google\Cloud\Bigtable\Admin\V2\StandardReadRemoteWrites $var + * @return $this + */ + public function setStandardReadRemoteWrites($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\StandardReadRemoteWrites::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Checks that reads using an app profile with `DataBoostIsolationReadOnly` + * can see all writes committed before the token was created, but only if + * the read and write target the same cluster. + * + * Generated from protobuf field .google.bigtable.admin.v2.DataBoostReadLocalWrites data_boost_read_local_writes = 4; + * @return \Google\Cloud\Bigtable\Admin\V2\DataBoostReadLocalWrites|null + */ + public function getDataBoostReadLocalWrites() + { + return $this->readOneof(4); + } + + public function hasDataBoostReadLocalWrites() + { + return $this->hasOneof(4); + } + + /** + * Checks that reads using an app profile with `DataBoostIsolationReadOnly` + * can see all writes committed before the token was created, but only if + * the read and write target the same cluster. + * + * Generated from protobuf field .google.bigtable.admin.v2.DataBoostReadLocalWrites data_boost_read_local_writes = 4; + * @param \Google\Cloud\Bigtable\Admin\V2\DataBoostReadLocalWrites $var + * @return $this + */ + public function setDataBoostReadLocalWrites($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\DataBoostReadLocalWrites::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getMode() + { + return $this->whichOneof("mode"); + } + } diff --git a/Bigtable/src/Admin/V2/Client/BigtableTableAdminClient.php b/Bigtable/src/Admin/V2/Client/BigtableTableAdminClient.php index 3ab2c55688d5..2bad059c5935 100644 --- a/Bigtable/src/Admin/V2/Client/BigtableTableAdminClient.php +++ b/Bigtable/src/Admin/V2/Client/BigtableTableAdminClient.php @@ -35,23 +35,28 @@ use Google\ApiCore\Transport\TransportInterface; use Google\ApiCore\ValidationException; use Google\Auth\FetchAuthTokenInterface; +use Google\Cloud\Bigtable\Admin\V2\AuthorizedView; use Google\Cloud\Bigtable\Admin\V2\Backup; use Google\Cloud\Bigtable\Admin\V2\CheckConsistencyRequest; use Google\Cloud\Bigtable\Admin\V2\CheckConsistencyResponse; use Google\Cloud\Bigtable\Admin\V2\CopyBackupRequest; +use Google\Cloud\Bigtable\Admin\V2\CreateAuthorizedViewRequest; use Google\Cloud\Bigtable\Admin\V2\CreateBackupMetadata; use Google\Cloud\Bigtable\Admin\V2\CreateBackupRequest; use Google\Cloud\Bigtable\Admin\V2\CreateTableFromSnapshotRequest; use Google\Cloud\Bigtable\Admin\V2\CreateTableRequest; +use Google\Cloud\Bigtable\Admin\V2\DeleteAuthorizedViewRequest; use Google\Cloud\Bigtable\Admin\V2\DeleteBackupRequest; use Google\Cloud\Bigtable\Admin\V2\DeleteSnapshotRequest; use Google\Cloud\Bigtable\Admin\V2\DeleteTableRequest; use Google\Cloud\Bigtable\Admin\V2\DropRowRangeRequest; use Google\Cloud\Bigtable\Admin\V2\GenerateConsistencyTokenRequest; use Google\Cloud\Bigtable\Admin\V2\GenerateConsistencyTokenResponse; +use Google\Cloud\Bigtable\Admin\V2\GetAuthorizedViewRequest; use Google\Cloud\Bigtable\Admin\V2\GetBackupRequest; use Google\Cloud\Bigtable\Admin\V2\GetSnapshotRequest; use Google\Cloud\Bigtable\Admin\V2\GetTableRequest; +use Google\Cloud\Bigtable\Admin\V2\ListAuthorizedViewsRequest; use Google\Cloud\Bigtable\Admin\V2\ListBackupsRequest; use Google\Cloud\Bigtable\Admin\V2\ListSnapshotsRequest; use Google\Cloud\Bigtable\Admin\V2\ListTablesRequest; @@ -62,6 +67,7 @@ use Google\Cloud\Bigtable\Admin\V2\SnapshotTableRequest; use Google\Cloud\Bigtable\Admin\V2\Table; use Google\Cloud\Bigtable\Admin\V2\UndeleteTableRequest; +use Google\Cloud\Bigtable\Admin\V2\UpdateAuthorizedViewRequest; use Google\Cloud\Bigtable\Admin\V2\UpdateBackupRequest; use Google\Cloud\Bigtable\Admin\V2\UpdateTableRequest; use Google\Cloud\Iam\V1\GetIamPolicyRequest; @@ -89,18 +95,22 @@ * * @method PromiseInterface checkConsistencyAsync(CheckConsistencyRequest $request, array $optionalArgs = []) * @method PromiseInterface copyBackupAsync(CopyBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface createAuthorizedViewAsync(CreateAuthorizedViewRequest $request, array $optionalArgs = []) * @method PromiseInterface createBackupAsync(CreateBackupRequest $request, array $optionalArgs = []) * @method PromiseInterface createTableAsync(CreateTableRequest $request, array $optionalArgs = []) * @method PromiseInterface createTableFromSnapshotAsync(CreateTableFromSnapshotRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteAuthorizedViewAsync(DeleteAuthorizedViewRequest $request, array $optionalArgs = []) * @method PromiseInterface deleteBackupAsync(DeleteBackupRequest $request, array $optionalArgs = []) * @method PromiseInterface deleteSnapshotAsync(DeleteSnapshotRequest $request, array $optionalArgs = []) * @method PromiseInterface deleteTableAsync(DeleteTableRequest $request, array $optionalArgs = []) * @method PromiseInterface dropRowRangeAsync(DropRowRangeRequest $request, array $optionalArgs = []) * @method PromiseInterface generateConsistencyTokenAsync(GenerateConsistencyTokenRequest $request, array $optionalArgs = []) + * @method PromiseInterface getAuthorizedViewAsync(GetAuthorizedViewRequest $request, array $optionalArgs = []) * @method PromiseInterface getBackupAsync(GetBackupRequest $request, array $optionalArgs = []) * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) * @method PromiseInterface getSnapshotAsync(GetSnapshotRequest $request, array $optionalArgs = []) * @method PromiseInterface getTableAsync(GetTableRequest $request, array $optionalArgs = []) + * @method PromiseInterface listAuthorizedViewsAsync(ListAuthorizedViewsRequest $request, array $optionalArgs = []) * @method PromiseInterface listBackupsAsync(ListBackupsRequest $request, array $optionalArgs = []) * @method PromiseInterface listSnapshotsAsync(ListSnapshotsRequest $request, array $optionalArgs = []) * @method PromiseInterface listTablesAsync(ListTablesRequest $request, array $optionalArgs = []) @@ -110,6 +120,7 @@ * @method PromiseInterface snapshotTableAsync(SnapshotTableRequest $request, array $optionalArgs = []) * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) * @method PromiseInterface undeleteTableAsync(UndeleteTableRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateAuthorizedViewAsync(UpdateAuthorizedViewRequest $request, array $optionalArgs = []) * @method PromiseInterface updateBackupAsync(UpdateBackupRequest $request, array $optionalArgs = []) * @method PromiseInterface updateTableAsync(UpdateTableRequest $request, array $optionalArgs = []) */ @@ -197,6 +208,27 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Formats a string containing the fully-qualified path to represent a + * authorized_view resource. + * + * @param string $project + * @param string $instance + * @param string $table + * @param string $authorizedView + * + * @return string The formatted authorized_view resource. + */ + public static function authorizedViewName(string $project, string $instance, string $table, string $authorizedView): string + { + return self::getPathTemplate('authorizedView')->render([ + 'project' => $project, + 'instance' => $instance, + 'table' => $table, + 'authorized_view' => $authorizedView, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a backup * resource. @@ -321,6 +353,7 @@ public static function tableName(string $project, string $instance, string $tabl * Parses a formatted name string and returns an associative array of the components in the name. * The following name formats are supported: * Template: Pattern + * - authorizedView: projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view} * - backup: projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup} * - cluster: projects/{project}/instances/{instance}/clusters/{cluster} * - cryptoKeyVersion: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version} @@ -473,6 +506,33 @@ public function copyBackup(CopyBackupRequest $request, array $callOptions = []): return $this->startApiCall('CopyBackup', $request, $callOptions)->wait(); } + /** + * Creates a new AuthorizedView in a table. + * + * The async variant is + * {@see BigtableTableAdminClient::createAuthorizedViewAsync()} . + * + * @example samples/V2/BigtableTableAdminClient/create_authorized_view.php + * + * @param CreateAuthorizedViewRequest $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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function createAuthorizedView(CreateAuthorizedViewRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateAuthorizedView', $request, $callOptions)->wait(); + } + /** * Starts creating a new Cloud Bigtable Backup. The returned backup * [long-running operation][google.longrunning.Operation] can be used to @@ -568,6 +628,31 @@ public function createTableFromSnapshot(CreateTableFromSnapshotRequest $request, return $this->startApiCall('CreateTableFromSnapshot', $request, $callOptions)->wait(); } + /** + * Permanently deletes a specified AuthorizedView. + * + * The async variant is + * {@see BigtableTableAdminClient::deleteAuthorizedViewAsync()} . + * + * @example samples/V2/BigtableTableAdminClient/delete_authorized_view.php + * + * @param DeleteAuthorizedViewRequest $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 deleteAuthorizedView(DeleteAuthorizedViewRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteAuthorizedView', $request, $callOptions)->wait(); + } + /** * Deletes a pending or completed Cloud Bigtable backup. * @@ -702,6 +787,32 @@ public function generateConsistencyToken(GenerateConsistencyTokenRequest $reques return $this->startApiCall('GenerateConsistencyToken', $request, $callOptions)->wait(); } + /** + * Gets information from a specified AuthorizedView. + * + * The async variant is {@see BigtableTableAdminClient::getAuthorizedViewAsync()} . + * + * @example samples/V2/BigtableTableAdminClient/get_authorized_view.php + * + * @param GetAuthorizedViewRequest $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 AuthorizedView + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAuthorizedView(GetAuthorizedViewRequest $request, array $callOptions = []): AuthorizedView + { + return $this->startApiCall('GetAuthorizedView', $request, $callOptions)->wait(); + } + /** * Gets metadata on a pending or completed Cloud Bigtable Backup. * @@ -814,6 +925,33 @@ public function getTable(GetTableRequest $request, array $callOptions = []): Tab return $this->startApiCall('GetTable', $request, $callOptions)->wait(); } + /** + * Lists all AuthorizedViews from a specific table. + * + * The async variant is {@see BigtableTableAdminClient::listAuthorizedViewsAsync()} + * . + * + * @example samples/V2/BigtableTableAdminClient/list_authorized_views.php + * + * @param ListAuthorizedViewsRequest $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 listAuthorizedViews(ListAuthorizedViewsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListAuthorizedViews', $request, $callOptions); + } + /** * Lists Cloud Bigtable backups. Returns both completed and pending * backups. @@ -1075,6 +1213,33 @@ public function undeleteTable(UndeleteTableRequest $request, array $callOptions return $this->startApiCall('UndeleteTable', $request, $callOptions)->wait(); } + /** + * Updates an AuthorizedView in a table. + * + * The async variant is + * {@see BigtableTableAdminClient::updateAuthorizedViewAsync()} . + * + * @example samples/V2/BigtableTableAdminClient/update_authorized_view.php + * + * @param UpdateAuthorizedViewRequest $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 OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateAuthorizedView(UpdateAuthorizedViewRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateAuthorizedView', $request, $callOptions)->wait(); + } + /** * Updates a pending or completed Cloud Bigtable Backup. * diff --git a/Bigtable/src/Admin/V2/ColumnFamily.php b/Bigtable/src/Admin/V2/ColumnFamily.php index 01a5ddd98e54..a4a7bcdb8539 100644 --- a/Bigtable/src/Admin/V2/ColumnFamily.php +++ b/Bigtable/src/Admin/V2/ColumnFamily.php @@ -25,6 +25,17 @@ class ColumnFamily extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.bigtable.admin.v2.GcRule gc_rule = 1; */ private $gc_rule = null; + /** + * The type of data stored in each of this family's cell values, including its + * full encoding. If omitted, the family only serves raw untyped bytes. + * For now, only the `Aggregate` type is supported. + * `Aggregate` can only be set at family creation and is immutable afterwards. + * If `value_type` is `Aggregate`, written data must be compatible with: + * * `value_type.input_type` for `AddInput` mutations + * + * Generated from protobuf field .google.bigtable.admin.v2.Type value_type = 3; + */ + private $value_type = null; /** * Constructor. @@ -38,6 +49,13 @@ class ColumnFamily extends \Google\Protobuf\Internal\Message * NOTE: Garbage collection executes opportunistically in the background, and * so it's possible for reads to return a cell even if it matches the active * GC expression for its family. + * @type \Google\Cloud\Bigtable\Admin\V2\Type $value_type + * The type of data stored in each of this family's cell values, including its + * full encoding. If omitted, the family only serves raw untyped bytes. + * For now, only the `Aggregate` type is supported. + * `Aggregate` can only be set at family creation and is immutable afterwards. + * If `value_type` is `Aggregate`, written data must be compatible with: + * * `value_type.input_type` for `AddInput` mutations * } */ public function __construct($data = NULL) { @@ -89,5 +107,51 @@ public function setGcRule($var) return $this; } + /** + * The type of data stored in each of this family's cell values, including its + * full encoding. If omitted, the family only serves raw untyped bytes. + * For now, only the `Aggregate` type is supported. + * `Aggregate` can only be set at family creation and is immutable afterwards. + * If `value_type` is `Aggregate`, written data must be compatible with: + * * `value_type.input_type` for `AddInput` mutations + * + * Generated from protobuf field .google.bigtable.admin.v2.Type value_type = 3; + * @return \Google\Cloud\Bigtable\Admin\V2\Type|null + */ + public function getValueType() + { + return $this->value_type; + } + + public function hasValueType() + { + return isset($this->value_type); + } + + public function clearValueType() + { + unset($this->value_type); + } + + /** + * The type of data stored in each of this family's cell values, including its + * full encoding. If omitted, the family only serves raw untyped bytes. + * For now, only the `Aggregate` type is supported. + * `Aggregate` can only be set at family creation and is immutable afterwards. + * If `value_type` is `Aggregate`, written data must be compatible with: + * * `value_type.input_type` for `AddInput` mutations + * + * Generated from protobuf field .google.bigtable.admin.v2.Type value_type = 3; + * @param \Google\Cloud\Bigtable\Admin\V2\Type $var + * @return $this + */ + public function setValueType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type::class); + $this->value_type = $var; + + return $this; + } + } diff --git a/Bigtable/src/Admin/V2/CreateAuthorizedViewMetadata.php b/Bigtable/src/Admin/V2/CreateAuthorizedViewMetadata.php new file mode 100644 index 000000000000..d2a0d15a4087 --- /dev/null +++ b/Bigtable/src/Admin/V2/CreateAuthorizedViewMetadata.php @@ -0,0 +1,165 @@ +google.bigtable.admin.v2.CreateAuthorizedViewMetadata + */ +class CreateAuthorizedViewMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The request that prompted the initiation of this CreateInstance operation. + * + * Generated from protobuf field .google.bigtable.admin.v2.CreateAuthorizedViewRequest original_request = 1; + */ + private $original_request = null; + /** + * The time at which the original request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp request_time = 2; + */ + private $request_time = null; + /** + * The time at which the operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp finish_time = 3; + */ + private $finish_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\Admin\V2\CreateAuthorizedViewRequest $original_request + * The request that prompted the initiation of this CreateInstance operation. + * @type \Google\Protobuf\Timestamp $request_time + * The time at which the original request was received. + * @type \Google\Protobuf\Timestamp $finish_time + * The time at which the operation failed or was completed successfully. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\BigtableTableAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The request that prompted the initiation of this CreateInstance operation. + * + * Generated from protobuf field .google.bigtable.admin.v2.CreateAuthorizedViewRequest original_request = 1; + * @return \Google\Cloud\Bigtable\Admin\V2\CreateAuthorizedViewRequest|null + */ + public function getOriginalRequest() + { + return $this->original_request; + } + + public function hasOriginalRequest() + { + return isset($this->original_request); + } + + public function clearOriginalRequest() + { + unset($this->original_request); + } + + /** + * The request that prompted the initiation of this CreateInstance operation. + * + * Generated from protobuf field .google.bigtable.admin.v2.CreateAuthorizedViewRequest original_request = 1; + * @param \Google\Cloud\Bigtable\Admin\V2\CreateAuthorizedViewRequest $var + * @return $this + */ + public function setOriginalRequest($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\CreateAuthorizedViewRequest::class); + $this->original_request = $var; + + return $this; + } + + /** + * The time at which the original request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp request_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getRequestTime() + { + return $this->request_time; + } + + public function hasRequestTime() + { + return isset($this->request_time); + } + + public function clearRequestTime() + { + unset($this->request_time); + } + + /** + * The time at which the original request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp request_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setRequestTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->request_time = $var; + + return $this; + } + + /** + * The time at which the operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp finish_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getFinishTime() + { + return $this->finish_time; + } + + public function hasFinishTime() + { + return isset($this->finish_time); + } + + public function clearFinishTime() + { + unset($this->finish_time); + } + + /** + * The time at which the operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp finish_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setFinishTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->finish_time = $var; + + return $this; + } + +} + diff --git a/Bigtable/src/Admin/V2/CreateAuthorizedViewRequest.php b/Bigtable/src/Admin/V2/CreateAuthorizedViewRequest.php new file mode 100644 index 000000000000..e3971ef2ea32 --- /dev/null +++ b/Bigtable/src/Admin/V2/CreateAuthorizedViewRequest.php @@ -0,0 +1,189 @@ +google.bigtable.admin.v2.CreateAuthorizedViewRequest + */ +class CreateAuthorizedViewRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. This is the name of the table the AuthorizedView belongs to. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * Required. The id of the AuthorizedView to create. This AuthorizedView must + * not already exist. The `authorized_view_id` appended to `parent` forms the + * full AuthorizedView name of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedView/{authorized_view}`. + * + * Generated from protobuf field string authorized_view_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $authorized_view_id = ''; + /** + * Required. The AuthorizedView to create. + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView authorized_view = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private $authorized_view = null; + + /** + * @param string $parent Required. This is the name of the table the AuthorizedView belongs to. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. Please see + * {@see BigtableTableAdminClient::tableName()} for help formatting this field. + * @param \Google\Cloud\Bigtable\Admin\V2\AuthorizedView $authorizedView Required. The AuthorizedView to create. + * @param string $authorizedViewId Required. The id of the AuthorizedView to create. This AuthorizedView must + * not already exist. The `authorized_view_id` appended to `parent` forms the + * full AuthorizedView name of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedView/{authorized_view}`. + * + * @return \Google\Cloud\Bigtable\Admin\V2\CreateAuthorizedViewRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Bigtable\Admin\V2\AuthorizedView $authorizedView, string $authorizedViewId): self + { + return (new self()) + ->setParent($parent) + ->setAuthorizedView($authorizedView) + ->setAuthorizedViewId($authorizedViewId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. This is the name of the table the AuthorizedView belongs to. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @type string $authorized_view_id + * Required. The id of the AuthorizedView to create. This AuthorizedView must + * not already exist. The `authorized_view_id` appended to `parent` forms the + * full AuthorizedView name of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedView/{authorized_view}`. + * @type \Google\Cloud\Bigtable\Admin\V2\AuthorizedView $authorized_view + * Required. The AuthorizedView to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\BigtableTableAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. This is the name of the table the AuthorizedView belongs to. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{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. This is the name of the table the AuthorizedView belongs to. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{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 id of the AuthorizedView to create. This AuthorizedView must + * not already exist. The `authorized_view_id` appended to `parent` forms the + * full AuthorizedView name of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedView/{authorized_view}`. + * + * Generated from protobuf field string authorized_view_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAuthorizedViewId() + { + return $this->authorized_view_id; + } + + /** + * Required. The id of the AuthorizedView to create. This AuthorizedView must + * not already exist. The `authorized_view_id` appended to `parent` forms the + * full AuthorizedView name of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedView/{authorized_view}`. + * + * Generated from protobuf field string authorized_view_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAuthorizedViewId($var) + { + GPBUtil::checkString($var, True); + $this->authorized_view_id = $var; + + return $this; + } + + /** + * Required. The AuthorizedView to create. + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView authorized_view = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Bigtable\Admin\V2\AuthorizedView|null + */ + public function getAuthorizedView() + { + return $this->authorized_view; + } + + public function hasAuthorizedView() + { + return isset($this->authorized_view); + } + + public function clearAuthorizedView() + { + unset($this->authorized_view); + } + + /** + * Required. The AuthorizedView to create. + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView authorized_view = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Bigtable\Admin\V2\AuthorizedView $var + * @return $this + */ + public function setAuthorizedView($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\AuthorizedView::class); + $this->authorized_view = $var; + + return $this; + } + +} + diff --git a/Bigtable/src/Admin/V2/DataBoostReadLocalWrites.php b/Bigtable/src/Admin/V2/DataBoostReadLocalWrites.php new file mode 100644 index 000000000000..6d8e2927312c --- /dev/null +++ b/Bigtable/src/Admin/V2/DataBoostReadLocalWrites.php @@ -0,0 +1,34 @@ +google.bigtable.admin.v2.DataBoostReadLocalWrites + */ +class DataBoostReadLocalWrites extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\BigtableTableAdmin::initOnce(); + parent::__construct($data); + } + +} + diff --git a/Bigtable/src/Admin/V2/DeleteAuthorizedViewRequest.php b/Bigtable/src/Admin/V2/DeleteAuthorizedViewRequest.php new file mode 100644 index 000000000000..38e240c2b038 --- /dev/null +++ b/Bigtable/src/Admin/V2/DeleteAuthorizedViewRequest.php @@ -0,0 +1,138 @@ +google.bigtable.admin.v2.DeleteAuthorizedViewRequest + */ +class DeleteAuthorizedViewRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The unique name of the AuthorizedView to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + /** + * Optional. The current etag of the AuthorizedView. + * If an etag is provided and does not match the current etag of the + * AuthorizedView, deletion will be blocked and an ABORTED error will be + * returned. + * + * Generated from protobuf field string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $etag = ''; + + /** + * @param string $name Required. The unique name of the AuthorizedView to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}`. Please see + * {@see BigtableTableAdminClient::authorizedViewName()} for help formatting this field. + * + * @return \Google\Cloud\Bigtable\Admin\V2\DeleteAuthorizedViewRequest + * + * @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 unique name of the AuthorizedView to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}`. + * @type string $etag + * Optional. The current etag of the AuthorizedView. + * If an etag is provided and does not match the current etag of the + * AuthorizedView, deletion will be blocked and an ABORTED error will be + * returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\BigtableTableAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The unique name of the AuthorizedView to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}`. + * + * 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 unique name of the AuthorizedView to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}`. + * + * 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. The current etag of the AuthorizedView. + * If an etag is provided and does not match the current etag of the + * AuthorizedView, deletion will be blocked and an ABORTED error will be + * returned. + * + * Generated from protobuf field string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getEtag() + { + return $this->etag; + } + + /** + * Optional. The current etag of the AuthorizedView. + * If an etag is provided and does not match the current etag of the + * AuthorizedView, deletion will be blocked and an ABORTED error will be + * returned. + * + * Generated from protobuf field string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setEtag($var) + { + GPBUtil::checkString($var, True); + $this->etag = $var; + + return $this; + } + +} + diff --git a/Bigtable/src/Admin/V2/Gapic/BigtableTableAdminGapicClient.php b/Bigtable/src/Admin/V2/Gapic/BigtableTableAdminGapicClient.php index b146fe6568b7..f109aeeae093 100644 --- a/Bigtable/src/Admin/V2/Gapic/BigtableTableAdminGapicClient.php +++ b/Bigtable/src/Admin/V2/Gapic/BigtableTableAdminGapicClient.php @@ -35,24 +35,31 @@ use Google\ApiCore\Transport\TransportInterface; use Google\ApiCore\ValidationException; use Google\Auth\FetchAuthTokenInterface; +use Google\Cloud\Bigtable\Admin\V2\AuthorizedView; use Google\Cloud\Bigtable\Admin\V2\Backup; use Google\Cloud\Bigtable\Admin\V2\CheckConsistencyRequest; use Google\Cloud\Bigtable\Admin\V2\CheckConsistencyResponse; use Google\Cloud\Bigtable\Admin\V2\CopyBackupRequest; +use Google\Cloud\Bigtable\Admin\V2\CreateAuthorizedViewRequest; use Google\Cloud\Bigtable\Admin\V2\CreateBackupMetadata; use Google\Cloud\Bigtable\Admin\V2\CreateBackupRequest; use Google\Cloud\Bigtable\Admin\V2\CreateTableFromSnapshotRequest; use Google\Cloud\Bigtable\Admin\V2\CreateTableRequest; use Google\Cloud\Bigtable\Admin\V2\CreateTableRequest\Split; +use Google\Cloud\Bigtable\Admin\V2\DataBoostReadLocalWrites; +use Google\Cloud\Bigtable\Admin\V2\DeleteAuthorizedViewRequest; use Google\Cloud\Bigtable\Admin\V2\DeleteBackupRequest; use Google\Cloud\Bigtable\Admin\V2\DeleteSnapshotRequest; use Google\Cloud\Bigtable\Admin\V2\DeleteTableRequest; use Google\Cloud\Bigtable\Admin\V2\DropRowRangeRequest; use Google\Cloud\Bigtable\Admin\V2\GenerateConsistencyTokenRequest; use Google\Cloud\Bigtable\Admin\V2\GenerateConsistencyTokenResponse; +use Google\Cloud\Bigtable\Admin\V2\GetAuthorizedViewRequest; use Google\Cloud\Bigtable\Admin\V2\GetBackupRequest; use Google\Cloud\Bigtable\Admin\V2\GetSnapshotRequest; use Google\Cloud\Bigtable\Admin\V2\GetTableRequest; +use Google\Cloud\Bigtable\Admin\V2\ListAuthorizedViewsRequest; +use Google\Cloud\Bigtable\Admin\V2\ListAuthorizedViewsResponse; use Google\Cloud\Bigtable\Admin\V2\ListBackupsRequest; use Google\Cloud\Bigtable\Admin\V2\ListBackupsResponse; use Google\Cloud\Bigtable\Admin\V2\ListSnapshotsRequest; @@ -65,9 +72,11 @@ use Google\Cloud\Bigtable\Admin\V2\RestoreTableRequest; use Google\Cloud\Bigtable\Admin\V2\Snapshot; use Google\Cloud\Bigtable\Admin\V2\SnapshotTableRequest; +use Google\Cloud\Bigtable\Admin\V2\StandardReadRemoteWrites; use Google\Cloud\Bigtable\Admin\V2\Table; use Google\Cloud\Bigtable\Admin\V2\Table\View; use Google\Cloud\Bigtable\Admin\V2\UndeleteTableRequest; +use Google\Cloud\Bigtable\Admin\V2\UpdateAuthorizedViewRequest; use Google\Cloud\Bigtable\Admin\V2\UpdateBackupRequest; use Google\Cloud\Bigtable\Admin\V2\UpdateTableRequest; use Google\Cloud\Iam\V1\GetIamPolicyRequest; @@ -143,6 +152,8 @@ class BigtableTableAdminGapicClient 'https://www.googleapis.com/auth/cloud-platform.read-only', ]; + private static $authorizedViewNameTemplate; + private static $backupNameTemplate; private static $clusterNameTemplate; @@ -178,6 +189,15 @@ private static function getClientDefaults() ]; } + private static function getAuthorizedViewNameTemplate() + { + if (self::$authorizedViewNameTemplate == null) { + self::$authorizedViewNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}'); + } + + return self::$authorizedViewNameTemplate; + } + private static function getBackupNameTemplate() { if (self::$backupNameTemplate == null) { @@ -236,6 +256,7 @@ private static function getPathTemplateMap() { if (self::$pathTemplateMap == null) { self::$pathTemplateMap = [ + 'authorizedView' => self::getAuthorizedViewNameTemplate(), 'backup' => self::getBackupNameTemplate(), 'cluster' => self::getClusterNameTemplate(), 'cryptoKeyVersion' => self::getCryptoKeyVersionNameTemplate(), @@ -248,6 +269,27 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + /** + * Formats a string containing the fully-qualified path to represent a + * authorized_view resource. + * + * @param string $project + * @param string $instance + * @param string $table + * @param string $authorizedView + * + * @return string The formatted authorized_view resource. + */ + public static function authorizedViewName($project, $instance, $table, $authorizedView) + { + return self::getAuthorizedViewNameTemplate()->render([ + 'project' => $project, + 'instance' => $instance, + 'table' => $table, + 'authorized_view' => $authorizedView, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a backup * resource. @@ -372,6 +414,7 @@ public static function tableName($project, $instance, $table) * Parses a formatted name string and returns an associative array of the components in the name. * The following name formats are supported: * Template: Pattern + * - authorizedView: projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view} * - backup: projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup} * - cluster: projects/{project}/instances/{instance}/clusters/{cluster} * - cryptoKeyVersion: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version} @@ -528,6 +571,14 @@ public function __construct(array $options = []) * @param array $optionalArgs { * Optional. * + * @type StandardReadRemoteWrites $standardReadRemoteWrites + * Checks that reads using an app profile with `StandardIsolation` can + * see all writes committed before the token was created, even if the + * read and write target different clusters. + * @type DataBoostReadLocalWrites $dataBoostReadLocalWrites + * Checks that reads using an app profile with `DataBoostIsolationReadOnly` + * can see all writes committed before the token was created, but only if + * the read and write target the same cluster. * @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 @@ -545,6 +596,14 @@ public function checkConsistency($name, $consistencyToken, array $optionalArgs = $request->setName($name); $request->setConsistencyToken($consistencyToken); $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['standardReadRemoteWrites'])) { + $request->setStandardReadRemoteWrites($optionalArgs['standardReadRemoteWrites']); + } + + if (isset($optionalArgs['dataBoostReadLocalWrites'])) { + $request->setDataBoostReadLocalWrites($optionalArgs['dataBoostReadLocalWrites']); + } + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall('CheckConsistency', CheckConsistencyResponse::class, $optionalArgs, $request)->wait(); @@ -641,6 +700,81 @@ public function copyBackup($parent, $backupId, $sourceBackup, $expireTime, array return $this->startOperationsCall('CopyBackup', $optionalArgs, $request, $this->getOperationsClient())->wait(); } + /** + * Creates a new AuthorizedView in a table. + * + * Sample code: + * ``` + * $bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient(); + * try { + * $formattedParent = $bigtableTableAdminClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]'); + * $authorizedViewId = 'authorized_view_id'; + * $authorizedView = new AuthorizedView(); + * $operationResponse = $bigtableTableAdminClient->createAuthorizedView($formattedParent, $authorizedViewId, $authorizedView); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $bigtableTableAdminClient->createAuthorizedView($formattedParent, $authorizedViewId, $authorizedView); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $bigtableTableAdminClient->resumeOperation($operationName, 'createAuthorizedView'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $bigtableTableAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. This is the name of the table the AuthorizedView belongs to. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param string $authorizedViewId Required. The id of the AuthorizedView to create. This AuthorizedView must + * not already exist. The `authorized_view_id` appended to `parent` forms the + * full AuthorizedView name of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedView/{authorized_view}`. + * @param AuthorizedView $authorizedView Required. The AuthorizedView to create. + * @param array $optionalArgs { + * 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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createAuthorizedView($parent, $authorizedViewId, $authorizedView, array $optionalArgs = []) + { + $request = new CreateAuthorizedViewRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setAuthorizedViewId($authorizedViewId); + $request->setAuthorizedView($authorizedView); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateAuthorizedView', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + /** * Starts creating a new Cloud Bigtable Backup. The returned backup * [long-running operation][google.longrunning.Operation] can be used to @@ -878,6 +1012,54 @@ public function createTableFromSnapshot($parent, $tableId, $sourceSnapshot, arra return $this->startOperationsCall('CreateTableFromSnapshot', $optionalArgs, $request, $this->getOperationsClient())->wait(); } + /** + * Permanently deletes a specified AuthorizedView. + * + * Sample code: + * ``` + * $bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient(); + * try { + * $formattedName = $bigtableTableAdminClient->authorizedViewName('[PROJECT]', '[INSTANCE]', '[TABLE]', '[AUTHORIZED_VIEW]'); + * $bigtableTableAdminClient->deleteAuthorizedView($formattedName); + * } finally { + * $bigtableTableAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The unique name of the AuthorizedView to be deleted. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}`. + * @param array $optionalArgs { + * Optional. + * + * @type string $etag + * Optional. The current etag of the AuthorizedView. + * If an etag is provided and does not match the current etag of the + * AuthorizedView, deletion will be blocked and an ABORTED error will be + * returned. + * @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 if the remote call fails + */ + public function deleteAuthorizedView($name, array $optionalArgs = []) + { + $request = new DeleteAuthorizedViewRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['etag'])) { + $request->setEtag($optionalArgs['etag']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteAuthorizedView', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + /** * Deletes a pending or completed Cloud Bigtable backup. * @@ -1099,6 +1281,55 @@ public function generateConsistencyToken($name, array $optionalArgs = []) return $this->startCall('GenerateConsistencyToken', GenerateConsistencyTokenResponse::class, $optionalArgs, $request)->wait(); } + /** + * Gets information from a specified AuthorizedView. + * + * Sample code: + * ``` + * $bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient(); + * try { + * $formattedName = $bigtableTableAdminClient->authorizedViewName('[PROJECT]', '[INSTANCE]', '[TABLE]', '[AUTHORIZED_VIEW]'); + * $response = $bigtableTableAdminClient->getAuthorizedView($formattedName); + * } finally { + * $bigtableTableAdminClient->close(); + * } + * ``` + * + * @param string $name Required. The unique name of the requested AuthorizedView. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $view + * Optional. The resource_view to be applied to the returned AuthorizedView's + * fields. Default to BASIC. + * For allowed values, use constants defined on {@see \Google\Cloud\Bigtable\Admin\V2\AuthorizedView\ResponseView} + * @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 \Google\Cloud\Bigtable\Admin\V2\AuthorizedView + * + * @throws ApiException if the remote call fails + */ + public function getAuthorizedView($name, array $optionalArgs = []) + { + $request = new GetAuthorizedViewRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAuthorizedView', AuthorizedView::class, $optionalArgs, $request)->wait(); + } + /** * Gets metadata on a pending or completed Cloud Bigtable Backup. * @@ -1285,6 +1516,84 @@ public function getTable($name, array $optionalArgs = []) return $this->startCall('GetTable', Table::class, $optionalArgs, $request)->wait(); } + /** + * Lists all AuthorizedViews from a specific table. + * + * Sample code: + * ``` + * $bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient(); + * try { + * $formattedParent = $bigtableTableAdminClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]'); + * // Iterate over pages of elements + * $pagedResponse = $bigtableTableAdminClient->listAuthorizedViews($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $bigtableTableAdminClient->listAuthorizedViews($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $bigtableTableAdminClient->close(); + * } + * ``` + * + * @param string $parent Required. The unique name of the table for which AuthorizedViews should be + * listed. Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $view + * Optional. The resource_view to be applied to the returned views' fields. + * Default to NAME_ONLY. + * For allowed values, use constants defined on {@see \Google\Cloud\Bigtable\Admin\V2\AuthorizedView\ResponseView} + * @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 \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAuthorizedViews($parent, array $optionalArgs = []) + { + $request = new ListAuthorizedViewsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAuthorizedViews', $optionalArgs, ListAuthorizedViewsResponse::class, $request); + } + /** * Lists Cloud Bigtable backups. Returns both completed and pending * backups. @@ -1986,6 +2295,92 @@ public function undeleteTable($name, array $optionalArgs = []) return $this->startOperationsCall('UndeleteTable', $optionalArgs, $request, $this->getOperationsClient())->wait(); } + /** + * Updates an AuthorizedView in a table. + * + * Sample code: + * ``` + * $bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient(); + * try { + * $authorizedView = new AuthorizedView(); + * $operationResponse = $bigtableTableAdminClient->updateAuthorizedView($authorizedView); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $bigtableTableAdminClient->updateAuthorizedView($authorizedView); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $bigtableTableAdminClient->resumeOperation($operationName, 'updateAuthorizedView'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $bigtableTableAdminClient->close(); + * } + * ``` + * + * @param AuthorizedView $authorizedView Required. The AuthorizedView to update. The `name` in `authorized_view` is + * used to identify the AuthorizedView. AuthorizedView name must in this + * format + * projects//instances//tables/
/authorizedViews/ + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. The list of fields to update. + * A mask specifying which fields in the AuthorizedView resource should be + * updated. This mask is relative to the AuthorizedView resource, not to the + * request message. A field will be overwritten if it is in the mask. If + * empty, all fields set in the request will be overwritten. A special value + * `*` means to overwrite all fields (including fields not set in the + * request). + * @type bool $ignoreWarnings + * Optional. If true, ignore the safety checks when updating the + * AuthorizedView. + * @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 \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateAuthorizedView($authorizedView, array $optionalArgs = []) + { + $request = new UpdateAuthorizedViewRequest(); + $requestParamHeaders = []; + $request->setAuthorizedView($authorizedView); + $requestParamHeaders['authorized_view.name'] = $authorizedView->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['ignoreWarnings'])) { + $request->setIgnoreWarnings($optionalArgs['ignoreWarnings']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateAuthorizedView', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + /** * Updates a pending or completed Cloud Bigtable Backup. * diff --git a/Bigtable/src/Admin/V2/GetAuthorizedViewRequest.php b/Bigtable/src/Admin/V2/GetAuthorizedViewRequest.php new file mode 100644 index 000000000000..7e0db42b32bd --- /dev/null +++ b/Bigtable/src/Admin/V2/GetAuthorizedViewRequest.php @@ -0,0 +1,130 @@ +google.bigtable.admin.v2.GetAuthorizedViewRequest + */ +class GetAuthorizedViewRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The unique name of the requested AuthorizedView. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + /** + * Optional. The resource_view to be applied to the returned AuthorizedView's + * fields. Default to BASIC. + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView.ResponseView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $view = 0; + + /** + * @param string $name Required. The unique name of the requested AuthorizedView. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}`. Please see + * {@see BigtableTableAdminClient::authorizedViewName()} for help formatting this field. + * + * @return \Google\Cloud\Bigtable\Admin\V2\GetAuthorizedViewRequest + * + * @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 unique name of the requested AuthorizedView. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}`. + * @type int $view + * Optional. The resource_view to be applied to the returned AuthorizedView's + * fields. Default to BASIC. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\BigtableTableAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The unique name of the requested AuthorizedView. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}`. + * + * 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 unique name of the requested AuthorizedView. + * Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}`. + * + * 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. The resource_view to be applied to the returned AuthorizedView's + * fields. Default to BASIC. + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView.ResponseView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Optional. The resource_view to be applied to the returned AuthorizedView's + * fields. Default to BASIC. + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView.ResponseView view = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Bigtable\Admin\V2\AuthorizedView\ResponseView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/Bigtable/src/Admin/V2/ListAuthorizedViewsRequest.php b/Bigtable/src/Admin/V2/ListAuthorizedViewsRequest.php new file mode 100644 index 000000000000..02e566a938e8 --- /dev/null +++ b/Bigtable/src/Admin/V2/ListAuthorizedViewsRequest.php @@ -0,0 +1,222 @@ +google.bigtable.admin.v2.ListAuthorizedViewsRequest + */ +class ListAuthorizedViewsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The unique name of the table for which AuthorizedViews should be + * listed. Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $parent = ''; + /** + * Optional. Maximum number of results per page. + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $page_size = 0; + /** + * Optional. The value of `next_page_token` returned by a previous call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $page_token = ''; + /** + * Optional. The resource_view to be applied to the returned views' fields. + * Default to NAME_ONLY. + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView.ResponseView view = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $view = 0; + + /** + * @param string $parent Required. The unique name of the table for which AuthorizedViews should be + * listed. Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. Please see + * {@see BigtableTableAdminClient::tableName()} for help formatting this field. + * + * @return \Google\Cloud\Bigtable\Admin\V2\ListAuthorizedViewsRequest + * + * @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 unique name of the table for which AuthorizedViews should be + * listed. Values are of the form + * `projects/{project}/instances/{instance}/tables/{table}`. + * @type int $page_size + * Optional. Maximum number of results per page. + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * @type string $page_token + * Optional. The value of `next_page_token` returned by a previous call. + * @type int $view + * Optional. The resource_view to be applied to the returned views' fields. + * Default to NAME_ONLY. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\BigtableTableAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The unique name of the table for which AuthorizedViews should be + * listed. Values are of the form + * `projects/{project}/instances/{instance}/tables/{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 unique name of the table for which AuthorizedViews should be + * listed. Values are of the form + * `projects/{project}/instances/{instance}/tables/{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. Maximum number of results per page. + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Maximum number of results per page. + * A page_size of zero lets the server choose the number of items to return. + * A page_size which is strictly positive will return at most that many items. + * A negative page_size will cause an error. + * Following the first request, subsequent paginated calls are not required + * to pass a page_size. If a page_size is set in subsequent calls, it must + * match the page_size given in the first request. + * + * 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. The value of `next_page_token` returned by a previous call. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The value of `next_page_token` returned by a previous 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. The resource_view to be applied to the returned views' fields. + * Default to NAME_ONLY. + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView.ResponseView view = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Optional. The resource_view to be applied to the returned views' fields. + * Default to NAME_ONLY. + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView.ResponseView view = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Bigtable\Admin\V2\AuthorizedView\ResponseView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/Bigtable/src/Admin/V2/ListAuthorizedViewsResponse.php b/Bigtable/src/Admin/V2/ListAuthorizedViewsResponse.php new file mode 100644 index 000000000000..e143146f2344 --- /dev/null +++ b/Bigtable/src/Admin/V2/ListAuthorizedViewsResponse.php @@ -0,0 +1,110 @@ +google.bigtable.admin.v2.ListAuthorizedViewsResponse + */ +class ListAuthorizedViewsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The AuthorizedViews present in the requested table. + * + * Generated from protobuf field repeated .google.bigtable.admin.v2.AuthorizedView authorized_views = 1; + */ + private $authorized_views; + /** + * Set if not all tables could be returned in a single response. + * Pass this value to `page_token` in another request to get the next + * page of results. + * + * Generated from protobuf field string next_page_token = 2; + */ + private $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Bigtable\Admin\V2\AuthorizedView>|\Google\Protobuf\Internal\RepeatedField $authorized_views + * The AuthorizedViews present in the requested table. + * @type string $next_page_token + * Set if not all tables could be returned in a single response. + * Pass this value to `page_token` in another request to get the next + * page of results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\BigtableTableAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The AuthorizedViews present in the requested table. + * + * Generated from protobuf field repeated .google.bigtable.admin.v2.AuthorizedView authorized_views = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAuthorizedViews() + { + return $this->authorized_views; + } + + /** + * The AuthorizedViews present in the requested table. + * + * Generated from protobuf field repeated .google.bigtable.admin.v2.AuthorizedView authorized_views = 1; + * @param array<\Google\Cloud\Bigtable\Admin\V2\AuthorizedView>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAuthorizedViews($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Bigtable\Admin\V2\AuthorizedView::class); + $this->authorized_views = $arr; + + return $this; + } + + /** + * Set if not all tables could be returned in a single response. + * Pass this value to `page_token` in another request to get the next + * page of results. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Set if not all tables could be returned in a single response. + * Pass this value to `page_token` in another request to get the next + * page of results. + * + * 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/Bigtable/src/Admin/V2/ModifyColumnFamiliesRequest/Modification.php b/Bigtable/src/Admin/V2/ModifyColumnFamiliesRequest/Modification.php index 9f96b53df46d..0886bfccdd8f 100644 --- a/Bigtable/src/Admin/V2/ModifyColumnFamiliesRequest/Modification.php +++ b/Bigtable/src/Admin/V2/ModifyColumnFamiliesRequest/Modification.php @@ -21,6 +21,14 @@ class Modification extends \Google\Protobuf\Internal\Message * Generated from protobuf field string id = 1; */ private $id = ''; + /** + * Optional. A mask specifying which fields (e.g. `gc_rule`) in the `update` + * mod should be updated, ignored for other modification types. If unset or + * empty, we treat it as updating `gc_rule` to be backward compatible. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $update_mask = null; protected $mod; /** @@ -40,6 +48,10 @@ class Modification extends \Google\Protobuf\Internal\Message * @type bool $drop * Drop (delete) the column family with the given ID, or fail if no such * family exists. + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. A mask specifying which fields (e.g. `gc_rule`) in the `update` + * mod should be updated, ignored for other modification types. If unset or + * empty, we treat it as updating `gc_rule` to be backward compatible. * } */ public function __construct($data = NULL) { @@ -172,6 +184,46 @@ public function setDrop($var) return $this; } + /** + * Optional. A mask specifying which fields (e.g. `gc_rule`) in the `update` + * mod should be updated, ignored for other modification types. If unset or + * empty, we treat it as updating `gc_rule` to be backward compatible. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 6 [(.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. A mask specifying which fields (e.g. `gc_rule`) in the `update` + * mod should be updated, ignored for other modification types. If unset or + * empty, we treat it as updating `gc_rule` to be backward compatible. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 6 [(.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; + } + /** * @return string */ diff --git a/Bigtable/src/Admin/V2/StandardReadRemoteWrites.php b/Bigtable/src/Admin/V2/StandardReadRemoteWrites.php new file mode 100644 index 000000000000..bc59f6b84f19 --- /dev/null +++ b/Bigtable/src/Admin/V2/StandardReadRemoteWrites.php @@ -0,0 +1,34 @@ +google.bigtable.admin.v2.StandardReadRemoteWrites + */ +class StandardReadRemoteWrites extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\BigtableTableAdmin::initOnce(); + parent::__construct($data); + } + +} + diff --git a/Bigtable/src/Admin/V2/Table.php b/Bigtable/src/Admin/V2/Table.php index f3289d6373a4..d1c8ac9abf63 100644 --- a/Bigtable/src/Admin/V2/Table.php +++ b/Bigtable/src/Admin/V2/Table.php @@ -76,6 +76,7 @@ class Table extends \Google\Protobuf\Internal\Message * Generated from protobuf field bool deletion_protection = 9; */ private $deletion_protection = false; + protected $automated_backup_config; /** * Constructor. @@ -115,6 +116,9 @@ class Table extends \Google\Protobuf\Internal\Message * * The column families in the table. * * The instance containing the table. * Note one can still delete the data stored in the table through Data APIs. + * @type \Google\Cloud\Bigtable\Admin\V2\Table\AutomatedBackupPolicy $automated_backup_policy + * If specified, automated backups are enabled for this table. + * Otherwise, automated backups are disabled. * } */ public function __construct($data = NULL) { @@ -360,5 +364,46 @@ public function setDeletionProtection($var) return $this; } + /** + * If specified, automated backups are enabled for this table. + * Otherwise, automated backups are disabled. + * + * Generated from protobuf field .google.bigtable.admin.v2.Table.AutomatedBackupPolicy automated_backup_policy = 13; + * @return \Google\Cloud\Bigtable\Admin\V2\Table\AutomatedBackupPolicy|null + */ + public function getAutomatedBackupPolicy() + { + return $this->readOneof(13); + } + + public function hasAutomatedBackupPolicy() + { + return $this->hasOneof(13); + } + + /** + * If specified, automated backups are enabled for this table. + * Otherwise, automated backups are disabled. + * + * Generated from protobuf field .google.bigtable.admin.v2.Table.AutomatedBackupPolicy automated_backup_policy = 13; + * @param \Google\Cloud\Bigtable\Admin\V2\Table\AutomatedBackupPolicy $var + * @return $this + */ + public function setAutomatedBackupPolicy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Table\AutomatedBackupPolicy::class); + $this->writeOneof(13, $var); + + return $this; + } + + /** + * @return string + */ + public function getAutomatedBackupConfig() + { + return $this->whichOneof("automated_backup_config"); + } + } diff --git a/Bigtable/src/Admin/V2/Table/AutomatedBackupPolicy.php b/Bigtable/src/Admin/V2/Table/AutomatedBackupPolicy.php new file mode 100644 index 000000000000..77c2510af299 --- /dev/null +++ b/Bigtable/src/Admin/V2/Table/AutomatedBackupPolicy.php @@ -0,0 +1,132 @@ +google.bigtable.admin.v2.Table.AutomatedBackupPolicy + */ +class AutomatedBackupPolicy extends \Google\Protobuf\Internal\Message +{ + /** + * Required. How long the automated backups should be retained. The only + * supported value at this time is 3 days. + * + * Generated from protobuf field .google.protobuf.Duration retention_period = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $retention_period = null; + /** + * Required. How frequently automated backups should occur. The only + * supported value at this time is 24 hours. + * + * Generated from protobuf field .google.protobuf.Duration frequency = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $frequency = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Duration $retention_period + * Required. How long the automated backups should be retained. The only + * supported value at this time is 3 days. + * @type \Google\Protobuf\Duration $frequency + * Required. How frequently automated backups should occur. The only + * supported value at this time is 24 hours. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Table::initOnce(); + parent::__construct($data); + } + + /** + * Required. How long the automated backups should be retained. The only + * supported value at this time is 3 days. + * + * Generated from protobuf field .google.protobuf.Duration retention_period = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getRetentionPeriod() + { + return $this->retention_period; + } + + public function hasRetentionPeriod() + { + return isset($this->retention_period); + } + + public function clearRetentionPeriod() + { + unset($this->retention_period); + } + + /** + * Required. How long the automated backups should be retained. The only + * supported value at this time is 3 days. + * + * Generated from protobuf field .google.protobuf.Duration retention_period = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setRetentionPeriod($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->retention_period = $var; + + return $this; + } + + /** + * Required. How frequently automated backups should occur. The only + * supported value at this time is 24 hours. + * + * Generated from protobuf field .google.protobuf.Duration frequency = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Duration|null + */ + public function getFrequency() + { + return $this->frequency; + } + + public function hasFrequency() + { + return isset($this->frequency); + } + + public function clearFrequency() + { + unset($this->frequency); + } + + /** + * Required. How frequently automated backups should occur. The only + * supported value at this time is 24 hours. + * + * Generated from protobuf field .google.protobuf.Duration frequency = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setFrequency($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->frequency = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AutomatedBackupPolicy::class, \Google\Cloud\Bigtable\Admin\V2\Table_AutomatedBackupPolicy::class); + diff --git a/Bigtable/src/Admin/V2/Type.php b/Bigtable/src/Admin/V2/Type.php new file mode 100644 index 000000000000..8f116ff2aba4 --- /dev/null +++ b/Bigtable/src/Admin/V2/Type.php @@ -0,0 +1,167 @@ + STRING -> raw bytes. In most cases, a "link" + * in the encoding chain will be based an on existing GoogleSQL conversion + * function like `CAST`. + * Each link in the encoding chain also defines the following properties: + * * Natural sort: Does the encoded value sort consistently with the original + * typed value? Note that Bigtable will always sort data based on the raw + * encoded value, *not* the decoded type. + * - Example: STRING values sort in the same order as their UTF-8 encodings. + * - Counterexample: Encoding INT64 to a fixed-width STRING does *not* + * preserve sort order when dealing with negative numbers. + * INT64(1) > INT64(-1), but STRING("-00001") > STRING("00001). + * - The overall encoding chain sorts naturally if *every* link does. + * * Self-delimiting: If we concatenate two encoded values, can we always tell + * where the first one ends and the second one begins? + * - Example: If we encode INT64s to fixed-width STRINGs, the first value + * will always contain exactly N digits, possibly preceded by a sign. + * - Counterexample: If we concatenate two UTF-8 encoded STRINGs, we have + * no way to tell where the first one ends. + * - The overall encoding chain is self-delimiting if *any* link is. + * * Compatibility: Which other systems have matching encoding schemes? For + * example, does this encoding have a GoogleSQL equivalent? HBase? Java? + * + * Generated from protobuf message google.bigtable.admin.v2.Type + */ +class Type extends \Google\Protobuf\Internal\Message +{ + protected $kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\Admin\V2\Type\Bytes $bytes_type + * Bytes + * @type \Google\Cloud\Bigtable\Admin\V2\Type\Int64 $int64_type + * Int64 + * @type \Google\Cloud\Bigtable\Admin\V2\Type\Aggregate $aggregate_type + * Aggregate + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * Bytes + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Bytes bytes_type = 1; + * @return \Google\Cloud\Bigtable\Admin\V2\Type\Bytes|null + */ + public function getBytesType() + { + return $this->readOneof(1); + } + + public function hasBytesType() + { + return $this->hasOneof(1); + } + + /** + * Bytes + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Bytes bytes_type = 1; + * @param \Google\Cloud\Bigtable\Admin\V2\Type\Bytes $var + * @return $this + */ + public function setBytesType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type\Bytes::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Int64 + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Int64 int64_type = 5; + * @return \Google\Cloud\Bigtable\Admin\V2\Type\Int64|null + */ + public function getInt64Type() + { + return $this->readOneof(5); + } + + public function hasInt64Type() + { + return $this->hasOneof(5); + } + + /** + * Int64 + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Int64 int64_type = 5; + * @param \Google\Cloud\Bigtable\Admin\V2\Type\Int64 $var + * @return $this + */ + public function setInt64Type($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type\Int64::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Aggregate + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Aggregate aggregate_type = 6; + * @return \Google\Cloud\Bigtable\Admin\V2\Type\Aggregate|null + */ + public function getAggregateType() + { + return $this->readOneof(6); + } + + public function hasAggregateType() + { + return $this->hasOneof(6); + } + + /** + * Aggregate + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Aggregate aggregate_type = 6; + * @param \Google\Cloud\Bigtable\Admin\V2\Type\Aggregate $var + * @return $this + */ + public function setAggregateType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type\Aggregate::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * @return string + */ + public function getKind() + { + return $this->whichOneof("kind"); + } + +} + diff --git a/Bigtable/src/Admin/V2/Type/Aggregate.php b/Bigtable/src/Admin/V2/Type/Aggregate.php new file mode 100644 index 000000000000..b8d2747badb0 --- /dev/null +++ b/Bigtable/src/Admin/V2/Type/Aggregate.php @@ -0,0 +1,185 @@ +google.bigtable.admin.v2.Type.Aggregate + */ +class Aggregate extends \Google\Protobuf\Internal\Message +{ + /** + * Type of the inputs that are accumulated by this `Aggregate`, which must + * specify a full encoding. + * Use `AddInput` mutations to accumulate new inputs. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type input_type = 1; + */ + private $input_type = null; + /** + * Output only. Type that holds the internal accumulator state for the + * `Aggregate`. This is a function of the `input_type` and `aggregator` + * chosen, and will always specify a full encoding. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type state_type = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $state_type = null; + protected $aggregator; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\Admin\V2\Type $input_type + * Type of the inputs that are accumulated by this `Aggregate`, which must + * specify a full encoding. + * Use `AddInput` mutations to accumulate new inputs. + * @type \Google\Cloud\Bigtable\Admin\V2\Type $state_type + * Output only. Type that holds the internal accumulator state for the + * `Aggregate`. This is a function of the `input_type` and `aggregator` + * chosen, and will always specify a full encoding. + * @type \Google\Cloud\Bigtable\Admin\V2\Type\Aggregate\Sum $sum + * Sum aggregator. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * Type of the inputs that are accumulated by this `Aggregate`, which must + * specify a full encoding. + * Use `AddInput` mutations to accumulate new inputs. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type input_type = 1; + * @return \Google\Cloud\Bigtable\Admin\V2\Type|null + */ + public function getInputType() + { + return $this->input_type; + } + + public function hasInputType() + { + return isset($this->input_type); + } + + public function clearInputType() + { + unset($this->input_type); + } + + /** + * Type of the inputs that are accumulated by this `Aggregate`, which must + * specify a full encoding. + * Use `AddInput` mutations to accumulate new inputs. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type input_type = 1; + * @param \Google\Cloud\Bigtable\Admin\V2\Type $var + * @return $this + */ + public function setInputType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type::class); + $this->input_type = $var; + + return $this; + } + + /** + * Output only. Type that holds the internal accumulator state for the + * `Aggregate`. This is a function of the `input_type` and `aggregator` + * chosen, and will always specify a full encoding. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type state_type = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Bigtable\Admin\V2\Type|null + */ + public function getStateType() + { + return $this->state_type; + } + + public function hasStateType() + { + return isset($this->state_type); + } + + public function clearStateType() + { + unset($this->state_type); + } + + /** + * Output only. Type that holds the internal accumulator state for the + * `Aggregate`. This is a function of the `input_type` and `aggregator` + * chosen, and will always specify a full encoding. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type state_type = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Bigtable\Admin\V2\Type $var + * @return $this + */ + public function setStateType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type::class); + $this->state_type = $var; + + return $this; + } + + /** + * Sum aggregator. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Aggregate.Sum sum = 4; + * @return \Google\Cloud\Bigtable\Admin\V2\Type\Aggregate\Sum|null + */ + public function getSum() + { + return $this->readOneof(4); + } + + public function hasSum() + { + return $this->hasOneof(4); + } + + /** + * Sum aggregator. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Aggregate.Sum sum = 4; + * @param \Google\Cloud\Bigtable\Admin\V2\Type\Aggregate\Sum $var + * @return $this + */ + public function setSum($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type\Aggregate\Sum::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getAggregator() + { + return $this->whichOneof("aggregator"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Aggregate::class, \Google\Cloud\Bigtable\Admin\V2\Type_Aggregate::class); + diff --git a/Bigtable/src/Admin/V2/Type/Aggregate/Sum.php b/Bigtable/src/Admin/V2/Type/Aggregate/Sum.php new file mode 100644 index 000000000000..209569e18bcc --- /dev/null +++ b/Bigtable/src/Admin/V2/Type/Aggregate/Sum.php @@ -0,0 +1,38 @@ +google.bigtable.admin.v2.Type.Aggregate.Sum + */ +class Sum extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Sum::class, \Google\Cloud\Bigtable\Admin\V2\Type_Aggregate_Sum::class); + diff --git a/Bigtable/src/Admin/V2/Type/Bytes.php b/Bigtable/src/Admin/V2/Type/Bytes.php new file mode 100644 index 000000000000..02a0e4454513 --- /dev/null +++ b/Bigtable/src/Admin/V2/Type/Bytes.php @@ -0,0 +1,81 @@ +google.bigtable.admin.v2.Type.Bytes + */ +class Bytes extends \Google\Protobuf\Internal\Message +{ + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Bytes.Encoding encoding = 1; + */ + private $encoding = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\Admin\V2\Type\Bytes\Encoding $encoding + * The encoding to use when converting to/from lower level types. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Bytes.Encoding encoding = 1; + * @return \Google\Cloud\Bigtable\Admin\V2\Type\Bytes\Encoding|null + */ + public function getEncoding() + { + return $this->encoding; + } + + public function hasEncoding() + { + return isset($this->encoding); + } + + public function clearEncoding() + { + unset($this->encoding); + } + + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Bytes.Encoding encoding = 1; + * @param \Google\Cloud\Bigtable\Admin\V2\Type\Bytes\Encoding $var + * @return $this + */ + public function setEncoding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type\Bytes\Encoding::class); + $this->encoding = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Bytes::class, \Google\Cloud\Bigtable\Admin\V2\Type_Bytes::class); + diff --git a/Bigtable/src/Admin/V2/Type/Bytes/Encoding.php b/Bigtable/src/Admin/V2/Type/Bytes/Encoding.php new file mode 100644 index 000000000000..4f4ea68391c9 --- /dev/null +++ b/Bigtable/src/Admin/V2/Type/Bytes/Encoding.php @@ -0,0 +1,78 @@ +google.bigtable.admin.v2.Type.Bytes.Encoding + */ +class Encoding extends \Google\Protobuf\Internal\Message +{ + protected $encoding; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\Admin\V2\Type\Bytes\Encoding\Raw $raw + * Use `Raw` encoding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * Use `Raw` encoding. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Bytes.Encoding.Raw raw = 1; + * @return \Google\Cloud\Bigtable\Admin\V2\Type\Bytes\Encoding\Raw|null + */ + public function getRaw() + { + return $this->readOneof(1); + } + + public function hasRaw() + { + return $this->hasOneof(1); + } + + /** + * Use `Raw` encoding. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Bytes.Encoding.Raw raw = 1; + * @param \Google\Cloud\Bigtable\Admin\V2\Type\Bytes\Encoding\Raw $var + * @return $this + */ + public function setRaw($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type\Bytes\Encoding\Raw::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getEncoding() + { + return $this->whichOneof("encoding"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Encoding::class, \Google\Cloud\Bigtable\Admin\V2\Type_Bytes_Encoding::class); + diff --git a/Bigtable/src/Admin/V2/Type/Bytes/Encoding/Raw.php b/Bigtable/src/Admin/V2/Type/Bytes/Encoding/Raw.php new file mode 100644 index 000000000000..e064c8580d2e --- /dev/null +++ b/Bigtable/src/Admin/V2/Type/Bytes/Encoding/Raw.php @@ -0,0 +1,39 @@ +google.bigtable.admin.v2.Type.Bytes.Encoding.Raw + */ +class Raw extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Types::initOnce(); + parent::__construct($data); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Raw::class, \Google\Cloud\Bigtable\Admin\V2\Type_Bytes_Encoding_Raw::class); + diff --git a/Bigtable/src/Admin/V2/Type/Int64.php b/Bigtable/src/Admin/V2/Type/Int64.php new file mode 100644 index 000000000000..cdc02b870421 --- /dev/null +++ b/Bigtable/src/Admin/V2/Type/Int64.php @@ -0,0 +1,81 @@ +google.bigtable.admin.v2.Type.Int64 + */ +class Int64 extends \Google\Protobuf\Internal\Message +{ + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Int64.Encoding encoding = 1; + */ + private $encoding = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\Admin\V2\Type\Int64\Encoding $encoding + * The encoding to use when converting to/from lower level types. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Int64.Encoding encoding = 1; + * @return \Google\Cloud\Bigtable\Admin\V2\Type\Int64\Encoding|null + */ + public function getEncoding() + { + return $this->encoding; + } + + public function hasEncoding() + { + return isset($this->encoding); + } + + public function clearEncoding() + { + unset($this->encoding); + } + + /** + * The encoding to use when converting to/from lower level types. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Int64.Encoding encoding = 1; + * @param \Google\Cloud\Bigtable\Admin\V2\Type\Int64\Encoding $var + * @return $this + */ + public function setEncoding($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type\Int64\Encoding::class); + $this->encoding = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Int64::class, \Google\Cloud\Bigtable\Admin\V2\Type_Int64::class); + diff --git a/Bigtable/src/Admin/V2/Type/Int64/Encoding.php b/Bigtable/src/Admin/V2/Type/Int64/Encoding.php new file mode 100644 index 000000000000..6a18aa7783f8 --- /dev/null +++ b/Bigtable/src/Admin/V2/Type/Int64/Encoding.php @@ -0,0 +1,78 @@ +google.bigtable.admin.v2.Type.Int64.Encoding + */ +class Encoding extends \Google\Protobuf\Internal\Message +{ + protected $encoding; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\Admin\V2\Type\Int64\Encoding\BigEndianBytes $big_endian_bytes + * Use `BigEndianBytes` encoding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * Use `BigEndianBytes` encoding. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Int64.Encoding.BigEndianBytes big_endian_bytes = 1; + * @return \Google\Cloud\Bigtable\Admin\V2\Type\Int64\Encoding\BigEndianBytes|null + */ + public function getBigEndianBytes() + { + return $this->readOneof(1); + } + + public function hasBigEndianBytes() + { + return $this->hasOneof(1); + } + + /** + * Use `BigEndianBytes` encoding. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Int64.Encoding.BigEndianBytes big_endian_bytes = 1; + * @param \Google\Cloud\Bigtable\Admin\V2\Type\Int64\Encoding\BigEndianBytes $var + * @return $this + */ + public function setBigEndianBytes($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type\Int64\Encoding\BigEndianBytes::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getEncoding() + { + return $this->whichOneof("encoding"); + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Encoding::class, \Google\Cloud\Bigtable\Admin\V2\Type_Int64_Encoding::class); + diff --git a/Bigtable/src/Admin/V2/Type/Int64/Encoding/BigEndianBytes.php b/Bigtable/src/Admin/V2/Type/Int64/Encoding/BigEndianBytes.php new file mode 100644 index 000000000000..4d45c8bd7cdb --- /dev/null +++ b/Bigtable/src/Admin/V2/Type/Int64/Encoding/BigEndianBytes.php @@ -0,0 +1,87 @@ +google.bigtable.admin.v2.Type.Int64.Encoding.BigEndianBytes + */ +class BigEndianBytes extends \Google\Protobuf\Internal\Message +{ + /** + * The underlying `Bytes` type, which may be able to encode further. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Bytes bytes_type = 1; + */ + private $bytes_type = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\Admin\V2\Type\Bytes $bytes_type + * The underlying `Bytes` type, which may be able to encode further. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\Types::initOnce(); + parent::__construct($data); + } + + /** + * The underlying `Bytes` type, which may be able to encode further. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Bytes bytes_type = 1; + * @return \Google\Cloud\Bigtable\Admin\V2\Type\Bytes|null + */ + public function getBytesType() + { + return $this->bytes_type; + } + + public function hasBytesType() + { + return isset($this->bytes_type); + } + + public function clearBytesType() + { + unset($this->bytes_type); + } + + /** + * The underlying `Bytes` type, which may be able to encode further. + * + * Generated from protobuf field .google.bigtable.admin.v2.Type.Bytes bytes_type = 1; + * @param \Google\Cloud\Bigtable\Admin\V2\Type\Bytes $var + * @return $this + */ + public function setBytesType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\Type\Bytes::class); + $this->bytes_type = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BigEndianBytes::class, \Google\Cloud\Bigtable\Admin\V2\Type_Int64_Encoding_BigEndianBytes::class); + diff --git a/Bigtable/src/Admin/V2/UpdateAuthorizedViewMetadata.php b/Bigtable/src/Admin/V2/UpdateAuthorizedViewMetadata.php new file mode 100644 index 000000000000..3133122f2298 --- /dev/null +++ b/Bigtable/src/Admin/V2/UpdateAuthorizedViewMetadata.php @@ -0,0 +1,170 @@ +google.bigtable.admin.v2.UpdateAuthorizedViewMetadata + */ +class UpdateAuthorizedViewMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The request that prompted the initiation of this UpdateAuthorizedView + * operation. + * + * Generated from protobuf field .google.bigtable.admin.v2.UpdateAuthorizedViewRequest original_request = 1; + */ + private $original_request = null; + /** + * The time at which the original request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp request_time = 2; + */ + private $request_time = null; + /** + * The time at which the operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp finish_time = 3; + */ + private $finish_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\Admin\V2\UpdateAuthorizedViewRequest $original_request + * The request that prompted the initiation of this UpdateAuthorizedView + * operation. + * @type \Google\Protobuf\Timestamp $request_time + * The time at which the original request was received. + * @type \Google\Protobuf\Timestamp $finish_time + * The time at which the operation failed or was completed successfully. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\BigtableTableAdmin::initOnce(); + parent::__construct($data); + } + + /** + * The request that prompted the initiation of this UpdateAuthorizedView + * operation. + * + * Generated from protobuf field .google.bigtable.admin.v2.UpdateAuthorizedViewRequest original_request = 1; + * @return \Google\Cloud\Bigtable\Admin\V2\UpdateAuthorizedViewRequest|null + */ + public function getOriginalRequest() + { + return $this->original_request; + } + + public function hasOriginalRequest() + { + return isset($this->original_request); + } + + public function clearOriginalRequest() + { + unset($this->original_request); + } + + /** + * The request that prompted the initiation of this UpdateAuthorizedView + * operation. + * + * Generated from protobuf field .google.bigtable.admin.v2.UpdateAuthorizedViewRequest original_request = 1; + * @param \Google\Cloud\Bigtable\Admin\V2\UpdateAuthorizedViewRequest $var + * @return $this + */ + public function setOriginalRequest($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\UpdateAuthorizedViewRequest::class); + $this->original_request = $var; + + return $this; + } + + /** + * The time at which the original request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp request_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getRequestTime() + { + return $this->request_time; + } + + public function hasRequestTime() + { + return isset($this->request_time); + } + + public function clearRequestTime() + { + unset($this->request_time); + } + + /** + * The time at which the original request was received. + * + * Generated from protobuf field .google.protobuf.Timestamp request_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setRequestTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->request_time = $var; + + return $this; + } + + /** + * The time at which the operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp finish_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getFinishTime() + { + return $this->finish_time; + } + + public function hasFinishTime() + { + return isset($this->finish_time); + } + + public function clearFinishTime() + { + unset($this->finish_time); + } + + /** + * The time at which the operation failed or was completed successfully. + * + * Generated from protobuf field .google.protobuf.Timestamp finish_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setFinishTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->finish_time = $var; + + return $this; + } + +} + diff --git a/Bigtable/src/Admin/V2/UpdateAuthorizedViewRequest.php b/Bigtable/src/Admin/V2/UpdateAuthorizedViewRequest.php new file mode 100644 index 000000000000..9616019d26d0 --- /dev/null +++ b/Bigtable/src/Admin/V2/UpdateAuthorizedViewRequest.php @@ -0,0 +1,220 @@ +google.bigtable.admin.v2.UpdateAuthorizedViewRequest + */ +class UpdateAuthorizedViewRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The AuthorizedView to update. The `name` in `authorized_view` is + * used to identify the AuthorizedView. AuthorizedView name must in this + * format + * projects//instances//tables/
/authorizedViews/ + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView authorized_view = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $authorized_view = null; + /** + * Optional. The list of fields to update. + * A mask specifying which fields in the AuthorizedView resource should be + * updated. This mask is relative to the AuthorizedView resource, not to the + * request message. A field will be overwritten if it is in the mask. If + * empty, all fields set in the request will be overwritten. A special value + * `*` means to overwrite all fields (including fields not set in the + * request). + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $update_mask = null; + /** + * Optional. If true, ignore the safety checks when updating the + * AuthorizedView. + * + * Generated from protobuf field bool ignore_warnings = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $ignore_warnings = false; + + /** + * @param \Google\Cloud\Bigtable\Admin\V2\AuthorizedView $authorizedView Required. The AuthorizedView to update. The `name` in `authorized_view` is + * used to identify the AuthorizedView. AuthorizedView name must in this + * format + * projects//instances//tables/
/authorizedViews/ + * @param \Google\Protobuf\FieldMask $updateMask Optional. The list of fields to update. + * A mask specifying which fields in the AuthorizedView resource should be + * updated. This mask is relative to the AuthorizedView resource, not to the + * request message. A field will be overwritten if it is in the mask. If + * empty, all fields set in the request will be overwritten. A special value + * `*` means to overwrite all fields (including fields not set in the + * request). + * + * @return \Google\Cloud\Bigtable\Admin\V2\UpdateAuthorizedViewRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Bigtable\Admin\V2\AuthorizedView $authorizedView, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setAuthorizedView($authorizedView) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Bigtable\Admin\V2\AuthorizedView $authorized_view + * Required. The AuthorizedView to update. The `name` in `authorized_view` is + * used to identify the AuthorizedView. AuthorizedView name must in this + * format + * projects//instances//tables/
/authorizedViews/ + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. The list of fields to update. + * A mask specifying which fields in the AuthorizedView resource should be + * updated. This mask is relative to the AuthorizedView resource, not to the + * request message. A field will be overwritten if it is in the mask. If + * empty, all fields set in the request will be overwritten. A special value + * `*` means to overwrite all fields (including fields not set in the + * request). + * @type bool $ignore_warnings + * Optional. If true, ignore the safety checks when updating the + * AuthorizedView. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\Admin\V2\BigtableTableAdmin::initOnce(); + parent::__construct($data); + } + + /** + * Required. The AuthorizedView to update. The `name` in `authorized_view` is + * used to identify the AuthorizedView. AuthorizedView name must in this + * format + * projects//instances//tables/
/authorizedViews/ + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView authorized_view = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Bigtable\Admin\V2\AuthorizedView|null + */ + public function getAuthorizedView() + { + return $this->authorized_view; + } + + public function hasAuthorizedView() + { + return isset($this->authorized_view); + } + + public function clearAuthorizedView() + { + unset($this->authorized_view); + } + + /** + * Required. The AuthorizedView to update. The `name` in `authorized_view` is + * used to identify the AuthorizedView. AuthorizedView name must in this + * format + * projects//instances//tables/
/authorizedViews/ + * + * Generated from protobuf field .google.bigtable.admin.v2.AuthorizedView authorized_view = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Bigtable\Admin\V2\AuthorizedView $var + * @return $this + */ + public function setAuthorizedView($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\Admin\V2\AuthorizedView::class); + $this->authorized_view = $var; + + return $this; + } + + /** + * Optional. The list of fields to update. + * A mask specifying which fields in the AuthorizedView resource should be + * updated. This mask is relative to the AuthorizedView resource, not to the + * request message. A field will be overwritten if it is in the mask. If + * empty, all fields set in the request will be overwritten. A special value + * `*` means to overwrite all fields (including fields not set in the + * request). + * + * 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. + * A mask specifying which fields in the AuthorizedView resource should be + * updated. This mask is relative to the AuthorizedView resource, not to the + * request message. A field will be overwritten if it is in the mask. If + * empty, all fields set in the request will be overwritten. A special value + * `*` means to overwrite all fields (including fields not set in the + * request). + * + * 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; + } + + /** + * Optional. If true, ignore the safety checks when updating the + * AuthorizedView. + * + * Generated from protobuf field bool ignore_warnings = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getIgnoreWarnings() + { + return $this->ignore_warnings; + } + + /** + * Optional. If true, ignore the safety checks when updating the + * AuthorizedView. + * + * Generated from protobuf field bool ignore_warnings = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setIgnoreWarnings($var) + { + GPBUtil::checkBool($var); + $this->ignore_warnings = $var; + + return $this; + } + +} + diff --git a/Bigtable/src/Admin/V2/resources/bigtable_instance_admin_descriptor_config.php b/Bigtable/src/Admin/V2/resources/bigtable_instance_admin_descriptor_config.php index c396dc6a8ab0..4232256b1ba6 100644 --- a/Bigtable/src/Admin/V2/resources/bigtable_instance_admin_descriptor_config.php +++ b/Bigtable/src/Admin/V2/resources/bigtable_instance_admin_descriptor_config.php @@ -1,4 +1,24 @@ [ diff --git a/Bigtable/src/Admin/V2/resources/bigtable_instance_admin_rest_client_config.php b/Bigtable/src/Admin/V2/resources/bigtable_instance_admin_rest_client_config.php index 16303777335e..a92f99ec26d8 100644 --- a/Bigtable/src/Admin/V2/resources/bigtable_instance_admin_rest_client_config.php +++ b/Bigtable/src/Admin/V2/resources/bigtable_instance_admin_rest_client_config.php @@ -1,4 +1,24 @@ [ diff --git a/Bigtable/src/Admin/V2/resources/bigtable_table_admin_client_config.json b/Bigtable/src/Admin/V2/resources/bigtable_table_admin_client_config.json index 3f976071db34..47b0c167c97c 100644 --- a/Bigtable/src/Admin/V2/resources/bigtable_table_admin_client_config.json +++ b/Bigtable/src/Admin/V2/resources/bigtable_table_admin_client_config.json @@ -30,6 +30,11 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "CreateAuthorizedView": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "CreateBackup": { "timeout_millis": 60000, "retry_codes_name": "non_idempotent", @@ -45,6 +50,11 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "DeleteAuthorizedView": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "DeleteBackup": { "timeout_millis": 60000, "retry_codes_name": "non_idempotent", @@ -70,6 +80,11 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "GetAuthorizedView": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, "GetBackup": { "timeout_millis": 60000, "retry_codes_name": "idempotent", @@ -90,6 +105,11 @@ "retry_codes_name": "idempotent", "retry_params_name": "default" }, + "ListAuthorizedViews": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, "ListBackups": { "timeout_millis": 60000, "retry_codes_name": "idempotent", @@ -135,6 +155,11 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "UpdateAuthorizedView": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "UpdateBackup": { "timeout_millis": 60000, "retry_codes_name": "non_idempotent", diff --git a/Bigtable/src/Admin/V2/resources/bigtable_table_admin_descriptor_config.php b/Bigtable/src/Admin/V2/resources/bigtable_table_admin_descriptor_config.php index 16ebe75c26fc..c2ada4e51105 100644 --- a/Bigtable/src/Admin/V2/resources/bigtable_table_admin_descriptor_config.php +++ b/Bigtable/src/Admin/V2/resources/bigtable_table_admin_descriptor_config.php @@ -1,4 +1,24 @@ [ @@ -22,6 +42,25 @@ ], ], ], + 'CreateAuthorizedView' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Bigtable\Admin\V2\AuthorizedView', + 'metadataReturnType' => '\Google\Cloud\Bigtable\Admin\V2\CreateAuthorizedViewMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], 'CreateBackup' => [ 'longRunning' => [ 'operationReturnType' => '\Google\Cloud\Bigtable\Admin\V2\Backup', @@ -117,6 +156,26 @@ ], ], ], + 'UpdateAuthorizedView' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Bigtable\Admin\V2\AuthorizedView', + 'metadataReturnType' => '\Google\Cloud\Bigtable\Admin\V2\UpdateAuthorizedViewMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'authorized_view.name', + 'fieldAccessors' => [ + 'getAuthorizedView', + 'getName', + ], + ], + ], + ], 'UpdateTable' => [ 'longRunning' => [ 'operationReturnType' => '\Google\Cloud\Bigtable\Admin\V2\Table', @@ -161,6 +220,18 @@ ], ], ], + 'DeleteAuthorizedView' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], 'DeleteBackup' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Protobuf\GPBEmpty', @@ -221,6 +292,18 @@ ], ], ], + 'GetAuthorizedView' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Bigtable\Admin\V2\AuthorizedView', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], 'GetBackup' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Cloud\Bigtable\Admin\V2\Backup', @@ -269,6 +352,26 @@ ], ], ], + 'ListAuthorizedViews' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getAuthorizedViews', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Bigtable\Admin\V2\ListAuthorizedViewsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], 'ListBackups' => [ 'pageStreaming' => [ 'requestPageTokenGetMethod' => 'getPageToken', @@ -379,6 +482,7 @@ ], ], 'templateMap' => [ + 'authorizedView' => 'projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}', 'backup' => 'projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}', 'cluster' => 'projects/{project}/instances/{instance}/clusters/{cluster}', 'cryptoKeyVersion' => 'projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}', diff --git a/Bigtable/src/Admin/V2/resources/bigtable_table_admin_rest_client_config.php b/Bigtable/src/Admin/V2/resources/bigtable_table_admin_rest_client_config.php index 2414ff1b10c7..70910ee9a916 100644 --- a/Bigtable/src/Admin/V2/resources/bigtable_table_admin_rest_client_config.php +++ b/Bigtable/src/Admin/V2/resources/bigtable_table_admin_rest_client_config.php @@ -1,4 +1,24 @@ [ @@ -27,6 +47,21 @@ ], ], ], + 'CreateAuthorizedView' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{parent=projects/*/instances/*/tables/*}/authorizedViews', + 'body' => 'authorized_view', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'authorized_view_id', + ], + ], 'CreateBackup' => [ 'method' => 'post', 'uriTemplate' => '/v2/{parent=projects/*/instances/*/clusters/*}/backups', @@ -66,6 +101,17 @@ ], ], ], + 'DeleteAuthorizedView' => [ + 'method' => 'delete', + 'uriTemplate' => '/v2/{name=projects/*/instances/*/tables/*/authorizedViews/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'DeleteBackup' => [ 'method' => 'delete', 'uriTemplate' => '/v2/{name=projects/*/instances/*/clusters/*/backups/*}', @@ -123,6 +169,17 @@ ], ], ], + 'GetAuthorizedView' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{name=projects/*/instances/*/tables/*/authorizedViews/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetBackup' => [ 'method' => 'get', 'uriTemplate' => '/v2/{name=projects/*/instances/*/clusters/*/backups/*}', @@ -175,6 +232,17 @@ ], ], ], + 'ListAuthorizedViews' => [ + 'method' => 'get', + 'uriTemplate' => '/v2/{parent=projects/*/instances/*/tables/*}/authorizedViews', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], 'ListBackups' => [ 'method' => 'get', 'uriTemplate' => '/v2/{parent=projects/*/instances/*/clusters/*}/backups', @@ -294,6 +362,19 @@ ], ], ], + 'UpdateAuthorizedView' => [ + 'method' => 'patch', + 'uriTemplate' => '/v2/{authorized_view.name=projects/*/instances/*/tables/*/authorizedViews/*}', + 'body' => 'authorized_view', + 'placeholders' => [ + 'authorized_view.name' => [ + 'getters' => [ + 'getAuthorizedView', + 'getName', + ], + ], + ], + ], 'UpdateBackup' => [ 'method' => 'patch', 'uriTemplate' => '/v2/{backup.name=projects/*/instances/*/clusters/*/backups/*}', diff --git a/Bigtable/src/V2/CheckAndMutateRowRequest.php b/Bigtable/src/V2/CheckAndMutateRowRequest.php index ea4e5feef2c9..c87631158d03 100644 --- a/Bigtable/src/V2/CheckAndMutateRowRequest.php +++ b/Bigtable/src/V2/CheckAndMutateRowRequest.php @@ -16,13 +16,23 @@ class CheckAndMutateRowRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The unique name of the table to which the conditional mutation - * should be applied. Values are of the form + * Optional. The unique name of the table to which the conditional mutation + * should be applied. + * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ private $table_name = ''; + /** + * Optional. The unique name of the AuthorizedView to which the conditional + * mutation should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $authorized_view_name = ''; /** * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -68,8 +78,10 @@ class CheckAndMutateRowRequest extends \Google\Protobuf\Internal\Message private $false_mutations; /** - * @param string $tableName Required. The unique name of the table to which the conditional mutation - * should be applied. Values are of the form + * @param string $tableName Optional. The unique name of the table to which the conditional mutation + * should be applied. + * + * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. * @param string $rowKey Required. The key of the row to which the conditional mutation should be @@ -104,8 +116,10 @@ public static function build(string $tableName, string $rowKey, \Google\Cloud\Bi } /** - * @param string $tableName Required. The unique name of the table to which the conditional mutation - * should be applied. Values are of the form + * @param string $tableName Optional. The unique name of the table to which the conditional mutation + * should be applied. + * + * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. * @param string $rowKey Required. The key of the row to which the conditional mutation should be @@ -149,9 +163,15 @@ public static function buildFromTableNameRowKeyPredicateFilterTrueMutationsFalse * Optional. Data for populating the Message object. * * @type string $table_name - * Required. The unique name of the table to which the conditional mutation - * should be applied. Values are of the form + * Optional. The unique name of the table to which the conditional mutation + * should be applied. + * Values are of the form * `projects//instances//tables/
`. + * @type string $authorized_view_name + * Optional. The unique name of the AuthorizedView to which the conditional + * mutation should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. * @type string $app_profile_id * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -183,11 +203,12 @@ public function __construct($data = NULL) { } /** - * Required. The unique name of the table to which the conditional mutation - * should be applied. Values are of the form + * Optional. The unique name of the table to which the conditional mutation + * should be applied. + * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @return string */ public function getTableName() @@ -196,11 +217,12 @@ public function getTableName() } /** - * Required. The unique name of the table to which the conditional mutation - * should be applied. Values are of the form + * Optional. The unique name of the table to which the conditional mutation + * should be applied. + * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @param string $var * @return $this */ @@ -212,6 +234,38 @@ public function setTableName($var) return $this; } + /** + * Optional. The unique name of the AuthorizedView to which the conditional + * mutation should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getAuthorizedViewName() + { + return $this->authorized_view_name; + } + + /** + * Optional. The unique name of the AuthorizedView to which the conditional + * mutation should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAuthorizedViewName($var) + { + GPBUtil::checkString($var, True); + $this->authorized_view_name = $var; + + return $this; + } + /** * This value specifies routing for replication. If not specified, the * "default" application profile will be used. diff --git a/Bigtable/src/V2/Client/BigtableClient.php b/Bigtable/src/V2/Client/BigtableClient.php index 2f3df3908ff6..01f9efeb2843 100644 --- a/Bigtable/src/V2/Client/BigtableClient.php +++ b/Bigtable/src/V2/Client/BigtableClient.php @@ -119,6 +119,27 @@ private static function getClientDefaults() ]; } + /** + * Formats a string containing the fully-qualified path to represent a + * authorized_view resource. + * + * @param string $project + * @param string $instance + * @param string $table + * @param string $authorizedView + * + * @return string The formatted authorized_view resource. + */ + public static function authorizedViewName(string $project, string $instance, string $table, string $authorizedView): string + { + return self::getPathTemplate('authorizedView')->render([ + 'project' => $project, + 'instance' => $instance, + 'table' => $table, + 'authorized_view' => $authorizedView, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a instance * resource. @@ -159,6 +180,7 @@ public static function tableName(string $project, string $instance, string $tabl * Parses a formatted name string and returns an associative array of the components in the name. * The following name formats are supported: * Template: Pattern + * - authorizedView: projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view} * - instance: projects/{project}/instances/{instance} * - table: projects/{project}/instances/{instance}/tables/{table} * diff --git a/Bigtable/src/V2/FeatureFlags.php b/Bigtable/src/V2/FeatureFlags.php index 90c3a53e83e8..f9d2d8bcacea 100644 --- a/Bigtable/src/V2/FeatureFlags.php +++ b/Bigtable/src/V2/FeatureFlags.php @@ -66,6 +66,12 @@ class FeatureFlags extends \Google\Protobuf\Internal\Message * Generated from protobuf field bool retry_info = 7; */ private $retry_info = false; + /** + * Notify the server that the client has client side metrics enabled. + * + * Generated from protobuf field bool client_side_metrics_enabled = 8; + */ + private $client_side_metrics_enabled = false; /** * Constructor. @@ -93,6 +99,8 @@ class FeatureFlags extends \Google\Protobuf\Internal\Message * @type bool $retry_info * Notify the server that the client supports using retry info back off * durations to retry requests with. + * @type bool $client_side_metrics_enabled + * Notify the server that the client has client side metrics enabled. * } */ public function __construct($data = NULL) { @@ -272,5 +280,31 @@ public function setRetryInfo($var) return $this; } + /** + * Notify the server that the client has client side metrics enabled. + * + * Generated from protobuf field bool client_side_metrics_enabled = 8; + * @return bool + */ + public function getClientSideMetricsEnabled() + { + return $this->client_side_metrics_enabled; + } + + /** + * Notify the server that the client has client side metrics enabled. + * + * Generated from protobuf field bool client_side_metrics_enabled = 8; + * @param bool $var + * @return $this + */ + public function setClientSideMetricsEnabled($var) + { + GPBUtil::checkBool($var); + $this->client_side_metrics_enabled = $var; + + return $this; + } + } diff --git a/Bigtable/src/V2/Gapic/BigtableGapicClient.php b/Bigtable/src/V2/Gapic/BigtableGapicClient.php index ce645037b4e8..99c5625a5b27 100644 --- a/Bigtable/src/V2/Gapic/BigtableGapicClient.php +++ b/Bigtable/src/V2/Gapic/BigtableGapicClient.php @@ -119,6 +119,8 @@ class BigtableGapicClient 'https://www.googleapis.com/auth/cloud-platform.read-only', ]; + private static $authorizedViewNameTemplate; + private static $instanceNameTemplate; private static $tableNameTemplate; @@ -144,6 +146,15 @@ private static function getClientDefaults() ]; } + private static function getAuthorizedViewNameTemplate() + { + if (self::$authorizedViewNameTemplate == null) { + self::$authorizedViewNameTemplate = new PathTemplate('projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}'); + } + + return self::$authorizedViewNameTemplate; + } + private static function getInstanceNameTemplate() { if (self::$instanceNameTemplate == null) { @@ -166,6 +177,7 @@ private static function getPathTemplateMap() { if (self::$pathTemplateMap == null) { self::$pathTemplateMap = [ + 'authorizedView' => self::getAuthorizedViewNameTemplate(), 'instance' => self::getInstanceNameTemplate(), 'table' => self::getTableNameTemplate(), ]; @@ -174,6 +186,27 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + /** + * Formats a string containing the fully-qualified path to represent a + * authorized_view resource. + * + * @param string $project + * @param string $instance + * @param string $table + * @param string $authorizedView + * + * @return string The formatted authorized_view resource. + */ + public static function authorizedViewName($project, $instance, $table, $authorizedView) + { + return self::getAuthorizedViewNameTemplate()->render([ + 'project' => $project, + 'instance' => $instance, + 'table' => $table, + 'authorized_view' => $authorizedView, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a instance * resource. @@ -214,6 +247,7 @@ public static function tableName($project, $instance, $table) * Parses a formatted name string and returns an associative array of the components in the name. * The following name formats are supported: * Template: Pattern + * - authorizedView: projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view} * - instance: projects/{project}/instances/{instance} * - table: projects/{project}/instances/{instance}/tables/{table} * @@ -327,14 +361,22 @@ public function __construct(array $options = []) * } * ``` * - * @param string $tableName Required. The unique name of the table to which the conditional mutation - * should be applied. Values are of the form + * @param string $tableName Optional. The unique name of the table to which the conditional mutation + * should be applied. + * + * Values are of the form * `projects//instances//tables/
`. * @param string $rowKey Required. The key of the row to which the conditional mutation should be * applied. * @param array $optionalArgs { * Optional. * + * @type string $authorizedViewName + * Optional. The unique name of the AuthorizedView to which the conditional + * mutation should be applied. + * + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. * @type string $appProfileId * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -376,6 +418,14 @@ public function checkAndMutateRow($tableName, $rowKey, array $optionalArgs = []) $requestParamHeaders['table_name'] = $tableNameMatches['table_name']; } + if (isset($optionalArgs['authorizedViewName'])) { + $request->setAuthorizedViewName($optionalArgs['authorizedViewName']); + $authorizedViewNameMatches = []; + if (preg_match('/^(?projects\/[^\/]+\/instances\/[^\/]+\/tables\/[^\/]+\/authorizedViews\/[^\/]+)$/', $optionalArgs['authorizedViewName'], $authorizedViewNameMatches)) { + $requestParamHeaders['authorized_view_name'] = $authorizedViewNameMatches['authorized_view_name']; + } + } + if (isset($optionalArgs['appProfileId'])) { $request->setAppProfileId($optionalArgs['appProfileId']); $requestParamHeaders['app_profile_id'] = $optionalArgs['appProfileId']; @@ -470,8 +520,10 @@ public function generateInitialChangeStreamPartitions($tableName, array $optiona * } * ``` * - * @param string $tableName Required. The unique name of the table to which the mutation should be - * applied. Values are of the form + * @param string $tableName Optional. The unique name of the table to which the mutation should be + * applied. + * + * Values are of the form * `projects//instances//tables/
`. * @param string $rowKey Required. The key of the row to which the mutation should be applied. * @param Mutation[] $mutations Required. Changes to be atomically applied to the specified row. Entries @@ -480,6 +532,12 @@ public function generateInitialChangeStreamPartitions($tableName, array $optiona * @param array $optionalArgs { * Optional. * + * @type string $authorizedViewName + * Optional. The unique name of the AuthorizedView to which the mutation + * should be applied. + * + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. * @type string $appProfileId * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -505,6 +563,14 @@ public function mutateRow($tableName, $rowKey, $mutations, array $optionalArgs = $requestParamHeaders['table_name'] = $tableNameMatches['table_name']; } + if (isset($optionalArgs['authorizedViewName'])) { + $request->setAuthorizedViewName($optionalArgs['authorizedViewName']); + $authorizedViewNameMatches = []; + if (preg_match('/^(?projects\/[^\/]+\/instances\/[^\/]+\/tables\/[^\/]+\/authorizedViews\/[^\/]+)$/', $optionalArgs['authorizedViewName'], $authorizedViewNameMatches)) { + $requestParamHeaders['authorized_view_name'] = $authorizedViewNameMatches['authorized_view_name']; + } + } + if (isset($optionalArgs['appProfileId'])) { $request->setAppProfileId($optionalArgs['appProfileId']); $requestParamHeaders['app_profile_id'] = $optionalArgs['appProfileId']; @@ -536,8 +602,11 @@ public function mutateRow($tableName, $rowKey, $mutations, array $optionalArgs = * } * ``` * - * @param string $tableName Required. The unique name of the table to which the mutations should be + * @param string $tableName Optional. The unique name of the table to which the mutations should be * applied. + * + * Values are of the form + * `projects//instances//tables/
`. * @param Entry[] $entries Required. The row keys and corresponding mutations to be applied in bulk. * Each entry is applied as an atomic mutation, but the entries may be * applied in arbitrary order (even between entries for the same row). @@ -546,6 +615,12 @@ public function mutateRow($tableName, $rowKey, $mutations, array $optionalArgs = * @param array $optionalArgs { * Optional. * + * @type string $authorizedViewName + * Optional. The unique name of the AuthorizedView to which the mutations + * should be applied. + * + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. * @type string $appProfileId * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -568,6 +643,14 @@ public function mutateRows($tableName, $entries, array $optionalArgs = []) $requestParamHeaders['table_name'] = $tableNameMatches['table_name']; } + if (isset($optionalArgs['authorizedViewName'])) { + $request->setAuthorizedViewName($optionalArgs['authorizedViewName']); + $authorizedViewNameMatches = []; + if (preg_match('/^(?projects\/[^\/]+\/instances\/[^\/]+\/tables\/[^\/]+\/authorizedViews\/[^\/]+)$/', $optionalArgs['authorizedViewName'], $authorizedViewNameMatches)) { + $requestParamHeaders['authorized_view_name'] = $authorizedViewNameMatches['authorized_view_name']; + } + } + if (isset($optionalArgs['appProfileId'])) { $request->setAppProfileId($optionalArgs['appProfileId']); $requestParamHeaders['app_profile_id'] = $optionalArgs['appProfileId']; @@ -752,8 +835,10 @@ public function readChangeStream($tableName, array $optionalArgs = []) * } * ``` * - * @param string $tableName Required. The unique name of the table to which the read/modify/write rules - * should be applied. Values are of the form + * @param string $tableName Optional. The unique name of the table to which the read/modify/write rules + * should be applied. + * + * Values are of the form * `projects//instances//tables/
`. * @param string $rowKey Required. The key of the row to which the read/modify/write rules should be * applied. @@ -763,6 +848,12 @@ public function readChangeStream($tableName, array $optionalArgs = []) * @param array $optionalArgs { * Optional. * + * @type string $authorizedViewName + * Optional. The unique name of the AuthorizedView to which the + * read/modify/write rules should be applied. + * + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. * @type string $appProfileId * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -788,6 +879,14 @@ public function readModifyWriteRow($tableName, $rowKey, $rules, array $optionalA $requestParamHeaders['table_name'] = $tableNameMatches['table_name']; } + if (isset($optionalArgs['authorizedViewName'])) { + $request->setAuthorizedViewName($optionalArgs['authorizedViewName']); + $authorizedViewNameMatches = []; + if (preg_match('/^(?projects\/[^\/]+\/instances\/[^\/]+\/tables\/[^\/]+\/authorizedViews\/[^\/]+)$/', $optionalArgs['authorizedViewName'], $authorizedViewNameMatches)) { + $requestParamHeaders['authorized_view_name'] = $authorizedViewNameMatches['authorized_view_name']; + } + } + if (isset($optionalArgs['appProfileId'])) { $request->setAppProfileId($optionalArgs['appProfileId']); $requestParamHeaders['app_profile_id'] = $optionalArgs['appProfileId']; @@ -820,12 +919,18 @@ public function readModifyWriteRow($tableName, $rowKey, $rules, array $optionalA * } * ``` * - * @param string $tableName Required. The unique name of the table from which to read. + * @param string $tableName Optional. The unique name of the table from which to read. + * * Values are of the form * `projects//instances//tables/
`. * @param array $optionalArgs { * Optional. * + * @type string $authorizedViewName + * Optional. The unique name of the AuthorizedView from which to read. + * + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. * @type string $appProfileId * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -872,6 +977,14 @@ public function readRows($tableName, array $optionalArgs = []) $requestParamHeaders['table_name'] = $tableNameMatches['table_name']; } + if (isset($optionalArgs['authorizedViewName'])) { + $request->setAuthorizedViewName($optionalArgs['authorizedViewName']); + $authorizedViewNameMatches = []; + if (preg_match('/^(?projects\/[^\/]+\/instances\/[^\/]+\/tables\/[^\/]+\/authorizedViews\/[^\/]+)$/', $optionalArgs['authorizedViewName'], $authorizedViewNameMatches)) { + $requestParamHeaders['authorized_view_name'] = $authorizedViewNameMatches['authorized_view_name']; + } + } + if (isset($optionalArgs['appProfileId'])) { $request->setAppProfileId($optionalArgs['appProfileId']); $requestParamHeaders['app_profile_id'] = $optionalArgs['appProfileId']; @@ -923,12 +1036,19 @@ public function readRows($tableName, array $optionalArgs = []) * } * ``` * - * @param string $tableName Required. The unique name of the table from which to sample row keys. + * @param string $tableName Optional. The unique name of the table from which to sample row keys. + * * Values are of the form * `projects//instances//tables/
`. * @param array $optionalArgs { * Optional. * + * @type string $authorizedViewName + * Optional. The unique name of the AuthorizedView from which to sample row + * keys. + * + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. * @type string $appProfileId * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -950,6 +1070,14 @@ public function sampleRowKeys($tableName, array $optionalArgs = []) $requestParamHeaders['table_name'] = $tableNameMatches['table_name']; } + if (isset($optionalArgs['authorizedViewName'])) { + $request->setAuthorizedViewName($optionalArgs['authorizedViewName']); + $authorizedViewNameMatches = []; + if (preg_match('/^(?projects\/[^\/]+\/instances\/[^\/]+\/tables\/[^\/]+\/authorizedViews\/[^\/]+)$/', $optionalArgs['authorizedViewName'], $authorizedViewNameMatches)) { + $requestParamHeaders['authorized_view_name'] = $authorizedViewNameMatches['authorized_view_name']; + } + } + if (isset($optionalArgs['appProfileId'])) { $request->setAppProfileId($optionalArgs['appProfileId']); $requestParamHeaders['app_profile_id'] = $optionalArgs['appProfileId']; diff --git a/Bigtable/src/V2/MutateRowRequest.php b/Bigtable/src/V2/MutateRowRequest.php index e60634cabfaa..e03d01a62110 100644 --- a/Bigtable/src/V2/MutateRowRequest.php +++ b/Bigtable/src/V2/MutateRowRequest.php @@ -16,13 +16,23 @@ class MutateRowRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The unique name of the table to which the mutation should be - * applied. Values are of the form + * Optional. The unique name of the table to which the mutation should be + * applied. + * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ private $table_name = ''; + /** + * Optional. The unique name of the AuthorizedView to which the mutation + * should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $authorized_view_name = ''; /** * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -46,8 +56,10 @@ class MutateRowRequest extends \Google\Protobuf\Internal\Message private $mutations; /** - * @param string $tableName Required. The unique name of the table to which the mutation should be - * applied. Values are of the form + * @param string $tableName Optional. The unique name of the table to which the mutation should be + * applied. + * + * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. * @param string $rowKey Required. The key of the row to which the mutation should be applied. @@ -68,8 +80,10 @@ public static function build(string $tableName, string $rowKey, array $mutations } /** - * @param string $tableName Required. The unique name of the table to which the mutation should be - * applied. Values are of the form + * @param string $tableName Optional. The unique name of the table to which the mutation should be + * applied. + * + * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. * @param string $rowKey Required. The key of the row to which the mutation should be applied. @@ -99,9 +113,15 @@ public static function buildFromTableNameRowKeyMutationsAppProfileId(string $tab * Optional. Data for populating the Message object. * * @type string $table_name - * Required. The unique name of the table to which the mutation should be - * applied. Values are of the form + * Optional. The unique name of the table to which the mutation should be + * applied. + * Values are of the form * `projects//instances//tables/
`. + * @type string $authorized_view_name + * Optional. The unique name of the AuthorizedView to which the mutation + * should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. * @type string $app_profile_id * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -119,11 +139,12 @@ public function __construct($data = NULL) { } /** - * Required. The unique name of the table to which the mutation should be - * applied. Values are of the form + * Optional. The unique name of the table to which the mutation should be + * applied. + * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @return string */ public function getTableName() @@ -132,11 +153,12 @@ public function getTableName() } /** - * Required. The unique name of the table to which the mutation should be - * applied. Values are of the form + * Optional. The unique name of the table to which the mutation should be + * applied. + * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @param string $var * @return $this */ @@ -148,6 +170,38 @@ public function setTableName($var) return $this; } + /** + * Optional. The unique name of the AuthorizedView to which the mutation + * should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getAuthorizedViewName() + { + return $this->authorized_view_name; + } + + /** + * Optional. The unique name of the AuthorizedView to which the mutation + * should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAuthorizedViewName($var) + { + GPBUtil::checkString($var, True); + $this->authorized_view_name = $var; + + return $this; + } + /** * This value specifies routing for replication. If not specified, the * "default" application profile will be used. diff --git a/Bigtable/src/V2/MutateRowsRequest.php b/Bigtable/src/V2/MutateRowsRequest.php index 7546ac9e7b87..8405df53f720 100644 --- a/Bigtable/src/V2/MutateRowsRequest.php +++ b/Bigtable/src/V2/MutateRowsRequest.php @@ -16,12 +16,23 @@ class MutateRowsRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The unique name of the table to which the mutations should be + * Optional. The unique name of the table to which the mutations should be * applied. + * Values are of the form + * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ private $table_name = ''; + /** + * Optional. The unique name of the AuthorizedView to which the mutations + * should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $authorized_view_name = ''; /** * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -41,8 +52,11 @@ class MutateRowsRequest extends \Google\Protobuf\Internal\Message private $entries; /** - * @param string $tableName Required. The unique name of the table to which the mutations should be - * applied. Please see + * @param string $tableName Optional. The unique name of the table to which the mutations should be + * applied. + * + * Values are of the form + * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. * @param \Google\Cloud\Bigtable\V2\MutateRowsRequest\Entry[] $entries Required. The row keys and corresponding mutations to be applied in bulk. * Each entry is applied as an atomic mutation, but the entries may be @@ -62,8 +76,11 @@ public static function build(string $tableName, array $entries): self } /** - * @param string $tableName Required. The unique name of the table to which the mutations should be - * applied. Please see + * @param string $tableName Optional. The unique name of the table to which the mutations should be + * applied. + * + * Values are of the form + * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. * @param \Google\Cloud\Bigtable\V2\MutateRowsRequest\Entry[] $entries Required. The row keys and corresponding mutations to be applied in bulk. * Each entry is applied as an atomic mutation, but the entries may be @@ -92,8 +109,15 @@ public static function buildFromTableNameEntriesAppProfileId(string $tableName, * Optional. Data for populating the Message object. * * @type string $table_name - * Required. The unique name of the table to which the mutations should be + * Optional. The unique name of the table to which the mutations should be * applied. + * Values are of the form + * `projects//instances//tables/
`. + * @type string $authorized_view_name + * Optional. The unique name of the AuthorizedView to which the mutations + * should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. * @type string $app_profile_id * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -111,10 +135,12 @@ public function __construct($data = NULL) { } /** - * Required. The unique name of the table to which the mutations should be + * Optional. The unique name of the table to which the mutations should be * applied. + * Values are of the form + * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @return string */ public function getTableName() @@ -123,10 +149,12 @@ public function getTableName() } /** - * Required. The unique name of the table to which the mutations should be + * Optional. The unique name of the table to which the mutations should be * applied. + * Values are of the form + * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @param string $var * @return $this */ @@ -138,6 +166,38 @@ public function setTableName($var) return $this; } + /** + * Optional. The unique name of the AuthorizedView to which the mutations + * should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getAuthorizedViewName() + { + return $this->authorized_view_name; + } + + /** + * Optional. The unique name of the AuthorizedView to which the mutations + * should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAuthorizedViewName($var) + { + GPBUtil::checkString($var, True); + $this->authorized_view_name = $var; + + return $this; + } + /** * This value specifies routing for replication. If not specified, the * "default" application profile will be used. diff --git a/Bigtable/src/V2/Mutation.php b/Bigtable/src/V2/Mutation.php index e47fce180c11..fe4ec68925f7 100644 --- a/Bigtable/src/V2/Mutation.php +++ b/Bigtable/src/V2/Mutation.php @@ -25,6 +25,8 @@ class Mutation extends \Google\Protobuf\Internal\Message * * @type \Google\Cloud\Bigtable\V2\Mutation\SetCell $set_cell * Set a cell's value. + * @type \Google\Cloud\Bigtable\V2\Mutation\AddToCell $add_to_cell + * Incrementally updates an `Aggregate` cell. * @type \Google\Cloud\Bigtable\V2\Mutation\DeleteFromColumn $delete_from_column * Deletes cells from a column. * @type \Google\Cloud\Bigtable\V2\Mutation\DeleteFromFamily $delete_from_family @@ -69,6 +71,37 @@ public function setSetCell($var) return $this; } + /** + * Incrementally updates an `Aggregate` cell. + * + * Generated from protobuf field .google.bigtable.v2.Mutation.AddToCell add_to_cell = 5; + * @return \Google\Cloud\Bigtable\V2\Mutation\AddToCell|null + */ + public function getAddToCell() + { + return $this->readOneof(5); + } + + public function hasAddToCell() + { + return $this->hasOneof(5); + } + + /** + * Incrementally updates an `Aggregate` cell. + * + * Generated from protobuf field .google.bigtable.v2.Mutation.AddToCell add_to_cell = 5; + * @param \Google\Cloud\Bigtable\V2\Mutation\AddToCell $var + * @return $this + */ + public function setAddToCell($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Mutation\AddToCell::class); + $this->writeOneof(5, $var); + + return $this; + } + /** * Deletes cells from a column. * diff --git a/Bigtable/src/V2/Mutation/AddToCell.php b/Bigtable/src/V2/Mutation/AddToCell.php new file mode 100644 index 000000000000..beb1e661db2a --- /dev/null +++ b/Bigtable/src/V2/Mutation/AddToCell.php @@ -0,0 +1,222 @@ +google.bigtable.v2.Mutation.AddToCell + */ +class AddToCell extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the `Aggregate` family into which new data should be added. + * This must be a family with a `value_type` of `Aggregate`. + * Format: `[-_.a-zA-Z0-9]+` + * + * Generated from protobuf field string family_name = 1; + */ + private $family_name = ''; + /** + * The qualifier of the column into which new data should be added. This + * must be a `raw_value`. + * + * Generated from protobuf field .google.bigtable.v2.Value column_qualifier = 2; + */ + private $column_qualifier = null; + /** + * The timestamp of the cell to which new data should be added. This must + * be a `raw_timestamp_micros` that matches the table's `granularity`. + * + * Generated from protobuf field .google.bigtable.v2.Value timestamp = 3; + */ + private $timestamp = null; + /** + * The input value to be accumulated into the specified cell. This must be + * compatible with the family's `value_type.input_type`. + * + * Generated from protobuf field .google.bigtable.v2.Value input = 4; + */ + private $input = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $family_name + * The name of the `Aggregate` family into which new data should be added. + * This must be a family with a `value_type` of `Aggregate`. + * Format: `[-_.a-zA-Z0-9]+` + * @type \Google\Cloud\Bigtable\V2\Value $column_qualifier + * The qualifier of the column into which new data should be added. This + * must be a `raw_value`. + * @type \Google\Cloud\Bigtable\V2\Value $timestamp + * The timestamp of the cell to which new data should be added. This must + * be a `raw_timestamp_micros` that matches the table's `granularity`. + * @type \Google\Cloud\Bigtable\V2\Value $input + * The input value to be accumulated into the specified cell. This must be + * compatible with the family's `value_type.input_type`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Data::initOnce(); + parent::__construct($data); + } + + /** + * The name of the `Aggregate` family into which new data should be added. + * This must be a family with a `value_type` of `Aggregate`. + * Format: `[-_.a-zA-Z0-9]+` + * + * Generated from protobuf field string family_name = 1; + * @return string + */ + public function getFamilyName() + { + return $this->family_name; + } + + /** + * The name of the `Aggregate` family into which new data should be added. + * This must be a family with a `value_type` of `Aggregate`. + * Format: `[-_.a-zA-Z0-9]+` + * + * Generated from protobuf field string family_name = 1; + * @param string $var + * @return $this + */ + public function setFamilyName($var) + { + GPBUtil::checkString($var, True); + $this->family_name = $var; + + return $this; + } + + /** + * The qualifier of the column into which new data should be added. This + * must be a `raw_value`. + * + * Generated from protobuf field .google.bigtable.v2.Value column_qualifier = 2; + * @return \Google\Cloud\Bigtable\V2\Value|null + */ + public function getColumnQualifier() + { + return $this->column_qualifier; + } + + public function hasColumnQualifier() + { + return isset($this->column_qualifier); + } + + public function clearColumnQualifier() + { + unset($this->column_qualifier); + } + + /** + * The qualifier of the column into which new data should be added. This + * must be a `raw_value`. + * + * Generated from protobuf field .google.bigtable.v2.Value column_qualifier = 2; + * @param \Google\Cloud\Bigtable\V2\Value $var + * @return $this + */ + public function setColumnQualifier($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Value::class); + $this->column_qualifier = $var; + + return $this; + } + + /** + * The timestamp of the cell to which new data should be added. This must + * be a `raw_timestamp_micros` that matches the table's `granularity`. + * + * Generated from protobuf field .google.bigtable.v2.Value timestamp = 3; + * @return \Google\Cloud\Bigtable\V2\Value|null + */ + public function getTimestamp() + { + return $this->timestamp; + } + + public function hasTimestamp() + { + return isset($this->timestamp); + } + + public function clearTimestamp() + { + unset($this->timestamp); + } + + /** + * The timestamp of the cell to which new data should be added. This must + * be a `raw_timestamp_micros` that matches the table's `granularity`. + * + * Generated from protobuf field .google.bigtable.v2.Value timestamp = 3; + * @param \Google\Cloud\Bigtable\V2\Value $var + * @return $this + */ + public function setTimestamp($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Value::class); + $this->timestamp = $var; + + return $this; + } + + /** + * The input value to be accumulated into the specified cell. This must be + * compatible with the family's `value_type.input_type`. + * + * Generated from protobuf field .google.bigtable.v2.Value input = 4; + * @return \Google\Cloud\Bigtable\V2\Value|null + */ + public function getInput() + { + return $this->input; + } + + public function hasInput() + { + return isset($this->input); + } + + public function clearInput() + { + unset($this->input); + } + + /** + * The input value to be accumulated into the specified cell. This must be + * compatible with the family's `value_type.input_type`. + * + * Generated from protobuf field .google.bigtable.v2.Value input = 4; + * @param \Google\Cloud\Bigtable\V2\Value $var + * @return $this + */ + public function setInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Bigtable\V2\Value::class); + $this->input = $var; + + return $this; + } + +} + +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(AddToCell::class, \Google\Cloud\Bigtable\V2\Mutation_AddToCell::class); + diff --git a/Bigtable/src/V2/ReadModifyWriteRowRequest.php b/Bigtable/src/V2/ReadModifyWriteRowRequest.php index 150305f70ba1..d7d0a6df01b8 100644 --- a/Bigtable/src/V2/ReadModifyWriteRowRequest.php +++ b/Bigtable/src/V2/ReadModifyWriteRowRequest.php @@ -16,13 +16,23 @@ class ReadModifyWriteRowRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The unique name of the table to which the read/modify/write rules - * should be applied. Values are of the form + * Optional. The unique name of the table to which the read/modify/write rules + * should be applied. + * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ private $table_name = ''; + /** + * Optional. The unique name of the AuthorizedView to which the + * read/modify/write rules should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $authorized_view_name = ''; /** * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -47,8 +57,10 @@ class ReadModifyWriteRowRequest extends \Google\Protobuf\Internal\Message private $rules; /** - * @param string $tableName Required. The unique name of the table to which the read/modify/write rules - * should be applied. Values are of the form + * @param string $tableName Optional. The unique name of the table to which the read/modify/write rules + * should be applied. + * + * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. * @param string $rowKey Required. The key of the row to which the read/modify/write rules should be @@ -70,8 +82,10 @@ public static function build(string $tableName, string $rowKey, array $rules): s } /** - * @param string $tableName Required. The unique name of the table to which the read/modify/write rules - * should be applied. Values are of the form + * @param string $tableName Optional. The unique name of the table to which the read/modify/write rules + * should be applied. + * + * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. * @param string $rowKey Required. The key of the row to which the read/modify/write rules should be @@ -102,9 +116,15 @@ public static function buildFromTableNameRowKeyRulesAppProfileId(string $tableNa * Optional. Data for populating the Message object. * * @type string $table_name - * Required. The unique name of the table to which the read/modify/write rules - * should be applied. Values are of the form + * Optional. The unique name of the table to which the read/modify/write rules + * should be applied. + * Values are of the form * `projects//instances//tables/
`. + * @type string $authorized_view_name + * Optional. The unique name of the AuthorizedView to which the + * read/modify/write rules should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. * @type string $app_profile_id * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -123,11 +143,12 @@ public function __construct($data = NULL) { } /** - * Required. The unique name of the table to which the read/modify/write rules - * should be applied. Values are of the form + * Optional. The unique name of the table to which the read/modify/write rules + * should be applied. + * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @return string */ public function getTableName() @@ -136,11 +157,12 @@ public function getTableName() } /** - * Required. The unique name of the table to which the read/modify/write rules - * should be applied. Values are of the form + * Optional. The unique name of the table to which the read/modify/write rules + * should be applied. + * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @param string $var * @return $this */ @@ -152,6 +174,38 @@ public function setTableName($var) return $this; } + /** + * Optional. The unique name of the AuthorizedView to which the + * read/modify/write rules should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getAuthorizedViewName() + { + return $this->authorized_view_name; + } + + /** + * Optional. The unique name of the AuthorizedView to which the + * read/modify/write rules should be applied. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAuthorizedViewName($var) + { + GPBUtil::checkString($var, True); + $this->authorized_view_name = $var; + + return $this; + } + /** * This value specifies routing for replication. If not specified, the * "default" application profile will be used. diff --git a/Bigtable/src/V2/ReadRowsRequest.php b/Bigtable/src/V2/ReadRowsRequest.php index 6952ba095bf7..d5821fca7945 100644 --- a/Bigtable/src/V2/ReadRowsRequest.php +++ b/Bigtable/src/V2/ReadRowsRequest.php @@ -16,13 +16,21 @@ class ReadRowsRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The unique name of the table from which to read. + * Optional. The unique name of the table from which to read. * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ private $table_name = ''; + /** + * Optional. The unique name of the AuthorizedView from which to read. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $authorized_view_name = ''; /** * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -73,7 +81,8 @@ class ReadRowsRequest extends \Google\Protobuf\Internal\Message private $reversed = false; /** - * @param string $tableName Required. The unique name of the table from which to read. + * @param string $tableName Optional. The unique name of the table from which to read. + * * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. @@ -89,7 +98,8 @@ public static function build(string $tableName): self } /** - * @param string $tableName Required. The unique name of the table from which to read. + * @param string $tableName Optional. The unique name of the table from which to read. + * * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. @@ -114,9 +124,13 @@ public static function buildFromTableNameAppProfileId(string $tableName, string * Optional. Data for populating the Message object. * * @type string $table_name - * Required. The unique name of the table from which to read. + * Optional. The unique name of the table from which to read. * Values are of the form * `projects//instances//tables/
`. + * @type string $authorized_view_name + * Optional. The unique name of the AuthorizedView from which to read. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. * @type string $app_profile_id * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -149,11 +163,11 @@ public function __construct($data = NULL) { } /** - * Required. The unique name of the table from which to read. + * Optional. The unique name of the table from which to read. * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @return string */ public function getTableName() @@ -162,11 +176,11 @@ public function getTableName() } /** - * Required. The unique name of the table from which to read. + * Optional. The unique name of the table from which to read. * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @param string $var * @return $this */ @@ -178,6 +192,36 @@ public function setTableName($var) return $this; } + /** + * Optional. The unique name of the AuthorizedView from which to read. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getAuthorizedViewName() + { + return $this->authorized_view_name; + } + + /** + * Optional. The unique name of the AuthorizedView from which to read. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAuthorizedViewName($var) + { + GPBUtil::checkString($var, True); + $this->authorized_view_name = $var; + + return $this; + } + /** * This value specifies routing for replication. If not specified, the * "default" application profile will be used. diff --git a/Bigtable/src/V2/SampleRowKeysRequest.php b/Bigtable/src/V2/SampleRowKeysRequest.php index 7c931c379d59..1ca9d18860c0 100644 --- a/Bigtable/src/V2/SampleRowKeysRequest.php +++ b/Bigtable/src/V2/SampleRowKeysRequest.php @@ -16,13 +16,22 @@ class SampleRowKeysRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The unique name of the table from which to sample row keys. + * Optional. The unique name of the table from which to sample row keys. * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { */ private $table_name = ''; + /** + * Optional. The unique name of the AuthorizedView from which to sample row + * keys. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $authorized_view_name = ''; /** * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -32,7 +41,8 @@ class SampleRowKeysRequest extends \Google\Protobuf\Internal\Message private $app_profile_id = ''; /** - * @param string $tableName Required. The unique name of the table from which to sample row keys. + * @param string $tableName Optional. The unique name of the table from which to sample row keys. + * * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. @@ -48,7 +58,8 @@ public static function build(string $tableName): self } /** - * @param string $tableName Required. The unique name of the table from which to sample row keys. + * @param string $tableName Optional. The unique name of the table from which to sample row keys. + * * Values are of the form * `projects//instances//tables/
`. Please see * {@see BigtableClient::tableName()} for help formatting this field. @@ -73,9 +84,14 @@ public static function buildFromTableNameAppProfileId(string $tableName, string * Optional. Data for populating the Message object. * * @type string $table_name - * Required. The unique name of the table from which to sample row keys. + * Optional. The unique name of the table from which to sample row keys. * Values are of the form * `projects//instances//tables/
`. + * @type string $authorized_view_name + * Optional. The unique name of the AuthorizedView from which to sample row + * keys. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. * @type string $app_profile_id * This value specifies routing for replication. If not specified, the * "default" application profile will be used. @@ -87,11 +103,11 @@ public function __construct($data = NULL) { } /** - * Required. The unique name of the table from which to sample row keys. + * Optional. The unique name of the table from which to sample row keys. * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @return string */ public function getTableName() @@ -100,11 +116,11 @@ public function getTableName() } /** - * Required. The unique name of the table from which to sample row keys. + * Optional. The unique name of the table from which to sample row keys. * Values are of the form * `projects//instances//tables/
`. * - * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * Generated from protobuf field string table_name = 1 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { * @param string $var * @return $this */ @@ -116,6 +132,38 @@ public function setTableName($var) return $this; } + /** + * Optional. The unique name of the AuthorizedView from which to sample row + * keys. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getAuthorizedViewName() + { + return $this->authorized_view_name; + } + + /** + * Optional. The unique name of the AuthorizedView from which to sample row + * keys. + * Values are of the form + * `projects//instances//tables/
/authorizedViews/`. + * + * Generated from protobuf field string authorized_view_name = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAuthorizedViewName($var) + { + GPBUtil::checkString($var, True); + $this->authorized_view_name = $var; + + return $this; + } + /** * This value specifies routing for replication. If not specified, the * "default" application profile will be used. diff --git a/Bigtable/src/V2/Value.php b/Bigtable/src/V2/Value.php new file mode 100644 index 000000000000..1c91f2d6273b --- /dev/null +++ b/Bigtable/src/V2/Value.php @@ -0,0 +1,153 @@ +google.bigtable.v2.Value + */ +class Value extends \Google\Protobuf\Internal\Message +{ + protected $kind; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $raw_value + * Represents a raw byte sequence with no type information. + * The `type` field must be omitted. + * @type int|string $raw_timestamp_micros + * Represents a raw cell timestamp with no type information. + * The `type` field must be omitted. + * @type int|string $int_value + * Represents a typed value transported as an integer. + * Default type for writes: `Int64` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Bigtable\V2\Data::initOnce(); + parent::__construct($data); + } + + /** + * Represents a raw byte sequence with no type information. + * The `type` field must be omitted. + * + * Generated from protobuf field bytes raw_value = 8; + * @return string + */ + public function getRawValue() + { + return $this->readOneof(8); + } + + public function hasRawValue() + { + return $this->hasOneof(8); + } + + /** + * Represents a raw byte sequence with no type information. + * The `type` field must be omitted. + * + * Generated from protobuf field bytes raw_value = 8; + * @param string $var + * @return $this + */ + public function setRawValue($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Represents a raw cell timestamp with no type information. + * The `type` field must be omitted. + * + * Generated from protobuf field int64 raw_timestamp_micros = 9; + * @return int|string + */ + public function getRawTimestampMicros() + { + return $this->readOneof(9); + } + + public function hasRawTimestampMicros() + { + return $this->hasOneof(9); + } + + /** + * Represents a raw cell timestamp with no type information. + * The `type` field must be omitted. + * + * Generated from protobuf field int64 raw_timestamp_micros = 9; + * @param int|string $var + * @return $this + */ + public function setRawTimestampMicros($var) + { + GPBUtil::checkInt64($var); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Represents a typed value transported as an integer. + * Default type for writes: `Int64` + * + * Generated from protobuf field int64 int_value = 6; + * @return int|string + */ + public function getIntValue() + { + return $this->readOneof(6); + } + + public function hasIntValue() + { + return $this->hasOneof(6); + } + + /** + * Represents a typed value transported as an integer. + * Default type for writes: `Int64` + * + * Generated from protobuf field int64 int_value = 6; + * @param int|string $var + * @return $this + */ + public function setIntValue($var) + { + GPBUtil::checkInt64($var); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * @return string + */ + public function getKind() + { + return $this->whichOneof("kind"); + } + +} + diff --git a/Bigtable/src/V2/resources/bigtable_descriptor_config.php b/Bigtable/src/V2/resources/bigtable_descriptor_config.php index 7e237a7eb312..072e59d30db5 100644 --- a/Bigtable/src/V2/resources/bigtable_descriptor_config.php +++ b/Bigtable/src/V2/resources/bigtable_descriptor_config.php @@ -1,4 +1,24 @@ [ @@ -22,6 +42,15 @@ 'getAppProfileId', ], ], + [ + 'keyName' => 'authorized_view_name', + 'fieldAccessors' => [ + 'getAuthorizedViewName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/instances\/[^\/]+\/tables\/[^\/]+\/authorizedViews\/[^\/]+)$/', + ], + ], ], ], 'GenerateInitialChangeStreamPartitions' => [ @@ -58,6 +87,15 @@ 'getAppProfileId', ], ], + [ + 'keyName' => 'authorized_view_name', + 'fieldAccessors' => [ + 'getAuthorizedViewName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/instances\/[^\/]+\/tables\/[^\/]+\/authorizedViews\/[^\/]+)$/', + ], + ], ], ], 'MutateRows' => [ @@ -82,6 +120,15 @@ 'getAppProfileId', ], ], + [ + 'keyName' => 'authorized_view_name', + 'fieldAccessors' => [ + 'getAuthorizedViewName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/instances\/[^\/]+\/tables\/[^\/]+\/authorizedViews\/[^\/]+)$/', + ], + ], ], ], 'PingAndWarm' => [ @@ -139,6 +186,15 @@ 'getAppProfileId', ], ], + [ + 'keyName' => 'authorized_view_name', + 'fieldAccessors' => [ + 'getAuthorizedViewName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/instances\/[^\/]+\/tables\/[^\/]+\/authorizedViews\/[^\/]+)$/', + ], + ], ], ], 'ReadRows' => [ @@ -163,6 +219,15 @@ 'getAppProfileId', ], ], + [ + 'keyName' => 'authorized_view_name', + 'fieldAccessors' => [ + 'getAuthorizedViewName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/instances\/[^\/]+\/tables\/[^\/]+\/authorizedViews\/[^\/]+)$/', + ], + ], ], ], 'SampleRowKeys' => [ @@ -187,9 +252,19 @@ 'getAppProfileId', ], ], + [ + 'keyName' => 'authorized_view_name', + 'fieldAccessors' => [ + 'getAuthorizedViewName', + ], + 'matchers' => [ + '/^(?projects\/[^\/]+\/instances\/[^\/]+\/tables\/[^\/]+\/authorizedViews\/[^\/]+)$/', + ], + ], ], ], 'templateMap' => [ + 'authorizedView' => 'projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}', 'instance' => 'projects/{project}/instances/{instance}', 'table' => 'projects/{project}/instances/{instance}/tables/{table}', ], diff --git a/Bigtable/src/V2/resources/bigtable_rest_client_config.php b/Bigtable/src/V2/resources/bigtable_rest_client_config.php index d8108bb45931..e19d76ba2bf0 100644 --- a/Bigtable/src/V2/resources/bigtable_rest_client_config.php +++ b/Bigtable/src/V2/resources/bigtable_rest_client_config.php @@ -1,4 +1,24 @@ [ @@ -7,7 +27,19 @@ 'method' => 'post', 'uriTemplate' => '/v2/{table_name=projects/*/instances/*/tables/*}:checkAndMutateRow', 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v2/{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}:checkAndMutateRow', + 'body' => '*', + ], + ], 'placeholders' => [ + 'authorized_view_name' => [ + 'getters' => [ + 'getAuthorizedViewName', + ], + ], 'table_name' => [ 'getters' => [ 'getTableName', @@ -31,7 +63,19 @@ 'method' => 'post', 'uriTemplate' => '/v2/{table_name=projects/*/instances/*/tables/*}:mutateRow', 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v2/{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}:mutateRow', + 'body' => '*', + ], + ], 'placeholders' => [ + 'authorized_view_name' => [ + 'getters' => [ + 'getAuthorizedViewName', + ], + ], 'table_name' => [ 'getters' => [ 'getTableName', @@ -43,7 +87,19 @@ 'method' => 'post', 'uriTemplate' => '/v2/{table_name=projects/*/instances/*/tables/*}:mutateRows', 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v2/{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}:mutateRows', + 'body' => '*', + ], + ], 'placeholders' => [ + 'authorized_view_name' => [ + 'getters' => [ + 'getAuthorizedViewName', + ], + ], 'table_name' => [ 'getters' => [ 'getTableName', @@ -79,7 +135,19 @@ 'method' => 'post', 'uriTemplate' => '/v2/{table_name=projects/*/instances/*/tables/*}:readModifyWriteRow', 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v2/{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}:readModifyWriteRow', + 'body' => '*', + ], + ], 'placeholders' => [ + 'authorized_view_name' => [ + 'getters' => [ + 'getAuthorizedViewName', + ], + ], 'table_name' => [ 'getters' => [ 'getTableName', @@ -91,7 +159,19 @@ 'method' => 'post', 'uriTemplate' => '/v2/{table_name=projects/*/instances/*/tables/*}:readRows', 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v2/{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}:readRows', + 'body' => '*', + ], + ], 'placeholders' => [ + 'authorized_view_name' => [ + 'getters' => [ + 'getAuthorizedViewName', + ], + ], 'table_name' => [ 'getters' => [ 'getTableName', @@ -102,7 +182,18 @@ 'SampleRowKeys' => [ 'method' => 'get', 'uriTemplate' => '/v2/{table_name=projects/*/instances/*/tables/*}:sampleRowKeys', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v2/{authorized_view_name=projects/*/instances/*/tables/*/authorizedViews/*}:sampleRowKeys', + ], + ], 'placeholders' => [ + 'authorized_view_name' => [ + 'getters' => [ + 'getAuthorizedViewName', + ], + ], 'table_name' => [ 'getters' => [ 'getTableName', diff --git a/Bigtable/tests/Unit/Admin/V2/BigtableTableAdminClientTest.php b/Bigtable/tests/Unit/Admin/V2/BigtableTableAdminClientTest.php index e93f95554837..cc1e86b5c6f3 100644 --- a/Bigtable/tests/Unit/Admin/V2/BigtableTableAdminClientTest.php +++ b/Bigtable/tests/Unit/Admin/V2/BigtableTableAdminClientTest.php @@ -27,10 +27,12 @@ use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; +use Google\Cloud\Bigtable\Admin\V2\AuthorizedView; use Google\Cloud\Bigtable\Admin\V2\Backup; use Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient; use Google\Cloud\Bigtable\Admin\V2\CheckConsistencyResponse; use Google\Cloud\Bigtable\Admin\V2\GenerateConsistencyTokenResponse; +use Google\Cloud\Bigtable\Admin\V2\ListAuthorizedViewsResponse; use Google\Cloud\Bigtable\Admin\V2\ListBackupsResponse; use Google\Cloud\Bigtable\Admin\V2\ListSnapshotsResponse; use Google\Cloud\Bigtable\Admin\V2\ListTablesResponse; @@ -277,6 +279,137 @@ public function copyBackupExceptionTest() $this->assertTrue($operationsTransport->isExhausted()); } + /** @test */ + public function createAuthorizedViewTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createAuthorizedViewTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $etag = 'etag3123477'; + $deletionProtection = true; + $expectedResponse = new AuthorizedView(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $expectedResponse->setDeletionProtection($deletionProtection); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAuthorizedViewTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]'); + $authorizedViewId = 'authorizedViewId1171901009'; + $authorizedView = new AuthorizedView(); + $response = $gapicClient->createAuthorizedView($formattedParent, $authorizedViewId, $authorizedView); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.bigtable.admin.v2.BigtableTableAdmin/CreateAuthorizedView', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAuthorizedViewId(); + $this->assertProtobufEquals($authorizedViewId, $actualValue); + $actualValue = $actualApiRequestObject->getAuthorizedView(); + $this->assertProtobufEquals($authorizedView, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAuthorizedViewTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createAuthorizedViewExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createAuthorizedViewTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $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); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]'); + $authorizedViewId = 'authorizedViewId1171901009'; + $authorizedView = new AuthorizedView(); + $response = $gapicClient->createAuthorizedView($formattedParent, $authorizedViewId, $authorizedView); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAuthorizedViewTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() 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 stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + /** @test */ public function createBackupTest() { @@ -617,6 +750,63 @@ public function createTableFromSnapshotExceptionTest() $this->assertTrue($operationsTransport->isExhausted()); } + /** @test */ + public function deleteAuthorizedViewTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->authorizedViewName('[PROJECT]', '[INSTANCE]', '[TABLE]', '[AUTHORIZED_VIEW]'); + $gapicClient->deleteAuthorizedView($formattedName); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.bigtable.admin.v2.BigtableTableAdmin/DeleteAuthorizedView', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteAuthorizedViewExceptionTest() + { + $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->authorizedViewName('[PROJECT]', '[INSTANCE]', '[TABLE]', '[AUTHORIZED_VIEW]'); + try { + $gapicClient->deleteAuthorizedView($formattedName); + // 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 deleteBackupTest() { @@ -905,6 +1095,70 @@ public function generateConsistencyTokenExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function getAuthorizedViewTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $etag = 'etag3123477'; + $deletionProtection = true; + $expectedResponse = new AuthorizedView(); + $expectedResponse->setName($name2); + $expectedResponse->setEtag($etag); + $expectedResponse->setDeletionProtection($deletionProtection); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->authorizedViewName('[PROJECT]', '[INSTANCE]', '[TABLE]', '[AUTHORIZED_VIEW]'); + $response = $gapicClient->getAuthorizedView($formattedName); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.bigtable.admin.v2.BigtableTableAdmin/GetAuthorizedView', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAuthorizedViewExceptionTest() + { + $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->authorizedViewName('[PROJECT]', '[INSTANCE]', '[TABLE]', '[AUTHORIZED_VIEW]'); + try { + $gapicClient->getAuthorizedView($formattedName); + // 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 getBackupTest() { @@ -1159,6 +1413,74 @@ public function getTableExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function listAuthorizedViewsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $authorizedViewsElement = new AuthorizedView(); + $authorizedViews = [ + $authorizedViewsElement, + ]; + $expectedResponse = new ListAuthorizedViewsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAuthorizedViews($authorizedViews); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]'); + $response = $gapicClient->listAuthorizedViews($formattedParent); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAuthorizedViews()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.bigtable.admin.v2.BigtableTableAdmin/ListAuthorizedViews', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAuthorizedViewsExceptionTest() + { + $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->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]'); + try { + $gapicClient->listAuthorizedViews($formattedParent); + // 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 listBackupsTest() { @@ -1934,6 +2256,129 @@ public function undeleteTableExceptionTest() $this->assertTrue($operationsTransport->isExhausted()); } + /** @test */ + public function updateAuthorizedViewTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateAuthorizedViewTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $etag = 'etag3123477'; + $deletionProtection = true; + $expectedResponse = new AuthorizedView(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $expectedResponse->setDeletionProtection($deletionProtection); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateAuthorizedViewTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $authorizedView = new AuthorizedView(); + $response = $gapicClient->updateAuthorizedView($authorizedView); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.bigtable.admin.v2.BigtableTableAdmin/UpdateAuthorizedView', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getAuthorizedView(); + $this->assertProtobufEquals($authorizedView, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAuthorizedViewTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateAuthorizedViewExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateAuthorizedViewTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $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); + $operationsTransport->addResponse(null, $status); + // Mock request + $authorizedView = new AuthorizedView(); + $response = $gapicClient->updateAuthorizedView($authorizedView); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAuthorizedViewTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() 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 stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + /** @test */ public function updateBackupTest() { diff --git a/Bigtable/tests/Unit/Admin/V2/Client/BigtableTableAdminClientTest.php b/Bigtable/tests/Unit/Admin/V2/Client/BigtableTableAdminClientTest.php index ed32edd34f91..b57e6f65fd29 100644 --- a/Bigtable/tests/Unit/Admin/V2/Client/BigtableTableAdminClientTest.php +++ b/Bigtable/tests/Unit/Admin/V2/Client/BigtableTableAdminClientTest.php @@ -27,23 +27,29 @@ use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; +use Google\Cloud\Bigtable\Admin\V2\AuthorizedView; use Google\Cloud\Bigtable\Admin\V2\Backup; use Google\Cloud\Bigtable\Admin\V2\CheckConsistencyRequest; use Google\Cloud\Bigtable\Admin\V2\CheckConsistencyResponse; use Google\Cloud\Bigtable\Admin\V2\Client\BigtableTableAdminClient; use Google\Cloud\Bigtable\Admin\V2\CopyBackupRequest; +use Google\Cloud\Bigtable\Admin\V2\CreateAuthorizedViewRequest; use Google\Cloud\Bigtable\Admin\V2\CreateBackupRequest; use Google\Cloud\Bigtable\Admin\V2\CreateTableFromSnapshotRequest; use Google\Cloud\Bigtable\Admin\V2\CreateTableRequest; +use Google\Cloud\Bigtable\Admin\V2\DeleteAuthorizedViewRequest; use Google\Cloud\Bigtable\Admin\V2\DeleteBackupRequest; use Google\Cloud\Bigtable\Admin\V2\DeleteSnapshotRequest; use Google\Cloud\Bigtable\Admin\V2\DeleteTableRequest; use Google\Cloud\Bigtable\Admin\V2\DropRowRangeRequest; use Google\Cloud\Bigtable\Admin\V2\GenerateConsistencyTokenRequest; use Google\Cloud\Bigtable\Admin\V2\GenerateConsistencyTokenResponse; +use Google\Cloud\Bigtable\Admin\V2\GetAuthorizedViewRequest; use Google\Cloud\Bigtable\Admin\V2\GetBackupRequest; use Google\Cloud\Bigtable\Admin\V2\GetSnapshotRequest; use Google\Cloud\Bigtable\Admin\V2\GetTableRequest; +use Google\Cloud\Bigtable\Admin\V2\ListAuthorizedViewsRequest; +use Google\Cloud\Bigtable\Admin\V2\ListAuthorizedViewsResponse; use Google\Cloud\Bigtable\Admin\V2\ListBackupsRequest; use Google\Cloud\Bigtable\Admin\V2\ListBackupsResponse; use Google\Cloud\Bigtable\Admin\V2\ListSnapshotsRequest; @@ -56,6 +62,7 @@ use Google\Cloud\Bigtable\Admin\V2\SnapshotTableRequest; use Google\Cloud\Bigtable\Admin\V2\Table; use Google\Cloud\Bigtable\Admin\V2\UndeleteTableRequest; +use Google\Cloud\Bigtable\Admin\V2\UpdateAuthorizedViewRequest; use Google\Cloud\Bigtable\Admin\V2\UpdateBackupRequest; use Google\Cloud\Bigtable\Admin\V2\UpdateTableRequest; use Google\Cloud\Iam\V1\GetIamPolicyRequest; @@ -318,6 +325,145 @@ public function copyBackupExceptionTest() $this->assertTrue($operationsTransport->isExhausted()); } + /** @test */ + public function createAuthorizedViewTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createAuthorizedViewTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $etag = 'etag3123477'; + $deletionProtection = true; + $expectedResponse = new AuthorizedView(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $expectedResponse->setDeletionProtection($deletionProtection); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createAuthorizedViewTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]'); + $authorizedViewId = 'authorizedViewId1171901009'; + $authorizedView = new AuthorizedView(); + $request = (new CreateAuthorizedViewRequest()) + ->setParent($formattedParent) + ->setAuthorizedViewId($authorizedViewId) + ->setAuthorizedView($authorizedView); + $response = $gapicClient->createAuthorizedView($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.bigtable.admin.v2.BigtableTableAdmin/CreateAuthorizedView', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getAuthorizedViewId(); + $this->assertProtobufEquals($authorizedViewId, $actualValue); + $actualValue = $actualApiRequestObject->getAuthorizedView(); + $this->assertProtobufEquals($authorizedView, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAuthorizedViewTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function createAuthorizedViewExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createAuthorizedViewTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $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); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]'); + $authorizedViewId = 'authorizedViewId1171901009'; + $authorizedView = new AuthorizedView(); + $request = (new CreateAuthorizedViewRequest()) + ->setParent($formattedParent) + ->setAuthorizedViewId($authorizedViewId) + ->setAuthorizedView($authorizedView); + $response = $gapicClient->createAuthorizedView($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createAuthorizedViewTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() 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 stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + /** @test */ public function createBackupTest() { @@ -682,6 +828,67 @@ public function createTableFromSnapshotExceptionTest() $this->assertTrue($operationsTransport->isExhausted()); } + /** @test */ + public function deleteAuthorizedViewTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->authorizedViewName('[PROJECT]', '[INSTANCE]', '[TABLE]', '[AUTHORIZED_VIEW]'); + $request = (new DeleteAuthorizedViewRequest()) + ->setName($formattedName); + $gapicClient->deleteAuthorizedView($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.bigtable.admin.v2.BigtableTableAdmin/DeleteAuthorizedView', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteAuthorizedViewExceptionTest() + { + $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->authorizedViewName('[PROJECT]', '[INSTANCE]', '[TABLE]', '[AUTHORIZED_VIEW]'); + $request = (new DeleteAuthorizedViewRequest()) + ->setName($formattedName); + try { + $gapicClient->deleteAuthorizedView($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 deleteBackupTest() { @@ -990,6 +1197,74 @@ public function generateConsistencyTokenExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function getAuthorizedViewTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $etag = 'etag3123477'; + $deletionProtection = true; + $expectedResponse = new AuthorizedView(); + $expectedResponse->setName($name2); + $expectedResponse->setEtag($etag); + $expectedResponse->setDeletionProtection($deletionProtection); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->authorizedViewName('[PROJECT]', '[INSTANCE]', '[TABLE]', '[AUTHORIZED_VIEW]'); + $request = (new GetAuthorizedViewRequest()) + ->setName($formattedName); + $response = $gapicClient->getAuthorizedView($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.bigtable.admin.v2.BigtableTableAdmin/GetAuthorizedView', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAuthorizedViewExceptionTest() + { + $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->authorizedViewName('[PROJECT]', '[INSTANCE]', '[TABLE]', '[AUTHORIZED_VIEW]'); + $request = (new GetAuthorizedViewRequest()) + ->setName($formattedName); + try { + $gapicClient->getAuthorizedView($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 getBackupTest() { @@ -1260,6 +1535,78 @@ public function getTableExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function listAuthorizedViewsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $authorizedViewsElement = new AuthorizedView(); + $authorizedViews = [ + $authorizedViewsElement, + ]; + $expectedResponse = new ListAuthorizedViewsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setAuthorizedViews($authorizedViews); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]'); + $request = (new ListAuthorizedViewsRequest()) + ->setParent($formattedParent); + $response = $gapicClient->listAuthorizedViews($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getAuthorizedViews()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.bigtable.admin.v2.BigtableTableAdmin/ListAuthorizedViews', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listAuthorizedViewsExceptionTest() + { + $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->tableName('[PROJECT]', '[INSTANCE]', '[TABLE]'); + $request = (new ListAuthorizedViewsRequest()) + ->setParent($formattedParent); + try { + $gapicClient->listAuthorizedViews($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 listBackupsTest() { @@ -2083,6 +2430,133 @@ public function undeleteTableExceptionTest() $this->assertTrue($operationsTransport->isExhausted()); } + /** @test */ + public function updateAuthorizedViewTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateAuthorizedViewTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $etag = 'etag3123477'; + $deletionProtection = true; + $expectedResponse = new AuthorizedView(); + $expectedResponse->setName($name); + $expectedResponse->setEtag($etag); + $expectedResponse->setDeletionProtection($deletionProtection); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateAuthorizedViewTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $authorizedView = new AuthorizedView(); + $request = (new UpdateAuthorizedViewRequest()) + ->setAuthorizedView($authorizedView); + $response = $gapicClient->updateAuthorizedView($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.bigtable.admin.v2.BigtableTableAdmin/UpdateAuthorizedView', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getAuthorizedView(); + $this->assertProtobufEquals($authorizedView, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAuthorizedViewTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateAuthorizedViewExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateAuthorizedViewTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $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); + $operationsTransport->addResponse(null, $status); + // Mock request + $authorizedView = new AuthorizedView(); + $request = (new UpdateAuthorizedViewRequest()) + ->setAuthorizedView($authorizedView); + $response = $gapicClient->updateAuthorizedView($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateAuthorizedViewTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() 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 stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + /** @test */ public function updateBackupTest() {