From 25e6011428019edad47c7c0b2ee1bbd8dea7dce0 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 10 Apr 2023 19:04:51 +0000 Subject: [PATCH] chore: fix go library package name PiperOrigin-RevId: 523142753 Source-Link: https://github.com/googleapis/googleapis/commit/7a7cfacfdd2844fefa951920f2972468a93b0acf Source-Link: https://github.com/googleapis/googleapis-gen/commit/5c50e1d1a88c797349559b3bf777b9fcb95f9ad4 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWM1MGUxZDFhODhjNzk3MzQ5NTU5YjNiZjc3N2I5ZmNiOTVmOWFkNCJ9 --- eventarc/publishing/apiv1/doc.go | 10 +- eventarc/publishing/apiv1/gapic_metadata.json | 4 +- eventarc/publishing/apiv1/publisher_client.go | 110 +++++++++--------- .../apiv1/publisher_client_example_test.go | 20 ++-- 4 files changed, 72 insertions(+), 72 deletions(-) diff --git a/eventarc/publishing/apiv1/doc.go b/eventarc/publishing/apiv1/doc.go index 457ae71621a5..41bb58a20e48 100755 --- a/eventarc/publishing/apiv1/doc.go +++ b/eventarc/publishing/apiv1/doc.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go_gapic. DO NOT EDIT. -// Package publisher is an auto-generated package for the +// Package publishing is an auto-generated package for the // Eventarc Publishing API. // // NOTE: This package is in beta. It is not stable, and may be subject to changes. @@ -33,7 +33,7 @@ // // - It may require correct/in-range values for request initialization. // // - It may require specifying regional endpoints when creating the service client as shown in: // // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options -// c, err := publisher.NewClient(ctx) +// c, err := publishing.NewPublisherClient(ctx) // if err != nil { // // TODO: Handle error. // } @@ -53,7 +53,7 @@ // // - It may require correct/in-range values for request initialization. // // - It may require specifying regional endpoints when creating the service client as shown in: // // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options -// c, err := publisher.NewClient(ctx) +// c, err := publishing.NewPublisherClient(ctx) // if err != nil { // // TODO: Handle error. // } @@ -72,12 +72,12 @@ // // Use of Context // -// The ctx passed to NewClient is used for authentication requests and +// The ctx passed to NewPublisherClient is used for authentication requests and // for creating the underlying connection, but is not used for subsequent calls. // Individual methods on the client use the ctx given to them. // // To close the open connection, use the Close() method. -package publisher // import "cloud.google.com/go/eventarc/publishing/apiv1" +package publishing // import "cloud.google.com/go/eventarc/publishing/apiv1" import ( "context" diff --git a/eventarc/publishing/apiv1/gapic_metadata.json b/eventarc/publishing/apiv1/gapic_metadata.json index 0a4015d6b812..0cd1c96c82ae 100644 --- a/eventarc/publishing/apiv1/gapic_metadata.json +++ b/eventarc/publishing/apiv1/gapic_metadata.json @@ -8,7 +8,7 @@ "Publisher": { "clients": { "grpc": { - "libraryClient": "Client", + "libraryClient": "PublisherClient", "rpcs": { "PublishChannelConnectionEvents": { "methods": [ @@ -23,7 +23,7 @@ } }, "rest": { - "libraryClient": "Client", + "libraryClient": "PublisherClient", "rpcs": { "PublishChannelConnectionEvents": { "methods": [ diff --git a/eventarc/publishing/apiv1/publisher_client.go b/eventarc/publishing/apiv1/publisher_client.go index 967dd5ac88cc..1f18a2fb3052 100755 --- a/eventarc/publishing/apiv1/publisher_client.go +++ b/eventarc/publishing/apiv1/publisher_client.go @@ -14,7 +14,7 @@ // Code generated by protoc-gen-go_gapic. DO NOT EDIT. -package publisher +package publishing import ( "bytes" @@ -38,15 +38,15 @@ import ( "google.golang.org/protobuf/encoding/protojson" ) -var newClientHook clientHook +var newPublisherClientHook clientHook -// CallOptions contains the retry settings for each method of Client. -type CallOptions struct { +// PublisherCallOptions contains the retry settings for each method of PublisherClient. +type PublisherCallOptions struct { PublishChannelConnectionEvents []gax.CallOption PublishEvents []gax.CallOption } -func defaultGRPCClientOptions() []option.ClientOption { +func defaultPublisherGRPCClientOptions() []option.ClientOption { return []option.ClientOption{ internaloption.WithDefaultEndpoint("eventarcpublishing.googleapis.com:443"), internaloption.WithDefaultMTLSEndpoint("eventarcpublishing.mtls.googleapis.com:443"), @@ -58,22 +58,22 @@ func defaultGRPCClientOptions() []option.ClientOption { } } -func defaultCallOptions() *CallOptions { - return &CallOptions{ +func defaultPublisherCallOptions() *PublisherCallOptions { + return &PublisherCallOptions{ PublishChannelConnectionEvents: []gax.CallOption{}, PublishEvents: []gax.CallOption{}, } } -func defaultRESTCallOptions() *CallOptions { - return &CallOptions{ +func defaultPublisherRESTCallOptions() *PublisherCallOptions { + return &PublisherCallOptions{ PublishChannelConnectionEvents: []gax.CallOption{}, PublishEvents: []gax.CallOption{}, } } -// internalClient is an interface that defines the methods available from Eventarc Publishing API. -type internalClient interface { +// internalPublisherClient is an interface that defines the methods available from Eventarc Publishing API. +type internalPublisherClient interface { Close() error setGoogleClientInfo(...string) Connection() *grpc.ClientConn @@ -81,7 +81,7 @@ type internalClient interface { PublishEvents(context.Context, *publishingpb.PublishEventsRequest, ...gax.CallOption) (*publishingpb.PublishEventsResponse, error) } -// Client is a client for interacting with Eventarc Publishing API. +// PublisherClient is a client for interacting with Eventarc Publishing API. // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. // // Eventarc processes events generated by an event provider and delivers them to @@ -108,26 +108,26 @@ type internalClient interface { // Channel. // // Publisher allows an event provider to publish events to Eventarc. -type Client struct { +type PublisherClient struct { // The internal transport-dependent client. - internalClient internalClient + internalClient internalPublisherClient // The call options for this service. - CallOptions *CallOptions + CallOptions *PublisherCallOptions } // Wrapper methods routed to the internal client. // Close closes the connection to the API service. The user should invoke this when // the client is no longer required. -func (c *Client) Close() error { +func (c *PublisherClient) Close() error { return c.internalClient.Close() } // setGoogleClientInfo sets the name and version of the application in // the `x-goog-api-client` header passed on each request. Intended for // use by Google-written clients. -func (c *Client) setGoogleClientInfo(keyval ...string) { +func (c *PublisherClient) setGoogleClientInfo(keyval ...string) { c.internalClient.setGoogleClientInfo(keyval...) } @@ -135,41 +135,41 @@ func (c *Client) setGoogleClientInfo(keyval ...string) { // // Deprecated: Connections are now pooled so this method does not always // return the same resource. -func (c *Client) Connection() *grpc.ClientConn { +func (c *PublisherClient) Connection() *grpc.ClientConn { return c.internalClient.Connection() } // PublishChannelConnectionEvents publish events to a ChannelConnection in a partner’s project. -func (c *Client) PublishChannelConnectionEvents(ctx context.Context, req *publishingpb.PublishChannelConnectionEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishChannelConnectionEventsResponse, error) { +func (c *PublisherClient) PublishChannelConnectionEvents(ctx context.Context, req *publishingpb.PublishChannelConnectionEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishChannelConnectionEventsResponse, error) { return c.internalClient.PublishChannelConnectionEvents(ctx, req, opts...) } // PublishEvents publish events to a subscriber’s channel. -func (c *Client) PublishEvents(ctx context.Context, req *publishingpb.PublishEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishEventsResponse, error) { +func (c *PublisherClient) PublishEvents(ctx context.Context, req *publishingpb.PublishEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishEventsResponse, error) { return c.internalClient.PublishEvents(ctx, req, opts...) } -// gRPCClient is a client for interacting with Eventarc Publishing API over gRPC transport. +// publisherGRPCClient is a client for interacting with Eventarc Publishing API over gRPC transport. // // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. -type gRPCClient struct { +type publisherGRPCClient struct { // Connection pool of gRPC connections to the service. connPool gtransport.ConnPool // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE disableDeadlines bool - // Points back to the CallOptions field of the containing Client - CallOptions **CallOptions + // Points back to the CallOptions field of the containing PublisherClient + CallOptions **PublisherCallOptions // The gRPC API client. - client publishingpb.PublisherClient + publisherClient publishingpb.PublisherClient // The x-goog-* metadata to be sent with each request. xGoogMetadata metadata.MD } -// NewClient creates a new publisher client based on gRPC. +// NewPublisherClient creates a new publisher client based on gRPC. // The returned client must be Closed when it is done being used to clean up its underlying connections. // // Eventarc processes events generated by an event provider and delivers them to @@ -196,10 +196,10 @@ type gRPCClient struct { // Channel. // // Publisher allows an event provider to publish events to Eventarc. -func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { - clientOpts := defaultGRPCClientOptions() - if newClientHook != nil { - hookOpts, err := newClientHook(ctx, clientHookParams{}) +func NewPublisherClient(ctx context.Context, opts ...option.ClientOption) (*PublisherClient, error) { + clientOpts := defaultPublisherGRPCClientOptions() + if newPublisherClientHook != nil { + hookOpts, err := newPublisherClientHook(ctx, clientHookParams{}) if err != nil { return nil, err } @@ -215,12 +215,12 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error if err != nil { return nil, err } - client := Client{CallOptions: defaultCallOptions()} + client := PublisherClient{CallOptions: defaultPublisherCallOptions()} - c := &gRPCClient{ + c := &publisherGRPCClient{ connPool: connPool, disableDeadlines: disableDeadlines, - client: publishingpb.NewPublisherClient(connPool), + publisherClient: publishingpb.NewPublisherClient(connPool), CallOptions: &client.CallOptions, } c.setGoogleClientInfo() @@ -234,14 +234,14 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error // // Deprecated: Connections are now pooled so this method does not always // return the same resource. -func (c *gRPCClient) Connection() *grpc.ClientConn { +func (c *publisherGRPCClient) Connection() *grpc.ClientConn { return c.connPool.Conn() } // setGoogleClientInfo sets the name and version of the application in // the `x-goog-api-client` header passed on each request. Intended for // use by Google-written clients. -func (c *gRPCClient) setGoogleClientInfo(keyval ...string) { +func (c *publisherGRPCClient) setGoogleClientInfo(keyval ...string) { kv := append([]string{"gl-go", versionGo()}, keyval...) kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version) c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) @@ -249,12 +249,12 @@ func (c *gRPCClient) setGoogleClientInfo(keyval ...string) { // Close closes the connection to the API service. The user should invoke this when // the client is no longer required. -func (c *gRPCClient) Close() error { +func (c *publisherGRPCClient) Close() error { return c.connPool.Close() } // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. -type restClient struct { +type publisherRESTClient struct { // The http endpoint to connect to. endpoint string @@ -264,11 +264,11 @@ type restClient struct { // The x-goog-* metadata to be sent with each request. xGoogMetadata metadata.MD - // Points back to the CallOptions field of the containing Client - CallOptions **CallOptions + // Points back to the CallOptions field of the containing PublisherClient + CallOptions **PublisherCallOptions } -// NewRESTClient creates a new publisher rest client. +// NewPublisherRESTClient creates a new publisher rest client. // // Eventarc processes events generated by an event provider and delivers them to // a subscriber. @@ -294,25 +294,25 @@ type restClient struct { // Channel. // // Publisher allows an event provider to publish events to Eventarc. -func NewRESTClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { - clientOpts := append(defaultRESTClientOptions(), opts...) +func NewPublisherRESTClient(ctx context.Context, opts ...option.ClientOption) (*PublisherClient, error) { + clientOpts := append(defaultPublisherRESTClientOptions(), opts...) httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) if err != nil { return nil, err } - callOpts := defaultRESTCallOptions() - c := &restClient{ + callOpts := defaultPublisherRESTCallOptions() + c := &publisherRESTClient{ endpoint: endpoint, httpClient: httpClient, CallOptions: &callOpts, } c.setGoogleClientInfo() - return &Client{internalClient: c, CallOptions: callOpts}, nil + return &PublisherClient{internalClient: c, CallOptions: callOpts}, nil } -func defaultRESTClientOptions() []option.ClientOption { +func defaultPublisherRESTClientOptions() []option.ClientOption { return []option.ClientOption{ internaloption.WithDefaultEndpoint("https://eventarcpublishing.googleapis.com"), internaloption.WithDefaultMTLSEndpoint("https://eventarcpublishing.mtls.googleapis.com"), @@ -324,7 +324,7 @@ func defaultRESTClientOptions() []option.ClientOption { // setGoogleClientInfo sets the name and version of the application in // the `x-goog-api-client` header passed on each request. Intended for // use by Google-written clients. -func (c *restClient) setGoogleClientInfo(keyval ...string) { +func (c *publisherRESTClient) setGoogleClientInfo(keyval ...string) { kv := append([]string{"gl-go", versionGo()}, keyval...) kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN") c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) @@ -332,7 +332,7 @@ func (c *restClient) setGoogleClientInfo(keyval ...string) { // Close closes the connection to the API service. The user should invoke this when // the client is no longer required. -func (c *restClient) Close() error { +func (c *publisherRESTClient) Close() error { // Replace httpClient with nil to force cleanup. c.httpClient = nil return nil @@ -341,10 +341,10 @@ func (c *restClient) Close() error { // Connection returns a connection to the API service. // // Deprecated: This method always returns nil. -func (c *restClient) Connection() *grpc.ClientConn { +func (c *publisherRESTClient) Connection() *grpc.ClientConn { return nil } -func (c *gRPCClient) PublishChannelConnectionEvents(ctx context.Context, req *publishingpb.PublishChannelConnectionEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishChannelConnectionEventsResponse, error) { +func (c *publisherGRPCClient) PublishChannelConnectionEvents(ctx context.Context, req *publishingpb.PublishChannelConnectionEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishChannelConnectionEventsResponse, error) { if _, ok := ctx.Deadline(); !ok && !c.disableDeadlines { cctx, cancel := context.WithTimeout(ctx, 60000*time.Millisecond) defer cancel() @@ -357,7 +357,7 @@ func (c *gRPCClient) PublishChannelConnectionEvents(ctx context.Context, req *pu var resp *publishingpb.PublishChannelConnectionEventsResponse err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error - resp, err = c.client.PublishChannelConnectionEvents(ctx, req, settings.GRPC...) + resp, err = c.publisherClient.PublishChannelConnectionEvents(ctx, req, settings.GRPC...) return err }, opts...) if err != nil { @@ -366,7 +366,7 @@ func (c *gRPCClient) PublishChannelConnectionEvents(ctx context.Context, req *pu return resp, nil } -func (c *gRPCClient) PublishEvents(ctx context.Context, req *publishingpb.PublishEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishEventsResponse, error) { +func (c *publisherGRPCClient) PublishEvents(ctx context.Context, req *publishingpb.PublishEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishEventsResponse, error) { md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "channel", url.QueryEscape(req.GetChannel()))) ctx = insertMetadata(ctx, c.xGoogMetadata, md) @@ -374,7 +374,7 @@ func (c *gRPCClient) PublishEvents(ctx context.Context, req *publishingpb.Publis var resp *publishingpb.PublishEventsResponse err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { var err error - resp, err = c.client.PublishEvents(ctx, req, settings.GRPC...) + resp, err = c.publisherClient.PublishEvents(ctx, req, settings.GRPC...) return err }, opts...) if err != nil { @@ -384,7 +384,7 @@ func (c *gRPCClient) PublishEvents(ctx context.Context, req *publishingpb.Publis } // PublishChannelConnectionEvents publish events to a ChannelConnection in a partner’s project. -func (c *restClient) PublishChannelConnectionEvents(ctx context.Context, req *publishingpb.PublishChannelConnectionEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishChannelConnectionEventsResponse, error) { +func (c *publisherRESTClient) PublishChannelConnectionEvents(ctx context.Context, req *publishingpb.PublishChannelConnectionEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishChannelConnectionEventsResponse, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) if err != nil { @@ -448,7 +448,7 @@ func (c *restClient) PublishChannelConnectionEvents(ctx context.Context, req *pu } // PublishEvents publish events to a subscriber’s channel. -func (c *restClient) PublishEvents(ctx context.Context, req *publishingpb.PublishEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishEventsResponse, error) { +func (c *publisherRESTClient) PublishEvents(ctx context.Context, req *publishingpb.PublishEventsRequest, opts ...gax.CallOption) (*publishingpb.PublishEventsResponse, error) { m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} jsonReq, err := m.Marshal(req) if err != nil { diff --git a/eventarc/publishing/apiv1/publisher_client_example_test.go b/eventarc/publishing/apiv1/publisher_client_example_test.go index d6c02cee5b1e..e48ab8f3db46 100644 --- a/eventarc/publishing/apiv1/publisher_client_example_test.go +++ b/eventarc/publishing/apiv1/publisher_client_example_test.go @@ -14,23 +14,23 @@ // Code generated by protoc-gen-go_gapic. DO NOT EDIT. -package publisher_test +package publishing_test import ( "context" - publisher "cloud.google.com/go/eventarc/publishing/apiv1" + publishing "cloud.google.com/go/eventarc/publishing/apiv1" publishingpb "cloud.google.com/go/eventarc/publishing/apiv1/publishingpb" ) -func ExampleNewClient() { +func ExampleNewPublisherClient() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options - c, err := publisher.NewClient(ctx) + c, err := publishing.NewPublisherClient(ctx) if err != nil { // TODO: Handle error. } @@ -40,14 +40,14 @@ func ExampleNewClient() { _ = c } -func ExampleNewRESTClient() { +func ExampleNewPublisherRESTClient() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options - c, err := publisher.NewRESTClient(ctx) + c, err := publishing.NewPublisherRESTClient(ctx) if err != nil { // TODO: Handle error. } @@ -57,14 +57,14 @@ func ExampleNewRESTClient() { _ = c } -func ExampleClient_PublishChannelConnectionEvents() { +func ExamplePublisherClient_PublishChannelConnectionEvents() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options - c, err := publisher.NewClient(ctx) + c, err := publishing.NewPublisherClient(ctx) if err != nil { // TODO: Handle error. } @@ -82,14 +82,14 @@ func ExampleClient_PublishChannelConnectionEvents() { _ = resp } -func ExampleClient_PublishEvents() { +func ExamplePublisherClient_PublishEvents() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options - c, err := publisher.NewClient(ctx) + c, err := publishing.NewPublisherClient(ctx) if err != nil { // TODO: Handle error. }