diff --git a/GkeHub/metadata/V1/Feature.php b/GkeHub/metadata/V1/Feature.php index d26e5f8ddeaa..d9a3c5008613 100644 Binary files a/GkeHub/metadata/V1/Feature.php and b/GkeHub/metadata/V1/Feature.php differ diff --git a/GkeHub/metadata/V1/Fleet.php b/GkeHub/metadata/V1/Fleet.php new file mode 100644 index 000000000000..62a07417f908 Binary files /dev/null and b/GkeHub/metadata/V1/Fleet.php differ diff --git a/GkeHub/metadata/V1/Rbacrolebindingactuation/Rbacrolebindingactuation.php b/GkeHub/metadata/V1/Rbacrolebindingactuation/Rbacrolebindingactuation.php new file mode 100644 index 000000000000..2e6387fb9408 --- /dev/null +++ b/GkeHub/metadata/V1/Rbacrolebindingactuation/Rbacrolebindingactuation.php @@ -0,0 +1,31 @@ +internalAddGeneratedFile( + ' +ª +Ngoogle/cloud/gkehub/v1/rbacrolebindingactuation/rbacrolebindingactuation.proto/google.cloud.gkehub.rbacrolebindingactuation.v1"+ + FeatureSpec +allowed_custom_roles ( " + FeatureStateBá +3com.google.cloud.gkehub.rbacrolebindingactuation.v1BRBACRoleBindingActuationProtoPZocloud.google.com/go/gkehub/rbacrolebindingactuation/apiv1/rbacrolebindingactuationpb;rbacrolebindingactuationpbª/Google.Cloud.GkeHub.RbacRoleBindingActuation.V1Ê/Google\\Cloud\\GkeHub\\RbacRoleBindingActuation\\V1ê3Google::Cloud::GkeHub::RbacRoleBindingActuation::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/GkeHub/metadata/V1/Service.php b/GkeHub/metadata/V1/Service.php index 2401f2d81a41..4ea182879931 100644 --- a/GkeHub/metadata/V1/Service.php +++ b/GkeHub/metadata/V1/Service.php @@ -19,28 +19,164 @@ public static function initOnce() { \GPBMetadata\Google\Api\FieldBehavior::initOnce(); \GPBMetadata\Google\Api\Resource::initOnce(); \GPBMetadata\Google\Cloud\Gkehub\V1\Feature::initOnce(); + \GPBMetadata\Google\Cloud\Gkehub\V1\Fleet::initOnce(); \GPBMetadata\Google\Cloud\Gkehub\V1\Membership::initOnce(); \GPBMetadata\Google\Longrunning\Operations::initOnce(); \GPBMetadata\Google\Protobuf\FieldMask::initOnce(); \GPBMetadata\Google\Protobuf\Timestamp::initOnce(); $pool->internalAddGeneratedFile( ' -—) -$google/cloud/gkehub/v1/service.protogoogle.cloud.gkehub.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto$google/cloud/gkehub/v1/feature.proto\'google/cloud/gkehub/v1/membership.proto#google/longrunning/operations.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"¯ +‚ +$google/cloud/gkehub/v1/service.protogoogle.cloud.gkehub.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto$google/cloud/gkehub/v1/feature.proto"google/cloud/gkehub/v1/fleet.proto\'google/cloud/gkehub/v1/membership.proto#google/longrunning/operations.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto"Q +GetScopeNamespaceRequest5 +name ( B\'àAúA! +gkehub.googleapis.com/Namespace"¸ +CreateScopeNamespaceRequest7 +parent ( B\'àAúA!gkehub.googleapis.com/Namespace +scope_namespace_id ( BàA? +scope_namespace ( 2!.google.cloud.gkehub.v1.NamespaceBàA"” +UpdateScopeNamespaceRequest? +scope_namespace ( 2!.google.cloud.gkehub.v1.NamespaceBàA4 + update_mask ( 2.google.protobuf.FieldMaskBàA"T +DeleteScopeNamespaceRequest5 +name ( B\'àAúA! +gkehub.googleapis.com/Namespace"† +ListScopeNamespacesRequest7 +parent ( B\'àAúA!gkehub.googleapis.com/Namespace + page_size (BàA + +page_token ( BàA"s +ListScopeNamespacesResponse; +scope_namespaces ( 2!.google.cloud.gkehub.v1.Namespace +next_page_token ( "] +GetScopeRBACRoleBindingRequest; +name ( B-àAúA\' +%gkehub.googleapis.com/RBACRoleBinding"Ê +!CreateScopeRBACRoleBindingRequest= +parent ( B-àAúA\'%gkehub.googleapis.com/RBACRoleBinding +rbacrolebinding_id ( BàAE +rbacrolebinding ( 2\'.google.cloud.gkehub.v1.RBACRoleBindingBàA"  +!UpdateScopeRBACRoleBindingRequestE +rbacrolebinding ( 2\'.google.cloud.gkehub.v1.RBACRoleBindingBàA4 + update_mask ( 2.google.protobuf.FieldMaskBàA"` +!DeleteScopeRBACRoleBindingRequest; +name ( B-àAúA\' +%gkehub.googleapis.com/RBACRoleBinding"’ + ListScopeRBACRoleBindingsRequest= +parent ( B-àAúA\'%gkehub.googleapis.com/RBACRoleBinding + page_size (BàA + +page_token ( BàA" +!ListScopeRBACRoleBindingsResponseA +rbacrolebindings ( 2\'.google.cloud.gkehub.v1.RBACRoleBinding +next_page_token ( "D +GetScopeRequest1 +name ( B#àAúA +gkehub.googleapis.com/Scope"“ +CreateScopeRequest3 +parent ( B#àAúAgkehub.googleapis.com/Scope +scope_id ( BàA1 +scope ( 2.google.cloud.gkehub.v1.ScopeBàA"} +UpdateScopeRequest1 +scope ( 2.google.cloud.gkehub.v1.ScopeBàA4 + update_mask ( 2.google.protobuf.FieldMaskBàA"G +DeleteScopeRequest1 +name ( B#àAúA +gkehub.googleapis.com/Scope"y +ListScopesRequest3 +parent ( B#àAúAgkehub.googleapis.com/Scope + page_size (BàA + +page_token ( BàA"\\ +ListScopesResponse- +scopes ( 2.google.cloud.gkehub.v1.Scope +next_page_token ( "‚ +ListPermittedScopesRequest3 +parent ( B#àAúAgkehub.googleapis.com/Scope + page_size (BàA + +page_token ( BàA"e +ListPermittedScopesResponse- +scopes ( 2.google.cloud.gkehub.v1.Scope +next_page_token ( "\\ +GetMembershipBindingRequest= +name ( B/àAúA) +\'gkehub.googleapis.com/MembershipBinding"Ñ +CreateMembershipBindingRequest? +parent ( B/àAúA)\'gkehub.googleapis.com/MembershipBindingJ +membership_binding ( 2).google.cloud.gkehub.v1.MembershipBindingBàA" +membership_binding_id ( BàA"¢ +UpdateMembershipBindingRequestJ +membership_binding ( 2).google.cloud.gkehub.v1.MembershipBindingBàA4 + update_mask ( 2.google.protobuf.FieldMaskBàA"_ +DeleteMembershipBindingRequest= +name ( B/àAúA) +\'gkehub.googleapis.com/MembershipBinding"¦ +ListMembershipBindingsRequest? +parent ( B/àAúA)\'gkehub.googleapis.com/MembershipBinding + page_size (BàA + +page_token ( BàA +filter ( BàA"– +ListMembershipBindingsResponseF +membership_bindings ( 2).google.cloud.gkehub.v1.MembershipBinding +next_page_token (  + unreachable ( "¯ ListMembershipsRequest8 parent ( B(àAúA" gkehub.googleapis.com/Membership page_size (BàA page_token ( BàA filter ( BàA -order_by ( BàA"~ +order_by ( BàA"b +#GetMembershipRBACRoleBindingRequest; +name ( B-àAúA\' +%gkehub.googleapis.com/RBACRoleBinding"Ï +&CreateMembershipRBACRoleBindingRequest= +parent ( B-àAúA\'%gkehub.googleapis.com/RBACRoleBinding +rbacrolebinding_id ( BàAE +rbacrolebinding ( 2\'.google.cloud.gkehub.v1.RBACRoleBindingBàA"¥ +&UpdateMembershipRBACRoleBindingRequestE +rbacrolebinding ( 2\'.google.cloud.gkehub.v1.RBACRoleBindingBàA4 + update_mask ( 2.google.protobuf.FieldMaskBàA"e +&DeleteMembershipRBACRoleBindingRequest; +name ( B-àAúA\' +%gkehub.googleapis.com/RBACRoleBinding"— +%ListMembershipRBACRoleBindingsRequest= +parent ( B-àAúA\'%gkehub.googleapis.com/RBACRoleBinding + page_size (BàA + +page_token ( BàA"™ +&ListMembershipRBACRoleBindingsResponseA +rbacrolebindings ( 2\'.google.cloud.gkehub.v1.RBACRoleBinding +next_page_token (  + unreachable ( "Ð +,GenerateMembershipRBACRoleBindingYAMLRequest8 +parent ( B(àAúA" + gkehub.googleapis.com/Membership +rbacrolebinding_id ( BàAE +rbacrolebinding ( 2\'.google.cloud.gkehub.v1.RBACRoleBindingBàA"K +-GenerateMembershipRBACRoleBindingYAMLResponse +role_bindings_yaml ( "~ ListMembershipsResponse5 resources ( 2".google.cloud.gkehub.v1.Membership next_page_token (  unreachable ( "N GetMembershipRequest6 name ( B(àAúA" - gkehub.googleapis.com/Membership"à + gkehub.googleapis.com/Membership"œ +ListBoundMembershipsRequest7 + +scope_name ( B#àAúA +gkehub.googleapis.com/Scope +filter ( BàA + page_size (BàA + +page_token ( BàA"… +ListBoundMembershipsResponse7 + memberships ( 2".google.cloud.gkehub.v1.Membership + unreachable (  +next_page_token ( "à CreateMembershipRequest8 parent ( B(àAúA" gkehub.googleapis.com/Membership membership_id ( BàA9 @@ -77,20 +213,22 @@ public static function initOnce() { manifest ( "- TypeMeta kind (  - api_version ( "’ + api_version ( "· ListFeaturesRequest2 parent ( B"úAgkehub.googleapis.com/Feature page_size ( page_token (  filter (  -order_by ( "c +order_by ( # +return_partial_success (BàA"c ListFeaturesResponse2 resources ( 2.google.cloud.gkehub.v1.Feature -next_page_token ( "E +next_page_token ( "j GetFeatureRequest0 name ( B"úA -gkehub.googleapis.com/Feature"¥ +gkehub.googleapis.com/Feature# +return_partial_success (BàA"¥ CreateFeatureRequest2 parent ( B"úAgkehub.googleapis.com/Feature @@ -110,7 +248,29 @@ public static function initOnce() { update_mask ( 2.google.protobuf.FieldMask1 resource ( 2.google.cloud.gkehub.v1.Feature -request_id ( "ù +request_id ( "‚ +CreateFleetRequest9 +parent ( B)àAúA# +!locations.googleapis.com/Location1 +fleet ( 2.google.cloud.gkehub.v1.FleetBàA"D +GetFleetRequest1 +name ( B#àAúA +gkehub.googleapis.com/Fleet"} +UpdateFleetRequest1 +fleet ( 2.google.cloud.gkehub.v1.FleetBàA4 + update_mask ( 2.google.protobuf.FieldMaskBàA"G +DeleteFleetRequest1 +name ( B#àAúA +gkehub.googleapis.com/Fleet" +ListFleetsRequest9 +parent ( B)àAúA# +!locations.googleapis.com/Location + +page_token ( BàA + page_size (BàA"\\ +ListFleetsResponse- +fleets ( 2.google.cloud.gkehub.v1.Fleet +next_page_token ( "ù OperationMetadata4 create_time ( 2.google.protobuf.TimestampBàA1 end_time ( 2.google.protobuf.TimestampBàA @@ -118,9 +278,11 @@ public static function initOnce() { verb ( BàA status_detail ( BàA cancel_requested (BàA - api_version ( BàA2ð + api_version ( BàA2–M GkeHub´ -ListMemberships..google.cloud.gkehub.v1.ListMembershipsRequest/.google.cloud.gkehub.v1.ListMembershipsResponse"@ÚAparent‚Óä“1//v1/{parent=projects/*/locations/*}/memberships¨ +ListMemberships..google.cloud.gkehub.v1.ListMembershipsRequest/.google.cloud.gkehub.v1.ListMembershipsResponse"@ÚAparent‚Óä“1//v1/{parent=projects/*/locations/*}/membershipsØ +ListBoundMemberships3.google.cloud.gkehub.v1.ListBoundMembershipsRequest4.google.cloud.gkehub.v1.ListBoundMembershipsResponse"UÚA +scope_name‚Óä“B@/v1/{scope_name=projects/*/locations/*/scopes/*}:listMemberships¨ ListFeatures+.google.cloud.gkehub.v1.ListFeaturesRequest,.google.cloud.gkehub.v1.ListFeaturesResponse"=ÚAparent‚Óä“.,/v1/{parent=projects/*/locations/*}/features¡ GetMembership,.google.cloud.gkehub.v1.GetMembershipRequest".google.cloud.gkehub.v1.Membership">ÚAname‚Óä“1//v1/{name=projects/*/locations/*/memberships/*}• @@ -139,7 +301,59 @@ public static function initOnce() { MembershipOperationMetadataÚAname,resource,update_mask‚Óä“;2//v1/{name=projects/*/locations/*/memberships/*}:resource× UpdateFeature,.google.cloud.gkehub.v1.UpdateFeatureRequest.google.longrunning.Operation"yÊA FeatureOperationMetadataÚAname,resource,update_mask‚Óä“82,/v1/{name=projects/*/locations/*/features/*}:resourceÛ -GenerateConnectManifest6.google.cloud.gkehub.v1.GenerateConnectManifestRequest7.google.cloud.gkehub.v1.GenerateConnectManifestResponse"O‚Óä“IG/v1/{name=projects/*/locations/*/memberships/*}:generateConnectManifestIÊAgkehub.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformB® +GenerateConnectManifest6.google.cloud.gkehub.v1.GenerateConnectManifestRequest7.google.cloud.gkehub.v1.GenerateConnectManifestResponse"O‚Óä“IG/v1/{name=projects/*/locations/*/memberships/*}:generateConnectManifest¿ + CreateFleet*.google.cloud.gkehub.v1.CreateFleetRequest.google.longrunning.Operation"eÊA +FleetOperationMetadataÚA parent,fleet‚Óä“3"*/v1/{parent=projects/*/locations/*}/fleets:fleet +GetFleet\'.google.cloud.gkehub.v1.GetFleetRequest.google.cloud.gkehub.v1.Fleet"9ÚAname‚Óä“,*/v1/{name=projects/*/locations/*/fleets/*}Ê + UpdateFleet*.google.cloud.gkehub.v1.UpdateFleetRequest.google.longrunning.Operation"pÊA +FleetOperationMetadataÚAfleet,update_mask‚Óä“920/v1/{fleet.name=projects/*/locations/*/fleets/*}:fleetÀ + DeleteFleet*.google.cloud.gkehub.v1.DeleteFleetRequest.google.longrunning.Operation"fÊA* +google.protobuf.EmptyOperationMetadataÚAname‚Óä“,**/v1/{name=projects/*/locations/*/fleets/*}Ó + +ListFleets).google.cloud.gkehub.v1.ListFleetsRequest*.google.cloud.gkehub.v1.ListFleetsResponse"nÚAparent‚Óä“_*/v1/{parent=projects/*/locations/*}/fleetsZ1//v1/{parent=organizations/*/locations/*}/fleets° +GetScopeNamespace0.google.cloud.gkehub.v1.GetScopeNamespaceRequest!.google.cloud.gkehub.v1.Namespace"FÚAname‚Óä“97/v1/{name=projects/*/locations/*/scopes/*/namespaces/*}Š +CreateScopeNamespace3.google.cloud.gkehub.v1.CreateScopeNamespaceRequest.google.longrunning.Operation"ÊA + NamespaceOperationMetadataÚA)parent,scope_namespace,scope_namespace_id‚Óä“J"7/v1/{parent=projects/*/locations/*/scopes/*}/namespaces:scope_namespaceŒ +UpdateScopeNamespace3.google.cloud.gkehub.v1.UpdateScopeNamespaceRequest.google.longrunning.Operation"ŸÊA + NamespaceOperationMetadataÚAscope_namespace,update_mask‚Óä“Z2G/v1/{scope_namespace.name=projects/*/locations/*/scopes/*/namespaces/*}:scope_namespaceß +DeleteScopeNamespace3.google.cloud.gkehub.v1.DeleteScopeNamespaceRequest.google.longrunning.Operation"sÊA* +google.protobuf.EmptyOperationMetadataÚAname‚Óä“9*7/v1/{name=projects/*/locations/*/scopes/*/namespaces/*}È +ListScopeNamespaces2.google.cloud.gkehub.v1.ListScopeNamespacesRequest3.google.cloud.gkehub.v1.ListScopeNamespacesResponse"HÚAparent‚Óä“97/v1/{parent=projects/*/locations/*/scopes/*}/namespacesÈ +GetScopeRBACRoleBinding6.google.cloud.gkehub.v1.GetScopeRBACRoleBindingRequest\'.google.cloud.gkehub.v1.RBACRoleBinding"LÚAname‚Óä“?=/v1/{name=projects/*/locations/*/scopes/*/rbacrolebindings/*}¢ +CreateScopeRBACRoleBinding9.google.cloud.gkehub.v1.CreateScopeRBACRoleBindingRequest.google.longrunning.Operation"©ÊA$ +RBACRoleBindingOperationMetadataÚA)parent,rbacrolebinding,rbacrolebinding_id‚Óä“P"=/v1/{parent=projects/*/locations/*/scopes/*}/rbacrolebindings:rbacrolebinding¤ +UpdateScopeRBACRoleBinding9.google.cloud.gkehub.v1.UpdateScopeRBACRoleBindingRequest.google.longrunning.Operation"«ÊA$ +RBACRoleBindingOperationMetadataÚArbacrolebinding,update_mask‚Óä“`2M/v1/{rbacrolebinding.name=projects/*/locations/*/scopes/*/rbacrolebindings/*}:rbacrolebindingñ +DeleteScopeRBACRoleBinding9.google.cloud.gkehub.v1.DeleteScopeRBACRoleBindingRequest.google.longrunning.Operation"yÊA* +google.protobuf.EmptyOperationMetadataÚAname‚Óä“?*=/v1/{name=projects/*/locations/*/scopes/*/rbacrolebindings/*}à +ListScopeRBACRoleBindings8.google.cloud.gkehub.v1.ListScopeRBACRoleBindingsRequest9.google.cloud.gkehub.v1.ListScopeRBACRoleBindingsResponse"NÚAparent‚Óä“?=/v1/{parent=projects/*/locations/*/scopes/*}/rbacrolebindings +GetScope\'.google.cloud.gkehub.v1.GetScopeRequest.google.cloud.gkehub.v1.Scope"9ÚAname‚Óä“,*/v1/{name=projects/*/locations/*/scopes/*}È + CreateScope*.google.cloud.gkehub.v1.CreateScopeRequest.google.longrunning.Operation"nÊA +ScopeOperationMetadataÚAparent,scope,scope_id‚Óä“3"*/v1/{parent=projects/*/locations/*}/scopes:scopeÊ + UpdateScope*.google.cloud.gkehub.v1.UpdateScopeRequest.google.longrunning.Operation"pÊA +ScopeOperationMetadataÚAscope,update_mask‚Óä“920/v1/{scope.name=projects/*/locations/*/scopes/*}:scopeÀ + DeleteScope*.google.cloud.gkehub.v1.DeleteScopeRequest.google.longrunning.Operation"fÊA* +google.protobuf.EmptyOperationMetadataÚAname‚Óä“,**/v1/{name=projects/*/locations/*/scopes/*}  + +ListScopes).google.cloud.gkehub.v1.ListScopesRequest*.google.cloud.gkehub.v1.ListScopesResponse";ÚAparent‚Óä“,*/v1/{parent=projects/*/locations/*}/scopesÉ +ListPermittedScopes2.google.cloud.gkehub.v1.ListPermittedScopesRequest3.google.cloud.gkehub.v1.ListPermittedScopesResponse"IÚAparent‚Óä“:8/v1/{parent=projects/*/locations/*}/scopes:listPermittedÁ +GetMembershipBinding3.google.cloud.gkehub.v1.GetMembershipBindingRequest).google.cloud.gkehub.v1.MembershipBinding"IÚAname‚Óä“<:/v1/{name=projects/*/locations/*/memberships/*/bindings/*}¤ +CreateMembershipBinding6.google.cloud.gkehub.v1.CreateMembershipBindingRequest.google.longrunning.Operation"±ÊA& +MembershipBindingOperationMetadataÚA/parent,membership_binding,membership_binding_id‚Óä“P":/v1/{parent=projects/*/locations/*/memberships/*}/bindings:membership_binding¦ +UpdateMembershipBinding6.google.cloud.gkehub.v1.UpdateMembershipBindingRequest.google.longrunning.Operation"³ÊA& +MembershipBindingOperationMetadataÚAmembership_binding,update_mask‚Óä“c2M/v1/{membership_binding.name=projects/*/locations/*/memberships/*/bindings/*}:membership_bindingè +DeleteMembershipBinding6.google.cloud.gkehub.v1.DeleteMembershipBindingRequest.google.longrunning.Operation"vÊA* +google.protobuf.EmptyOperationMetadataÚAname‚Óä“<*:/v1/{name=projects/*/locations/*/memberships/*/bindings/*}Ô +ListMembershipBindings5.google.cloud.gkehub.v1.ListMembershipBindingsRequest6.google.cloud.gkehub.v1.ListMembershipBindingsResponse"KÚAparent‚Óä“<:/v1/{parent=projects/*/locations/*/memberships/*}/bindings× +GetMembershipRBACRoleBinding;.google.cloud.gkehub.v1.GetMembershipRBACRoleBindingRequest\'.google.cloud.gkehub.v1.RBACRoleBinding"QÚAname‚Óä“DB/v1/{name=projects/*/locations/*/memberships/*/rbacrolebindings/*}± +CreateMembershipRBACRoleBinding>.google.cloud.gkehub.v1.CreateMembershipRBACRoleBindingRequest.google.longrunning.Operation"®ÊA$ +RBACRoleBindingOperationMetadataÚA)parent,rbacrolebinding,rbacrolebinding_id‚Óä“U"B/v1/{parent=projects/*/locations/*/memberships/*}/rbacrolebindings:rbacrolebinding³ +UpdateMembershipRBACRoleBinding>.google.cloud.gkehub.v1.UpdateMembershipRBACRoleBindingRequest.google.longrunning.Operation"°ÊA$ +RBACRoleBindingOperationMetadataÚArbacrolebinding,update_mask‚Óä“e2R/v1/{rbacrolebinding.name=projects/*/locations/*/memberships/*/rbacrolebindings/*}:rbacrolebinding€ +DeleteMembershipRBACRoleBinding>.google.cloud.gkehub.v1.DeleteMembershipRBACRoleBindingRequest.google.longrunning.Operation"~ÊA* +google.protobuf.EmptyOperationMetadataÚAname‚Óä“D*B/v1/{name=projects/*/locations/*/memberships/*/rbacrolebindings/*}ô +ListMembershipRBACRoleBindings=.google.cloud.gkehub.v1.ListMembershipRBACRoleBindingsRequest>.google.cloud.gkehub.v1.ListMembershipRBACRoleBindingsResponse"SÚAparent‚Óä“DB/v1/{parent=projects/*/locations/*/memberships/*}/rbacrolebindings¸ +%GenerateMembershipRBACRoleBindingYAMLD.google.cloud.gkehub.v1.GenerateMembershipRBACRoleBindingYAMLRequestE.google.cloud.gkehub.v1.GenerateMembershipRBACRoleBindingYAMLResponse"‚Óä“{"h/v1/{parent=projects/*/locations/*/memberships/*}/rbacrolebindings:generateMembershipRBACRoleBindingYAML:rbacrolebindingIÊAgkehub.googleapis.comÒA.https://www.googleapis.com/auth/cloud-platformB® com.google.cloud.gkehub.v1B ServiceProtoPZ2cloud.google.com/go/gkehub/apiv1/gkehubpb;gkehubpbªGoogle.Cloud.GkeHub.V1ÊGoogle\\Cloud\\GkeHub\\V1êGoogle::Cloud::GkeHub::V1bproto3' , true); diff --git a/GkeHub/samples/V1/GkeHubClient/create_fleet.php b/GkeHub/samples/V1/GkeHubClient/create_fleet.php new file mode 100644 index 000000000000..5721765b8dc4 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/create_fleet.php @@ -0,0 +1,86 @@ +setParent($formattedParent) + ->setFleet($fleet); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->createFleet($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Fleet $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::locationName('[PROJECT]', '[LOCATION]'); + + create_fleet_sample($formattedParent); +} +// [END gkehub_v1_generated_GkeHub_CreateFleet_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/create_membership_binding.php b/GkeHub/samples/V1/GkeHubClient/create_membership_binding.php new file mode 100644 index 000000000000..5a0758554366 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/create_membership_binding.php @@ -0,0 +1,92 @@ +setParent($formattedParent) + ->setMembershipBinding($membershipBinding) + ->setMembershipBindingId($membershipBindingId); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->createMembershipBinding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MembershipBinding $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $membershipBindingId = '[MEMBERSHIP_BINDING_ID]'; + + create_membership_binding_sample($formattedParent, $membershipBindingId); +} +// [END gkehub_v1_generated_GkeHub_CreateMembershipBinding_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/create_membership_rbac_role_binding.php b/GkeHub/samples/V1/GkeHubClient/create_membership_rbac_role_binding.php new file mode 100644 index 000000000000..9769b43a3552 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/create_membership_rbac_role_binding.php @@ -0,0 +1,102 @@ +setRole($rbacrolebindingRole); + $request = (new CreateMembershipRBACRoleBindingRequest()) + ->setParent($formattedParent) + ->setRbacrolebindingId($rbacrolebindingId) + ->setRbacrolebinding($rbacrolebinding); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->createMembershipRBACRoleBinding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var RBACRoleBinding $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $rbacrolebindingId = '[RBACROLEBINDING_ID]'; + + create_membership_rbac_role_binding_sample($formattedParent, $rbacrolebindingId); +} +// [END gkehub_v1_generated_GkeHub_CreateMembershipRBACRoleBinding_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/create_scope.php b/GkeHub/samples/V1/GkeHubClient/create_scope.php new file mode 100644 index 000000000000..03384a4204e9 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/create_scope.php @@ -0,0 +1,90 @@ +setParent($formattedParent) + ->setScopeId($scopeId) + ->setScope($scope); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->createScope($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Scope $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::locationName('[PROJECT]', '[LOCATION]'); + $scopeId = '[SCOPE_ID]'; + + create_scope_sample($formattedParent, $scopeId); +} +// [END gkehub_v1_generated_GkeHub_CreateScope_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/create_scope_namespace.php b/GkeHub/samples/V1/GkeHubClient/create_scope_namespace.php new file mode 100644 index 000000000000..d62c115c9bbb --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/create_scope_namespace.php @@ -0,0 +1,104 @@ +setScope($formattedScopeNamespaceScope); + $request = (new CreateScopeNamespaceRequest()) + ->setParent($formattedParent) + ->setScopeNamespaceId($scopeNamespaceId) + ->setScopeNamespace($scopeNamespace); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->createScopeNamespace($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PBNamespace $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $scopeNamespaceId = '[SCOPE_NAMESPACE_ID]'; + $formattedScopeNamespaceScope = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + + create_scope_namespace_sample($formattedParent, $scopeNamespaceId, $formattedScopeNamespaceScope); +} +// [END gkehub_v1_generated_GkeHub_CreateScopeNamespace_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/create_scope_rbac_role_binding.php b/GkeHub/samples/V1/GkeHubClient/create_scope_rbac_role_binding.php new file mode 100644 index 000000000000..3a4b33f8320d --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/create_scope_rbac_role_binding.php @@ -0,0 +1,102 @@ +setRole($rbacrolebindingRole); + $request = (new CreateScopeRBACRoleBindingRequest()) + ->setParent($formattedParent) + ->setRbacrolebindingId($rbacrolebindingId) + ->setRbacrolebinding($rbacrolebinding); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->createScopeRBACRoleBinding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var RBACRoleBinding $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $rbacrolebindingId = '[RBACROLEBINDING_ID]'; + + create_scope_rbac_role_binding_sample($formattedParent, $rbacrolebindingId); +} +// [END gkehub_v1_generated_GkeHub_CreateScopeRBACRoleBinding_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/delete_fleet.php b/GkeHub/samples/V1/GkeHubClient/delete_fleet.php new file mode 100644 index 000000000000..a17fdcf3d80e --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/delete_fleet.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->deleteFleet($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GkeHubClient::fleetName('[PROJECT]', '[LOCATION]', '[FLEET]'); + + delete_fleet_sample($formattedName); +} +// [END gkehub_v1_generated_GkeHub_DeleteFleet_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/delete_membership_binding.php b/GkeHub/samples/V1/GkeHubClient/delete_membership_binding.php new file mode 100644 index 000000000000..d33574ead7b0 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/delete_membership_binding.php @@ -0,0 +1,86 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->deleteMembershipBinding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GkeHubClient::membershipBindingName( + '[PROJECT]', + '[LOCATION]', + '[MEMBERSHIP]', + '[MEMBERSHIPBINDING]' + ); + + delete_membership_binding_sample($formattedName); +} +// [END gkehub_v1_generated_GkeHub_DeleteMembershipBinding_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/delete_membership_rbac_role_binding.php b/GkeHub/samples/V1/GkeHubClient/delete_membership_rbac_role_binding.php new file mode 100644 index 000000000000..d0796b608d3d --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/delete_membership_rbac_role_binding.php @@ -0,0 +1,86 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->deleteMembershipRBACRoleBinding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GkeHubClient::rBACRoleBindingName( + '[PROJECT]', + '[LOCATION]', + '[SCOPE]', + '[RBACROLEBINDING]' + ); + + delete_membership_rbac_role_binding_sample($formattedName); +} +// [END gkehub_v1_generated_GkeHub_DeleteMembershipRBACRoleBinding_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/delete_scope.php b/GkeHub/samples/V1/GkeHubClient/delete_scope.php new file mode 100644 index 000000000000..dfa3180c70c7 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/delete_scope.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->deleteScope($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + + delete_scope_sample($formattedName); +} +// [END gkehub_v1_generated_GkeHub_DeleteScope_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/delete_scope_namespace.php b/GkeHub/samples/V1/GkeHubClient/delete_scope_namespace.php new file mode 100644 index 000000000000..322bf21fbd09 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/delete_scope_namespace.php @@ -0,0 +1,81 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->deleteScopeNamespace($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GkeHubClient::namespaceName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[NAMESPACE]'); + + delete_scope_namespace_sample($formattedName); +} +// [END gkehub_v1_generated_GkeHub_DeleteScopeNamespace_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/delete_scope_rbac_role_binding.php b/GkeHub/samples/V1/GkeHubClient/delete_scope_rbac_role_binding.php new file mode 100644 index 000000000000..5710584b271c --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/delete_scope_rbac_role_binding.php @@ -0,0 +1,86 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->deleteScopeRBACRoleBinding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GkeHubClient::rBACRoleBindingName( + '[PROJECT]', + '[LOCATION]', + '[SCOPE]', + '[RBACROLEBINDING]' + ); + + delete_scope_rbac_role_binding_sample($formattedName); +} +// [END gkehub_v1_generated_GkeHub_DeleteScopeRBACRoleBinding_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/generate_membership_rbac_role_binding_yaml.php b/GkeHub/samples/V1/GkeHubClient/generate_membership_rbac_role_binding_yaml.php new file mode 100644 index 000000000000..94dfd1851e73 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/generate_membership_rbac_role_binding_yaml.php @@ -0,0 +1,92 @@ +setRole($rbacrolebindingRole); + $request = (new GenerateMembershipRBACRoleBindingYAMLRequest()) + ->setParent($formattedParent) + ->setRbacrolebindingId($rbacrolebindingId) + ->setRbacrolebinding($rbacrolebinding); + + // Call the API and handle any network failures. + try { + /** @var GenerateMembershipRBACRoleBindingYAMLResponse $response */ + $response = $gkeHubClient->generateMembershipRBACRoleBindingYAML($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $rbacrolebindingId = '[RBACROLEBINDING_ID]'; + + generate_membership_rbac_role_binding_yaml_sample($formattedParent, $rbacrolebindingId); +} +// [END gkehub_v1_generated_GkeHub_GenerateMembershipRBACRoleBindingYAML_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/get_fleet.php b/GkeHub/samples/V1/GkeHubClient/get_fleet.php new file mode 100644 index 000000000000..530d7576828b --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/get_fleet.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Fleet $response */ + $response = $gkeHubClient->getFleet($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GkeHubClient::fleetName('[PROJECT]', '[LOCATION]', '[FLEET]'); + + get_fleet_sample($formattedName); +} +// [END gkehub_v1_generated_GkeHub_GetFleet_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/get_membership_binding.php b/GkeHub/samples/V1/GkeHubClient/get_membership_binding.php new file mode 100644 index 000000000000..a8b2eb57588b --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/get_membership_binding.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var MembershipBinding $response */ + $response = $gkeHubClient->getMembershipBinding($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GkeHubClient::membershipBindingName( + '[PROJECT]', + '[LOCATION]', + '[MEMBERSHIP]', + '[MEMBERSHIPBINDING]' + ); + + get_membership_binding_sample($formattedName); +} +// [END gkehub_v1_generated_GkeHub_GetMembershipBinding_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/get_membership_rbac_role_binding.php b/GkeHub/samples/V1/GkeHubClient/get_membership_rbac_role_binding.php new file mode 100644 index 000000000000..0f017f6da4be --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/get_membership_rbac_role_binding.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var RBACRoleBinding $response */ + $response = $gkeHubClient->getMembershipRBACRoleBinding($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GkeHubClient::rBACRoleBindingName( + '[PROJECT]', + '[LOCATION]', + '[SCOPE]', + '[RBACROLEBINDING]' + ); + + get_membership_rbac_role_binding_sample($formattedName); +} +// [END gkehub_v1_generated_GkeHub_GetMembershipRBACRoleBinding_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/get_scope.php b/GkeHub/samples/V1/GkeHubClient/get_scope.php new file mode 100644 index 000000000000..1d784dc4df6f --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/get_scope.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Scope $response */ + $response = $gkeHubClient->getScope($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + + get_scope_sample($formattedName); +} +// [END gkehub_v1_generated_GkeHub_GetScope_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/get_scope_namespace.php b/GkeHub/samples/V1/GkeHubClient/get_scope_namespace.php new file mode 100644 index 000000000000..34731ff6f754 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/get_scope_namespace.php @@ -0,0 +1,72 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var PBNamespace $response */ + $response = $gkeHubClient->getScopeNamespace($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GkeHubClient::namespaceName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[NAMESPACE]'); + + get_scope_namespace_sample($formattedName); +} +// [END gkehub_v1_generated_GkeHub_GetScopeNamespace_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/get_scope_rbac_role_binding.php b/GkeHub/samples/V1/GkeHubClient/get_scope_rbac_role_binding.php new file mode 100644 index 000000000000..a4a4f0f23686 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/get_scope_rbac_role_binding.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var RBACRoleBinding $response */ + $response = $gkeHubClient->getScopeRBACRoleBinding($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = GkeHubClient::rBACRoleBindingName( + '[PROJECT]', + '[LOCATION]', + '[SCOPE]', + '[RBACROLEBINDING]' + ); + + get_scope_rbac_role_binding_sample($formattedName); +} +// [END gkehub_v1_generated_GkeHub_GetScopeRBACRoleBinding_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/list_bound_memberships.php b/GkeHub/samples/V1/GkeHubClient/list_bound_memberships.php new file mode 100644 index 000000000000..a95655798984 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/list_bound_memberships.php @@ -0,0 +1,78 @@ +setScopeName($formattedScopeName); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $gkeHubClient->listBoundMemberships($request); + + /** @var Membership $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedScopeName = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + + list_bound_memberships_sample($formattedScopeName); +} +// [END gkehub_v1_generated_GkeHub_ListBoundMemberships_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/list_fleets.php b/GkeHub/samples/V1/GkeHubClient/list_fleets.php new file mode 100644 index 000000000000..b2f8cadb7911 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/list_fleets.php @@ -0,0 +1,78 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $gkeHubClient->listFleets($request); + + /** @var Fleet $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::locationName('[PROJECT]', '[LOCATION]'); + + list_fleets_sample($formattedParent); +} +// [END gkehub_v1_generated_GkeHub_ListFleets_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/list_membership_bindings.php b/GkeHub/samples/V1/GkeHubClient/list_membership_bindings.php new file mode 100644 index 000000000000..e8b2cb7667d2 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/list_membership_bindings.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $gkeHubClient->listMembershipBindings($request); + + /** @var MembershipBinding $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + + list_membership_bindings_sample($formattedParent); +} +// [END gkehub_v1_generated_GkeHub_ListMembershipBindings_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/list_membership_rbac_role_bindings.php b/GkeHub/samples/V1/GkeHubClient/list_membership_rbac_role_bindings.php new file mode 100644 index 000000000000..35fafd292544 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/list_membership_rbac_role_bindings.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $gkeHubClient->listMembershipRBACRoleBindings($request); + + /** @var RBACRoleBinding $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + + list_membership_rbac_role_bindings_sample($formattedParent); +} +// [END gkehub_v1_generated_GkeHub_ListMembershipRBACRoleBindings_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/list_permitted_scopes.php b/GkeHub/samples/V1/GkeHubClient/list_permitted_scopes.php new file mode 100644 index 000000000000..2283dad77ec4 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/list_permitted_scopes.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $gkeHubClient->listPermittedScopes($request); + + /** @var Scope $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::locationName('[PROJECT]', '[LOCATION]'); + + list_permitted_scopes_sample($formattedParent); +} +// [END gkehub_v1_generated_GkeHub_ListPermittedScopes_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/list_scope_namespaces.php b/GkeHub/samples/V1/GkeHubClient/list_scope_namespaces.php new file mode 100644 index 000000000000..6ddc9423d332 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/list_scope_namespaces.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $gkeHubClient->listScopeNamespaces($request); + + /** @var PBNamespace $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + + list_scope_namespaces_sample($formattedParent); +} +// [END gkehub_v1_generated_GkeHub_ListScopeNamespaces_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/list_scope_rbac_role_bindings.php b/GkeHub/samples/V1/GkeHubClient/list_scope_rbac_role_bindings.php new file mode 100644 index 000000000000..4da4798533db --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/list_scope_rbac_role_bindings.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $gkeHubClient->listScopeRBACRoleBindings($request); + + /** @var RBACRoleBinding $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + + list_scope_rbac_role_bindings_sample($formattedParent); +} +// [END gkehub_v1_generated_GkeHub_ListScopeRBACRoleBindings_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/list_scopes.php b/GkeHub/samples/V1/GkeHubClient/list_scopes.php new file mode 100644 index 000000000000..bb224085cb23 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/list_scopes.php @@ -0,0 +1,77 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $gkeHubClient->listScopes($request); + + /** @var Scope $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = GkeHubClient::locationName('[PROJECT]', '[LOCATION]'); + + list_scopes_sample($formattedParent); +} +// [END gkehub_v1_generated_GkeHub_ListScopes_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/update_fleet.php b/GkeHub/samples/V1/GkeHubClient/update_fleet.php new file mode 100644 index 000000000000..28e85bb5cf3e --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/update_fleet.php @@ -0,0 +1,74 @@ +setFleet($fleet) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->updateFleet($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Fleet $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END gkehub_v1_generated_GkeHub_UpdateFleet_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/update_membership_binding.php b/GkeHub/samples/V1/GkeHubClient/update_membership_binding.php new file mode 100644 index 000000000000..e1a30ffe4140 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/update_membership_binding.php @@ -0,0 +1,74 @@ +setMembershipBinding($membershipBinding) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->updateMembershipBinding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var MembershipBinding $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END gkehub_v1_generated_GkeHub_UpdateMembershipBinding_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/update_membership_rbac_role_binding.php b/GkeHub/samples/V1/GkeHubClient/update_membership_rbac_role_binding.php new file mode 100644 index 000000000000..67b58378a330 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/update_membership_rbac_role_binding.php @@ -0,0 +1,77 @@ +setRole($rbacrolebindingRole); + $updateMask = new FieldMask(); + $request = (new UpdateMembershipRBACRoleBindingRequest()) + ->setRbacrolebinding($rbacrolebinding) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->updateMembershipRBACRoleBinding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var RBACRoleBinding $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END gkehub_v1_generated_GkeHub_UpdateMembershipRBACRoleBinding_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/update_scope.php b/GkeHub/samples/V1/GkeHubClient/update_scope.php new file mode 100644 index 000000000000..08a67253bb5a --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/update_scope.php @@ -0,0 +1,74 @@ +setScope($scope) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->updateScope($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Scope $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END gkehub_v1_generated_GkeHub_UpdateScope_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/update_scope_namespace.php b/GkeHub/samples/V1/GkeHubClient/update_scope_namespace.php new file mode 100644 index 000000000000..ce155884bc88 --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/update_scope_namespace.php @@ -0,0 +1,88 @@ +setScope($formattedScopeNamespaceScope); + $updateMask = new FieldMask(); + $request = (new UpdateScopeNamespaceRequest()) + ->setScopeNamespace($scopeNamespace) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->updateScopeNamespace($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var PBNamespace $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedScopeNamespaceScope = GkeHubClient::scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + + update_scope_namespace_sample($formattedScopeNamespaceScope); +} +// [END gkehub_v1_generated_GkeHub_UpdateScopeNamespace_sync] diff --git a/GkeHub/samples/V1/GkeHubClient/update_scope_rbac_role_binding.php b/GkeHub/samples/V1/GkeHubClient/update_scope_rbac_role_binding.php new file mode 100644 index 000000000000..e2eea1d1802a --- /dev/null +++ b/GkeHub/samples/V1/GkeHubClient/update_scope_rbac_role_binding.php @@ -0,0 +1,77 @@ +setRole($rbacrolebindingRole); + $updateMask = new FieldMask(); + $request = (new UpdateScopeRBACRoleBindingRequest()) + ->setRbacrolebinding($rbacrolebinding) + ->setUpdateMask($updateMask); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $gkeHubClient->updateScopeRBACRoleBinding($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var RBACRoleBinding $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END gkehub_v1_generated_GkeHub_UpdateScopeRBACRoleBinding_sync] diff --git a/GkeHub/src/V1/Client/GkeHubClient.php b/GkeHub/src/V1/Client/GkeHubClient.php index 5e575732b03f..6c4ef1a8d8cc 100644 --- a/GkeHub/src/V1/Client/GkeHubClient.php +++ b/GkeHub/src/V1/Client/GkeHubClient.php @@ -36,19 +36,58 @@ use Google\ApiCore\ValidationException; use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\GkeHub\V1\CreateFeatureRequest; +use Google\Cloud\GkeHub\V1\CreateFleetRequest; +use Google\Cloud\GkeHub\V1\CreateMembershipBindingRequest; +use Google\Cloud\GkeHub\V1\CreateMembershipRBACRoleBindingRequest; use Google\Cloud\GkeHub\V1\CreateMembershipRequest; +use Google\Cloud\GkeHub\V1\CreateScopeNamespaceRequest; +use Google\Cloud\GkeHub\V1\CreateScopeRBACRoleBindingRequest; +use Google\Cloud\GkeHub\V1\CreateScopeRequest; use Google\Cloud\GkeHub\V1\DeleteFeatureRequest; +use Google\Cloud\GkeHub\V1\DeleteFleetRequest; +use Google\Cloud\GkeHub\V1\DeleteMembershipBindingRequest; +use Google\Cloud\GkeHub\V1\DeleteMembershipRBACRoleBindingRequest; use Google\Cloud\GkeHub\V1\DeleteMembershipRequest; +use Google\Cloud\GkeHub\V1\DeleteScopeNamespaceRequest; +use Google\Cloud\GkeHub\V1\DeleteScopeRBACRoleBindingRequest; +use Google\Cloud\GkeHub\V1\DeleteScopeRequest; use Google\Cloud\GkeHub\V1\Feature; +use Google\Cloud\GkeHub\V1\Fleet; use Google\Cloud\GkeHub\V1\GenerateConnectManifestRequest; use Google\Cloud\GkeHub\V1\GenerateConnectManifestResponse; +use Google\Cloud\GkeHub\V1\GenerateMembershipRBACRoleBindingYAMLRequest; +use Google\Cloud\GkeHub\V1\GenerateMembershipRBACRoleBindingYAMLResponse; use Google\Cloud\GkeHub\V1\GetFeatureRequest; +use Google\Cloud\GkeHub\V1\GetFleetRequest; +use Google\Cloud\GkeHub\V1\GetMembershipBindingRequest; +use Google\Cloud\GkeHub\V1\GetMembershipRBACRoleBindingRequest; use Google\Cloud\GkeHub\V1\GetMembershipRequest; +use Google\Cloud\GkeHub\V1\GetScopeNamespaceRequest; +use Google\Cloud\GkeHub\V1\GetScopeRBACRoleBindingRequest; +use Google\Cloud\GkeHub\V1\GetScopeRequest; +use Google\Cloud\GkeHub\V1\ListBoundMembershipsRequest; use Google\Cloud\GkeHub\V1\ListFeaturesRequest; +use Google\Cloud\GkeHub\V1\ListFleetsRequest; +use Google\Cloud\GkeHub\V1\ListMembershipBindingsRequest; +use Google\Cloud\GkeHub\V1\ListMembershipRBACRoleBindingsRequest; use Google\Cloud\GkeHub\V1\ListMembershipsRequest; +use Google\Cloud\GkeHub\V1\ListPermittedScopesRequest; +use Google\Cloud\GkeHub\V1\ListScopeNamespacesRequest; +use Google\Cloud\GkeHub\V1\ListScopeRBACRoleBindingsRequest; +use Google\Cloud\GkeHub\V1\ListScopesRequest; use Google\Cloud\GkeHub\V1\Membership; +use Google\Cloud\GkeHub\V1\MembershipBinding; +use Google\Cloud\GkeHub\V1\PBNamespace; +use Google\Cloud\GkeHub\V1\RBACRoleBinding; +use Google\Cloud\GkeHub\V1\Scope; use Google\Cloud\GkeHub\V1\UpdateFeatureRequest; +use Google\Cloud\GkeHub\V1\UpdateFleetRequest; +use Google\Cloud\GkeHub\V1\UpdateMembershipBindingRequest; +use Google\Cloud\GkeHub\V1\UpdateMembershipRBACRoleBindingRequest; use Google\Cloud\GkeHub\V1\UpdateMembershipRequest; +use Google\Cloud\GkeHub\V1\UpdateScopeNamespaceRequest; +use Google\Cloud\GkeHub\V1\UpdateScopeRBACRoleBindingRequest; +use Google\Cloud\GkeHub\V1\UpdateScopeRequest; use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -82,16 +121,49 @@ * contained within formatted names that are returned by the API. * * @method PromiseInterface createFeatureAsync(CreateFeatureRequest $request, array $optionalArgs = []) + * @method PromiseInterface createFleetAsync(CreateFleetRequest $request, array $optionalArgs = []) * @method PromiseInterface createMembershipAsync(CreateMembershipRequest $request, array $optionalArgs = []) + * @method PromiseInterface createMembershipBindingAsync(CreateMembershipBindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface createMembershipRBACRoleBindingAsync(CreateMembershipRBACRoleBindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface createScopeAsync(CreateScopeRequest $request, array $optionalArgs = []) + * @method PromiseInterface createScopeNamespaceAsync(CreateScopeNamespaceRequest $request, array $optionalArgs = []) + * @method PromiseInterface createScopeRBACRoleBindingAsync(CreateScopeRBACRoleBindingRequest $request, array $optionalArgs = []) * @method PromiseInterface deleteFeatureAsync(DeleteFeatureRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteFleetAsync(DeleteFleetRequest $request, array $optionalArgs = []) * @method PromiseInterface deleteMembershipAsync(DeleteMembershipRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteMembershipBindingAsync(DeleteMembershipBindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteMembershipRBACRoleBindingAsync(DeleteMembershipRBACRoleBindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteScopeAsync(DeleteScopeRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteScopeNamespaceAsync(DeleteScopeNamespaceRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteScopeRBACRoleBindingAsync(DeleteScopeRBACRoleBindingRequest $request, array $optionalArgs = []) * @method PromiseInterface generateConnectManifestAsync(GenerateConnectManifestRequest $request, array $optionalArgs = []) + * @method PromiseInterface generateMembershipRBACRoleBindingYAMLAsync(GenerateMembershipRBACRoleBindingYAMLRequest $request, array $optionalArgs = []) * @method PromiseInterface getFeatureAsync(GetFeatureRequest $request, array $optionalArgs = []) + * @method PromiseInterface getFleetAsync(GetFleetRequest $request, array $optionalArgs = []) * @method PromiseInterface getMembershipAsync(GetMembershipRequest $request, array $optionalArgs = []) + * @method PromiseInterface getMembershipBindingAsync(GetMembershipBindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface getMembershipRBACRoleBindingAsync(GetMembershipRBACRoleBindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface getScopeAsync(GetScopeRequest $request, array $optionalArgs = []) + * @method PromiseInterface getScopeNamespaceAsync(GetScopeNamespaceRequest $request, array $optionalArgs = []) + * @method PromiseInterface getScopeRBACRoleBindingAsync(GetScopeRBACRoleBindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface listBoundMembershipsAsync(ListBoundMembershipsRequest $request, array $optionalArgs = []) * @method PromiseInterface listFeaturesAsync(ListFeaturesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listFleetsAsync(ListFleetsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listMembershipBindingsAsync(ListMembershipBindingsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listMembershipRBACRoleBindingsAsync(ListMembershipRBACRoleBindingsRequest $request, array $optionalArgs = []) * @method PromiseInterface listMembershipsAsync(ListMembershipsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listPermittedScopesAsync(ListPermittedScopesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listScopeNamespacesAsync(ListScopeNamespacesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listScopeRBACRoleBindingsAsync(ListScopeRBACRoleBindingsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listScopesAsync(ListScopesRequest $request, array $optionalArgs = []) * @method PromiseInterface updateFeatureAsync(UpdateFeatureRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateFleetAsync(UpdateFleetRequest $request, array $optionalArgs = []) * @method PromiseInterface updateMembershipAsync(UpdateMembershipRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateMembershipBindingAsync(UpdateMembershipBindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateMembershipRBACRoleBindingAsync(UpdateMembershipRBACRoleBindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateScopeAsync(UpdateScopeRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateScopeNamespaceAsync(UpdateScopeNamespaceRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateScopeRBACRoleBindingAsync(UpdateScopeRBACRoleBindingRequest $request, array $optionalArgs = []) */ final class GkeHubClient { @@ -208,6 +280,25 @@ public static function featureName(string $project, string $location, string $fe ]); } + /** + * Formats a string containing the fully-qualified path to represent a fleet + * resource. + * + * @param string $project + * @param string $location + * @param string $fleet + * + * @return string The formatted fleet resource. + */ + public static function fleetName(string $project, string $location, string $fleet): string + { + return self::getPathTemplate('fleet')->render([ + 'project' => $project, + 'location' => $location, + 'fleet' => $fleet, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a location * resource. @@ -244,13 +335,200 @@ public static function membershipName(string $project, string $location, string ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * membership_binding resource. + * + * @param string $project + * @param string $location + * @param string $membership + * @param string $membershipbinding + * + * @return string The formatted membership_binding resource. + */ + public static function membershipBindingName( + string $project, + string $location, + string $membership, + string $membershipbinding + ): string { + return self::getPathTemplate('membershipBinding')->render([ + 'project' => $project, + 'location' => $location, + 'membership' => $membership, + 'membershipbinding' => $membershipbinding, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a namespace + * resource. + * + * @param string $project + * @param string $location + * @param string $scope + * @param string $namespace + * + * @return string The formatted namespace resource. + */ + public static function namespaceName(string $project, string $location, string $scope, string $namespace): string + { + return self::getPathTemplate('namespace')->render([ + 'project' => $project, + 'location' => $location, + 'scope' => $scope, + 'namespace' => $namespace, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_fleet resource. + * + * @param string $organization + * @param string $location + * @param string $fleet + * + * @return string The formatted organization_location_fleet resource. + */ + public static function organizationLocationFleetName(string $organization, string $location, string $fleet): string + { + return self::getPathTemplate('organizationLocationFleet')->render([ + 'organization' => $organization, + 'location' => $location, + 'fleet' => $fleet, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_fleet resource. + * + * @param string $project + * @param string $location + * @param string $fleet + * + * @return string The formatted project_location_fleet resource. + */ + public static function projectLocationFleetName(string $project, string $location, string $fleet): string + { + return self::getPathTemplate('projectLocationFleet')->render([ + 'project' => $project, + 'location' => $location, + 'fleet' => $fleet, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_membership_rbacrolebinding resource. + * + * @param string $project + * @param string $location + * @param string $membership + * @param string $rbacrolebinding + * + * @return string The formatted project_location_membership_rbacrolebinding resource. + */ + public static function projectLocationMembershipRbacrolebindingName( + string $project, + string $location, + string $membership, + string $rbacrolebinding + ): string { + return self::getPathTemplate('projectLocationMembershipRbacrolebinding')->render([ + 'project' => $project, + 'location' => $location, + 'membership' => $membership, + 'rbacrolebinding' => $rbacrolebinding, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_scope_rbacrolebinding resource. + * + * @param string $project + * @param string $location + * @param string $scope + * @param string $rbacrolebinding + * + * @return string The formatted project_location_scope_rbacrolebinding resource. + */ + public static function projectLocationScopeRbacrolebindingName( + string $project, + string $location, + string $scope, + string $rbacrolebinding + ): string { + return self::getPathTemplate('projectLocationScopeRbacrolebinding')->render([ + 'project' => $project, + 'location' => $location, + 'scope' => $scope, + 'rbacrolebinding' => $rbacrolebinding, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * rbac_role_binding resource. + * + * @param string $project + * @param string $location + * @param string $scope + * @param string $rbacrolebinding + * + * @return string The formatted rbac_role_binding resource. + */ + public static function rBACRoleBindingName( + string $project, + string $location, + string $scope, + string $rbacrolebinding + ): string { + return self::getPathTemplate('rBACRoleBinding')->render([ + 'project' => $project, + 'location' => $location, + 'scope' => $scope, + 'rbacrolebinding' => $rbacrolebinding, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a scope + * resource. + * + * @param string $project + * @param string $location + * @param string $scope + * + * @return string The formatted scope resource. + */ + public static function scopeName(string $project, string $location, string $scope): string + { + return self::getPathTemplate('scope')->render([ + 'project' => $project, + 'location' => $location, + 'scope' => $scope, + ]); + } + /** * Parses a formatted name string and returns an associative array of the components in the name. * The following name formats are supported: * Template: Pattern * - feature: projects/{project}/locations/{location}/features/{feature} + * - fleet: projects/{project}/locations/{location}/fleets/{fleet} * - location: projects/{project}/locations/{location} * - membership: projects/{project}/locations/{location}/memberships/{membership} + * - membershipBinding: projects/{project}/locations/{location}/memberships/{membership}/bindings/{membershipbinding} + * - namespace: projects/{project}/locations/{location}/scopes/{scope}/namespaces/{namespace} + * - organizationLocationFleet: organizations/{organization}/locations/{location}/fleets/{fleet} + * - projectLocationFleet: projects/{project}/locations/{location}/fleets/{fleet} + * - projectLocationMembershipRbacrolebinding: projects/{project}/locations/{location}/memberships/{membership}/rbacrolebindings/{rbacrolebinding} + * - projectLocationScopeRbacrolebinding: projects/{project}/locations/{location}/scopes/{scope}/rbacrolebindings/{rbacrolebinding} + * - rBACRoleBinding: projects/{project}/locations/{location}/scopes/{scope}/rbacrolebindings/{rbacrolebinding} + * - scope: projects/{project}/locations/{location}/scopes/{scope} * * The optional $template argument can be supplied to specify a particular pattern, * and must match one of the templates listed above. If no $template argument is @@ -382,6 +660,32 @@ public function createFeature(CreateFeatureRequest $request, array $callOptions return $this->startApiCall('CreateFeature', $request, $callOptions)->wait(); } + /** + * Creates a fleet. + * + * The async variant is {@see GkeHubClient::createFleetAsync()} . + * + * @example samples/V1/GkeHubClient/create_fleet.php + * + * @param CreateFleetRequest $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 createFleet(CreateFleetRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('CreateFleet', $request, $callOptions)->wait(); + } + /** * Creates a new Membership. * @@ -413,14 +717,14 @@ public function createMembership(CreateMembershipRequest $request, array $callOp } /** - * Removes a Feature. + * Creates a MembershipBinding. * - * The async variant is {@see GkeHubClient::deleteFeatureAsync()} . + * The async variant is {@see GkeHubClient::createMembershipBindingAsync()} . * - * @example samples/V1/GkeHubClient/delete_feature.php + * @example samples/V1/GkeHubClient/create_membership_binding.php * - * @param DeleteFeatureRequest $request A request to house fields associated with the call. - * @param array $callOptions { + * @param CreateMembershipBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { * Optional. * * @type RetrySettings|array $retrySettings @@ -429,28 +733,55 @@ public function createMembership(CreateMembershipRequest $request, array $callOp * {@see RetrySettings} for example usage. * } * - * @return OperationResponse + * @return OperationResponse * * @throws ApiException Thrown if the API call fails. */ - public function deleteFeature(DeleteFeatureRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('DeleteFeature', $request, $callOptions)->wait(); + public function createMembershipBinding( + CreateMembershipBindingRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('CreateMembershipBinding', $request, $callOptions)->wait(); } /** - * Removes a Membership. + * Creates a Membership RBACRoleBinding. * - * **This is currently only supported for GKE clusters on Google Cloud**. - * To unregister other clusters, follow the instructions at - * https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. + * The async variant is {@see GkeHubClient::createMembershipRBACRoleBindingAsync()} + * . * - * The async variant is {@see GkeHubClient::deleteMembershipAsync()} . + * @example samples/V1/GkeHubClient/create_membership_rbac_role_binding.php * - * @example samples/V1/GkeHubClient/delete_membership.php + * @param CreateMembershipRBACRoleBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. * - * @param DeleteMembershipRequest $request A request to house fields associated with the call. - * @param array $callOptions { + * @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 createMembershipRBACRoleBinding( + CreateMembershipRBACRoleBindingRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('CreateMembershipRBACRoleBinding', $request, $callOptions)->wait(); + } + + /** + * Creates a Scope. + * + * The async variant is {@see GkeHubClient::createScopeAsync()} . + * + * @example samples/V1/GkeHubClient/create_scope.php + * + * @param CreateScopeRequest $request A request to house fields associated with the call. + * @param array $callOptions { * Optional. * * @type RetrySettings|array $retrySettings @@ -459,27 +790,24 @@ public function deleteFeature(DeleteFeatureRequest $request, array $callOptions * {@see RetrySettings} for example usage. * } * - * @return OperationResponse + * @return OperationResponse * * @throws ApiException Thrown if the API call fails. */ - public function deleteMembership(DeleteMembershipRequest $request, array $callOptions = []): OperationResponse + public function createScope(CreateScopeRequest $request, array $callOptions = []): OperationResponse { - return $this->startApiCall('DeleteMembership', $request, $callOptions)->wait(); + return $this->startApiCall('CreateScope', $request, $callOptions)->wait(); } /** - * Generates the manifest for deployment of the GKE connect agent. - * - * **This method is used internally by Google-provided libraries.** - * Most clients should not need to call this method directly. + * Creates a fleet namespace. * - * The async variant is {@see GkeHubClient::generateConnectManifestAsync()} . + * The async variant is {@see GkeHubClient::createScopeNamespaceAsync()} . * - * @example samples/V1/GkeHubClient/generate_connect_manifest.php + * @example samples/V1/GkeHubClient/create_scope_namespace.php * - * @param GenerateConnectManifestRequest $request A request to house fields associated with the call. - * @param array $callOptions { + * @param CreateScopeNamespaceRequest $request A request to house fields associated with the call. + * @param array $callOptions { * Optional. * * @type RetrySettings|array $retrySettings @@ -488,26 +816,26 @@ public function deleteMembership(DeleteMembershipRequest $request, array $callOp * {@see RetrySettings} for example usage. * } * - * @return GenerateConnectManifestResponse + * @return OperationResponse * * @throws ApiException Thrown if the API call fails. */ - public function generateConnectManifest( - GenerateConnectManifestRequest $request, + public function createScopeNamespace( + CreateScopeNamespaceRequest $request, array $callOptions = [] - ): GenerateConnectManifestResponse { - return $this->startApiCall('GenerateConnectManifest', $request, $callOptions)->wait(); + ): OperationResponse { + return $this->startApiCall('CreateScopeNamespace', $request, $callOptions)->wait(); } /** - * Gets details of a single Feature. + * Creates a Scope RBACRoleBinding. * - * The async variant is {@see GkeHubClient::getFeatureAsync()} . + * The async variant is {@see GkeHubClient::createScopeRBACRoleBindingAsync()} . * - * @example samples/V1/GkeHubClient/get_feature.php + * @example samples/V1/GkeHubClient/create_scope_rbac_role_binding.php * - * @param GetFeatureRequest $request A request to house fields associated with the call. - * @param array $callOptions { + * @param CreateScopeRBACRoleBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { * Optional. * * @type RetrySettings|array $retrySettings @@ -516,23 +844,25 @@ public function generateConnectManifest( * {@see RetrySettings} for example usage. * } * - * @return Feature + * @return OperationResponse * * @throws ApiException Thrown if the API call fails. */ - public function getFeature(GetFeatureRequest $request, array $callOptions = []): Feature - { - return $this->startApiCall('GetFeature', $request, $callOptions)->wait(); + public function createScopeRBACRoleBinding( + CreateScopeRBACRoleBindingRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('CreateScopeRBACRoleBinding', $request, $callOptions)->wait(); } /** - * Gets the details of a Membership. + * Removes a Feature. * - * The async variant is {@see GkeHubClient::getMembershipAsync()} . + * The async variant is {@see GkeHubClient::deleteFeatureAsync()} . * - * @example samples/V1/GkeHubClient/get_membership.php + * @example samples/V1/GkeHubClient/delete_feature.php * - * @param GetMembershipRequest $request A request to house fields associated with the call. + * @param DeleteFeatureRequest $request A request to house fields associated with the call. * @param array $callOptions { * Optional. * @@ -542,24 +872,24 @@ public function getFeature(GetFeatureRequest $request, array $callOptions = []): * {@see RetrySettings} for example usage. * } * - * @return Membership + * @return OperationResponse * * @throws ApiException Thrown if the API call fails. */ - public function getMembership(GetMembershipRequest $request, array $callOptions = []): Membership + public function deleteFeature(DeleteFeatureRequest $request, array $callOptions = []): OperationResponse { - return $this->startApiCall('GetMembership', $request, $callOptions)->wait(); + return $this->startApiCall('DeleteFeature', $request, $callOptions)->wait(); } /** - * Lists Features in a given project and location. + * Removes a Fleet. There must be no memberships remaining in the Fleet. * - * The async variant is {@see GkeHubClient::listFeaturesAsync()} . + * The async variant is {@see GkeHubClient::deleteFleetAsync()} . * - * @example samples/V1/GkeHubClient/list_features.php + * @example samples/V1/GkeHubClient/delete_fleet.php * - * @param ListFeaturesRequest $request A request to house fields associated with the call. - * @param array $callOptions { + * @param DeleteFleetRequest $request A request to house fields associated with the call. + * @param array $callOptions { * Optional. * * @type RetrySettings|array $retrySettings @@ -568,24 +898,28 @@ public function getMembership(GetMembershipRequest $request, array $callOptions * {@see RetrySettings} for example usage. * } * - * @return PagedListResponse + * @return OperationResponse * * @throws ApiException Thrown if the API call fails. */ - public function listFeatures(ListFeaturesRequest $request, array $callOptions = []): PagedListResponse + public function deleteFleet(DeleteFleetRequest $request, array $callOptions = []): OperationResponse { - return $this->startApiCall('ListFeatures', $request, $callOptions); + return $this->startApiCall('DeleteFleet', $request, $callOptions)->wait(); } /** - * Lists Memberships in a given project and location. + * Removes a Membership. * - * The async variant is {@see GkeHubClient::listMembershipsAsync()} . + * **This is currently only supported for GKE clusters on Google Cloud**. + * To unregister other clusters, follow the instructions at + * https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster. * - * @example samples/V1/GkeHubClient/list_memberships.php + * The async variant is {@see GkeHubClient::deleteMembershipAsync()} . * - * @param ListMembershipsRequest $request A request to house fields associated with the call. - * @param array $callOptions { + * @example samples/V1/GkeHubClient/delete_membership.php + * + * @param DeleteMembershipRequest $request A request to house fields associated with the call. + * @param array $callOptions { * Optional. * * @type RetrySettings|array $retrySettings @@ -594,24 +928,24 @@ public function listFeatures(ListFeaturesRequest $request, array $callOptions = * {@see RetrySettings} for example usage. * } * - * @return PagedListResponse + * @return OperationResponse * * @throws ApiException Thrown if the API call fails. */ - public function listMemberships(ListMembershipsRequest $request, array $callOptions = []): PagedListResponse + public function deleteMembership(DeleteMembershipRequest $request, array $callOptions = []): OperationResponse { - return $this->startApiCall('ListMemberships', $request, $callOptions); + return $this->startApiCall('DeleteMembership', $request, $callOptions)->wait(); } /** - * Updates an existing Feature. + * Deletes a MembershipBinding. * - * The async variant is {@see GkeHubClient::updateFeatureAsync()} . + * The async variant is {@see GkeHubClient::deleteMembershipBindingAsync()} . * - * @example samples/V1/GkeHubClient/update_feature.php + * @example samples/V1/GkeHubClient/delete_membership_binding.php * - * @param UpdateFeatureRequest $request A request to house fields associated with the call. - * @param array $callOptions { + * @param DeleteMembershipBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { * Optional. * * @type RetrySettings|array $retrySettings @@ -620,24 +954,27 @@ public function listMemberships(ListMembershipsRequest $request, array $callOpti * {@see RetrySettings} for example usage. * } * - * @return OperationResponse + * @return OperationResponse * * @throws ApiException Thrown if the API call fails. */ - public function updateFeature(UpdateFeatureRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateFeature', $request, $callOptions)->wait(); + public function deleteMembershipBinding( + DeleteMembershipBindingRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('DeleteMembershipBinding', $request, $callOptions)->wait(); } /** - * Updates an existing Membership. + * Deletes a Membership RBACRoleBinding. * - * The async variant is {@see GkeHubClient::updateMembershipAsync()} . + * The async variant is {@see GkeHubClient::deleteMembershipRBACRoleBindingAsync()} + * . * - * @example samples/V1/GkeHubClient/update_membership.php + * @example samples/V1/GkeHubClient/delete_membership_rbac_role_binding.php * - * @param UpdateMembershipRequest $request A request to house fields associated with the call. - * @param array $callOptions { + * @param DeleteMembershipRBACRoleBindingRequest $request A request to house fields associated with the call. + * @param array $callOptions { * Optional. * * @type RetrySettings|array $retrySettings @@ -646,12 +983,859 @@ public function updateFeature(UpdateFeatureRequest $request, array $callOptions * {@see RetrySettings} for example usage. * } * - * @return OperationResponse + * @return OperationResponse * * @throws ApiException Thrown if the API call fails. */ - public function updateMembership(UpdateMembershipRequest $request, array $callOptions = []): OperationResponse - { - return $this->startApiCall('UpdateMembership', $request, $callOptions)->wait(); + public function deleteMembershipRBACRoleBinding( + DeleteMembershipRBACRoleBindingRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('DeleteMembershipRBACRoleBinding', $request, $callOptions)->wait(); + } + + /** + * Deletes a Scope. + * + * The async variant is {@see GkeHubClient::deleteScopeAsync()} . + * + * @example samples/V1/GkeHubClient/delete_scope.php + * + * @param DeleteScopeRequest $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 deleteScope(DeleteScopeRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('DeleteScope', $request, $callOptions)->wait(); + } + + /** + * Deletes a fleet namespace. + * + * The async variant is {@see GkeHubClient::deleteScopeNamespaceAsync()} . + * + * @example samples/V1/GkeHubClient/delete_scope_namespace.php + * + * @param DeleteScopeNamespaceRequest $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 deleteScopeNamespace( + DeleteScopeNamespaceRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('DeleteScopeNamespace', $request, $callOptions)->wait(); + } + + /** + * Deletes a Scope RBACRoleBinding. + * + * The async variant is {@see GkeHubClient::deleteScopeRBACRoleBindingAsync()} . + * + * @example samples/V1/GkeHubClient/delete_scope_rbac_role_binding.php + * + * @param DeleteScopeRBACRoleBindingRequest $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 deleteScopeRBACRoleBinding( + DeleteScopeRBACRoleBindingRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('DeleteScopeRBACRoleBinding', $request, $callOptions)->wait(); + } + + /** + * Generates the manifest for deployment of the GKE connect agent. + * + * **This method is used internally by Google-provided libraries.** + * Most clients should not need to call this method directly. + * + * The async variant is {@see GkeHubClient::generateConnectManifestAsync()} . + * + * @example samples/V1/GkeHubClient/generate_connect_manifest.php + * + * @param GenerateConnectManifestRequest $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 GenerateConnectManifestResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateConnectManifest( + GenerateConnectManifestRequest $request, + array $callOptions = [] + ): GenerateConnectManifestResponse { + return $this->startApiCall('GenerateConnectManifest', $request, $callOptions)->wait(); + } + + /** + * Generates a YAML of the RBAC policies for the specified + * RoleBinding and its associated impersonation resources. + * + * The async variant is + * {@see GkeHubClient::generateMembershipRBACRoleBindingYAMLAsync()} . + * + * @example samples/V1/GkeHubClient/generate_membership_rbac_role_binding_yaml.php + * + * @param GenerateMembershipRBACRoleBindingYAMLRequest $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 GenerateMembershipRBACRoleBindingYAMLResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateMembershipRBACRoleBindingYAML( + GenerateMembershipRBACRoleBindingYAMLRequest $request, + array $callOptions = [] + ): GenerateMembershipRBACRoleBindingYAMLResponse { + return $this->startApiCall('GenerateMembershipRBACRoleBindingYAML', $request, $callOptions)->wait(); + } + + /** + * Gets details of a single Feature. + * + * The async variant is {@see GkeHubClient::getFeatureAsync()} . + * + * @example samples/V1/GkeHubClient/get_feature.php + * + * @param GetFeatureRequest $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 Feature + * + * @throws ApiException Thrown if the API call fails. + */ + public function getFeature(GetFeatureRequest $request, array $callOptions = []): Feature + { + return $this->startApiCall('GetFeature', $request, $callOptions)->wait(); + } + + /** + * Returns the details of a fleet. + * + * The async variant is {@see GkeHubClient::getFleetAsync()} . + * + * @example samples/V1/GkeHubClient/get_fleet.php + * + * @param GetFleetRequest $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 Fleet + * + * @throws ApiException Thrown if the API call fails. + */ + public function getFleet(GetFleetRequest $request, array $callOptions = []): Fleet + { + return $this->startApiCall('GetFleet', $request, $callOptions)->wait(); + } + + /** + * Gets the details of a Membership. + * + * The async variant is {@see GkeHubClient::getMembershipAsync()} . + * + * @example samples/V1/GkeHubClient/get_membership.php + * + * @param GetMembershipRequest $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 Membership + * + * @throws ApiException Thrown if the API call fails. + */ + public function getMembership(GetMembershipRequest $request, array $callOptions = []): Membership + { + return $this->startApiCall('GetMembership', $request, $callOptions)->wait(); + } + + /** + * Returns the details of a MembershipBinding. + * + * The async variant is {@see GkeHubClient::getMembershipBindingAsync()} . + * + * @example samples/V1/GkeHubClient/get_membership_binding.php + * + * @param GetMembershipBindingRequest $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 MembershipBinding + * + * @throws ApiException Thrown if the API call fails. + */ + public function getMembershipBinding( + GetMembershipBindingRequest $request, + array $callOptions = [] + ): MembershipBinding { + return $this->startApiCall('GetMembershipBinding', $request, $callOptions)->wait(); + } + + /** + * Returns the details of a Membership RBACRoleBinding. + * + * The async variant is {@see GkeHubClient::getMembershipRBACRoleBindingAsync()} . + * + * @example samples/V1/GkeHubClient/get_membership_rbac_role_binding.php + * + * @param GetMembershipRBACRoleBindingRequest $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 RBACRoleBinding + * + * @throws ApiException Thrown if the API call fails. + */ + public function getMembershipRBACRoleBinding( + GetMembershipRBACRoleBindingRequest $request, + array $callOptions = [] + ): RBACRoleBinding { + return $this->startApiCall('GetMembershipRBACRoleBinding', $request, $callOptions)->wait(); + } + + /** + * Returns the details of a Scope. + * + * The async variant is {@see GkeHubClient::getScopeAsync()} . + * + * @example samples/V1/GkeHubClient/get_scope.php + * + * @param GetScopeRequest $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 Scope + * + * @throws ApiException Thrown if the API call fails. + */ + public function getScope(GetScopeRequest $request, array $callOptions = []): Scope + { + return $this->startApiCall('GetScope', $request, $callOptions)->wait(); + } + + /** + * Returns the details of a fleet namespace. + * + * The async variant is {@see GkeHubClient::getScopeNamespaceAsync()} . + * + * @example samples/V1/GkeHubClient/get_scope_namespace.php + * + * @param GetScopeNamespaceRequest $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 PBNamespace + * + * @throws ApiException Thrown if the API call fails. + */ + public function getScopeNamespace(GetScopeNamespaceRequest $request, array $callOptions = []): PBNamespace + { + return $this->startApiCall('GetScopeNamespace', $request, $callOptions)->wait(); + } + + /** + * Returns the details of a Scope RBACRoleBinding. + * + * The async variant is {@see GkeHubClient::getScopeRBACRoleBindingAsync()} . + * + * @example samples/V1/GkeHubClient/get_scope_rbac_role_binding.php + * + * @param GetScopeRBACRoleBindingRequest $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 RBACRoleBinding + * + * @throws ApiException Thrown if the API call fails. + */ + public function getScopeRBACRoleBinding( + GetScopeRBACRoleBindingRequest $request, + array $callOptions = [] + ): RBACRoleBinding { + return $this->startApiCall('GetScopeRBACRoleBinding', $request, $callOptions)->wait(); + } + + /** + * Lists Memberships bound to a Scope. The response includes relevant + * Memberships from all regions. + * + * The async variant is {@see GkeHubClient::listBoundMembershipsAsync()} . + * + * @example samples/V1/GkeHubClient/list_bound_memberships.php + * + * @param ListBoundMembershipsRequest $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 listBoundMemberships( + ListBoundMembershipsRequest $request, + array $callOptions = [] + ): PagedListResponse { + return $this->startApiCall('ListBoundMemberships', $request, $callOptions); + } + + /** + * Lists Features in a given project and location. + * + * The async variant is {@see GkeHubClient::listFeaturesAsync()} . + * + * @example samples/V1/GkeHubClient/list_features.php + * + * @param ListFeaturesRequest $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 listFeatures(ListFeaturesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListFeatures', $request, $callOptions); + } + + /** + * Returns all fleets within an organization or a project that the caller has + * access to. + * + * The async variant is {@see GkeHubClient::listFleetsAsync()} . + * + * @example samples/V1/GkeHubClient/list_fleets.php + * + * @param ListFleetsRequest $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 listFleets(ListFleetsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListFleets', $request, $callOptions); + } + + /** + * Lists MembershipBindings. + * + * The async variant is {@see GkeHubClient::listMembershipBindingsAsync()} . + * + * @example samples/V1/GkeHubClient/list_membership_bindings.php + * + * @param ListMembershipBindingsRequest $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 listMembershipBindings( + ListMembershipBindingsRequest $request, + array $callOptions = [] + ): PagedListResponse { + return $this->startApiCall('ListMembershipBindings', $request, $callOptions); + } + + /** + * Lists all Membership RBACRoleBindings. + * + * The async variant is {@see GkeHubClient::listMembershipRBACRoleBindingsAsync()} + * . + * + * @example samples/V1/GkeHubClient/list_membership_rbac_role_bindings.php + * + * @param ListMembershipRBACRoleBindingsRequest $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 listMembershipRBACRoleBindings( + ListMembershipRBACRoleBindingsRequest $request, + array $callOptions = [] + ): PagedListResponse { + return $this->startApiCall('ListMembershipRBACRoleBindings', $request, $callOptions); + } + + /** + * Lists Memberships in a given project and location. + * + * The async variant is {@see GkeHubClient::listMembershipsAsync()} . + * + * @example samples/V1/GkeHubClient/list_memberships.php + * + * @param ListMembershipsRequest $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 listMemberships(ListMembershipsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListMemberships', $request, $callOptions); + } + + /** + * Lists permitted Scopes. + * + * The async variant is {@see GkeHubClient::listPermittedScopesAsync()} . + * + * @example samples/V1/GkeHubClient/list_permitted_scopes.php + * + * @param ListPermittedScopesRequest $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 listPermittedScopes(ListPermittedScopesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListPermittedScopes', $request, $callOptions); + } + + /** + * Lists fleet namespaces. + * + * The async variant is {@see GkeHubClient::listScopeNamespacesAsync()} . + * + * @example samples/V1/GkeHubClient/list_scope_namespaces.php + * + * @param ListScopeNamespacesRequest $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 listScopeNamespaces(ListScopeNamespacesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListScopeNamespaces', $request, $callOptions); + } + + /** + * Lists all Scope RBACRoleBindings. + * + * The async variant is {@see GkeHubClient::listScopeRBACRoleBindingsAsync()} . + * + * @example samples/V1/GkeHubClient/list_scope_rbac_role_bindings.php + * + * @param ListScopeRBACRoleBindingsRequest $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 listScopeRBACRoleBindings( + ListScopeRBACRoleBindingsRequest $request, + array $callOptions = [] + ): PagedListResponse { + return $this->startApiCall('ListScopeRBACRoleBindings', $request, $callOptions); + } + + /** + * Lists Scopes. + * + * The async variant is {@see GkeHubClient::listScopesAsync()} . + * + * @example samples/V1/GkeHubClient/list_scopes.php + * + * @param ListScopesRequest $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 listScopes(ListScopesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListScopes', $request, $callOptions); + } + + /** + * Updates an existing Feature. + * + * The async variant is {@see GkeHubClient::updateFeatureAsync()} . + * + * @example samples/V1/GkeHubClient/update_feature.php + * + * @param UpdateFeatureRequest $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 updateFeature(UpdateFeatureRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateFeature', $request, $callOptions)->wait(); + } + + /** + * Updates a fleet. + * + * The async variant is {@see GkeHubClient::updateFleetAsync()} . + * + * @example samples/V1/GkeHubClient/update_fleet.php + * + * @param UpdateFleetRequest $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 updateFleet(UpdateFleetRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateFleet', $request, $callOptions)->wait(); + } + + /** + * Updates an existing Membership. + * + * The async variant is {@see GkeHubClient::updateMembershipAsync()} . + * + * @example samples/V1/GkeHubClient/update_membership.php + * + * @param UpdateMembershipRequest $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 updateMembership(UpdateMembershipRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateMembership', $request, $callOptions)->wait(); + } + + /** + * Updates a MembershipBinding. + * + * The async variant is {@see GkeHubClient::updateMembershipBindingAsync()} . + * + * @example samples/V1/GkeHubClient/update_membership_binding.php + * + * @param UpdateMembershipBindingRequest $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 updateMembershipBinding( + UpdateMembershipBindingRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('UpdateMembershipBinding', $request, $callOptions)->wait(); + } + + /** + * Updates a Membership RBACRoleBinding. + * + * The async variant is {@see GkeHubClient::updateMembershipRBACRoleBindingAsync()} + * . + * + * @example samples/V1/GkeHubClient/update_membership_rbac_role_binding.php + * + * @param UpdateMembershipRBACRoleBindingRequest $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 updateMembershipRBACRoleBinding( + UpdateMembershipRBACRoleBindingRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('UpdateMembershipRBACRoleBinding', $request, $callOptions)->wait(); + } + + /** + * Updates a scopes. + * + * The async variant is {@see GkeHubClient::updateScopeAsync()} . + * + * @example samples/V1/GkeHubClient/update_scope.php + * + * @param UpdateScopeRequest $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 updateScope(UpdateScopeRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('UpdateScope', $request, $callOptions)->wait(); + } + + /** + * Updates a fleet namespace. + * + * The async variant is {@see GkeHubClient::updateScopeNamespaceAsync()} . + * + * @example samples/V1/GkeHubClient/update_scope_namespace.php + * + * @param UpdateScopeNamespaceRequest $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 updateScopeNamespace( + UpdateScopeNamespaceRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('UpdateScopeNamespace', $request, $callOptions)->wait(); + } + + /** + * Updates a Scope RBACRoleBinding. + * + * The async variant is {@see GkeHubClient::updateScopeRBACRoleBindingAsync()} . + * + * @example samples/V1/GkeHubClient/update_scope_rbac_role_binding.php + * + * @param UpdateScopeRBACRoleBindingRequest $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 updateScopeRBACRoleBinding( + UpdateScopeRBACRoleBindingRequest $request, + array $callOptions = [] + ): OperationResponse { + return $this->startApiCall('UpdateScopeRBACRoleBinding', $request, $callOptions)->wait(); } } diff --git a/GkeHub/src/V1/FeatureSpec.php b/GkeHub/src/V1/FeatureSpec.php index 1031f8479b15..009a3914d922 100644 --- a/GkeHub/src/V1/FeatureSpec.php +++ b/GkeHub/src/V1/FeatureSpec.php @@ -1,28 +1,29 @@ google.cloud.gkehub.multiclusteringress.v1.FeatureSpec + * Generated from protobuf message google.cloud.gkehub.rbacrolebindingactuation.v1.FeatureSpec */ class FeatureSpec extends \Google\Protobuf\Internal\Message { /** - * Fully-qualified Membership name which hosts the MultiClusterIngress CRD. - * Example: `projects/foo-proj/locations/global/memberships/bar` + * The list of allowed custom roles (ClusterRoles). If a ClusterRole is not + * part of this list, it cannot be used in a Scope RBACRoleBinding. If a + * ClusterRole in this list is in use, it cannot be removed from the list. * - * Generated from protobuf field string config_membership = 1; + * Generated from protobuf field repeated string allowed_custom_roles = 2; */ - protected $config_membership = ''; + private $allowed_custom_roles; /** * Constructor. @@ -30,40 +31,43 @@ class FeatureSpec extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type string $config_membership - * Fully-qualified Membership name which hosts the MultiClusterIngress CRD. - * Example: `projects/foo-proj/locations/global/memberships/bar` + * @type array|\Google\Protobuf\Internal\RepeatedField $allowed_custom_roles + * The list of allowed custom roles (ClusterRoles). If a ClusterRole is not + * part of this list, it cannot be used in a Scope RBACRoleBinding. If a + * ClusterRole in this list is in use, it cannot be removed from the list. * } */ public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Gkehub\V1\Multiclusteringress\Multiclusteringress::initOnce(); + \GPBMetadata\Google\Cloud\Gkehub\V1\Rbacrolebindingactuation\Rbacrolebindingactuation::initOnce(); parent::__construct($data); } /** - * Fully-qualified Membership name which hosts the MultiClusterIngress CRD. - * Example: `projects/foo-proj/locations/global/memberships/bar` + * The list of allowed custom roles (ClusterRoles). If a ClusterRole is not + * part of this list, it cannot be used in a Scope RBACRoleBinding. If a + * ClusterRole in this list is in use, it cannot be removed from the list. * - * Generated from protobuf field string config_membership = 1; - * @return string + * Generated from protobuf field repeated string allowed_custom_roles = 2; + * @return \Google\Protobuf\Internal\RepeatedField */ - public function getConfigMembership() + public function getAllowedCustomRoles() { - return $this->config_membership; + return $this->allowed_custom_roles; } /** - * Fully-qualified Membership name which hosts the MultiClusterIngress CRD. - * Example: `projects/foo-proj/locations/global/memberships/bar` + * The list of allowed custom roles (ClusterRoles). If a ClusterRole is not + * part of this list, it cannot be used in a Scope RBACRoleBinding. If a + * ClusterRole in this list is in use, it cannot be removed from the list. * - * Generated from protobuf field string config_membership = 1; - * @param string $var + * Generated from protobuf field repeated string allowed_custom_roles = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ - public function setConfigMembership($var) + public function setAllowedCustomRoles($var) { - GPBUtil::checkString($var, True); - $this->config_membership = $var; + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->allowed_custom_roles = $arr; return $this; } diff --git a/GkeHub/src/V1/FeatureState.php b/GkeHub/src/V1/FeatureState.php index d2188bb9360d..fc27f23f8ee3 100644 --- a/GkeHub/src/V1/FeatureState.php +++ b/GkeHub/src/V1/FeatureState.php @@ -1,40 +1,21 @@ google.cloud.gkehub.v1.FeatureState + * Generated from protobuf message google.cloud.gkehub.rbacrolebindingactuation.v1.FeatureState */ class FeatureState extends \Google\Protobuf\Internal\Message { - /** - * The high-level, machine-readable status of this Feature. - * - * Generated from protobuf field .google.cloud.gkehub.v1.FeatureState.Code code = 1; - */ - protected $code = 0; - /** - * A human-readable description of the current status. - * - * Generated from protobuf field string description = 2; - */ - protected $description = ''; - /** - * The time this status and any related Feature-specific details were updated. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 3; - */ - protected $update_time = null; /** * Constructor. @@ -42,106 +23,12 @@ class FeatureState extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * - * @type int $code - * The high-level, machine-readable status of this Feature. - * @type string $description - * A human-readable description of the current status. - * @type \Google\Protobuf\Timestamp $update_time - * The time this status and any related Feature-specific details were updated. * } */ public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Gkehub\V1\Feature::initOnce(); + \GPBMetadata\Google\Cloud\Gkehub\V1\Rbacrolebindingactuation\Rbacrolebindingactuation::initOnce(); parent::__construct($data); } - /** - * The high-level, machine-readable status of this Feature. - * - * Generated from protobuf field .google.cloud.gkehub.v1.FeatureState.Code code = 1; - * @return int - */ - public function getCode() - { - return $this->code; - } - - /** - * The high-level, machine-readable status of this Feature. - * - * Generated from protobuf field .google.cloud.gkehub.v1.FeatureState.Code code = 1; - * @param int $var - * @return $this - */ - public function setCode($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\GkeHub\V1\FeatureState\Code::class); - $this->code = $var; - - return $this; - } - - /** - * A human-readable description of the current status. - * - * Generated from protobuf field string description = 2; - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * A human-readable description of the current status. - * - * Generated from protobuf field string description = 2; - * @param string $var - * @return $this - */ - public function setDescription($var) - { - GPBUtil::checkString($var, True); - $this->description = $var; - - return $this; - } - - /** - * The time this status and any related Feature-specific details were updated. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 3; - * @return \Google\Protobuf\Timestamp|null - */ - public function getUpdateTime() - { - return $this->update_time; - } - - public function hasUpdateTime() - { - return isset($this->update_time); - } - - public function clearUpdateTime() - { - unset($this->update_time); - } - - /** - * The time this status and any related Feature-specific details were updated. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 3; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setUpdateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->update_time = $var; - - return $this; - } - } diff --git a/GkeHub/src/V1/gapic_metadata.json b/GkeHub/src/V1/gapic_metadata.json index 7b0047620c7f..b97f2929ef6b 100644 --- a/GkeHub/src/V1/gapic_metadata.json +++ b/GkeHub/src/V1/gapic_metadata.json @@ -15,55 +15,220 @@ "createFeature" ] }, + "CreateFleet": { + "methods": [ + "createFleet" + ] + }, "CreateMembership": { "methods": [ "createMembership" ] }, + "CreateMembershipBinding": { + "methods": [ + "createMembershipBinding" + ] + }, + "CreateMembershipRBACRoleBinding": { + "methods": [ + "createMembershipRBACRoleBinding" + ] + }, + "CreateScope": { + "methods": [ + "createScope" + ] + }, + "CreateScopeNamespace": { + "methods": [ + "createScopeNamespace" + ] + }, + "CreateScopeRBACRoleBinding": { + "methods": [ + "createScopeRBACRoleBinding" + ] + }, "DeleteFeature": { "methods": [ "deleteFeature" ] }, + "DeleteFleet": { + "methods": [ + "deleteFleet" + ] + }, "DeleteMembership": { "methods": [ "deleteMembership" ] }, + "DeleteMembershipBinding": { + "methods": [ + "deleteMembershipBinding" + ] + }, + "DeleteMembershipRBACRoleBinding": { + "methods": [ + "deleteMembershipRBACRoleBinding" + ] + }, + "DeleteScope": { + "methods": [ + "deleteScope" + ] + }, + "DeleteScopeNamespace": { + "methods": [ + "deleteScopeNamespace" + ] + }, + "DeleteScopeRBACRoleBinding": { + "methods": [ + "deleteScopeRBACRoleBinding" + ] + }, "GenerateConnectManifest": { "methods": [ "generateConnectManifest" ] }, + "GenerateMembershipRBACRoleBindingYAML": { + "methods": [ + "generateMembershipRBACRoleBindingYAML" + ] + }, "GetFeature": { "methods": [ "getFeature" ] }, + "GetFleet": { + "methods": [ + "getFleet" + ] + }, "GetMembership": { "methods": [ "getMembership" ] }, + "GetMembershipBinding": { + "methods": [ + "getMembershipBinding" + ] + }, + "GetMembershipRBACRoleBinding": { + "methods": [ + "getMembershipRBACRoleBinding" + ] + }, + "GetScope": { + "methods": [ + "getScope" + ] + }, + "GetScopeNamespace": { + "methods": [ + "getScopeNamespace" + ] + }, + "GetScopeRBACRoleBinding": { + "methods": [ + "getScopeRBACRoleBinding" + ] + }, + "ListBoundMemberships": { + "methods": [ + "listBoundMemberships" + ] + }, "ListFeatures": { "methods": [ "listFeatures" ] }, + "ListFleets": { + "methods": [ + "listFleets" + ] + }, + "ListMembershipBindings": { + "methods": [ + "listMembershipBindings" + ] + }, + "ListMembershipRBACRoleBindings": { + "methods": [ + "listMembershipRBACRoleBindings" + ] + }, "ListMemberships": { "methods": [ "listMemberships" ] }, + "ListPermittedScopes": { + "methods": [ + "listPermittedScopes" + ] + }, + "ListScopeNamespaces": { + "methods": [ + "listScopeNamespaces" + ] + }, + "ListScopeRBACRoleBindings": { + "methods": [ + "listScopeRBACRoleBindings" + ] + }, + "ListScopes": { + "methods": [ + "listScopes" + ] + }, "UpdateFeature": { "methods": [ "updateFeature" ] }, + "UpdateFleet": { + "methods": [ + "updateFleet" + ] + }, "UpdateMembership": { "methods": [ "updateMembership" ] + }, + "UpdateMembershipBinding": { + "methods": [ + "updateMembershipBinding" + ] + }, + "UpdateMembershipRBACRoleBinding": { + "methods": [ + "updateMembershipRBACRoleBinding" + ] + }, + "UpdateScope": { + "methods": [ + "updateScope" + ] + }, + "UpdateScopeNamespace": { + "methods": [ + "updateScopeNamespace" + ] + }, + "UpdateScopeRBACRoleBinding": { + "methods": [ + "updateScopeRBACRoleBinding" + ] } } } diff --git a/GkeHub/src/V1/resources/gke_hub_client_config.json b/GkeHub/src/V1/resources/gke_hub_client_config.json index f361405e676f..71f5c1b998c6 100644 --- a/GkeHub/src/V1/resources/gke_hub_client_config.json +++ b/GkeHub/src/V1/resources/gke_hub_client_config.json @@ -33,55 +33,220 @@ "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "CreateFleet": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "CreateMembership": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "CreateMembershipBinding": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "CreateMembershipRBACRoleBinding": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "CreateScope": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "CreateScopeNamespace": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "CreateScopeRBACRoleBinding": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "DeleteFeature": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "DeleteFleet": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "DeleteMembership": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "DeleteMembershipBinding": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeleteMembershipRBACRoleBinding": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeleteScope": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeleteScopeNamespace": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeleteScopeRBACRoleBinding": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "GenerateConnectManifest": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "GenerateMembershipRBACRoleBindingYAML": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "GetFeature": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "GetFleet": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "GetMembership": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "GetMembershipBinding": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetMembershipRBACRoleBinding": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetScope": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetScopeNamespace": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetScopeRBACRoleBinding": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListBoundMemberships": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "ListFeatures": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "ListFleets": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListMembershipBindings": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListMembershipRBACRoleBindings": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "ListMemberships": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "ListPermittedScopes": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListScopeNamespaces": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListScopeRBACRoleBindings": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListScopes": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "UpdateFeature": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "UpdateFleet": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "UpdateMembership": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" + }, + "UpdateMembershipBinding": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateMembershipRBACRoleBinding": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateScope": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateScopeNamespace": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateScopeRBACRoleBinding": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" } } } diff --git a/GkeHub/src/V1/resources/gke_hub_descriptor_config.php b/GkeHub/src/V1/resources/gke_hub_descriptor_config.php index 490753e5428b..041197f34244 100644 --- a/GkeHub/src/V1/resources/gke_hub_descriptor_config.php +++ b/GkeHub/src/V1/resources/gke_hub_descriptor_config.php @@ -42,6 +42,25 @@ ], ], ], + 'CreateFleet' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeHub\V1\Fleet', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], 'CreateMembership' => [ 'longRunning' => [ 'operationReturnType' => '\Google\Cloud\GkeHub\V1\Membership', @@ -61,6 +80,101 @@ ], ], ], + 'CreateMembershipBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeHub\V1\MembershipBinding', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateMembershipRBACRoleBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeHub\V1\RBACRoleBinding', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateScope' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeHub\V1\Scope', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateScopeNamespace' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeHub\V1\PBNamespace', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateScopeRBACRoleBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeHub\V1\RBACRoleBinding', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], 'DeleteFeature' => [ 'longRunning' => [ 'operationReturnType' => '\Google\Protobuf\GPBEmpty', @@ -80,6 +194,25 @@ ], ], ], + 'DeleteFleet' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], 'DeleteMembership' => [ 'longRunning' => [ 'operationReturnType' => '\Google\Protobuf\GPBEmpty', @@ -99,6 +232,101 @@ ], ], ], + 'DeleteMembershipBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteMembershipRBACRoleBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteScope' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteScopeNamespace' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteScopeRBACRoleBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Protobuf\GPBEmpty', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], 'UpdateFeature' => [ 'longRunning' => [ 'operationReturnType' => '\Google\Cloud\GkeHub\V1\Feature', @@ -118,6 +346,26 @@ ], ], ], + 'UpdateFleet' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeHub\V1\Fleet', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'fleet.name', + 'fieldAccessors' => [ + 'getFleet', + 'getName', + ], + ], + ], + ], 'UpdateMembership' => [ 'longRunning' => [ 'operationReturnType' => '\Google\Cloud\GkeHub\V1\Membership', @@ -137,6 +385,106 @@ ], ], ], + 'UpdateMembershipBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeHub\V1\MembershipBinding', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'membership_binding.name', + 'fieldAccessors' => [ + 'getMembershipBinding', + 'getName', + ], + ], + ], + ], + 'UpdateMembershipRBACRoleBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeHub\V1\RBACRoleBinding', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'rbacrolebinding.name', + 'fieldAccessors' => [ + 'getRbacrolebinding', + 'getName', + ], + ], + ], + ], + 'UpdateScope' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeHub\V1\Scope', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'scope.name', + 'fieldAccessors' => [ + 'getScope', + 'getName', + ], + ], + ], + ], + 'UpdateScopeNamespace' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeHub\V1\PBNamespace', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'scope_namespace.name', + 'fieldAccessors' => [ + 'getScopeNamespace', + 'getName', + ], + ], + ], + ], + 'UpdateScopeRBACRoleBinding' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\GkeHub\V1\RBACRoleBinding', + 'metadataReturnType' => '\Google\Cloud\GkeHub\V1\OperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'rbacrolebinding.name', + 'fieldAccessors' => [ + 'getRbacrolebinding', + 'getName', + ], + ], + ], + ], 'GenerateConnectManifest' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Cloud\GkeHub\V1\GenerateConnectManifestResponse', @@ -149,6 +497,18 @@ ], ], ], + 'GenerateMembershipRBACRoleBindingYAML' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\GenerateMembershipRBACRoleBindingYAMLResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], 'GetFeature' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Cloud\GkeHub\V1\Feature', @@ -161,6 +521,18 @@ ], ], ], + 'GetFleet' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\Fleet', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], 'GetMembership' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Cloud\GkeHub\V1\Membership', @@ -173,6 +545,86 @@ ], ], ], + 'GetMembershipBinding' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\MembershipBinding', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetMembershipRBACRoleBinding' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\RBACRoleBinding', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetScope' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\Scope', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetScopeNamespace' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\PBNamespace', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetScopeRBACRoleBinding' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\RBACRoleBinding', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListBoundMemberships' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getMemberships', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\ListBoundMembershipsResponse', + 'headerParams' => [ + [ + 'keyName' => 'scope_name', + 'fieldAccessors' => [ + 'getScopeName', + ], + ], + ], + ], 'ListFeatures' => [ 'pageStreaming' => [ 'requestPageTokenGetMethod' => 'getPageToken', @@ -193,6 +645,66 @@ ], ], ], + 'ListFleets' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getFleets', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\ListFleetsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListMembershipBindings' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getMembershipBindings', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\ListMembershipBindingsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListMembershipRBACRoleBindings' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getRbacrolebindings', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\ListMembershipRBACRoleBindingsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], 'ListMemberships' => [ 'pageStreaming' => [ 'requestPageTokenGetMethod' => 'getPageToken', @@ -213,10 +725,99 @@ ], ], ], + 'ListPermittedScopes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getScopes', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\ListPermittedScopesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListScopeNamespaces' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getScopeNamespaces', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\ListScopeNamespacesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListScopeRBACRoleBindings' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getRbacrolebindings', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\ListScopeRBACRoleBindingsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListScopes' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getScopes', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeHub\V1\ListScopesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], 'templateMap' => [ 'feature' => 'projects/{project}/locations/{location}/features/{feature}', + 'fleet' => 'projects/{project}/locations/{location}/fleets/{fleet}', 'location' => 'projects/{project}/locations/{location}', 'membership' => 'projects/{project}/locations/{location}/memberships/{membership}', + 'membershipBinding' => 'projects/{project}/locations/{location}/memberships/{membership}/bindings/{membershipbinding}', + 'namespace' => 'projects/{project}/locations/{location}/scopes/{scope}/namespaces/{namespace}', + 'organizationLocationFleet' => 'organizations/{organization}/locations/{location}/fleets/{fleet}', + 'projectLocationFleet' => 'projects/{project}/locations/{location}/fleets/{fleet}', + 'projectLocationMembershipRbacrolebinding' => 'projects/{project}/locations/{location}/memberships/{membership}/rbacrolebindings/{rbacrolebinding}', + 'projectLocationScopeRbacrolebinding' => 'projects/{project}/locations/{location}/scopes/{scope}/rbacrolebindings/{rbacrolebinding}', + 'rBACRoleBinding' => 'projects/{project}/locations/{location}/scopes/{scope}/rbacrolebindings/{rbacrolebinding}', + 'scope' => 'projects/{project}/locations/{location}/scopes/{scope}', ], ], ], diff --git a/GkeHub/src/V1/resources/gke_hub_rest_client_config.php b/GkeHub/src/V1/resources/gke_hub_rest_client_config.php index 3b91c2de285d..b534146a0787 100644 --- a/GkeHub/src/V1/resources/gke_hub_rest_client_config.php +++ b/GkeHub/src/V1/resources/gke_hub_rest_client_config.php @@ -35,6 +35,18 @@ ], ], ], + 'CreateFleet' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/fleets', + 'body' => 'fleet', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], 'CreateMembership' => [ 'method' => 'post', 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/memberships', @@ -50,6 +62,81 @@ 'membership_id', ], ], + 'CreateMembershipBinding' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/memberships/*}/bindings', + 'body' => 'membership_binding', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'membership_binding_id', + ], + ], + 'CreateMembershipRBACRoleBinding' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/memberships/*}/rbacrolebindings', + 'body' => 'rbacrolebinding', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'rbacrolebinding_id', + ], + ], + 'CreateScope' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/scopes', + 'body' => 'scope', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'scope_id', + ], + ], + 'CreateScopeNamespace' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/scopes/*}/namespaces', + 'body' => 'scope_namespace', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'scope_namespace_id', + ], + ], + 'CreateScopeRBACRoleBinding' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/scopes/*}/rbacrolebindings', + 'body' => 'rbacrolebinding', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'rbacrolebinding_id', + ], + ], 'DeleteFeature' => [ 'method' => 'delete', 'uriTemplate' => '/v1/{name=projects/*/locations/*/features/*}', @@ -61,6 +148,17 @@ ], ], ], + 'DeleteFleet' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/fleets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'DeleteMembership' => [ 'method' => 'delete', 'uriTemplate' => '/v1/{name=projects/*/locations/*/memberships/*}', @@ -72,6 +170,61 @@ ], ], ], + 'DeleteMembershipBinding' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/memberships/*/bindings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteMembershipRBACRoleBinding' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/memberships/*/rbacrolebindings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteScope' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/scopes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteScopeNamespace' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/scopes/*/namespaces/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteScopeRBACRoleBinding' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/scopes/*/rbacrolebindings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GenerateConnectManifest' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/locations/*/memberships/*}:generateConnectManifest', @@ -83,6 +236,18 @@ ], ], ], + 'GenerateMembershipRBACRoleBindingYAML' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/memberships/*}/rbacrolebindings:generateMembershipRBACRoleBindingYAML', + 'body' => 'rbacrolebinding', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], 'GetFeature' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/locations/*/features/*}', @@ -94,6 +259,17 @@ ], ], ], + 'GetFleet' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/fleets/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetMembership' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/locations/*/memberships/*}', @@ -105,6 +281,72 @@ ], ], ], + 'GetMembershipBinding' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/memberships/*/bindings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetMembershipRBACRoleBinding' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/memberships/*/rbacrolebindings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetScope' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/scopes/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetScopeNamespace' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/scopes/*/namespaces/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetScopeRBACRoleBinding' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/scopes/*/rbacrolebindings/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListBoundMemberships' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{scope_name=projects/*/locations/*/scopes/*}:listMemberships', + 'placeholders' => [ + 'scope_name' => [ + 'getters' => [ + 'getScopeName', + ], + ], + ], + ], 'ListFeatures' => [ 'method' => 'get', 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/features', @@ -116,6 +358,45 @@ ], ], ], + 'ListFleets' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/fleets', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=organizations/*/locations/*}/fleets', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListMembershipBindings' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/memberships/*}/bindings', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListMembershipRBACRoleBindings' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/memberships/*}/rbacrolebindings', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], 'ListMemberships' => [ 'method' => 'get', 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/memberships', @@ -127,6 +408,50 @@ ], ], ], + 'ListPermittedScopes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/scopes:listPermitted', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListScopeNamespaces' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/scopes/*}/namespaces', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListScopeRBACRoleBindings' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/scopes/*}/rbacrolebindings', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListScopes' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/scopes', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], 'UpdateFeature' => [ 'method' => 'patch', 'uriTemplate' => '/v1/{name=projects/*/locations/*/features/*}', @@ -139,6 +464,22 @@ ], ], ], + 'UpdateFleet' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{fleet.name=projects/*/locations/*/fleets/*}', + 'body' => 'fleet', + 'placeholders' => [ + 'fleet.name' => [ + 'getters' => [ + 'getFleet', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], 'UpdateMembership' => [ 'method' => 'patch', 'uriTemplate' => '/v1/{name=projects/*/locations/*/memberships/*}', @@ -154,6 +495,86 @@ 'update_mask', ], ], + 'UpdateMembershipBinding' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{membership_binding.name=projects/*/locations/*/memberships/*/bindings/*}', + 'body' => 'membership_binding', + 'placeholders' => [ + 'membership_binding.name' => [ + 'getters' => [ + 'getMembershipBinding', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateMembershipRBACRoleBinding' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{rbacrolebinding.name=projects/*/locations/*/memberships/*/rbacrolebindings/*}', + 'body' => 'rbacrolebinding', + 'placeholders' => [ + 'rbacrolebinding.name' => [ + 'getters' => [ + 'getRbacrolebinding', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateScope' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{scope.name=projects/*/locations/*/scopes/*}', + 'body' => 'scope', + 'placeholders' => [ + 'scope.name' => [ + 'getters' => [ + 'getScope', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateScopeNamespace' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{scope_namespace.name=projects/*/locations/*/scopes/*/namespaces/*}', + 'body' => 'scope_namespace', + 'placeholders' => [ + 'scope_namespace.name' => [ + 'getters' => [ + 'getScopeNamespace', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], + 'UpdateScopeRBACRoleBinding' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{rbacrolebinding.name=projects/*/locations/*/scopes/*/rbacrolebindings/*}', + 'body' => 'rbacrolebinding', + 'placeholders' => [ + 'rbacrolebinding.name' => [ + 'getters' => [ + 'getRbacrolebinding', + 'getName', + ], + ], + ], + 'queryParams' => [ + 'update_mask', + ], + ], ], 'google.cloud.location.Locations' => [ 'GetLocation' => [ diff --git a/GkeHub/tests/Unit/V1/Client/GkeHubClientTest.php b/GkeHub/tests/Unit/V1/Client/GkeHubClientTest.php index 799b50276e35..0d7d7967744b 100644 --- a/GkeHub/tests/Unit/V1/Client/GkeHubClientTest.php +++ b/GkeHub/tests/Unit/V1/Client/GkeHubClientTest.php @@ -28,21 +28,69 @@ use Google\ApiCore\Testing\MockTransport; use Google\Cloud\GkeHub\V1\Client\GkeHubClient; use Google\Cloud\GkeHub\V1\CreateFeatureRequest; +use Google\Cloud\GkeHub\V1\CreateFleetRequest; +use Google\Cloud\GkeHub\V1\CreateMembershipBindingRequest; +use Google\Cloud\GkeHub\V1\CreateMembershipRBACRoleBindingRequest; use Google\Cloud\GkeHub\V1\CreateMembershipRequest; +use Google\Cloud\GkeHub\V1\CreateScopeNamespaceRequest; +use Google\Cloud\GkeHub\V1\CreateScopeRBACRoleBindingRequest; +use Google\Cloud\GkeHub\V1\CreateScopeRequest; use Google\Cloud\GkeHub\V1\DeleteFeatureRequest; +use Google\Cloud\GkeHub\V1\DeleteFleetRequest; +use Google\Cloud\GkeHub\V1\DeleteMembershipBindingRequest; +use Google\Cloud\GkeHub\V1\DeleteMembershipRBACRoleBindingRequest; use Google\Cloud\GkeHub\V1\DeleteMembershipRequest; +use Google\Cloud\GkeHub\V1\DeleteScopeNamespaceRequest; +use Google\Cloud\GkeHub\V1\DeleteScopeRBACRoleBindingRequest; +use Google\Cloud\GkeHub\V1\DeleteScopeRequest; use Google\Cloud\GkeHub\V1\Feature; +use Google\Cloud\GkeHub\V1\Fleet; use Google\Cloud\GkeHub\V1\GenerateConnectManifestRequest; use Google\Cloud\GkeHub\V1\GenerateConnectManifestResponse; +use Google\Cloud\GkeHub\V1\GenerateMembershipRBACRoleBindingYAMLRequest; +use Google\Cloud\GkeHub\V1\GenerateMembershipRBACRoleBindingYAMLResponse; use Google\Cloud\GkeHub\V1\GetFeatureRequest; +use Google\Cloud\GkeHub\V1\GetFleetRequest; +use Google\Cloud\GkeHub\V1\GetMembershipBindingRequest; +use Google\Cloud\GkeHub\V1\GetMembershipRBACRoleBindingRequest; use Google\Cloud\GkeHub\V1\GetMembershipRequest; +use Google\Cloud\GkeHub\V1\GetScopeNamespaceRequest; +use Google\Cloud\GkeHub\V1\GetScopeRBACRoleBindingRequest; +use Google\Cloud\GkeHub\V1\GetScopeRequest; +use Google\Cloud\GkeHub\V1\ListBoundMembershipsRequest; +use Google\Cloud\GkeHub\V1\ListBoundMembershipsResponse; use Google\Cloud\GkeHub\V1\ListFeaturesRequest; use Google\Cloud\GkeHub\V1\ListFeaturesResponse; +use Google\Cloud\GkeHub\V1\ListFleetsRequest; +use Google\Cloud\GkeHub\V1\ListFleetsResponse; +use Google\Cloud\GkeHub\V1\ListMembershipBindingsRequest; +use Google\Cloud\GkeHub\V1\ListMembershipBindingsResponse; +use Google\Cloud\GkeHub\V1\ListMembershipRBACRoleBindingsRequest; +use Google\Cloud\GkeHub\V1\ListMembershipRBACRoleBindingsResponse; use Google\Cloud\GkeHub\V1\ListMembershipsRequest; use Google\Cloud\GkeHub\V1\ListMembershipsResponse; +use Google\Cloud\GkeHub\V1\ListPermittedScopesRequest; +use Google\Cloud\GkeHub\V1\ListPermittedScopesResponse; +use Google\Cloud\GkeHub\V1\ListScopeNamespacesRequest; +use Google\Cloud\GkeHub\V1\ListScopeNamespacesResponse; +use Google\Cloud\GkeHub\V1\ListScopeRBACRoleBindingsRequest; +use Google\Cloud\GkeHub\V1\ListScopeRBACRoleBindingsResponse; +use Google\Cloud\GkeHub\V1\ListScopesRequest; +use Google\Cloud\GkeHub\V1\ListScopesResponse; use Google\Cloud\GkeHub\V1\Membership; +use Google\Cloud\GkeHub\V1\MembershipBinding; +use Google\Cloud\GkeHub\V1\PBNamespace; +use Google\Cloud\GkeHub\V1\RBACRoleBinding; +use Google\Cloud\GkeHub\V1\RBACRoleBinding\Role; +use Google\Cloud\GkeHub\V1\Scope; use Google\Cloud\GkeHub\V1\UpdateFeatureRequest; +use Google\Cloud\GkeHub\V1\UpdateFleetRequest; +use Google\Cloud\GkeHub\V1\UpdateMembershipBindingRequest; +use Google\Cloud\GkeHub\V1\UpdateMembershipRBACRoleBindingRequest; use Google\Cloud\GkeHub\V1\UpdateMembershipRequest; +use Google\Cloud\GkeHub\V1\UpdateScopeNamespaceRequest; +use Google\Cloud\GkeHub\V1\UpdateScopeRBACRoleBindingRequest; +use Google\Cloud\GkeHub\V1\UpdateScopeRequest; use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; @@ -200,6 +248,138 @@ public function createFeatureExceptionTest() $this->assertTrue($operationsTransport->isExhausted()); } + /** @test */ + public function createFleetTest() + { + $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/createFleetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $expectedResponse = new Fleet(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createFleetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $fleet = new Fleet(); + $request = (new CreateFleetRequest())->setParent($formattedParent)->setFleet($fleet); + $response = $gapicClient->createFleet($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.cloud.gkehub.v1.GkeHub/CreateFleet', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getFleet(); + $this->assertProtobufEquals($fleet, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFleetTest'); + $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 createFleetExceptionTest() + { + $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/createFleetTest'); + $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->locationName('[PROJECT]', '[LOCATION]'); + $fleet = new Fleet(); + $request = (new CreateFleetRequest())->setParent($formattedParent)->setFleet($fleet); + $response = $gapicClient->createFleet($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createFleetTest'); + 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 createMembershipTest() { @@ -345,7 +525,7 @@ public function createMembershipExceptionTest() } /** @test */ - public function deleteFeatureTest() + public function createMembershipBindingTest() { $operationsTransport = $this->createTransport(); $operationsClient = new OperationsClient([ @@ -362,19 +542,32 @@ public function deleteFeatureTest() $this->assertTrue($operationsTransport->isExhausted()); // Mock response $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureTest'); + $incompleteOperation->setName('operations/createMembershipBindingTest'); $incompleteOperation->setDone(false); $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); + $scope = 'scope109264468'; + $name = 'name3373707'; + $uid = 'uid115792'; + $expectedResponse = new MembershipBinding(); + $expectedResponse->setScope($scope); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteFeatureTest'); + $completeOperation->setName('operations/createMembershipBindingTest'); $completeOperation->setDone(true); $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); - $request = new DeleteFeatureRequest(); - $response = $gapicClient->deleteFeature($request); + // Mock request + $formattedParent = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $membershipBinding = new MembershipBinding(); + $membershipBindingId = 'membershipBindingId-1012849378'; + $request = (new CreateMembershipBindingRequest()) + ->setParent($formattedParent) + ->setMembershipBinding($membershipBinding) + ->setMembershipBindingId($membershipBindingId); + $response = $gapicClient->createMembershipBinding($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $apiRequests = $transport->popReceivedCalls(); @@ -383,9 +576,15 @@ public function deleteFeatureTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkehub.v1.GkeHub/DeleteFeature', $actualApiFuncCall); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/CreateMembershipBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getMembershipBinding(); + $this->assertProtobufEquals($membershipBinding, $actualValue); + $actualValue = $actualApiRequestObject->getMembershipBindingId(); + $this->assertProtobufEquals($membershipBindingId, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureTest'); + $expectedOperationsRequestObject->setName('operations/createMembershipBindingTest'); $response->pollUntilComplete([ 'initialPollDelayMillis' => 1, ]); @@ -404,7 +603,7 @@ public function deleteFeatureTest() } /** @test */ - public function deleteFeatureExceptionTest() + public function createMembershipBindingExceptionTest() { $operationsTransport = $this->createTransport(); $operationsClient = new OperationsClient([ @@ -421,7 +620,7 @@ public function deleteFeatureExceptionTest() $this->assertTrue($operationsTransport->isExhausted()); // Mock response $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteFeatureTest'); + $incompleteOperation->setName('operations/createMembershipBindingTest'); $incompleteOperation->setDone(false); $transport->addResponse($incompleteOperation); $status = new stdClass(); @@ -437,12 +636,19 @@ public function deleteFeatureExceptionTest() JSON_PRETTY_PRINT ); $operationsTransport->addResponse(null, $status); - $request = new DeleteFeatureRequest(); - $response = $gapicClient->deleteFeature($request); + // Mock request + $formattedParent = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $membershipBinding = new MembershipBinding(); + $membershipBindingId = 'membershipBindingId-1012849378'; + $request = (new CreateMembershipBindingRequest()) + ->setParent($formattedParent) + ->setMembershipBinding($membershipBinding) + ->setMembershipBindingId($membershipBindingId); + $response = $gapicClient->createMembershipBinding($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteFeatureTest'); + $expectedOperationsRequestObject->setName('operations/createMembershipBindingTest'); try { $response->pollUntilComplete([ 'initialPollDelayMillis' => 1, @@ -461,7 +667,7 @@ public function deleteFeatureExceptionTest() } /** @test */ - public function deleteMembershipTest() + public function createMembershipRBACRoleBindingTest() { $operationsTransport = $this->createTransport(); $operationsClient = new OperationsClient([ @@ -478,21 +684,34 @@ public function deleteMembershipTest() $this->assertTrue($operationsTransport->isExhausted()); // Mock response $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteMembershipTest'); + $incompleteOperation->setName('operations/createMembershipRBACRoleBindingTest'); $incompleteOperation->setDone(false); $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); + $user = 'user3599307'; + $name = 'name3373707'; + $uid = 'uid115792'; + $expectedResponse = new RBACRoleBinding(); + $expectedResponse->setUser($user); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteMembershipTest'); + $completeOperation->setName('operations/createMembershipRBACRoleBindingTest'); $completeOperation->setDone(true); $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); - $request = (new DeleteMembershipRequest())->setName($formattedName); - $response = $gapicClient->deleteMembership($request); + $formattedParent = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $rbacrolebindingId = 'rbacrolebindingId-114871075'; + $rbacrolebinding = new RBACRoleBinding(); + $rbacrolebindingRole = new Role(); + $rbacrolebinding->setRole($rbacrolebindingRole); + $request = (new CreateMembershipRBACRoleBindingRequest()) + ->setParent($formattedParent) + ->setRbacrolebindingId($rbacrolebindingId) + ->setRbacrolebinding($rbacrolebinding); + $response = $gapicClient->createMembershipRBACRoleBinding($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $apiRequests = $transport->popReceivedCalls(); @@ -501,11 +720,15 @@ public function deleteMembershipTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkehub.v1.GkeHub/DeleteMembership', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/CreateMembershipRBACRoleBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getRbacrolebindingId(); + $this->assertProtobufEquals($rbacrolebindingId, $actualValue); + $actualValue = $actualApiRequestObject->getRbacrolebinding(); + $this->assertProtobufEquals($rbacrolebinding, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteMembershipTest'); + $expectedOperationsRequestObject->setName('operations/createMembershipRBACRoleBindingTest'); $response->pollUntilComplete([ 'initialPollDelayMillis' => 1, ]); @@ -524,7 +747,7 @@ public function deleteMembershipTest() } /** @test */ - public function deleteMembershipExceptionTest() + public function createMembershipRBACRoleBindingExceptionTest() { $operationsTransport = $this->createTransport(); $operationsClient = new OperationsClient([ @@ -541,7 +764,7 @@ public function deleteMembershipExceptionTest() $this->assertTrue($operationsTransport->isExhausted()); // Mock response $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteMembershipTest'); + $incompleteOperation->setName('operations/createMembershipRBACRoleBindingTest'); $incompleteOperation->setDone(false); $transport->addResponse($incompleteOperation); $status = new stdClass(); @@ -558,13 +781,20 @@ public function deleteMembershipExceptionTest() ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); - $request = (new DeleteMembershipRequest())->setName($formattedName); - $response = $gapicClient->deleteMembership($request); + $formattedParent = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $rbacrolebindingId = 'rbacrolebindingId-114871075'; + $rbacrolebinding = new RBACRoleBinding(); + $rbacrolebindingRole = new Role(); + $rbacrolebinding->setRole($rbacrolebindingRole); + $request = (new CreateMembershipRBACRoleBindingRequest()) + ->setParent($formattedParent) + ->setRbacrolebindingId($rbacrolebindingId) + ->setRbacrolebinding($rbacrolebinding); + $response = $gapicClient->createMembershipRBACRoleBinding($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteMembershipTest'); + $expectedOperationsRequestObject->setName('operations/createMembershipRBACRoleBindingTest'); try { $response->pollUntilComplete([ 'initialPollDelayMillis' => 1, @@ -583,39 +813,102 @@ public function deleteMembershipExceptionTest() } /** @test */ - public function generateConnectManifestTest() + public function createScopeTest() { + $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 - $expectedResponse = new GenerateConnectManifestResponse(); - $transport->addResponse($expectedResponse); + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/createScopeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $expectedResponse = new Scope(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createScopeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); - $request = (new GenerateConnectManifestRequest())->setName($formattedName); - $response = $gapicClient->generateConnectManifest($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkehub.v1.GkeHub/GenerateConnectManifest', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $scopeId = 'scopeId-487349530'; + $scope = new Scope(); + $request = (new CreateScopeRequest()) + ->setParent($formattedParent) + ->setScopeId($scopeId) + ->setScope($scope); + $response = $gapicClient->createScope($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.cloud.gkehub.v1.GkeHub/CreateScope', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getScopeId(); + $this->assertProtobufEquals($scopeId, $actualValue); + $actualValue = $actualApiRequestObject->getScope(); + $this->assertProtobufEquals($scope, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createScopeTest'); + $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 generateConnectManifestExceptionTest() + public function createScopeExceptionTest() { + $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/createScopeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; @@ -628,55 +921,2922 @@ public function generateConnectManifestExceptionTest() ], JSON_PRETTY_PRINT ); - $transport->addResponse(null, $status); + $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); - $request = (new GenerateConnectManifestRequest())->setName($formattedName); + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $scopeId = 'scopeId-487349530'; + $scope = new Scope(); + $request = (new CreateScopeRequest()) + ->setParent($formattedParent) + ->setScopeId($scopeId) + ->setScope($scope); + $response = $gapicClient->createScope($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createScopeTest'); try { - $gapicClient->generateConnectManifest($request); - // If the $gapicClient method call did not throw, fail the test + $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 stub is exhausted + // Call popReceivedCalls to ensure the stubs are exhausted $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ - public function getFeatureTest() + public function createScopeNamespaceTest() { + $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/createScopeNamespaceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $scope = 'scope109264468'; + $expectedResponse = new PBNamespace(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setScope($scope); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createScopeNamespaceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $scopeNamespaceId = 'scopeNamespaceId-236818806'; + $scopeNamespace = new PBNamespace(); + $scopeNamespaceScope = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $scopeNamespace->setScope($scopeNamespaceScope); + $request = (new CreateScopeNamespaceRequest()) + ->setParent($formattedParent) + ->setScopeNamespaceId($scopeNamespaceId) + ->setScopeNamespace($scopeNamespace); + $response = $gapicClient->createScopeNamespace($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.cloud.gkehub.v1.GkeHub/CreateScopeNamespace', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getScopeNamespaceId(); + $this->assertProtobufEquals($scopeNamespaceId, $actualValue); + $actualValue = $actualApiRequestObject->getScopeNamespace(); + $this->assertProtobufEquals($scopeNamespace, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createScopeNamespaceTest'); + $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 createScopeNamespaceExceptionTest() + { + $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/createScopeNamespaceTest'); + $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->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $scopeNamespaceId = 'scopeNamespaceId-236818806'; + $scopeNamespace = new PBNamespace(); + $scopeNamespaceScope = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $scopeNamespace->setScope($scopeNamespaceScope); + $request = (new CreateScopeNamespaceRequest()) + ->setParent($formattedParent) + ->setScopeNamespaceId($scopeNamespaceId) + ->setScopeNamespace($scopeNamespace); + $response = $gapicClient->createScopeNamespace($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createScopeNamespaceTest'); + 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 createScopeRBACRoleBindingTest() + { + $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/createScopeRBACRoleBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $user = 'user3599307'; + $name = 'name3373707'; + $uid = 'uid115792'; + $expectedResponse = new RBACRoleBinding(); + $expectedResponse->setUser($user); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/createScopeRBACRoleBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $rbacrolebindingId = 'rbacrolebindingId-114871075'; + $rbacrolebinding = new RBACRoleBinding(); + $rbacrolebindingRole = new Role(); + $rbacrolebinding->setRole($rbacrolebindingRole); + $request = (new CreateScopeRBACRoleBindingRequest()) + ->setParent($formattedParent) + ->setRbacrolebindingId($rbacrolebindingId) + ->setRbacrolebinding($rbacrolebinding); + $response = $gapicClient->createScopeRBACRoleBinding($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.cloud.gkehub.v1.GkeHub/CreateScopeRBACRoleBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualApiRequestObject->getRbacrolebindingId(); + $this->assertProtobufEquals($rbacrolebindingId, $actualValue); + $actualValue = $actualApiRequestObject->getRbacrolebinding(); + $this->assertProtobufEquals($rbacrolebinding, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createScopeRBACRoleBindingTest'); + $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 createScopeRBACRoleBindingExceptionTest() + { + $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/createScopeRBACRoleBindingTest'); + $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->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $rbacrolebindingId = 'rbacrolebindingId-114871075'; + $rbacrolebinding = new RBACRoleBinding(); + $rbacrolebindingRole = new Role(); + $rbacrolebinding->setRole($rbacrolebindingRole); + $request = (new CreateScopeRBACRoleBindingRequest()) + ->setParent($formattedParent) + ->setRbacrolebindingId($rbacrolebindingId) + ->setRbacrolebinding($rbacrolebinding); + $response = $gapicClient->createScopeRBACRoleBinding($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/createScopeRBACRoleBindingTest'); + 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 deleteFeatureTest() + { + $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/deleteFeatureTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteFeatureTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + $request = new DeleteFeatureRequest(); + $response = $gapicClient->deleteFeature($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.cloud.gkehub.v1.GkeHub/DeleteFeature', $actualApiFuncCall); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFeatureTest'); + $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 deleteFeatureExceptionTest() + { + $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/deleteFeatureTest'); + $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); + $request = new DeleteFeatureRequest(); + $response = $gapicClient->deleteFeature($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFeatureTest'); + 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 deleteFleetTest() + { + $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/deleteFleetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteFleetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->fleetName('[PROJECT]', '[LOCATION]', '[FLEET]'); + $request = (new DeleteFleetRequest())->setName($formattedName); + $response = $gapicClient->deleteFleet($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.cloud.gkehub.v1.GkeHub/DeleteFleet', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFleetTest'); + $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 deleteFleetExceptionTest() + { + $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/deleteFleetTest'); + $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 + $formattedName = $gapicClient->fleetName('[PROJECT]', '[LOCATION]', '[FLEET]'); + $request = (new DeleteFleetRequest())->setName($formattedName); + $response = $gapicClient->deleteFleet($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteFleetTest'); + 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 deleteMembershipTest() + { + $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/deleteMembershipTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteMembershipTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $request = (new DeleteMembershipRequest())->setName($formattedName); + $response = $gapicClient->deleteMembership($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.cloud.gkehub.v1.GkeHub/DeleteMembership', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteMembershipTest'); + $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 deleteMembershipExceptionTest() + { + $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/deleteMembershipTest'); + $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 + $formattedName = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $request = (new DeleteMembershipRequest())->setName($formattedName); + $response = $gapicClient->deleteMembership($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteMembershipTest'); + 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 deleteMembershipBindingTest() + { + $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/deleteMembershipBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteMembershipBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->membershipBindingName( + '[PROJECT]', + '[LOCATION]', + '[MEMBERSHIP]', + '[MEMBERSHIPBINDING]' + ); + $request = (new DeleteMembershipBindingRequest())->setName($formattedName); + $response = $gapicClient->deleteMembershipBinding($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.cloud.gkehub.v1.GkeHub/DeleteMembershipBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteMembershipBindingTest'); + $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 deleteMembershipBindingExceptionTest() + { + $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/deleteMembershipBindingTest'); + $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 + $formattedName = $gapicClient->membershipBindingName( + '[PROJECT]', + '[LOCATION]', + '[MEMBERSHIP]', + '[MEMBERSHIPBINDING]' + ); + $request = (new DeleteMembershipBindingRequest())->setName($formattedName); + $response = $gapicClient->deleteMembershipBinding($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteMembershipBindingTest'); + 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 deleteMembershipRBACRoleBindingTest() + { + $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/deleteMembershipRBACRoleBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteMembershipRBACRoleBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->rBACRoleBindingName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[RBACROLEBINDING]'); + $request = (new DeleteMembershipRBACRoleBindingRequest())->setName($formattedName); + $response = $gapicClient->deleteMembershipRBACRoleBinding($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.cloud.gkehub.v1.GkeHub/DeleteMembershipRBACRoleBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteMembershipRBACRoleBindingTest'); + $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 deleteMembershipRBACRoleBindingExceptionTest() + { + $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/deleteMembershipRBACRoleBindingTest'); + $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 + $formattedName = $gapicClient->rBACRoleBindingName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[RBACROLEBINDING]'); + $request = (new DeleteMembershipRBACRoleBindingRequest())->setName($formattedName); + $response = $gapicClient->deleteMembershipRBACRoleBinding($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteMembershipRBACRoleBindingTest'); + 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 deleteScopeTest() + { + $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/deleteScopeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteScopeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $request = (new DeleteScopeRequest())->setName($formattedName); + $response = $gapicClient->deleteScope($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.cloud.gkehub.v1.GkeHub/DeleteScope', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteScopeTest'); + $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 deleteScopeExceptionTest() + { + $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/deleteScopeTest'); + $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 + $formattedName = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $request = (new DeleteScopeRequest())->setName($formattedName); + $response = $gapicClient->deleteScope($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteScopeTest'); + 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 deleteScopeNamespaceTest() + { + $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/deleteScopeNamespaceTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteScopeNamespaceTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->namespaceName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[NAMESPACE]'); + $request = (new DeleteScopeNamespaceRequest())->setName($formattedName); + $response = $gapicClient->deleteScopeNamespace($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.cloud.gkehub.v1.GkeHub/DeleteScopeNamespace', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteScopeNamespaceTest'); + $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 deleteScopeNamespaceExceptionTest() + { + $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/deleteScopeNamespaceTest'); + $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 + $formattedName = $gapicClient->namespaceName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[NAMESPACE]'); + $request = (new DeleteScopeNamespaceRequest())->setName($formattedName); + $response = $gapicClient->deleteScopeNamespace($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteScopeNamespaceTest'); + 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 deleteScopeRBACRoleBindingTest() + { + $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/deleteScopeRBACRoleBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $expectedResponse = new GPBEmpty(); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/deleteScopeRBACRoleBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->rBACRoleBindingName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[RBACROLEBINDING]'); + $request = (new DeleteScopeRBACRoleBindingRequest())->setName($formattedName); + $response = $gapicClient->deleteScopeRBACRoleBinding($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.cloud.gkehub.v1.GkeHub/DeleteScopeRBACRoleBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteScopeRBACRoleBindingTest'); + $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 deleteScopeRBACRoleBindingExceptionTest() + { + $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/deleteScopeRBACRoleBindingTest'); + $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 + $formattedName = $gapicClient->rBACRoleBindingName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[RBACROLEBINDING]'); + $request = (new DeleteScopeRBACRoleBindingRequest())->setName($formattedName); + $response = $gapicClient->deleteScopeRBACRoleBinding($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/deleteScopeRBACRoleBindingTest'); + 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 generateConnectManifestTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GenerateConnectManifestResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $request = (new GenerateConnectManifestRequest())->setName($formattedName); + $response = $gapicClient->generateConnectManifest($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/GenerateConnectManifest', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateConnectManifestExceptionTest() + { + $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->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $request = (new GenerateConnectManifestRequest())->setName($formattedName); + try { + $gapicClient->generateConnectManifest($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 generateMembershipRBACRoleBindingYAMLTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $roleBindingsYaml = 'roleBindingsYaml1394984367'; + $expectedResponse = new GenerateMembershipRBACRoleBindingYAMLResponse(); + $expectedResponse->setRoleBindingsYaml($roleBindingsYaml); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $rbacrolebindingId = 'rbacrolebindingId-114871075'; + $rbacrolebinding = new RBACRoleBinding(); + $rbacrolebindingRole = new Role(); + $rbacrolebinding->setRole($rbacrolebindingRole); + $request = (new GenerateMembershipRBACRoleBindingYAMLRequest()) + ->setParent($formattedParent) + ->setRbacrolebindingId($rbacrolebindingId) + ->setRbacrolebinding($rbacrolebinding); + $response = $gapicClient->generateMembershipRBACRoleBindingYAML($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/GenerateMembershipRBACRoleBindingYAML', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getRbacrolebindingId(); + $this->assertProtobufEquals($rbacrolebindingId, $actualValue); + $actualValue = $actualRequestObject->getRbacrolebinding(); + $this->assertProtobufEquals($rbacrolebinding, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateMembershipRBACRoleBindingYAMLExceptionTest() + { + $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->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $rbacrolebindingId = 'rbacrolebindingId-114871075'; + $rbacrolebinding = new RBACRoleBinding(); + $rbacrolebindingRole = new Role(); + $rbacrolebinding->setRole($rbacrolebindingRole); + $request = (new GenerateMembershipRBACRoleBindingYAMLRequest()) + ->setParent($formattedParent) + ->setRbacrolebindingId($rbacrolebindingId) + ->setRbacrolebinding($rbacrolebinding); + try { + $gapicClient->generateMembershipRBACRoleBindingYAML($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 getFeatureTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $expectedResponse = new Feature(); + $expectedResponse->setName($name2); + $transport->addResponse($expectedResponse); + $request = new GetFeatureRequest(); + $response = $gapicClient->getFeature($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/GetFeature', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFeatureExceptionTest() + { + $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); + $request = new GetFeatureRequest(); + try { + $gapicClient->getFeature($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 getFleetTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $expectedResponse = new Fleet(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->fleetName('[PROJECT]', '[LOCATION]', '[FLEET]'); + $request = (new GetFleetRequest())->setName($formattedName); + $response = $gapicClient->getFleet($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/GetFleet', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getFleetExceptionTest() + { + $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->fleetName('[PROJECT]', '[LOCATION]', '[FLEET]'); + $request = (new GetFleetRequest())->setName($formattedName); + try { + $gapicClient->getFleet($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 getMembershipTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $externalId = 'externalId-1153075697'; + $uniqueId = 'uniqueId-538310583'; + $expectedResponse = new Membership(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $expectedResponse->setExternalId($externalId); + $expectedResponse->setUniqueId($uniqueId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $request = (new GetMembershipRequest())->setName($formattedName); + $response = $gapicClient->getMembership($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/GetMembership', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMembershipExceptionTest() + { + $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->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $request = (new GetMembershipRequest())->setName($formattedName); + try { + $gapicClient->getMembership($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 getMembershipBindingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $scope = 'scope109264468'; + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $expectedResponse = new MembershipBinding(); + $expectedResponse->setScope($scope); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->membershipBindingName( + '[PROJECT]', + '[LOCATION]', + '[MEMBERSHIP]', + '[MEMBERSHIPBINDING]' + ); + $request = (new GetMembershipBindingRequest())->setName($formattedName); + $response = $gapicClient->getMembershipBinding($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/GetMembershipBinding', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMembershipBindingExceptionTest() + { + $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->membershipBindingName( + '[PROJECT]', + '[LOCATION]', + '[MEMBERSHIP]', + '[MEMBERSHIPBINDING]' + ); + $request = (new GetMembershipBindingRequest())->setName($formattedName); + try { + $gapicClient->getMembershipBinding($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 getMembershipRBACRoleBindingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $user = 'user3599307'; $name2 = 'name2-1052831874'; - $expectedResponse = new Feature(); + $uid = 'uid115792'; + $expectedResponse = new RBACRoleBinding(); + $expectedResponse->setUser($user); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->rBACRoleBindingName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[RBACROLEBINDING]'); + $request = (new GetMembershipRBACRoleBindingRequest())->setName($formattedName); + $response = $gapicClient->getMembershipRBACRoleBinding($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/GetMembershipRBACRoleBinding', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getMembershipRBACRoleBindingExceptionTest() + { + $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->rBACRoleBindingName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[RBACROLEBINDING]'); + $request = (new GetMembershipRBACRoleBindingRequest())->setName($formattedName); + try { + $gapicClient->getMembershipRBACRoleBinding($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 getScopeTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $expectedResponse = new Scope(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $request = (new GetScopeRequest())->setName($formattedName); + $response = $gapicClient->getScope($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/GetScope', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getScopeExceptionTest() + { + $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->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $request = (new GetScopeRequest())->setName($formattedName); + try { + $gapicClient->getScope($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 getScopeNamespaceTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $scope = 'scope109264468'; + $expectedResponse = new PBNamespace(); + $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $expectedResponse->setScope($scope); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->namespaceName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[NAMESPACE]'); + $request = (new GetScopeNamespaceRequest())->setName($formattedName); + $response = $gapicClient->getScopeNamespace($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/GetScopeNamespace', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getScopeNamespaceExceptionTest() + { + $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->namespaceName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[NAMESPACE]'); + $request = (new GetScopeNamespaceRequest())->setName($formattedName); + try { + $gapicClient->getScopeNamespace($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 getScopeRBACRoleBindingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $user = 'user3599307'; + $name2 = 'name2-1052831874'; + $uid = 'uid115792'; + $expectedResponse = new RBACRoleBinding(); + $expectedResponse->setUser($user); $expectedResponse->setName($name2); + $expectedResponse->setUid($uid); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->rBACRoleBindingName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[RBACROLEBINDING]'); + $request = (new GetScopeRBACRoleBindingRequest())->setName($formattedName); + $response = $gapicClient->getScopeRBACRoleBinding($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/GetScopeRBACRoleBinding', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getScopeRBACRoleBindingExceptionTest() + { + $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->rBACRoleBindingName('[PROJECT]', '[LOCATION]', '[SCOPE]', '[RBACROLEBINDING]'); + $request = (new GetScopeRBACRoleBindingRequest())->setName($formattedName); + try { + $gapicClient->getScopeRBACRoleBinding($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 listBoundMembershipsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $membershipsElement = new Membership(); + $memberships = [$membershipsElement]; + $expectedResponse = new ListBoundMembershipsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMemberships($memberships); + $transport->addResponse($expectedResponse); + // Mock request + $formattedScopeName = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $request = (new ListBoundMembershipsRequest())->setScopeName($formattedScopeName); + $response = $gapicClient->listBoundMemberships($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMemberships()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/ListBoundMemberships', $actualFuncCall); + $actualValue = $actualRequestObject->getScopeName(); + $this->assertProtobufEquals($formattedScopeName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listBoundMembershipsExceptionTest() + { + $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 + $formattedScopeName = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $request = (new ListBoundMembershipsRequest())->setScopeName($formattedScopeName); + try { + $gapicClient->listBoundMemberships($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 listFeaturesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $resourcesElement = new Feature(); + $resources = [$resourcesElement]; + $expectedResponse = new ListFeaturesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setResources($resources); + $transport->addResponse($expectedResponse); + $request = new ListFeaturesRequest(); + $response = $gapicClient->listFeatures($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getResources()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/ListFeatures', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFeaturesExceptionTest() + { + $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); + $request = new ListFeaturesRequest(); + try { + $gapicClient->listFeatures($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 listFleetsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $fleetsElement = new Fleet(); + $fleets = [$fleetsElement]; + $expectedResponse = new ListFleetsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setFleets($fleets); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListFleetsRequest())->setParent($formattedParent); + $response = $gapicClient->listFleets($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getFleets()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/ListFleets', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listFleetsExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListFleetsRequest())->setParent($formattedParent); + try { + $gapicClient->listFleets($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 listMembershipBindingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $membershipBindingsElement = new MembershipBinding(); + $membershipBindings = [$membershipBindingsElement]; + $expectedResponse = new ListMembershipBindingsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setMembershipBindings($membershipBindings); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $request = (new ListMembershipBindingsRequest())->setParent($formattedParent); + $response = $gapicClient->listMembershipBindings($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getMembershipBindings()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/ListMembershipBindings', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMembershipBindingsExceptionTest() + { + $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->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $request = (new ListMembershipBindingsRequest())->setParent($formattedParent); + try { + $gapicClient->listMembershipBindings($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 listMembershipRBACRoleBindingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $rbacrolebindingsElement = new RBACRoleBinding(); + $rbacrolebindings = [$rbacrolebindingsElement]; + $expectedResponse = new ListMembershipRBACRoleBindingsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setRbacrolebindings($rbacrolebindings); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $request = (new ListMembershipRBACRoleBindingsRequest())->setParent($formattedParent); + $response = $gapicClient->listMembershipRBACRoleBindings($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getRbacrolebindings()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/ListMembershipRBACRoleBindings', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMembershipRBACRoleBindingsExceptionTest() + { + $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->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $request = (new ListMembershipRBACRoleBindingsRequest())->setParent($formattedParent); + try { + $gapicClient->listMembershipRBACRoleBindings($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 listMembershipsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $resourcesElement = new Membership(); + $resources = [$resourcesElement]; + $expectedResponse = new ListMembershipsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setResources($resources); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListMembershipsRequest())->setParent($formattedParent); + $response = $gapicClient->listMemberships($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getResources()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/ListMemberships', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listMembershipsExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListMembershipsRequest())->setParent($formattedParent); + try { + $gapicClient->listMemberships($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 listPermittedScopesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $scopesElement = new Scope(); + $scopes = [$scopesElement]; + $expectedResponse = new ListPermittedScopesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setScopes($scopes); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListPermittedScopesRequest())->setParent($formattedParent); + $response = $gapicClient->listPermittedScopes($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getScopes()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/ListPermittedScopes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPermittedScopesExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListPermittedScopesRequest())->setParent($formattedParent); + try { + $gapicClient->listPermittedScopes($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 listScopeNamespacesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $scopeNamespacesElement = new PBNamespace(); + $scopeNamespaces = [$scopeNamespacesElement]; + $expectedResponse = new ListScopeNamespacesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setScopeNamespaces($scopeNamespaces); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $request = (new ListScopeNamespacesRequest())->setParent($formattedParent); + $response = $gapicClient->listScopeNamespaces($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getScopeNamespaces()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/ListScopeNamespaces', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listScopeNamespacesExceptionTest() + { + $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->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $request = (new ListScopeNamespacesRequest())->setParent($formattedParent); + try { + $gapicClient->listScopeNamespaces($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 listScopeRBACRoleBindingsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $rbacrolebindingsElement = new RBACRoleBinding(); + $rbacrolebindings = [$rbacrolebindingsElement]; + $expectedResponse = new ListScopeRBACRoleBindingsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setRbacrolebindings($rbacrolebindings); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $request = (new ListScopeRBACRoleBindingsRequest())->setParent($formattedParent); + $response = $gapicClient->listScopeRBACRoleBindings($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getRbacrolebindings()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/ListScopeRBACRoleBindings', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listScopeRBACRoleBindingsExceptionTest() + { + $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->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $request = (new ListScopeRBACRoleBindingsRequest())->setParent($formattedParent); + try { + $gapicClient->listScopeRBACRoleBindings($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 listScopesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $scopesElement = new Scope(); + $scopes = [$scopesElement]; + $expectedResponse = new ListScopesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setScopes($scopes); $transport->addResponse($expectedResponse); - $request = new GetFeatureRequest(); - $response = $gapicClient->getFeature($request); - $this->assertEquals($expectedResponse, $response); + // Mock request + $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListScopesRequest())->setParent($formattedParent); + $response = $gapicClient->listScopes($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getScopes()[0], $resources[0]); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkehub.v1.GkeHub/GetFeature', $actualFuncCall); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/ListScopes', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listScopesExceptionTest() + { + $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->locationName('[PROJECT]', '[LOCATION]'); + $request = (new ListScopesRequest())->setParent($formattedParent); + try { + $gapicClient->listScopes($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 updateFeatureTest() + { + $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/updateFeatureTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $expectedResponse = new Feature(); + $expectedResponse->setName($name2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateFeatureTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + $request = new UpdateFeatureRequest(); + $response = $gapicClient->updateFeature($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.cloud.gkehub.v1.GkeHub/UpdateFeature', $actualApiFuncCall); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFeatureTest'); + $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 updateFeatureExceptionTest() + { + $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/updateFeatureTest'); + $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); + $request = new UpdateFeatureRequest(); + $response = $gapicClient->updateFeature($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFeatureTest'); + 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 updateFleetTest() + { + $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/updateFleetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $uid = 'uid115792'; + $expectedResponse = new Fleet(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateFleetTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $fleet = new Fleet(); + $updateMask = new FieldMask(); + $request = (new UpdateFleetRequest())->setFleet($fleet)->setUpdateMask($updateMask); + $response = $gapicClient->updateFleet($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.cloud.gkehub.v1.GkeHub/UpdateFleet', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getFleet(); + $this->assertProtobufEquals($fleet, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFleetTest'); + $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 getFeatureExceptionTest() + public function updateFleetExceptionTest() { + $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/updateFleetTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; @@ -689,30 +3849,54 @@ public function getFeatureExceptionTest() ], JSON_PRETTY_PRINT ); - $transport->addResponse(null, $status); - $request = new GetFeatureRequest(); + $operationsTransport->addResponse(null, $status); + // Mock request + $fleet = new Fleet(); + $updateMask = new FieldMask(); + $request = (new UpdateFleetRequest())->setFleet($fleet)->setUpdateMask($updateMask); + $response = $gapicClient->updateFleet($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateFleetTest'); try { - $gapicClient->getFeature($request); - // If the $gapicClient method call did not throw, fail the test + $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 stub is exhausted + // Call popReceivedCalls to ensure the stubs are exhausted $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ - public function getMembershipTest() + public function updateMembershipTest() { + $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/updateMembershipTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $name2 = 'name2-1052831874'; $description = 'description-1724546052'; $externalId = 'externalId-1153075697'; @@ -722,30 +3906,77 @@ public function getMembershipTest() $expectedResponse->setDescription($description); $expectedResponse->setExternalId($externalId); $expectedResponse->setUniqueId($uniqueId); - $transport->addResponse($expectedResponse); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateMembershipTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); // Mock request $formattedName = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); - $request = (new GetMembershipRequest())->setName($formattedName); - $response = $gapicClient->getMembership($request); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkehub.v1.GkeHub/GetMembership', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); + $updateMask = new FieldMask(); + $resource = new Membership(); + $request = (new UpdateMembershipRequest()) + ->setName($formattedName) + ->setUpdateMask($updateMask) + ->setResource($resource); + $response = $gapicClient->updateMembership($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.cloud.gkehub.v1.GkeHub/UpdateMembership', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $actualValue = $actualApiRequestObject->getResource(); + $this->assertProtobufEquals($resource, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMembershipTest'); + $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 getMembershipExceptionTest() + public function updateMembershipExceptionTest() { + $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/updateMembershipTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; @@ -758,61 +3989,270 @@ public function getMembershipExceptionTest() ], JSON_PRETTY_PRINT ); - $transport->addResponse(null, $status); + $operationsTransport->addResponse(null, $status); // Mock request $formattedName = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); - $request = (new GetMembershipRequest())->setName($formattedName); + $updateMask = new FieldMask(); + $resource = new Membership(); + $request = (new UpdateMembershipRequest()) + ->setName($formattedName) + ->setUpdateMask($updateMask) + ->setResource($resource); + $response = $gapicClient->updateMembership($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMembershipTest'); try { - $gapicClient->getMembership($request); - // If the $gapicClient method call did not throw, fail the test + $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 stub is exhausted + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function updateMembershipBindingTest() + { + $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/updateMembershipBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $scope = 'scope109264468'; + $name = 'name3373707'; + $uid = 'uid115792'; + $expectedResponse = new MembershipBinding(); + $expectedResponse->setScope($scope); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateMembershipBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $membershipBinding = new MembershipBinding(); + $updateMask = new FieldMask(); + $request = (new UpdateMembershipBindingRequest()) + ->setMembershipBinding($membershipBinding) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateMembershipBinding($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.cloud.gkehub.v1.GkeHub/UpdateMembershipBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getMembershipBinding(); + $this->assertProtobufEquals($membershipBinding, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMembershipBindingTest'); + $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 updateMembershipBindingExceptionTest() + { + $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/updateMembershipBindingTest'); + $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 + $membershipBinding = new MembershipBinding(); + $updateMask = new FieldMask(); + $request = (new UpdateMembershipBindingRequest()) + ->setMembershipBinding($membershipBinding) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateMembershipBinding($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMembershipBindingTest'); + 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 listFeaturesTest() + public function updateMembershipRBACRoleBindingTest() { + $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 - $nextPageToken = ''; - $resourcesElement = new Feature(); - $resources = [$resourcesElement]; - $expectedResponse = new ListFeaturesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setResources($resources); - $transport->addResponse($expectedResponse); - $request = new ListFeaturesRequest(); - $response = $gapicClient->listFeatures($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getResources()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkehub.v1.GkeHub/ListFeatures', $actualFuncCall); + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateMembershipRBACRoleBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $user = 'user3599307'; + $name = 'name3373707'; + $uid = 'uid115792'; + $expectedResponse = new RBACRoleBinding(); + $expectedResponse->setUser($user); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateMembershipRBACRoleBindingTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $rbacrolebinding = new RBACRoleBinding(); + $rbacrolebindingRole = new Role(); + $rbacrolebinding->setRole($rbacrolebindingRole); + $updateMask = new FieldMask(); + $request = (new UpdateMembershipRBACRoleBindingRequest()) + ->setRbacrolebinding($rbacrolebinding) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateMembershipRBACRoleBinding($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.cloud.gkehub.v1.GkeHub/UpdateMembershipRBACRoleBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getRbacrolebinding(); + $this->assertProtobufEquals($rbacrolebinding, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMembershipRBACRoleBindingTest'); + $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 listFeaturesExceptionTest() + public function updateMembershipRBACRoleBindingExceptionTest() { + $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/updateMembershipRBACRoleBindingTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; @@ -825,63 +4265,128 @@ public function listFeaturesExceptionTest() ], JSON_PRETTY_PRINT ); - $transport->addResponse(null, $status); - $request = new ListFeaturesRequest(); + $operationsTransport->addResponse(null, $status); + // Mock request + $rbacrolebinding = new RBACRoleBinding(); + $rbacrolebindingRole = new Role(); + $rbacrolebinding->setRole($rbacrolebindingRole); + $updateMask = new FieldMask(); + $request = (new UpdateMembershipRBACRoleBindingRequest()) + ->setRbacrolebinding($rbacrolebinding) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateMembershipRBACRoleBinding($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateMembershipRBACRoleBindingTest'); try { - $gapicClient->listFeatures($request); - // If the $gapicClient method call did not throw, fail the test + $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 stub is exhausted + // Call popReceivedCalls to ensure the stubs are exhausted $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ - public function listMembershipsTest() + public function updateScopeTest() { + $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 - $nextPageToken = ''; - $resourcesElement = new Membership(); - $resources = [$resourcesElement]; - $expectedResponse = new ListMembershipsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setResources($resources); - $transport->addResponse($expectedResponse); + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/updateScopeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name = 'name3373707'; + $uid = 'uid115792'; + $expectedResponse = new Scope(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/updateScopeTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListMembershipsRequest())->setParent($formattedParent); - $response = $gapicClient->listMemberships($request); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getResources()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkehub.v1.GkeHub/ListMemberships', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); + $scope = new Scope(); + $updateMask = new FieldMask(); + $request = (new UpdateScopeRequest())->setScope($scope)->setUpdateMask($updateMask); + $response = $gapicClient->updateScope($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.cloud.gkehub.v1.GkeHub/UpdateScope', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getScope(); + $this->assertProtobufEquals($scope, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateScopeTest'); + $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 listMembershipsExceptionTest() + public function updateScopeExceptionTest() { + $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/updateScopeTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; @@ -894,25 +4399,35 @@ public function listMembershipsExceptionTest() ], JSON_PRETTY_PRINT ); - $transport->addResponse(null, $status); + $operationsTransport->addResponse(null, $status); // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $request = (new ListMembershipsRequest())->setParent($formattedParent); + $scope = new Scope(); + $updateMask = new FieldMask(); + $request = (new UpdateScopeRequest())->setScope($scope)->setUpdateMask($updateMask); + $response = $gapicClient->updateScope($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/updateScopeTest'); try { - $gapicClient->listMemberships($request); - // If the $gapicClient method call did not throw, fail the test + $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 stub is exhausted + // Call popReceivedCalls to ensure the stubs are exhausted $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); } /** @test */ - public function updateFeatureTest() + public function updateScopeNamespaceTest() { $operationsTransport = $this->createTransport(); $operationsClient = new OperationsClient([ @@ -929,21 +4444,30 @@ public function updateFeatureTest() $this->assertTrue($operationsTransport->isExhausted()); // Mock response $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFeatureTest'); + $incompleteOperation->setName('operations/updateScopeNamespaceTest'); $incompleteOperation->setDone(false); $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $expectedResponse = new Feature(); - $expectedResponse->setName($name2); + $name = 'name3373707'; + $uid = 'uid115792'; + $scope = 'scope109264468'; + $expectedResponse = new PBNamespace(); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); + $expectedResponse->setScope($scope); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); - $completeOperation->setName('operations/updateFeatureTest'); + $completeOperation->setName('operations/updateScopeNamespaceTest'); $completeOperation->setDone(true); $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); - $request = new UpdateFeatureRequest(); - $response = $gapicClient->updateFeature($request); + // Mock request + $scopeNamespace = new PBNamespace(); + $scopeNamespaceScope = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $scopeNamespace->setScope($scopeNamespaceScope); + $updateMask = new FieldMask(); + $request = (new UpdateScopeNamespaceRequest())->setScopeNamespace($scopeNamespace)->setUpdateMask($updateMask); + $response = $gapicClient->updateScopeNamespace($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $apiRequests = $transport->popReceivedCalls(); @@ -952,9 +4476,13 @@ public function updateFeatureTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkehub.v1.GkeHub/UpdateFeature', $actualApiFuncCall); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/UpdateScopeNamespace', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getScopeNamespace(); + $this->assertProtobufEquals($scopeNamespace, $actualValue); + $actualValue = $actualApiRequestObject->getUpdateMask(); + $this->assertProtobufEquals($updateMask, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFeatureTest'); + $expectedOperationsRequestObject->setName('operations/updateScopeNamespaceTest'); $response->pollUntilComplete([ 'initialPollDelayMillis' => 1, ]); @@ -973,7 +4501,7 @@ public function updateFeatureTest() } /** @test */ - public function updateFeatureExceptionTest() + public function updateScopeNamespaceExceptionTest() { $operationsTransport = $this->createTransport(); $operationsClient = new OperationsClient([ @@ -990,7 +4518,7 @@ public function updateFeatureExceptionTest() $this->assertTrue($operationsTransport->isExhausted()); // Mock response $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateFeatureTest'); + $incompleteOperation->setName('operations/updateScopeNamespaceTest'); $incompleteOperation->setDone(false); $transport->addResponse($incompleteOperation); $status = new stdClass(); @@ -1006,12 +4534,17 @@ public function updateFeatureExceptionTest() JSON_PRETTY_PRINT ); $operationsTransport->addResponse(null, $status); - $request = new UpdateFeatureRequest(); - $response = $gapicClient->updateFeature($request); + // Mock request + $scopeNamespace = new PBNamespace(); + $scopeNamespaceScope = $gapicClient->scopeName('[PROJECT]', '[LOCATION]', '[SCOPE]'); + $scopeNamespace->setScope($scopeNamespaceScope); + $updateMask = new FieldMask(); + $request = (new UpdateScopeNamespaceRequest())->setScopeNamespace($scopeNamespace)->setUpdateMask($updateMask); + $response = $gapicClient->updateScopeNamespace($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateFeatureTest'); + $expectedOperationsRequestObject->setName('operations/updateScopeNamespaceTest'); try { $response->pollUntilComplete([ 'initialPollDelayMillis' => 1, @@ -1030,7 +4563,7 @@ public function updateFeatureExceptionTest() } /** @test */ - public function updateMembershipTest() + public function updateScopeRBACRoleBindingTest() { $operationsTransport = $this->createTransport(); $operationsClient = new OperationsClient([ @@ -1047,34 +4580,32 @@ public function updateMembershipTest() $this->assertTrue($operationsTransport->isExhausted()); // Mock response $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateMembershipTest'); + $incompleteOperation->setName('operations/updateScopeRBACRoleBindingTest'); $incompleteOperation->setDone(false); $transport->addResponse($incompleteOperation); - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $externalId = 'externalId-1153075697'; - $uniqueId = 'uniqueId-538310583'; - $expectedResponse = new Membership(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setExternalId($externalId); - $expectedResponse->setUniqueId($uniqueId); + $user = 'user3599307'; + $name = 'name3373707'; + $uid = 'uid115792'; + $expectedResponse = new RBACRoleBinding(); + $expectedResponse->setUser($user); + $expectedResponse->setName($name); + $expectedResponse->setUid($uid); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); - $completeOperation->setName('operations/updateMembershipTest'); + $completeOperation->setName('operations/updateScopeRBACRoleBindingTest'); $completeOperation->setDone(true); $completeOperation->setResponse($anyResponse); $operationsTransport->addResponse($completeOperation); // Mock request - $formattedName = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $rbacrolebinding = new RBACRoleBinding(); + $rbacrolebindingRole = new Role(); + $rbacrolebinding->setRole($rbacrolebindingRole); $updateMask = new FieldMask(); - $resource = new Membership(); - $request = (new UpdateMembershipRequest()) - ->setName($formattedName) - ->setUpdateMask($updateMask) - ->setResource($resource); - $response = $gapicClient->updateMembership($request); + $request = (new UpdateScopeRBACRoleBindingRequest()) + ->setRbacrolebinding($rbacrolebinding) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateScopeRBACRoleBinding($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $apiRequests = $transport->popReceivedCalls(); @@ -1083,15 +4614,13 @@ public function updateMembershipTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.gkehub.v1.GkeHub/UpdateMembership', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertSame('/google.cloud.gkehub.v1.GkeHub/UpdateScopeRBACRoleBinding', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getRbacrolebinding(); + $this->assertProtobufEquals($rbacrolebinding, $actualValue); $actualValue = $actualApiRequestObject->getUpdateMask(); $this->assertProtobufEquals($updateMask, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateMembershipTest'); + $expectedOperationsRequestObject->setName('operations/updateScopeRBACRoleBindingTest'); $response->pollUntilComplete([ 'initialPollDelayMillis' => 1, ]); @@ -1110,7 +4639,7 @@ public function updateMembershipTest() } /** @test */ - public function updateMembershipExceptionTest() + public function updateScopeRBACRoleBindingExceptionTest() { $operationsTransport = $this->createTransport(); $operationsClient = new OperationsClient([ @@ -1127,7 +4656,7 @@ public function updateMembershipExceptionTest() $this->assertTrue($operationsTransport->isExhausted()); // Mock response $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateMembershipTest'); + $incompleteOperation->setName('operations/updateScopeRBACRoleBindingTest'); $incompleteOperation->setDone(false); $transport->addResponse($incompleteOperation); $status = new stdClass(); @@ -1144,18 +4673,18 @@ public function updateMembershipExceptionTest() ); $operationsTransport->addResponse(null, $status); // Mock request - $formattedName = $gapicClient->membershipName('[PROJECT]', '[LOCATION]', '[MEMBERSHIP]'); + $rbacrolebinding = new RBACRoleBinding(); + $rbacrolebindingRole = new Role(); + $rbacrolebinding->setRole($rbacrolebindingRole); $updateMask = new FieldMask(); - $resource = new Membership(); - $request = (new UpdateMembershipRequest()) - ->setName($formattedName) - ->setUpdateMask($updateMask) - ->setResource($resource); - $response = $gapicClient->updateMembership($request); + $request = (new UpdateScopeRBACRoleBindingRequest()) + ->setRbacrolebinding($rbacrolebinding) + ->setUpdateMask($updateMask); + $response = $gapicClient->updateScopeRBACRoleBinding($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateMembershipTest'); + $expectedOperationsRequestObject->setName('operations/updateScopeRBACRoleBindingTest'); try { $response->pollUntilComplete([ 'initialPollDelayMillis' => 1,