diff --git a/config/tests/samples/create/harness.go b/config/tests/samples/create/harness.go index 9a999ec696..73e256142b 100644 --- a/config/tests/samples/create/harness.go +++ b/config/tests/samples/create/harness.go @@ -793,6 +793,7 @@ func MaybeSkip(t *testing.T, name string, resources []*unstructured.Unstructured case schema.GroupKind{Group: "dataform.cnrm.cloud.google.com", Kind: "DataformRepository"}: case schema.GroupKind{Group: "discoveryengine.cnrm.cloud.google.com", Kind: "DiscoveryEngineDataStore"}: + case schema.GroupKind{Group: "discoveryengine.cnrm.cloud.google.com", Kind: "DiscoveryEngineDataStoreTargetSite"}: case schema.GroupKind{Group: "iam.cnrm.cloud.google.com", Kind: "IAMPartialPolicy"}: case schema.GroupKind{Group: "iam.cnrm.cloud.google.com", Kind: "IAMPolicy"}: diff --git a/mockgcp/Makefile b/mockgcp/Makefile index abb73090d6..b09180cacc 100644 --- a/mockgcp/Makefile +++ b/mockgcp/Makefile @@ -131,6 +131,8 @@ generate-grpc-for-google-protos: --grpc-gateway_opt standalone=true \ ./third_party/googleapis/google/cloud/discoveryengine/v1/data_store_service.proto \ ./third_party/googleapis/google/cloud/discoveryengine/v1/engine_service.proto \ + ./third_party/googleapis/google/cloud/discoveryengine/v1/site_search_engine.proto \ + ./third_party/googleapis/google/cloud/discoveryengine/v1/site_search_engine_service.proto \ ./third_party/googleapis/google/bigtable/admin/v2/*.proto .PHONY: generate-protos-from-openapi diff --git a/mockgcp/generated/google/cloud/discoveryengine/v1/site_search_engine_service.pb.gw.go b/mockgcp/generated/google/cloud/discoveryengine/v1/site_search_engine_service.pb.gw.go new file mode 100644 index 0000000000..02173acdb0 --- /dev/null +++ b/mockgcp/generated/google/cloud/discoveryengine/v1/site_search_engine_service.pb.gw.go @@ -0,0 +1,2615 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: google/cloud/discoveryengine/v1/site_search_engine_service.proto + +/* +Package discoveryenginepb is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package discoveryenginepb + +import ( + "context" + "io" + "net/http" + + extDiscoveryenginepb "cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb" + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_SiteSearchEngineService_GetSiteSearchEngine_0(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.GetSiteSearchEngineRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.GetSiteSearchEngine(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_GetSiteSearchEngine_0(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.GetSiteSearchEngineRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.GetSiteSearchEngine(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_GetSiteSearchEngine_1(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.GetSiteSearchEngineRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.GetSiteSearchEngine(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_GetSiteSearchEngine_1(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.GetSiteSearchEngineRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.GetSiteSearchEngine(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_CreateTargetSite_0(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.CreateTargetSiteRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.TargetSite); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + msg, err := client.CreateTargetSite(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_CreateTargetSite_0(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.CreateTargetSiteRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.TargetSite); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + msg, err := server.CreateTargetSite(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_CreateTargetSite_1(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.CreateTargetSiteRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.TargetSite); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + msg, err := client.CreateTargetSite(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_CreateTargetSite_1(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.CreateTargetSiteRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.TargetSite); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + msg, err := server.CreateTargetSite(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_BatchCreateTargetSites_0(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.BatchCreateTargetSitesRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + msg, err := client.BatchCreateTargetSites(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_BatchCreateTargetSites_0(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.BatchCreateTargetSitesRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + msg, err := server.BatchCreateTargetSites(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_BatchCreateTargetSites_1(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.BatchCreateTargetSitesRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + msg, err := client.BatchCreateTargetSites(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_BatchCreateTargetSites_1(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.BatchCreateTargetSitesRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + msg, err := server.BatchCreateTargetSites(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_GetTargetSite_0(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.GetTargetSiteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.GetTargetSite(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_GetTargetSite_0(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.GetTargetSiteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.GetTargetSite(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_GetTargetSite_1(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.GetTargetSiteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.GetTargetSite(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_GetTargetSite_1(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.GetTargetSiteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.GetTargetSite(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_UpdateTargetSite_0(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.UpdateTargetSiteRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.TargetSite); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["target_site.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "target_site.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "target_site.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "target_site.name", err) + } + + msg, err := client.UpdateTargetSite(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_UpdateTargetSite_0(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.UpdateTargetSiteRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.TargetSite); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["target_site.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "target_site.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "target_site.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "target_site.name", err) + } + + msg, err := server.UpdateTargetSite(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_UpdateTargetSite_1(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.UpdateTargetSiteRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.TargetSite); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["target_site.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "target_site.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "target_site.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "target_site.name", err) + } + + msg, err := client.UpdateTargetSite(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_UpdateTargetSite_1(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.UpdateTargetSiteRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.TargetSite); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["target_site.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "target_site.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "target_site.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "target_site.name", err) + } + + msg, err := server.UpdateTargetSite(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_DeleteTargetSite_0(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.DeleteTargetSiteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.DeleteTargetSite(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_DeleteTargetSite_0(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.DeleteTargetSiteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.DeleteTargetSite(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_DeleteTargetSite_1(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.DeleteTargetSiteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.DeleteTargetSite(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_DeleteTargetSite_1(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.DeleteTargetSiteRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.DeleteTargetSite(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_SiteSearchEngineService_ListTargetSites_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_SiteSearchEngineService_ListTargetSites_0(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.ListTargetSitesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SiteSearchEngineService_ListTargetSites_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListTargetSites(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_ListTargetSites_0(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.ListTargetSitesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SiteSearchEngineService_ListTargetSites_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListTargetSites(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_SiteSearchEngineService_ListTargetSites_1 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_SiteSearchEngineService_ListTargetSites_1(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.ListTargetSitesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SiteSearchEngineService_ListTargetSites_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListTargetSites(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_ListTargetSites_1(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.ListTargetSitesRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SiteSearchEngineService_ListTargetSites_1); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListTargetSites(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_EnableAdvancedSiteSearch_0(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.EnableAdvancedSiteSearchRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + msg, err := client.EnableAdvancedSiteSearch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_EnableAdvancedSiteSearch_0(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.EnableAdvancedSiteSearchRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + msg, err := server.EnableAdvancedSiteSearch(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_EnableAdvancedSiteSearch_1(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.EnableAdvancedSiteSearchRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + msg, err := client.EnableAdvancedSiteSearch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_EnableAdvancedSiteSearch_1(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.EnableAdvancedSiteSearchRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + msg, err := server.EnableAdvancedSiteSearch(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_DisableAdvancedSiteSearch_0(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.DisableAdvancedSiteSearchRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + msg, err := client.DisableAdvancedSiteSearch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_DisableAdvancedSiteSearch_0(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.DisableAdvancedSiteSearchRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + msg, err := server.DisableAdvancedSiteSearch(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_DisableAdvancedSiteSearch_1(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.DisableAdvancedSiteSearchRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + msg, err := client.DisableAdvancedSiteSearch(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_DisableAdvancedSiteSearch_1(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.DisableAdvancedSiteSearchRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + msg, err := server.DisableAdvancedSiteSearch(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_RecrawlUris_0(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.RecrawlUrisRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + msg, err := client.RecrawlUris(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_RecrawlUris_0(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.RecrawlUrisRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + msg, err := server.RecrawlUris(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_RecrawlUris_1(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.RecrawlUrisRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + msg, err := client.RecrawlUris(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_RecrawlUris_1(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.RecrawlUrisRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + msg, err := server.RecrawlUris(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SiteSearchEngineService_BatchVerifyTargetSites_0(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.BatchVerifyTargetSitesRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + msg, err := client.BatchVerifyTargetSites(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_BatchVerifyTargetSites_0(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.BatchVerifyTargetSitesRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["parent"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent") + } + + protoReq.Parent, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err) + } + + msg, err := server.BatchVerifyTargetSites(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_SiteSearchEngineService_FetchDomainVerificationStatus_0 = &utilities.DoubleArray{Encoding: map[string]int{"site_search_engine": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_SiteSearchEngineService_FetchDomainVerificationStatus_0(ctx context.Context, marshaler runtime.Marshaler, client extDiscoveryenginepb.SiteSearchEngineServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.FetchDomainVerificationStatusRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SiteSearchEngineService_FetchDomainVerificationStatus_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.FetchDomainVerificationStatus(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SiteSearchEngineService_FetchDomainVerificationStatus_0(ctx context.Context, marshaler runtime.Marshaler, server extDiscoveryenginepb.SiteSearchEngineServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq extDiscoveryenginepb.FetchDomainVerificationStatusRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["site_search_engine"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "site_search_engine") + } + + protoReq.SiteSearchEngine, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "site_search_engine", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SiteSearchEngineService_FetchDomainVerificationStatus_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.FetchDomainVerificationStatus(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterSiteSearchEngineServiceHandlerServer registers the http handlers for service SiteSearchEngineService to "mux". +// UnaryRPC :call SiteSearchEngineServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSiteSearchEngineServiceHandlerFromEndpoint instead. +func RegisterSiteSearchEngineServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server extDiscoveryenginepb.SiteSearchEngineServiceServer) error { + + mux.Handle("GET", pattern_SiteSearchEngineService_GetSiteSearchEngine_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/GetSiteSearchEngine", runtime.WithHTTPPathPattern("/v1/{name=projects/*/locations/*/dataStores/*/siteSearchEngine}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_GetSiteSearchEngine_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_GetSiteSearchEngine_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SiteSearchEngineService_GetSiteSearchEngine_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/GetSiteSearchEngine", runtime.WithHTTPPathPattern("/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_GetSiteSearchEngine_1(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_GetSiteSearchEngine_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_CreateTargetSite_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/CreateTargetSite", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/dataStores/*/siteSearchEngine}/targetSites")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_CreateTargetSite_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_CreateTargetSite_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_CreateTargetSite_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/CreateTargetSite", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/targetSites")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_CreateTargetSite_1(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_CreateTargetSite_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_BatchCreateTargetSites_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/BatchCreateTargetSites", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/dataStores/*/siteSearchEngine}/targetSites:batchCreate")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_BatchCreateTargetSites_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_BatchCreateTargetSites_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_BatchCreateTargetSites_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/BatchCreateTargetSites", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/targetSites:batchCreate")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_BatchCreateTargetSites_1(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_BatchCreateTargetSites_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SiteSearchEngineService_GetTargetSite_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/GetTargetSite", runtime.WithHTTPPathPattern("/v1/{name=projects/*/locations/*/dataStores/*/siteSearchEngine/targetSites/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_GetTargetSite_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_GetTargetSite_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SiteSearchEngineService_GetTargetSite_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/GetTargetSite", runtime.WithHTTPPathPattern("/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_GetTargetSite_1(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_GetTargetSite_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_SiteSearchEngineService_UpdateTargetSite_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/UpdateTargetSite", runtime.WithHTTPPathPattern("/v1/{target_site.name=projects/*/locations/*/dataStores/*/siteSearchEngine/targetSites/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_UpdateTargetSite_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_UpdateTargetSite_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_SiteSearchEngineService_UpdateTargetSite_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/UpdateTargetSite", runtime.WithHTTPPathPattern("/v1/{target_site.name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_UpdateTargetSite_1(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_UpdateTargetSite_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_SiteSearchEngineService_DeleteTargetSite_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/DeleteTargetSite", runtime.WithHTTPPathPattern("/v1/{name=projects/*/locations/*/dataStores/*/siteSearchEngine/targetSites/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_DeleteTargetSite_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_DeleteTargetSite_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_SiteSearchEngineService_DeleteTargetSite_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/DeleteTargetSite", runtime.WithHTTPPathPattern("/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_DeleteTargetSite_1(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_DeleteTargetSite_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SiteSearchEngineService_ListTargetSites_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/ListTargetSites", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/dataStores/*/siteSearchEngine}/targetSites")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_ListTargetSites_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_ListTargetSites_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SiteSearchEngineService_ListTargetSites_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/ListTargetSites", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/targetSites")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_ListTargetSites_1(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_ListTargetSites_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_EnableAdvancedSiteSearch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/EnableAdvancedSiteSearch", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/dataStores/*/siteSearchEngine}:enableAdvancedSiteSearch")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_EnableAdvancedSiteSearch_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_EnableAdvancedSiteSearch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_EnableAdvancedSiteSearch_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/EnableAdvancedSiteSearch", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:enableAdvancedSiteSearch")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_EnableAdvancedSiteSearch_1(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_EnableAdvancedSiteSearch_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_DisableAdvancedSiteSearch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/DisableAdvancedSiteSearch", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/dataStores/*/siteSearchEngine}:disableAdvancedSiteSearch")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_DisableAdvancedSiteSearch_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_DisableAdvancedSiteSearch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_DisableAdvancedSiteSearch_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/DisableAdvancedSiteSearch", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:disableAdvancedSiteSearch")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_DisableAdvancedSiteSearch_1(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_DisableAdvancedSiteSearch_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_RecrawlUris_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/RecrawlUris", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/dataStores/*/siteSearchEngine}:recrawlUris")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_RecrawlUris_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_RecrawlUris_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_RecrawlUris_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/RecrawlUris", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:recrawlUris")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_RecrawlUris_1(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_RecrawlUris_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_BatchVerifyTargetSites_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/BatchVerifyTargetSites", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:batchVerifyTargetSites")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_BatchVerifyTargetSites_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_BatchVerifyTargetSites_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SiteSearchEngineService_FetchDomainVerificationStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/FetchDomainVerificationStatus", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:fetchDomainVerificationStatus")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SiteSearchEngineService_FetchDomainVerificationStatus_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_FetchDomainVerificationStatus_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterSiteSearchEngineServiceHandlerFromEndpoint is same as RegisterSiteSearchEngineServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterSiteSearchEngineServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterSiteSearchEngineServiceHandler(ctx, mux, conn) +} + +// RegisterSiteSearchEngineServiceHandler registers the http handlers for service SiteSearchEngineService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterSiteSearchEngineServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterSiteSearchEngineServiceHandlerClient(ctx, mux, extDiscoveryenginepb.NewSiteSearchEngineServiceClient(conn)) +} + +// RegisterSiteSearchEngineServiceHandlerClient registers the http handlers for service SiteSearchEngineService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "extDiscoveryenginepb.SiteSearchEngineServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "extDiscoveryenginepb.SiteSearchEngineServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "extDiscoveryenginepb.SiteSearchEngineServiceClient" to call the correct interceptors. +func RegisterSiteSearchEngineServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client extDiscoveryenginepb.SiteSearchEngineServiceClient) error { + + mux.Handle("GET", pattern_SiteSearchEngineService_GetSiteSearchEngine_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/GetSiteSearchEngine", runtime.WithHTTPPathPattern("/v1/{name=projects/*/locations/*/dataStores/*/siteSearchEngine}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_GetSiteSearchEngine_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_GetSiteSearchEngine_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SiteSearchEngineService_GetSiteSearchEngine_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/GetSiteSearchEngine", runtime.WithHTTPPathPattern("/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_GetSiteSearchEngine_1(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_GetSiteSearchEngine_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_CreateTargetSite_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/CreateTargetSite", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/dataStores/*/siteSearchEngine}/targetSites")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_CreateTargetSite_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_CreateTargetSite_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_CreateTargetSite_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/CreateTargetSite", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/targetSites")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_CreateTargetSite_1(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_CreateTargetSite_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_BatchCreateTargetSites_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/BatchCreateTargetSites", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/dataStores/*/siteSearchEngine}/targetSites:batchCreate")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_BatchCreateTargetSites_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_BatchCreateTargetSites_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_BatchCreateTargetSites_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/BatchCreateTargetSites", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/targetSites:batchCreate")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_BatchCreateTargetSites_1(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_BatchCreateTargetSites_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SiteSearchEngineService_GetTargetSite_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/GetTargetSite", runtime.WithHTTPPathPattern("/v1/{name=projects/*/locations/*/dataStores/*/siteSearchEngine/targetSites/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_GetTargetSite_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_GetTargetSite_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SiteSearchEngineService_GetTargetSite_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/GetTargetSite", runtime.WithHTTPPathPattern("/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_GetTargetSite_1(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_GetTargetSite_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_SiteSearchEngineService_UpdateTargetSite_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/UpdateTargetSite", runtime.WithHTTPPathPattern("/v1/{target_site.name=projects/*/locations/*/dataStores/*/siteSearchEngine/targetSites/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_UpdateTargetSite_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_UpdateTargetSite_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_SiteSearchEngineService_UpdateTargetSite_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/UpdateTargetSite", runtime.WithHTTPPathPattern("/v1/{target_site.name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_UpdateTargetSite_1(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_UpdateTargetSite_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_SiteSearchEngineService_DeleteTargetSite_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/DeleteTargetSite", runtime.WithHTTPPathPattern("/v1/{name=projects/*/locations/*/dataStores/*/siteSearchEngine/targetSites/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_DeleteTargetSite_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_DeleteTargetSite_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_SiteSearchEngineService_DeleteTargetSite_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/DeleteTargetSite", runtime.WithHTTPPathPattern("/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_DeleteTargetSite_1(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_DeleteTargetSite_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SiteSearchEngineService_ListTargetSites_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/ListTargetSites", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/dataStores/*/siteSearchEngine}/targetSites")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_ListTargetSites_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_ListTargetSites_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SiteSearchEngineService_ListTargetSites_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/ListTargetSites", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/targetSites")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_ListTargetSites_1(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_ListTargetSites_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_EnableAdvancedSiteSearch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/EnableAdvancedSiteSearch", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/dataStores/*/siteSearchEngine}:enableAdvancedSiteSearch")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_EnableAdvancedSiteSearch_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_EnableAdvancedSiteSearch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_EnableAdvancedSiteSearch_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/EnableAdvancedSiteSearch", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:enableAdvancedSiteSearch")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_EnableAdvancedSiteSearch_1(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_EnableAdvancedSiteSearch_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_DisableAdvancedSiteSearch_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/DisableAdvancedSiteSearch", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/dataStores/*/siteSearchEngine}:disableAdvancedSiteSearch")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_DisableAdvancedSiteSearch_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_DisableAdvancedSiteSearch_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_DisableAdvancedSiteSearch_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/DisableAdvancedSiteSearch", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:disableAdvancedSiteSearch")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_DisableAdvancedSiteSearch_1(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_DisableAdvancedSiteSearch_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_RecrawlUris_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/RecrawlUris", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/dataStores/*/siteSearchEngine}:recrawlUris")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_RecrawlUris_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_RecrawlUris_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_RecrawlUris_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/RecrawlUris", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:recrawlUris")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_RecrawlUris_1(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_RecrawlUris_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SiteSearchEngineService_BatchVerifyTargetSites_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/BatchVerifyTargetSites", runtime.WithHTTPPathPattern("/v1/{parent=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:batchVerifyTargetSites")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_BatchVerifyTargetSites_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_BatchVerifyTargetSites_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SiteSearchEngineService_FetchDomainVerificationStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/google.cloud.discoveryengine.v1.SiteSearchEngineService/FetchDomainVerificationStatus", runtime.WithHTTPPathPattern("/v1/{site_search_engine=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}:fetchDomainVerificationStatus")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SiteSearchEngineService_FetchDomainVerificationStatus_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SiteSearchEngineService_FetchDomainVerificationStatus_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_SiteSearchEngineService_GetSiteSearchEngine_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 4, 7, 5, 5}, []string{"v1", "projects", "locations", "dataStores", "siteSearchEngine", "name"}, "")) + + pattern_SiteSearchEngineService_GetSiteSearchEngine_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 1, 0, 2, 5, 4, 9, 5, 6}, []string{"v1", "projects", "locations", "collections", "dataStores", "siteSearchEngine", "name"}, "")) + + pattern_SiteSearchEngineService_CreateTargetSite_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 4, 7, 5, 5, 2, 6}, []string{"v1", "projects", "locations", "dataStores", "siteSearchEngine", "parent", "targetSites"}, "")) + + pattern_SiteSearchEngineService_CreateTargetSite_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 1, 0, 2, 5, 4, 9, 5, 6, 2, 7}, []string{"v1", "projects", "locations", "collections", "dataStores", "siteSearchEngine", "parent", "targetSites"}, "")) + + pattern_SiteSearchEngineService_BatchCreateTargetSites_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 4, 7, 5, 5, 2, 6}, []string{"v1", "projects", "locations", "dataStores", "siteSearchEngine", "parent", "targetSites"}, "batchCreate")) + + pattern_SiteSearchEngineService_BatchCreateTargetSites_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 1, 0, 2, 5, 4, 9, 5, 6, 2, 7}, []string{"v1", "projects", "locations", "collections", "dataStores", "siteSearchEngine", "parent", "targetSites"}, "batchCreate")) + + pattern_SiteSearchEngineService_GetTargetSite_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 2, 5, 1, 0, 4, 9, 5, 6}, []string{"v1", "projects", "locations", "dataStores", "siteSearchEngine", "targetSites", "name"}, "")) + + pattern_SiteSearchEngineService_GetTargetSite_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 1, 0, 2, 5, 2, 6, 1, 0, 4, 11, 5, 7}, []string{"v1", "projects", "locations", "collections", "dataStores", "siteSearchEngine", "targetSites", "name"}, "")) + + pattern_SiteSearchEngineService_UpdateTargetSite_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 2, 5, 1, 0, 4, 9, 5, 6}, []string{"v1", "projects", "locations", "dataStores", "siteSearchEngine", "targetSites", "target_site.name"}, "")) + + pattern_SiteSearchEngineService_UpdateTargetSite_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 1, 0, 2, 5, 2, 6, 1, 0, 4, 11, 5, 7}, []string{"v1", "projects", "locations", "collections", "dataStores", "siteSearchEngine", "targetSites", "target_site.name"}, "")) + + pattern_SiteSearchEngineService_DeleteTargetSite_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 2, 5, 1, 0, 4, 9, 5, 6}, []string{"v1", "projects", "locations", "dataStores", "siteSearchEngine", "targetSites", "name"}, "")) + + pattern_SiteSearchEngineService_DeleteTargetSite_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 1, 0, 2, 5, 2, 6, 1, 0, 4, 11, 5, 7}, []string{"v1", "projects", "locations", "collections", "dataStores", "siteSearchEngine", "targetSites", "name"}, "")) + + pattern_SiteSearchEngineService_ListTargetSites_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 4, 7, 5, 5, 2, 6}, []string{"v1", "projects", "locations", "dataStores", "siteSearchEngine", "parent", "targetSites"}, "")) + + pattern_SiteSearchEngineService_ListTargetSites_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 1, 0, 2, 5, 4, 9, 5, 6, 2, 7}, []string{"v1", "projects", "locations", "collections", "dataStores", "siteSearchEngine", "parent", "targetSites"}, "")) + + pattern_SiteSearchEngineService_EnableAdvancedSiteSearch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 4, 7, 5, 5}, []string{"v1", "projects", "locations", "dataStores", "siteSearchEngine", "site_search_engine"}, "enableAdvancedSiteSearch")) + + pattern_SiteSearchEngineService_EnableAdvancedSiteSearch_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 1, 0, 2, 5, 4, 9, 5, 6}, []string{"v1", "projects", "locations", "collections", "dataStores", "siteSearchEngine", "site_search_engine"}, "enableAdvancedSiteSearch")) + + pattern_SiteSearchEngineService_DisableAdvancedSiteSearch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 4, 7, 5, 5}, []string{"v1", "projects", "locations", "dataStores", "siteSearchEngine", "site_search_engine"}, "disableAdvancedSiteSearch")) + + pattern_SiteSearchEngineService_DisableAdvancedSiteSearch_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 1, 0, 2, 5, 4, 9, 5, 6}, []string{"v1", "projects", "locations", "collections", "dataStores", "siteSearchEngine", "site_search_engine"}, "disableAdvancedSiteSearch")) + + pattern_SiteSearchEngineService_RecrawlUris_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 4, 7, 5, 5}, []string{"v1", "projects", "locations", "dataStores", "siteSearchEngine", "site_search_engine"}, "recrawlUris")) + + pattern_SiteSearchEngineService_RecrawlUris_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 1, 0, 2, 5, 4, 9, 5, 6}, []string{"v1", "projects", "locations", "collections", "dataStores", "siteSearchEngine", "site_search_engine"}, "recrawlUris")) + + pattern_SiteSearchEngineService_BatchVerifyTargetSites_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 1, 0, 2, 5, 4, 9, 5, 6}, []string{"v1", "projects", "locations", "collections", "dataStores", "siteSearchEngine", "parent"}, "batchVerifyTargetSites")) + + pattern_SiteSearchEngineService_FetchDomainVerificationStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 3, 1, 0, 2, 4, 1, 0, 2, 5, 4, 9, 5, 6}, []string{"v1", "projects", "locations", "collections", "dataStores", "siteSearchEngine", "site_search_engine"}, "fetchDomainVerificationStatus")) +) + +var ( + forward_SiteSearchEngineService_GetSiteSearchEngine_0 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_GetSiteSearchEngine_1 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_CreateTargetSite_0 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_CreateTargetSite_1 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_BatchCreateTargetSites_0 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_BatchCreateTargetSites_1 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_GetTargetSite_0 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_GetTargetSite_1 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_UpdateTargetSite_0 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_UpdateTargetSite_1 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_DeleteTargetSite_0 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_DeleteTargetSite_1 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_ListTargetSites_0 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_ListTargetSites_1 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_EnableAdvancedSiteSearch_0 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_EnableAdvancedSiteSearch_1 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_DisableAdvancedSiteSearch_0 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_DisableAdvancedSiteSearch_1 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_RecrawlUris_0 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_RecrawlUris_1 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_BatchVerifyTargetSites_0 = runtime.ForwardResponseMessage + + forward_SiteSearchEngineService_FetchDomainVerificationStatus_0 = runtime.ForwardResponseMessage +) diff --git a/mockgcp/mockdiscoveryengine/service.go b/mockgcp/mockdiscoveryengine/service.go index 3c6a5b0e54..cf51ac3862 100644 --- a/mockgcp/mockdiscoveryengine/service.go +++ b/mockgcp/mockdiscoveryengine/service.go @@ -52,11 +52,13 @@ func (s *MockService) ExpectedHosts() []string { func (s *MockService) Register(grpcServer *grpc.Server) { pb.RegisterDataStoreServiceServer(grpcServer, &dataStoreService{MockService: s}) + pb.RegisterSiteSearchEngineServiceServer(grpcServer, &siteSearchEngineService{MockService: s}) } func (s *MockService) NewHTTPMux(ctx context.Context, conn *grpc.ClientConn) (http.Handler, error) { mux, err := httpmux.NewServeMux(ctx, conn, httpmux.Options{}, pbhttp.RegisterDataStoreServiceHandler, + pbhttp.RegisterSiteSearchEngineServiceHandler, // s.operations.RegisterOperationsPath("/v1beta1/{prefix=**}/operations/{name}") ) if err != nil { diff --git a/mockgcp/mockdiscoveryengine/targetsite.go b/mockgcp/mockdiscoveryengine/targetsite.go new file mode 100644 index 0000000000..50dba6d1a7 --- /dev/null +++ b/mockgcp/mockdiscoveryengine/targetsite.go @@ -0,0 +1,174 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +tool:mockgcp-support +// krm.apiVersion: discoveryengine.cnrm.cloud.google.com/v1alpha1 +// krm.kind: DiscoveryEngineDataStoreTargetSite +// proto.service: google.cloud.discoveryengine.v1.SiteSearchEngineService +// proto.resource: TargetSite + +package mockdiscoveryengine + +import ( + "context" + "fmt" + "strings" + "time" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/timestamppb" + + pb "cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + + "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/projects" +) + +type siteSearchEngineService struct { + *MockService + pb.UnimplementedSiteSearchEngineServiceServer +} + +func (s *siteSearchEngineService) CreateTargetSite(ctx context.Context, req *pb.CreateTargetSiteRequest) (*longrunningpb.Operation, error) { + // targetSiteID is system-generated + targetSiteID := fmt.Sprintf("%x", time.Now().UnixNano()) + + reqName := fmt.Sprintf("%s/targetSites/%s", req.GetParent(), targetSiteID) + name, err := s.parseTargetSiteName(reqName) + if err != nil { + return nil, err + } + + now := time.Now() + + fqn := name.String() + obj := proto.Clone(req.GetTargetSite()).(*pb.TargetSite) + obj.Name = fqn + // obj.CreateTime = timestamppb.New(now) + obj.UpdateTime = timestamppb.New(now) + + if err := s.storage.Create(ctx, fqn, obj); err != nil { + return nil, err + } + + prefix := fmt.Sprintf("projects/%d/locations/%s/collections/%s/dataStores/%s/siteSearchEngine", name.Project.Number, name.Location, name.Collection, name.DataStore) + // Returns with no createTime and updateTime + lroRet := proto.Clone(obj).(*pb.TargetSite) + // lroRet.CreateTime = nil + lroRet.UpdateTime = nil + + return s.operations.DoneLRO(ctx, prefix, nil, lroRet) +} + +func (s *siteSearchEngineService) UpdateTargetSite(ctx context.Context, req *pb.UpdateTargetSiteRequest) (*longrunningpb.Operation, error) { + name, err := s.parseTargetSiteName(req.TargetSite.Name) + if err != nil { + return nil, err + } + fqn := name.String() + obj := &pb.TargetSite{} + + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if status.Code(err) == codes.NotFound { + return nil, status.Errorf(codes.NotFound, "targetSite %q not found", name) + } + return nil, err + } + + now := time.Now() + updated := proto.Clone(req.GetTargetSite()).(*pb.TargetSite) + // updated.CreateTime = obj.CreateTime + updated.UpdateTime = timestamppb.New(now) + + if err := s.storage.Update(ctx, fqn, updated); err != nil { + return nil, err + } + + prefix := fmt.Sprintf("projects/%d/locations/%s/collections/%s/dataStores/%s/siteSearchEngine", name.Project.Number, name.Location, name.Collection, name.DataStore) + // Returns with no createTime and updateTime + lroRet := proto.Clone(updated).(*pb.TargetSite) + // lroRet.CreateTime = nil + lroRet.UpdateTime = nil + return s.operations.DoneLRO(ctx, prefix, nil, lroRet) + +} + +func (s *siteSearchEngineService) DeleteTargetSite(ctx context.Context, req *pb.DeleteTargetSiteRequest) (*longrunningpb.Operation, error) { + name, err := s.parseTargetSiteName(req.Name) + if err != nil { + return nil, err + } + + fqn := name.String() + + deleted := &pb.TargetSite{} + if err := s.storage.Delete(ctx, fqn, deleted); err != nil { + return nil, err + } + + prefix := fmt.Sprintf("projects/%d/locations/%s/collections/%s/dataStores/%s/siteSearchEngine", name.Project.Number, name.Location, name.Collection, name.DataStore) + return s.operations.DoneLRO(ctx, prefix, nil, &emptypb.Empty{}) +} + +func (s *siteSearchEngineService) GetTargetSite(ctx context.Context, req *pb.GetTargetSiteRequest) (*pb.TargetSite, error) { + name, err := s.parseTargetSiteName(req.Name) + if err != nil { + return nil, err + } + + fqn := name.String() + obj := &pb.TargetSite{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if status.Code(err) == codes.NotFound { + return nil, status.Errorf(codes.NotFound, "targetSite %v not found.", name) + } + return nil, err + } + return obj, nil +} + +type targetSiteName struct { + Project *projects.ProjectData + Location string + Collection string + DataStore string + TargetSite string +} + +func (n *targetSiteName) String() string { + return fmt.Sprintf("projects/%d/locations/%s/collections/%s/dataStores/%s/siteSearchEngine/targetSites/%s", n.Project.Number, n.Location, n.Collection, n.DataStore, n.TargetSite) +} + +func (s *MockService) parseTargetSiteName(name string) (*targetSiteName, error) { + tokens := strings.Split(name, "/") + if len(tokens) == 11 && tokens[0] == "projects" && tokens[2] == "locations" && tokens[4] == "collections" && tokens[6] == "dataStores" && tokens[8] == "siteSearchEngine" && tokens[9] == "targetSites" { + project, err := s.Projects.GetProjectByID(tokens[1]) + if err != nil { + return nil, err + } + + return &targetSiteName{ + Project: project, + Location: tokens[3], + Collection: tokens[5], + DataStore: tokens[7], + TargetSite: tokens[10], + }, nil + } + + return nil, status.Errorf(codes.InvalidArgument, "invalid name %q", name) +}