1// Copyright 2021 Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package pubsublite provides access to the Pub/Sub Lite API. 8// 9// For product documentation, see: https://cloud.google.com/pubsub/lite/docs 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/pubsublite/v1" 16// ... 17// ctx := context.Background() 18// pubsubliteService, err := pubsublite.NewService(ctx) 19// 20// In this example, Google Application Default Credentials are used for authentication. 21// 22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23// 24// Other authentication options 25// 26// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 27// 28// pubsubliteService, err := pubsublite.NewService(ctx, option.WithAPIKey("AIza...")) 29// 30// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 31// 32// config := &oauth2.Config{...} 33// // ... 34// token, err := config.Exchange(ctx, ...) 35// pubsubliteService, err := pubsublite.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 36// 37// See https://godoc.org/google.golang.org/api/option/ for details on options. 38package pubsublite // import "google.golang.org/api/pubsublite/v1" 39 40import ( 41 "bytes" 42 "context" 43 "encoding/json" 44 "errors" 45 "fmt" 46 "io" 47 "net/http" 48 "net/url" 49 "strconv" 50 "strings" 51 52 googleapi "google.golang.org/api/googleapi" 53 gensupport "google.golang.org/api/internal/gensupport" 54 option "google.golang.org/api/option" 55 internaloption "google.golang.org/api/option/internaloption" 56 htransport "google.golang.org/api/transport/http" 57) 58 59// Always reference these packages, just in case the auto-generated code 60// below doesn't. 61var _ = bytes.NewBuffer 62var _ = strconv.Itoa 63var _ = fmt.Sprintf 64var _ = json.NewDecoder 65var _ = io.Copy 66var _ = url.Parse 67var _ = gensupport.MarshalJSON 68var _ = googleapi.Version 69var _ = errors.New 70var _ = strings.Replace 71var _ = context.Canceled 72var _ = internaloption.WithDefaultEndpoint 73 74const apiId = "pubsublite:v1" 75const apiName = "pubsublite" 76const apiVersion = "v1" 77const basePath = "https://pubsublite.googleapis.com/" 78const mtlsBasePath = "https://pubsublite.mtls.googleapis.com/" 79 80// OAuth2 scopes used by this API. 81const ( 82 // See, edit, configure, and delete your Google Cloud Platform data 83 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 84) 85 86// NewService creates a new Service. 87func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 88 scopesOption := option.WithScopes( 89 "https://www.googleapis.com/auth/cloud-platform", 90 ) 91 // NOTE: prepend, so we don't override user-specified scopes. 92 opts = append([]option.ClientOption{scopesOption}, opts...) 93 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 94 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 95 client, endpoint, err := htransport.NewClient(ctx, opts...) 96 if err != nil { 97 return nil, err 98 } 99 s, err := New(client) 100 if err != nil { 101 return nil, err 102 } 103 if endpoint != "" { 104 s.BasePath = endpoint 105 } 106 return s, nil 107} 108 109// New creates a new Service. It uses the provided http.Client for requests. 110// 111// Deprecated: please use NewService instead. 112// To provide a custom HTTP client, use option.WithHTTPClient. 113// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 114func New(client *http.Client) (*Service, error) { 115 if client == nil { 116 return nil, errors.New("client is nil") 117 } 118 s := &Service{client: client, BasePath: basePath} 119 s.Admin = NewAdminService(s) 120 s.Cursor = NewCursorService(s) 121 s.TopicStats = NewTopicStatsService(s) 122 return s, nil 123} 124 125type Service struct { 126 client *http.Client 127 BasePath string // API endpoint base URL 128 UserAgent string // optional additional User-Agent fragment 129 130 Admin *AdminService 131 132 Cursor *CursorService 133 134 TopicStats *TopicStatsService 135} 136 137func (s *Service) userAgent() string { 138 if s.UserAgent == "" { 139 return googleapi.UserAgent 140 } 141 return googleapi.UserAgent + " " + s.UserAgent 142} 143 144func NewAdminService(s *Service) *AdminService { 145 rs := &AdminService{s: s} 146 rs.Projects = NewAdminProjectsService(s) 147 return rs 148} 149 150type AdminService struct { 151 s *Service 152 153 Projects *AdminProjectsService 154} 155 156func NewAdminProjectsService(s *Service) *AdminProjectsService { 157 rs := &AdminProjectsService{s: s} 158 rs.Locations = NewAdminProjectsLocationsService(s) 159 return rs 160} 161 162type AdminProjectsService struct { 163 s *Service 164 165 Locations *AdminProjectsLocationsService 166} 167 168func NewAdminProjectsLocationsService(s *Service) *AdminProjectsLocationsService { 169 rs := &AdminProjectsLocationsService{s: s} 170 rs.Subscriptions = NewAdminProjectsLocationsSubscriptionsService(s) 171 rs.Topics = NewAdminProjectsLocationsTopicsService(s) 172 return rs 173} 174 175type AdminProjectsLocationsService struct { 176 s *Service 177 178 Subscriptions *AdminProjectsLocationsSubscriptionsService 179 180 Topics *AdminProjectsLocationsTopicsService 181} 182 183func NewAdminProjectsLocationsSubscriptionsService(s *Service) *AdminProjectsLocationsSubscriptionsService { 184 rs := &AdminProjectsLocationsSubscriptionsService{s: s} 185 return rs 186} 187 188type AdminProjectsLocationsSubscriptionsService struct { 189 s *Service 190} 191 192func NewAdminProjectsLocationsTopicsService(s *Service) *AdminProjectsLocationsTopicsService { 193 rs := &AdminProjectsLocationsTopicsService{s: s} 194 rs.Subscriptions = NewAdminProjectsLocationsTopicsSubscriptionsService(s) 195 return rs 196} 197 198type AdminProjectsLocationsTopicsService struct { 199 s *Service 200 201 Subscriptions *AdminProjectsLocationsTopicsSubscriptionsService 202} 203 204func NewAdminProjectsLocationsTopicsSubscriptionsService(s *Service) *AdminProjectsLocationsTopicsSubscriptionsService { 205 rs := &AdminProjectsLocationsTopicsSubscriptionsService{s: s} 206 return rs 207} 208 209type AdminProjectsLocationsTopicsSubscriptionsService struct { 210 s *Service 211} 212 213func NewCursorService(s *Service) *CursorService { 214 rs := &CursorService{s: s} 215 rs.Projects = NewCursorProjectsService(s) 216 return rs 217} 218 219type CursorService struct { 220 s *Service 221 222 Projects *CursorProjectsService 223} 224 225func NewCursorProjectsService(s *Service) *CursorProjectsService { 226 rs := &CursorProjectsService{s: s} 227 rs.Locations = NewCursorProjectsLocationsService(s) 228 return rs 229} 230 231type CursorProjectsService struct { 232 s *Service 233 234 Locations *CursorProjectsLocationsService 235} 236 237func NewCursorProjectsLocationsService(s *Service) *CursorProjectsLocationsService { 238 rs := &CursorProjectsLocationsService{s: s} 239 rs.Subscriptions = NewCursorProjectsLocationsSubscriptionsService(s) 240 return rs 241} 242 243type CursorProjectsLocationsService struct { 244 s *Service 245 246 Subscriptions *CursorProjectsLocationsSubscriptionsService 247} 248 249func NewCursorProjectsLocationsSubscriptionsService(s *Service) *CursorProjectsLocationsSubscriptionsService { 250 rs := &CursorProjectsLocationsSubscriptionsService{s: s} 251 rs.Cursors = NewCursorProjectsLocationsSubscriptionsCursorsService(s) 252 return rs 253} 254 255type CursorProjectsLocationsSubscriptionsService struct { 256 s *Service 257 258 Cursors *CursorProjectsLocationsSubscriptionsCursorsService 259} 260 261func NewCursorProjectsLocationsSubscriptionsCursorsService(s *Service) *CursorProjectsLocationsSubscriptionsCursorsService { 262 rs := &CursorProjectsLocationsSubscriptionsCursorsService{s: s} 263 return rs 264} 265 266type CursorProjectsLocationsSubscriptionsCursorsService struct { 267 s *Service 268} 269 270func NewTopicStatsService(s *Service) *TopicStatsService { 271 rs := &TopicStatsService{s: s} 272 rs.Projects = NewTopicStatsProjectsService(s) 273 return rs 274} 275 276type TopicStatsService struct { 277 s *Service 278 279 Projects *TopicStatsProjectsService 280} 281 282func NewTopicStatsProjectsService(s *Service) *TopicStatsProjectsService { 283 rs := &TopicStatsProjectsService{s: s} 284 rs.Locations = NewTopicStatsProjectsLocationsService(s) 285 return rs 286} 287 288type TopicStatsProjectsService struct { 289 s *Service 290 291 Locations *TopicStatsProjectsLocationsService 292} 293 294func NewTopicStatsProjectsLocationsService(s *Service) *TopicStatsProjectsLocationsService { 295 rs := &TopicStatsProjectsLocationsService{s: s} 296 rs.Topics = NewTopicStatsProjectsLocationsTopicsService(s) 297 return rs 298} 299 300type TopicStatsProjectsLocationsService struct { 301 s *Service 302 303 Topics *TopicStatsProjectsLocationsTopicsService 304} 305 306func NewTopicStatsProjectsLocationsTopicsService(s *Service) *TopicStatsProjectsLocationsTopicsService { 307 rs := &TopicStatsProjectsLocationsTopicsService{s: s} 308 return rs 309} 310 311type TopicStatsProjectsLocationsTopicsService struct { 312 s *Service 313} 314 315// Capacity: The throughput capacity configuration for each partition. 316type Capacity struct { 317 // PublishMibPerSec: Publish throughput capacity per partition in MiB/s. 318 // Must be >= 4 and <= 16. 319 PublishMibPerSec int64 `json:"publishMibPerSec,omitempty"` 320 321 // SubscribeMibPerSec: Subscribe throughput capacity per partition in 322 // MiB/s. Must be >= 4 and <= 32. 323 SubscribeMibPerSec int64 `json:"subscribeMibPerSec,omitempty"` 324 325 // ForceSendFields is a list of field names (e.g. "PublishMibPerSec") to 326 // unconditionally include in API requests. By default, fields with 327 // empty values are omitted from API requests. However, any non-pointer, 328 // non-interface field appearing in ForceSendFields will be sent to the 329 // server regardless of whether the field is empty or not. This may be 330 // used to include empty fields in Patch requests. 331 ForceSendFields []string `json:"-"` 332 333 // NullFields is a list of field names (e.g. "PublishMibPerSec") to 334 // include in API requests with the JSON null value. By default, fields 335 // with empty values are omitted from API requests. However, any field 336 // with an empty value appearing in NullFields will be sent to the 337 // server as null. It is an error if a field in this list has a 338 // non-empty value. This may be used to include null fields in Patch 339 // requests. 340 NullFields []string `json:"-"` 341} 342 343func (s *Capacity) MarshalJSON() ([]byte, error) { 344 type NoMethod Capacity 345 raw := NoMethod(*s) 346 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 347} 348 349// ComputeHeadCursorRequest: Compute the current head cursor for a 350// partition. 351type ComputeHeadCursorRequest struct { 352 // Partition: Required. The partition for which we should compute the 353 // head cursor. 354 Partition int64 `json:"partition,omitempty,string"` 355 356 // ForceSendFields is a list of field names (e.g. "Partition") to 357 // unconditionally include in API requests. By default, fields with 358 // empty values are omitted from API requests. However, any non-pointer, 359 // non-interface field appearing in ForceSendFields will be sent to the 360 // server regardless of whether the field is empty or not. This may be 361 // used to include empty fields in Patch requests. 362 ForceSendFields []string `json:"-"` 363 364 // NullFields is a list of field names (e.g. "Partition") to include in 365 // API requests with the JSON null value. By default, fields with empty 366 // values are omitted from API requests. However, any field with an 367 // empty value appearing in NullFields will be sent to the server as 368 // null. It is an error if a field in this list has a non-empty value. 369 // This may be used to include null fields in Patch requests. 370 NullFields []string `json:"-"` 371} 372 373func (s *ComputeHeadCursorRequest) MarshalJSON() ([]byte, error) { 374 type NoMethod ComputeHeadCursorRequest 375 raw := NoMethod(*s) 376 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 377} 378 379// ComputeHeadCursorResponse: Response containing the head cursor for 380// the requested topic and partition. 381type ComputeHeadCursorResponse struct { 382 // HeadCursor: The head cursor. 383 HeadCursor *Cursor `json:"headCursor,omitempty"` 384 385 // ServerResponse contains the HTTP response code and headers from the 386 // server. 387 googleapi.ServerResponse `json:"-"` 388 389 // ForceSendFields is a list of field names (e.g. "HeadCursor") to 390 // unconditionally include in API requests. By default, fields with 391 // empty values are omitted from API requests. However, any non-pointer, 392 // non-interface field appearing in ForceSendFields will be sent to the 393 // server regardless of whether the field is empty or not. This may be 394 // used to include empty fields in Patch requests. 395 ForceSendFields []string `json:"-"` 396 397 // NullFields is a list of field names (e.g. "HeadCursor") to include in 398 // API requests with the JSON null value. By default, fields with empty 399 // values are omitted from API requests. However, any field with an 400 // empty value appearing in NullFields will be sent to the server as 401 // null. It is an error if a field in this list has a non-empty value. 402 // This may be used to include null fields in Patch requests. 403 NullFields []string `json:"-"` 404} 405 406func (s *ComputeHeadCursorResponse) MarshalJSON() ([]byte, error) { 407 type NoMethod ComputeHeadCursorResponse 408 raw := NoMethod(*s) 409 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 410} 411 412// ComputeMessageStatsRequest: Compute statistics about a range of 413// messages in a given topic and partition. 414type ComputeMessageStatsRequest struct { 415 // EndCursor: The exclusive end of the range. The range is empty if 416 // end_cursor <= start_cursor. Specifying a start_cursor before the 417 // first message and an end_cursor after the last message will retrieve 418 // all messages. 419 EndCursor *Cursor `json:"endCursor,omitempty"` 420 421 // Partition: Required. The partition for which we should compute 422 // message stats. 423 Partition int64 `json:"partition,omitempty,string"` 424 425 // StartCursor: The inclusive start of the range. 426 StartCursor *Cursor `json:"startCursor,omitempty"` 427 428 // ForceSendFields is a list of field names (e.g. "EndCursor") to 429 // unconditionally include in API requests. By default, fields with 430 // empty values are omitted from API requests. However, any non-pointer, 431 // non-interface field appearing in ForceSendFields will be sent to the 432 // server regardless of whether the field is empty or not. This may be 433 // used to include empty fields in Patch requests. 434 ForceSendFields []string `json:"-"` 435 436 // NullFields is a list of field names (e.g. "EndCursor") to include in 437 // API requests with the JSON null value. By default, fields with empty 438 // values are omitted from API requests. However, any field with an 439 // empty value appearing in NullFields will be sent to the server as 440 // null. It is an error if a field in this list has a non-empty value. 441 // This may be used to include null fields in Patch requests. 442 NullFields []string `json:"-"` 443} 444 445func (s *ComputeMessageStatsRequest) MarshalJSON() ([]byte, error) { 446 type NoMethod ComputeMessageStatsRequest 447 raw := NoMethod(*s) 448 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 449} 450 451// ComputeMessageStatsResponse: Response containing stats for messages 452// in the requested topic and partition. 453type ComputeMessageStatsResponse struct { 454 // MessageBytes: The number of quota bytes accounted to these messages. 455 MessageBytes int64 `json:"messageBytes,omitempty,string"` 456 457 // MessageCount: The count of messages. 458 MessageCount int64 `json:"messageCount,omitempty,string"` 459 460 // MinimumEventTime: The minimum event timestamp across these messages. 461 // For the purposes of this computation, if a message does not have an 462 // event time, we use the publish time. The timestamp will be unset if 463 // there are no messages. 464 MinimumEventTime string `json:"minimumEventTime,omitempty"` 465 466 // MinimumPublishTime: The minimum publish timestamp across these 467 // messages. Note that publish timestamps within a partition are not 468 // guaranteed to be non-decreasing. The timestamp will be unset if there 469 // are no messages. 470 MinimumPublishTime string `json:"minimumPublishTime,omitempty"` 471 472 // ServerResponse contains the HTTP response code and headers from the 473 // server. 474 googleapi.ServerResponse `json:"-"` 475 476 // ForceSendFields is a list of field names (e.g. "MessageBytes") to 477 // unconditionally include in API requests. By default, fields with 478 // empty values are omitted from API requests. However, any non-pointer, 479 // non-interface field appearing in ForceSendFields will be sent to the 480 // server regardless of whether the field is empty or not. This may be 481 // used to include empty fields in Patch requests. 482 ForceSendFields []string `json:"-"` 483 484 // NullFields is a list of field names (e.g. "MessageBytes") to include 485 // in API requests with the JSON null value. By default, fields with 486 // empty values are omitted from API requests. However, any field with 487 // an empty value appearing in NullFields will be sent to the server as 488 // null. It is an error if a field in this list has a non-empty value. 489 // This may be used to include null fields in Patch requests. 490 NullFields []string `json:"-"` 491} 492 493func (s *ComputeMessageStatsResponse) MarshalJSON() ([]byte, error) { 494 type NoMethod ComputeMessageStatsResponse 495 raw := NoMethod(*s) 496 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 497} 498 499// Cursor: A cursor that describes the position of a message within a 500// topic partition. 501type Cursor struct { 502 // Offset: The offset of a message within a topic partition. Must be 503 // greater than or equal 0. 504 Offset int64 `json:"offset,omitempty,string"` 505 506 // ForceSendFields is a list of field names (e.g. "Offset") to 507 // unconditionally include in API requests. By default, fields with 508 // empty values are omitted from API requests. However, any non-pointer, 509 // non-interface field appearing in ForceSendFields will be sent to the 510 // server regardless of whether the field is empty or not. This may be 511 // used to include empty fields in Patch requests. 512 ForceSendFields []string `json:"-"` 513 514 // NullFields is a list of field names (e.g. "Offset") to include in API 515 // requests with the JSON null value. By default, fields with empty 516 // values are omitted from API requests. However, any field with an 517 // empty value appearing in NullFields will be sent to the server as 518 // null. It is an error if a field in this list has a non-empty value. 519 // This may be used to include null fields in Patch requests. 520 NullFields []string `json:"-"` 521} 522 523func (s *Cursor) MarshalJSON() ([]byte, error) { 524 type NoMethod Cursor 525 raw := NoMethod(*s) 526 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 527} 528 529// DeliveryConfig: The settings for a subscription's message delivery. 530type DeliveryConfig struct { 531 // DeliveryRequirement: The DeliveryRequirement for this subscription. 532 // 533 // Possible values: 534 // "DELIVERY_REQUIREMENT_UNSPECIFIED" - Default value. This value is 535 // unused. 536 // "DELIVER_IMMEDIATELY" - The server does not wait for a published 537 // message to be successfully written to storage before delivering it to 538 // subscribers. 539 // "DELIVER_AFTER_STORED" - The server will not deliver a published 540 // message to subscribers until the message has been successfully 541 // written to storage. This will result in higher end-to-end latency, 542 // but consistent delivery. 543 DeliveryRequirement string `json:"deliveryRequirement,omitempty"` 544 545 // ForceSendFields is a list of field names (e.g. "DeliveryRequirement") 546 // to unconditionally include in API requests. By default, fields with 547 // empty values are omitted from API requests. However, any non-pointer, 548 // non-interface field appearing in ForceSendFields will be sent to the 549 // server regardless of whether the field is empty or not. This may be 550 // used to include empty fields in Patch requests. 551 ForceSendFields []string `json:"-"` 552 553 // NullFields is a list of field names (e.g. "DeliveryRequirement") to 554 // include in API requests with the JSON null value. By default, fields 555 // with empty values are omitted from API requests. However, any field 556 // with an empty value appearing in NullFields will be sent to the 557 // server as null. It is an error if a field in this list has a 558 // non-empty value. This may be used to include null fields in Patch 559 // requests. 560 NullFields []string `json:"-"` 561} 562 563func (s *DeliveryConfig) MarshalJSON() ([]byte, error) { 564 type NoMethod DeliveryConfig 565 raw := NoMethod(*s) 566 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 567} 568 569// Empty: A generic empty message that you can re-use to avoid defining 570// duplicated empty messages in your APIs. A typical example is to use 571// it as the request or the response type of an API method. For 572// instance: service Foo { rpc Bar(google.protobuf.Empty) returns 573// (google.protobuf.Empty); } The JSON representation for `Empty` is 574// empty JSON object `{}`. 575type Empty struct { 576 // ServerResponse contains the HTTP response code and headers from the 577 // server. 578 googleapi.ServerResponse `json:"-"` 579} 580 581// ListPartitionCursorsResponse: Response for ListPartitionCursors 582type ListPartitionCursorsResponse struct { 583 // NextPageToken: A token, which can be sent as `page_token` to retrieve 584 // the next page. If this field is omitted, there are no subsequent 585 // pages. 586 NextPageToken string `json:"nextPageToken,omitempty"` 587 588 // PartitionCursors: The partition cursors from this request. 589 PartitionCursors []*PartitionCursor `json:"partitionCursors,omitempty"` 590 591 // ServerResponse contains the HTTP response code and headers from the 592 // server. 593 googleapi.ServerResponse `json:"-"` 594 595 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 596 // unconditionally include in API requests. By default, fields with 597 // empty values are omitted from API requests. However, any non-pointer, 598 // non-interface field appearing in ForceSendFields will be sent to the 599 // server regardless of whether the field is empty or not. This may be 600 // used to include empty fields in Patch requests. 601 ForceSendFields []string `json:"-"` 602 603 // NullFields is a list of field names (e.g. "NextPageToken") to include 604 // in API requests with the JSON null value. By default, fields with 605 // empty values are omitted from API requests. However, any field with 606 // an empty value appearing in NullFields will be sent to the server as 607 // null. It is an error if a field in this list has a non-empty value. 608 // This may be used to include null fields in Patch requests. 609 NullFields []string `json:"-"` 610} 611 612func (s *ListPartitionCursorsResponse) MarshalJSON() ([]byte, error) { 613 type NoMethod ListPartitionCursorsResponse 614 raw := NoMethod(*s) 615 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 616} 617 618// ListSubscriptionsResponse: Response for ListSubscriptions. 619type ListSubscriptionsResponse struct { 620 // NextPageToken: A token that can be sent as `page_token` to retrieve 621 // the next page of results. If this field is omitted, there are no more 622 // results. 623 NextPageToken string `json:"nextPageToken,omitempty"` 624 625 // Subscriptions: The list of subscriptions in the requested parent. The 626 // order of the subscriptions is unspecified. 627 Subscriptions []*Subscription `json:"subscriptions,omitempty"` 628 629 // ServerResponse contains the HTTP response code and headers from the 630 // server. 631 googleapi.ServerResponse `json:"-"` 632 633 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 634 // unconditionally include in API requests. By default, fields with 635 // empty values are omitted from API requests. However, any non-pointer, 636 // non-interface field appearing in ForceSendFields will be sent to the 637 // server regardless of whether the field is empty or not. This may be 638 // used to include empty fields in Patch requests. 639 ForceSendFields []string `json:"-"` 640 641 // NullFields is a list of field names (e.g. "NextPageToken") to include 642 // in API requests with the JSON null value. By default, fields with 643 // empty values are omitted from API requests. However, any field with 644 // an empty value appearing in NullFields will be sent to the server as 645 // null. It is an error if a field in this list has a non-empty value. 646 // This may be used to include null fields in Patch requests. 647 NullFields []string `json:"-"` 648} 649 650func (s *ListSubscriptionsResponse) MarshalJSON() ([]byte, error) { 651 type NoMethod ListSubscriptionsResponse 652 raw := NoMethod(*s) 653 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 654} 655 656// ListTopicSubscriptionsResponse: Response for ListTopicSubscriptions. 657type ListTopicSubscriptionsResponse struct { 658 // NextPageToken: A token that can be sent as `page_token` to retrieve 659 // the next page of results. If this field is omitted, there are no more 660 // results. 661 NextPageToken string `json:"nextPageToken,omitempty"` 662 663 // Subscriptions: The names of subscriptions attached to the topic. The 664 // order of the subscriptions is unspecified. 665 Subscriptions []string `json:"subscriptions,omitempty"` 666 667 // ServerResponse contains the HTTP response code and headers from the 668 // server. 669 googleapi.ServerResponse `json:"-"` 670 671 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 672 // unconditionally include in API requests. By default, fields with 673 // empty values are omitted from API requests. However, any non-pointer, 674 // non-interface field appearing in ForceSendFields will be sent to the 675 // server regardless of whether the field is empty or not. This may be 676 // used to include empty fields in Patch requests. 677 ForceSendFields []string `json:"-"` 678 679 // NullFields is a list of field names (e.g. "NextPageToken") to include 680 // in API requests with the JSON null value. By default, fields with 681 // empty values are omitted from API requests. However, any field with 682 // an empty value appearing in NullFields will be sent to the server as 683 // null. It is an error if a field in this list has a non-empty value. 684 // This may be used to include null fields in Patch requests. 685 NullFields []string `json:"-"` 686} 687 688func (s *ListTopicSubscriptionsResponse) MarshalJSON() ([]byte, error) { 689 type NoMethod ListTopicSubscriptionsResponse 690 raw := NoMethod(*s) 691 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 692} 693 694// ListTopicsResponse: Response for ListTopics. 695type ListTopicsResponse struct { 696 // NextPageToken: A token that can be sent as `page_token` to retrieve 697 // the next page of results. If this field is omitted, there are no more 698 // results. 699 NextPageToken string `json:"nextPageToken,omitempty"` 700 701 // Topics: The list of topic in the requested parent. The order of the 702 // topics is unspecified. 703 Topics []*Topic `json:"topics,omitempty"` 704 705 // ServerResponse contains the HTTP response code and headers from the 706 // server. 707 googleapi.ServerResponse `json:"-"` 708 709 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 710 // unconditionally include in API requests. By default, fields with 711 // empty values are omitted from API requests. However, any non-pointer, 712 // non-interface field appearing in ForceSendFields will be sent to the 713 // server regardless of whether the field is empty or not. This may be 714 // used to include empty fields in Patch requests. 715 ForceSendFields []string `json:"-"` 716 717 // NullFields is a list of field names (e.g. "NextPageToken") to include 718 // in API requests with the JSON null value. By default, fields with 719 // empty values are omitted from API requests. However, any field with 720 // an empty value appearing in NullFields will be sent to the server as 721 // null. It is an error if a field in this list has a non-empty value. 722 // This may be used to include null fields in Patch requests. 723 NullFields []string `json:"-"` 724} 725 726func (s *ListTopicsResponse) MarshalJSON() ([]byte, error) { 727 type NoMethod ListTopicsResponse 728 raw := NoMethod(*s) 729 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 730} 731 732// PartitionConfig: The settings for a topic's partitions. 733type PartitionConfig struct { 734 // Capacity: The capacity configuration. 735 Capacity *Capacity `json:"capacity,omitempty"` 736 737 // Count: The number of partitions in the topic. Must be at least 1. 738 // Once a topic has been created the number of partitions can be 739 // increased but not decreased. Message ordering is not guaranteed 740 // across a topic resize. For more information see 741 // https://cloud.google.com/pubsub/lite/docs/topics#scaling_capacity 742 Count int64 `json:"count,omitempty,string"` 743 744 // Scale: DEPRECATED: Use capacity instead which can express a superset 745 // of configurations. Every partition in the topic is allocated 746 // throughput equivalent to `scale` times the standard partition 747 // throughput (4 MiB/s). This is also reflected in the cost of this 748 // topic; a topic with `scale` of 2 and count of 10 is charged for 20 749 // partitions. This value must be in the range [1,4]. 750 Scale int64 `json:"scale,omitempty"` 751 752 // ForceSendFields is a list of field names (e.g. "Capacity") to 753 // unconditionally include in API requests. By default, fields with 754 // empty values are omitted from API requests. However, any non-pointer, 755 // non-interface field appearing in ForceSendFields will be sent to the 756 // server regardless of whether the field is empty or not. This may be 757 // used to include empty fields in Patch requests. 758 ForceSendFields []string `json:"-"` 759 760 // NullFields is a list of field names (e.g. "Capacity") to include in 761 // API requests with the JSON null value. By default, fields with empty 762 // values are omitted from API requests. However, any field with an 763 // empty value appearing in NullFields will be sent to the server as 764 // null. It is an error if a field in this list has a non-empty value. 765 // This may be used to include null fields in Patch requests. 766 NullFields []string `json:"-"` 767} 768 769func (s *PartitionConfig) MarshalJSON() ([]byte, error) { 770 type NoMethod PartitionConfig 771 raw := NoMethod(*s) 772 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 773} 774 775// PartitionCursor: A pair of a Cursor and the partition it is for. 776type PartitionCursor struct { 777 // Cursor: The value of the cursor. 778 Cursor *Cursor `json:"cursor,omitempty"` 779 780 // Partition: The partition this is for. 781 Partition int64 `json:"partition,omitempty,string"` 782 783 // ForceSendFields is a list of field names (e.g. "Cursor") to 784 // unconditionally include in API requests. By default, fields with 785 // empty values are omitted from API requests. However, any non-pointer, 786 // non-interface field appearing in ForceSendFields will be sent to the 787 // server regardless of whether the field is empty or not. This may be 788 // used to include empty fields in Patch requests. 789 ForceSendFields []string `json:"-"` 790 791 // NullFields is a list of field names (e.g. "Cursor") to include in API 792 // requests with the JSON null value. By default, fields with empty 793 // values are omitted from API requests. However, any field with an 794 // empty value appearing in NullFields will be sent to the server as 795 // null. It is an error if a field in this list has a non-empty value. 796 // This may be used to include null fields in Patch requests. 797 NullFields []string `json:"-"` 798} 799 800func (s *PartitionCursor) MarshalJSON() ([]byte, error) { 801 type NoMethod PartitionCursor 802 raw := NoMethod(*s) 803 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 804} 805 806// RetentionConfig: The settings for a topic's message retention. 807type RetentionConfig struct { 808 // PerPartitionBytes: The provisioned storage, in bytes, per partition. 809 // If the number of bytes stored in any of the topic's partitions grows 810 // beyond this value, older messages will be dropped to make room for 811 // newer ones, regardless of the value of `period`. 812 PerPartitionBytes int64 `json:"perPartitionBytes,omitempty,string"` 813 814 // Period: How long a published message is retained. If unset, messages 815 // will be retained as long as the bytes retained for each partition is 816 // below `per_partition_bytes`. 817 Period string `json:"period,omitempty"` 818 819 // ForceSendFields is a list of field names (e.g. "PerPartitionBytes") 820 // to unconditionally include in API requests. By default, fields with 821 // empty values are omitted from API requests. However, any non-pointer, 822 // non-interface field appearing in ForceSendFields will be sent to the 823 // server regardless of whether the field is empty or not. This may be 824 // used to include empty fields in Patch requests. 825 ForceSendFields []string `json:"-"` 826 827 // NullFields is a list of field names (e.g. "PerPartitionBytes") to 828 // include in API requests with the JSON null value. By default, fields 829 // with empty values are omitted from API requests. However, any field 830 // with an empty value appearing in NullFields will be sent to the 831 // server as null. It is an error if a field in this list has a 832 // non-empty value. This may be used to include null fields in Patch 833 // requests. 834 NullFields []string `json:"-"` 835} 836 837func (s *RetentionConfig) MarshalJSON() ([]byte, error) { 838 type NoMethod RetentionConfig 839 raw := NoMethod(*s) 840 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 841} 842 843// Subscription: Metadata about a subscription resource. 844type Subscription struct { 845 // DeliveryConfig: The settings for this subscription's message 846 // delivery. 847 DeliveryConfig *DeliveryConfig `json:"deliveryConfig,omitempty"` 848 849 // Name: The name of the subscription. Structured like: 850 // projects/{project_number}/locations/{location}/subscriptions/{subscrip 851 // tion_id} 852 Name string `json:"name,omitempty"` 853 854 // Topic: The name of the topic this subscription is attached to. 855 // Structured like: 856 // projects/{project_number}/locations/{location}/topics/{topic_id} 857 Topic string `json:"topic,omitempty"` 858 859 // ServerResponse contains the HTTP response code and headers from the 860 // server. 861 googleapi.ServerResponse `json:"-"` 862 863 // ForceSendFields is a list of field names (e.g. "DeliveryConfig") to 864 // unconditionally include in API requests. By default, fields with 865 // empty values are omitted from API requests. However, any non-pointer, 866 // non-interface field appearing in ForceSendFields will be sent to the 867 // server regardless of whether the field is empty or not. This may be 868 // used to include empty fields in Patch requests. 869 ForceSendFields []string `json:"-"` 870 871 // NullFields is a list of field names (e.g. "DeliveryConfig") to 872 // include in API requests with the JSON null value. By default, fields 873 // with empty values are omitted from API requests. However, any field 874 // with an empty value appearing in NullFields will be sent to the 875 // server as null. It is an error if a field in this list has a 876 // non-empty value. This may be used to include null fields in Patch 877 // requests. 878 NullFields []string `json:"-"` 879} 880 881func (s *Subscription) MarshalJSON() ([]byte, error) { 882 type NoMethod Subscription 883 raw := NoMethod(*s) 884 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 885} 886 887// Topic: Metadata about a topic resource. 888type Topic struct { 889 // Name: The name of the topic. Structured like: 890 // projects/{project_number}/locations/{location}/topics/{topic_id} 891 Name string `json:"name,omitempty"` 892 893 // PartitionConfig: The settings for this topic's partitions. 894 PartitionConfig *PartitionConfig `json:"partitionConfig,omitempty"` 895 896 // RetentionConfig: The settings for this topic's message retention. 897 RetentionConfig *RetentionConfig `json:"retentionConfig,omitempty"` 898 899 // ServerResponse contains the HTTP response code and headers from the 900 // server. 901 googleapi.ServerResponse `json:"-"` 902 903 // ForceSendFields is a list of field names (e.g. "Name") to 904 // unconditionally include in API requests. By default, fields with 905 // empty values are omitted from API requests. However, any non-pointer, 906 // non-interface field appearing in ForceSendFields will be sent to the 907 // server regardless of whether the field is empty or not. This may be 908 // used to include empty fields in Patch requests. 909 ForceSendFields []string `json:"-"` 910 911 // NullFields is a list of field names (e.g. "Name") to include in API 912 // requests with the JSON null value. By default, fields with empty 913 // values are omitted from API requests. However, any field with an 914 // empty value appearing in NullFields will be sent to the server as 915 // null. It is an error if a field in this list has a non-empty value. 916 // This may be used to include null fields in Patch requests. 917 NullFields []string `json:"-"` 918} 919 920func (s *Topic) MarshalJSON() ([]byte, error) { 921 type NoMethod Topic 922 raw := NoMethod(*s) 923 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 924} 925 926// TopicPartitions: Response for GetTopicPartitions. 927type TopicPartitions struct { 928 // PartitionCount: The number of partitions in the topic. 929 PartitionCount int64 `json:"partitionCount,omitempty,string"` 930 931 // ServerResponse contains the HTTP response code and headers from the 932 // server. 933 googleapi.ServerResponse `json:"-"` 934 935 // ForceSendFields is a list of field names (e.g. "PartitionCount") to 936 // unconditionally include in API requests. By default, fields with 937 // empty values are omitted from API requests. However, any non-pointer, 938 // non-interface field appearing in ForceSendFields will be sent to the 939 // server regardless of whether the field is empty or not. This may be 940 // used to include empty fields in Patch requests. 941 ForceSendFields []string `json:"-"` 942 943 // NullFields is a list of field names (e.g. "PartitionCount") to 944 // include in API requests with the JSON null value. By default, fields 945 // with empty values are omitted from API requests. However, any field 946 // with an empty value appearing in NullFields will be sent to the 947 // server as null. It is an error if a field in this list has a 948 // non-empty value. This may be used to include null fields in Patch 949 // requests. 950 NullFields []string `json:"-"` 951} 952 953func (s *TopicPartitions) MarshalJSON() ([]byte, error) { 954 type NoMethod TopicPartitions 955 raw := NoMethod(*s) 956 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 957} 958 959// method id "pubsublite.admin.projects.locations.subscriptions.create": 960 961type AdminProjectsLocationsSubscriptionsCreateCall struct { 962 s *Service 963 parent string 964 subscription *Subscription 965 urlParams_ gensupport.URLParams 966 ctx_ context.Context 967 header_ http.Header 968} 969 970// Create: Creates a new subscription. 971// 972// - parent: The parent location in which to create the subscription. 973// Structured like `projects/{project_number}/locations/{location}`. 974func (r *AdminProjectsLocationsSubscriptionsService) Create(parent string, subscription *Subscription) *AdminProjectsLocationsSubscriptionsCreateCall { 975 c := &AdminProjectsLocationsSubscriptionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 976 c.parent = parent 977 c.subscription = subscription 978 return c 979} 980 981// SkipBacklog sets the optional parameter "skipBacklog": If true, the 982// newly created subscription will only receive messages published after 983// the subscription was created. Otherwise, the entire message backlog 984// will be received on the subscription. Defaults to false. 985func (c *AdminProjectsLocationsSubscriptionsCreateCall) SkipBacklog(skipBacklog bool) *AdminProjectsLocationsSubscriptionsCreateCall { 986 c.urlParams_.Set("skipBacklog", fmt.Sprint(skipBacklog)) 987 return c 988} 989 990// SubscriptionId sets the optional parameter "subscriptionId": 991// Required. The ID to use for the subscription, which will become the 992// final component of the subscription's name. This value is structured 993// like: `my-sub-name`. 994func (c *AdminProjectsLocationsSubscriptionsCreateCall) SubscriptionId(subscriptionId string) *AdminProjectsLocationsSubscriptionsCreateCall { 995 c.urlParams_.Set("subscriptionId", subscriptionId) 996 return c 997} 998 999// Fields allows partial responses to be retrieved. See 1000// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1001// for more information. 1002func (c *AdminProjectsLocationsSubscriptionsCreateCall) Fields(s ...googleapi.Field) *AdminProjectsLocationsSubscriptionsCreateCall { 1003 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1004 return c 1005} 1006 1007// Context sets the context to be used in this call's Do method. Any 1008// pending HTTP request will be aborted if the provided context is 1009// canceled. 1010func (c *AdminProjectsLocationsSubscriptionsCreateCall) Context(ctx context.Context) *AdminProjectsLocationsSubscriptionsCreateCall { 1011 c.ctx_ = ctx 1012 return c 1013} 1014 1015// Header returns an http.Header that can be modified by the caller to 1016// add HTTP headers to the request. 1017func (c *AdminProjectsLocationsSubscriptionsCreateCall) Header() http.Header { 1018 if c.header_ == nil { 1019 c.header_ = make(http.Header) 1020 } 1021 return c.header_ 1022} 1023 1024func (c *AdminProjectsLocationsSubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) { 1025 reqHeaders := make(http.Header) 1026 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 1027 for k, v := range c.header_ { 1028 reqHeaders[k] = v 1029 } 1030 reqHeaders.Set("User-Agent", c.s.userAgent()) 1031 var body io.Reader = nil 1032 body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription) 1033 if err != nil { 1034 return nil, err 1035 } 1036 reqHeaders.Set("Content-Type", "application/json") 1037 c.urlParams_.Set("alt", alt) 1038 c.urlParams_.Set("prettyPrint", "false") 1039 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/admin/{+parent}/subscriptions") 1040 urls += "?" + c.urlParams_.Encode() 1041 req, err := http.NewRequest("POST", urls, body) 1042 if err != nil { 1043 return nil, err 1044 } 1045 req.Header = reqHeaders 1046 googleapi.Expand(req.URL, map[string]string{ 1047 "parent": c.parent, 1048 }) 1049 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1050} 1051 1052// Do executes the "pubsublite.admin.projects.locations.subscriptions.create" call. 1053// Exactly one of *Subscription or error will be non-nil. Any non-2xx 1054// status code is an error. Response headers are in either 1055// *Subscription.ServerResponse.Header or (if a response was returned at 1056// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1057// to check whether the returned error was because 1058// http.StatusNotModified was returned. 1059func (c *AdminProjectsLocationsSubscriptionsCreateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) { 1060 gensupport.SetOptions(c.urlParams_, opts...) 1061 res, err := c.doRequest("json") 1062 if res != nil && res.StatusCode == http.StatusNotModified { 1063 if res.Body != nil { 1064 res.Body.Close() 1065 } 1066 return nil, &googleapi.Error{ 1067 Code: res.StatusCode, 1068 Header: res.Header, 1069 } 1070 } 1071 if err != nil { 1072 return nil, err 1073 } 1074 defer googleapi.CloseBody(res) 1075 if err := googleapi.CheckResponse(res); err != nil { 1076 return nil, err 1077 } 1078 ret := &Subscription{ 1079 ServerResponse: googleapi.ServerResponse{ 1080 Header: res.Header, 1081 HTTPStatusCode: res.StatusCode, 1082 }, 1083 } 1084 target := &ret 1085 if err := gensupport.DecodeResponse(target, res); err != nil { 1086 return nil, err 1087 } 1088 return ret, nil 1089 // { 1090 // "description": "Creates a new subscription.", 1091 // "flatPath": "v1/admin/projects/{projectsId}/locations/{locationsId}/subscriptions", 1092 // "httpMethod": "POST", 1093 // "id": "pubsublite.admin.projects.locations.subscriptions.create", 1094 // "parameterOrder": [ 1095 // "parent" 1096 // ], 1097 // "parameters": { 1098 // "parent": { 1099 // "description": "Required. The parent location in which to create the subscription. Structured like `projects/{project_number}/locations/{location}`.", 1100 // "location": "path", 1101 // "pattern": "^projects/[^/]+/locations/[^/]+$", 1102 // "required": true, 1103 // "type": "string" 1104 // }, 1105 // "skipBacklog": { 1106 // "description": "If true, the newly created subscription will only receive messages published after the subscription was created. Otherwise, the entire message backlog will be received on the subscription. Defaults to false.", 1107 // "location": "query", 1108 // "type": "boolean" 1109 // }, 1110 // "subscriptionId": { 1111 // "description": "Required. The ID to use for the subscription, which will become the final component of the subscription's name. This value is structured like: `my-sub-name`.", 1112 // "location": "query", 1113 // "type": "string" 1114 // } 1115 // }, 1116 // "path": "v1/admin/{+parent}/subscriptions", 1117 // "request": { 1118 // "$ref": "Subscription" 1119 // }, 1120 // "response": { 1121 // "$ref": "Subscription" 1122 // }, 1123 // "scopes": [ 1124 // "https://www.googleapis.com/auth/cloud-platform" 1125 // ] 1126 // } 1127 1128} 1129 1130// method id "pubsublite.admin.projects.locations.subscriptions.delete": 1131 1132type AdminProjectsLocationsSubscriptionsDeleteCall struct { 1133 s *Service 1134 name string 1135 urlParams_ gensupport.URLParams 1136 ctx_ context.Context 1137 header_ http.Header 1138} 1139 1140// Delete: Deletes the specified subscription. 1141// 1142// - name: The name of the subscription to delete. 1143func (r *AdminProjectsLocationsSubscriptionsService) Delete(name string) *AdminProjectsLocationsSubscriptionsDeleteCall { 1144 c := &AdminProjectsLocationsSubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1145 c.name = name 1146 return c 1147} 1148 1149// Fields allows partial responses to be retrieved. See 1150// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1151// for more information. 1152func (c *AdminProjectsLocationsSubscriptionsDeleteCall) Fields(s ...googleapi.Field) *AdminProjectsLocationsSubscriptionsDeleteCall { 1153 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1154 return c 1155} 1156 1157// Context sets the context to be used in this call's Do method. Any 1158// pending HTTP request will be aborted if the provided context is 1159// canceled. 1160func (c *AdminProjectsLocationsSubscriptionsDeleteCall) Context(ctx context.Context) *AdminProjectsLocationsSubscriptionsDeleteCall { 1161 c.ctx_ = ctx 1162 return c 1163} 1164 1165// Header returns an http.Header that can be modified by the caller to 1166// add HTTP headers to the request. 1167func (c *AdminProjectsLocationsSubscriptionsDeleteCall) Header() http.Header { 1168 if c.header_ == nil { 1169 c.header_ = make(http.Header) 1170 } 1171 return c.header_ 1172} 1173 1174func (c *AdminProjectsLocationsSubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) { 1175 reqHeaders := make(http.Header) 1176 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 1177 for k, v := range c.header_ { 1178 reqHeaders[k] = v 1179 } 1180 reqHeaders.Set("User-Agent", c.s.userAgent()) 1181 var body io.Reader = nil 1182 c.urlParams_.Set("alt", alt) 1183 c.urlParams_.Set("prettyPrint", "false") 1184 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/admin/{+name}") 1185 urls += "?" + c.urlParams_.Encode() 1186 req, err := http.NewRequest("DELETE", urls, body) 1187 if err != nil { 1188 return nil, err 1189 } 1190 req.Header = reqHeaders 1191 googleapi.Expand(req.URL, map[string]string{ 1192 "name": c.name, 1193 }) 1194 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1195} 1196 1197// Do executes the "pubsublite.admin.projects.locations.subscriptions.delete" call. 1198// Exactly one of *Empty or error will be non-nil. Any non-2xx status 1199// code is an error. Response headers are in either 1200// *Empty.ServerResponse.Header or (if a response was returned at all) 1201// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1202// check whether the returned error was because http.StatusNotModified 1203// was returned. 1204func (c *AdminProjectsLocationsSubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1205 gensupport.SetOptions(c.urlParams_, opts...) 1206 res, err := c.doRequest("json") 1207 if res != nil && res.StatusCode == http.StatusNotModified { 1208 if res.Body != nil { 1209 res.Body.Close() 1210 } 1211 return nil, &googleapi.Error{ 1212 Code: res.StatusCode, 1213 Header: res.Header, 1214 } 1215 } 1216 if err != nil { 1217 return nil, err 1218 } 1219 defer googleapi.CloseBody(res) 1220 if err := googleapi.CheckResponse(res); err != nil { 1221 return nil, err 1222 } 1223 ret := &Empty{ 1224 ServerResponse: googleapi.ServerResponse{ 1225 Header: res.Header, 1226 HTTPStatusCode: res.StatusCode, 1227 }, 1228 } 1229 target := &ret 1230 if err := gensupport.DecodeResponse(target, res); err != nil { 1231 return nil, err 1232 } 1233 return ret, nil 1234 // { 1235 // "description": "Deletes the specified subscription.", 1236 // "flatPath": "v1/admin/projects/{projectsId}/locations/{locationsId}/subscriptions/{subscriptionsId}", 1237 // "httpMethod": "DELETE", 1238 // "id": "pubsublite.admin.projects.locations.subscriptions.delete", 1239 // "parameterOrder": [ 1240 // "name" 1241 // ], 1242 // "parameters": { 1243 // "name": { 1244 // "description": "Required. The name of the subscription to delete.", 1245 // "location": "path", 1246 // "pattern": "^projects/[^/]+/locations/[^/]+/subscriptions/[^/]+$", 1247 // "required": true, 1248 // "type": "string" 1249 // } 1250 // }, 1251 // "path": "v1/admin/{+name}", 1252 // "response": { 1253 // "$ref": "Empty" 1254 // }, 1255 // "scopes": [ 1256 // "https://www.googleapis.com/auth/cloud-platform" 1257 // ] 1258 // } 1259 1260} 1261 1262// method id "pubsublite.admin.projects.locations.subscriptions.get": 1263 1264type AdminProjectsLocationsSubscriptionsGetCall struct { 1265 s *Service 1266 name string 1267 urlParams_ gensupport.URLParams 1268 ifNoneMatch_ string 1269 ctx_ context.Context 1270 header_ http.Header 1271} 1272 1273// Get: Returns the subscription configuration. 1274// 1275// - name: The name of the subscription whose configuration to return. 1276func (r *AdminProjectsLocationsSubscriptionsService) Get(name string) *AdminProjectsLocationsSubscriptionsGetCall { 1277 c := &AdminProjectsLocationsSubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1278 c.name = name 1279 return c 1280} 1281 1282// Fields allows partial responses to be retrieved. See 1283// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1284// for more information. 1285func (c *AdminProjectsLocationsSubscriptionsGetCall) Fields(s ...googleapi.Field) *AdminProjectsLocationsSubscriptionsGetCall { 1286 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1287 return c 1288} 1289 1290// IfNoneMatch sets the optional parameter which makes the operation 1291// fail if the object's ETag matches the given value. This is useful for 1292// getting updates only after the object has changed since the last 1293// request. Use googleapi.IsNotModified to check whether the response 1294// error from Do is the result of In-None-Match. 1295func (c *AdminProjectsLocationsSubscriptionsGetCall) IfNoneMatch(entityTag string) *AdminProjectsLocationsSubscriptionsGetCall { 1296 c.ifNoneMatch_ = entityTag 1297 return c 1298} 1299 1300// Context sets the context to be used in this call's Do method. Any 1301// pending HTTP request will be aborted if the provided context is 1302// canceled. 1303func (c *AdminProjectsLocationsSubscriptionsGetCall) Context(ctx context.Context) *AdminProjectsLocationsSubscriptionsGetCall { 1304 c.ctx_ = ctx 1305 return c 1306} 1307 1308// Header returns an http.Header that can be modified by the caller to 1309// add HTTP headers to the request. 1310func (c *AdminProjectsLocationsSubscriptionsGetCall) Header() http.Header { 1311 if c.header_ == nil { 1312 c.header_ = make(http.Header) 1313 } 1314 return c.header_ 1315} 1316 1317func (c *AdminProjectsLocationsSubscriptionsGetCall) doRequest(alt string) (*http.Response, error) { 1318 reqHeaders := make(http.Header) 1319 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 1320 for k, v := range c.header_ { 1321 reqHeaders[k] = v 1322 } 1323 reqHeaders.Set("User-Agent", c.s.userAgent()) 1324 if c.ifNoneMatch_ != "" { 1325 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1326 } 1327 var body io.Reader = nil 1328 c.urlParams_.Set("alt", alt) 1329 c.urlParams_.Set("prettyPrint", "false") 1330 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/admin/{+name}") 1331 urls += "?" + c.urlParams_.Encode() 1332 req, err := http.NewRequest("GET", urls, body) 1333 if err != nil { 1334 return nil, err 1335 } 1336 req.Header = reqHeaders 1337 googleapi.Expand(req.URL, map[string]string{ 1338 "name": c.name, 1339 }) 1340 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1341} 1342 1343// Do executes the "pubsublite.admin.projects.locations.subscriptions.get" call. 1344// Exactly one of *Subscription or error will be non-nil. Any non-2xx 1345// status code is an error. Response headers are in either 1346// *Subscription.ServerResponse.Header or (if a response was returned at 1347// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1348// to check whether the returned error was because 1349// http.StatusNotModified was returned. 1350func (c *AdminProjectsLocationsSubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) { 1351 gensupport.SetOptions(c.urlParams_, opts...) 1352 res, err := c.doRequest("json") 1353 if res != nil && res.StatusCode == http.StatusNotModified { 1354 if res.Body != nil { 1355 res.Body.Close() 1356 } 1357 return nil, &googleapi.Error{ 1358 Code: res.StatusCode, 1359 Header: res.Header, 1360 } 1361 } 1362 if err != nil { 1363 return nil, err 1364 } 1365 defer googleapi.CloseBody(res) 1366 if err := googleapi.CheckResponse(res); err != nil { 1367 return nil, err 1368 } 1369 ret := &Subscription{ 1370 ServerResponse: googleapi.ServerResponse{ 1371 Header: res.Header, 1372 HTTPStatusCode: res.StatusCode, 1373 }, 1374 } 1375 target := &ret 1376 if err := gensupport.DecodeResponse(target, res); err != nil { 1377 return nil, err 1378 } 1379 return ret, nil 1380 // { 1381 // "description": "Returns the subscription configuration.", 1382 // "flatPath": "v1/admin/projects/{projectsId}/locations/{locationsId}/subscriptions/{subscriptionsId}", 1383 // "httpMethod": "GET", 1384 // "id": "pubsublite.admin.projects.locations.subscriptions.get", 1385 // "parameterOrder": [ 1386 // "name" 1387 // ], 1388 // "parameters": { 1389 // "name": { 1390 // "description": "Required. The name of the subscription whose configuration to return.", 1391 // "location": "path", 1392 // "pattern": "^projects/[^/]+/locations/[^/]+/subscriptions/[^/]+$", 1393 // "required": true, 1394 // "type": "string" 1395 // } 1396 // }, 1397 // "path": "v1/admin/{+name}", 1398 // "response": { 1399 // "$ref": "Subscription" 1400 // }, 1401 // "scopes": [ 1402 // "https://www.googleapis.com/auth/cloud-platform" 1403 // ] 1404 // } 1405 1406} 1407 1408// method id "pubsublite.admin.projects.locations.subscriptions.list": 1409 1410type AdminProjectsLocationsSubscriptionsListCall struct { 1411 s *Service 1412 parent string 1413 urlParams_ gensupport.URLParams 1414 ifNoneMatch_ string 1415 ctx_ context.Context 1416 header_ http.Header 1417} 1418 1419// List: Returns the list of subscriptions for the given project. 1420// 1421// - parent: The parent whose subscriptions are to be listed. Structured 1422// like `projects/{project_number}/locations/{location}`. 1423func (r *AdminProjectsLocationsSubscriptionsService) List(parent string) *AdminProjectsLocationsSubscriptionsListCall { 1424 c := &AdminProjectsLocationsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1425 c.parent = parent 1426 return c 1427} 1428 1429// PageSize sets the optional parameter "pageSize": The maximum number 1430// of subscriptions to return. The service may return fewer than this 1431// value. If unset or zero, all subscriptions for the parent will be 1432// returned. 1433func (c *AdminProjectsLocationsSubscriptionsListCall) PageSize(pageSize int64) *AdminProjectsLocationsSubscriptionsListCall { 1434 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1435 return c 1436} 1437 1438// PageToken sets the optional parameter "pageToken": A page token, 1439// received from a previous `ListSubscriptions` call. Provide this to 1440// retrieve the subsequent page. When paginating, all other parameters 1441// provided to `ListSubscriptions` must match the call that provided the 1442// page token. 1443func (c *AdminProjectsLocationsSubscriptionsListCall) PageToken(pageToken string) *AdminProjectsLocationsSubscriptionsListCall { 1444 c.urlParams_.Set("pageToken", pageToken) 1445 return c 1446} 1447 1448// Fields allows partial responses to be retrieved. See 1449// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1450// for more information. 1451func (c *AdminProjectsLocationsSubscriptionsListCall) Fields(s ...googleapi.Field) *AdminProjectsLocationsSubscriptionsListCall { 1452 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1453 return c 1454} 1455 1456// IfNoneMatch sets the optional parameter which makes the operation 1457// fail if the object's ETag matches the given value. This is useful for 1458// getting updates only after the object has changed since the last 1459// request. Use googleapi.IsNotModified to check whether the response 1460// error from Do is the result of In-None-Match. 1461func (c *AdminProjectsLocationsSubscriptionsListCall) IfNoneMatch(entityTag string) *AdminProjectsLocationsSubscriptionsListCall { 1462 c.ifNoneMatch_ = entityTag 1463 return c 1464} 1465 1466// Context sets the context to be used in this call's Do method. Any 1467// pending HTTP request will be aborted if the provided context is 1468// canceled. 1469func (c *AdminProjectsLocationsSubscriptionsListCall) Context(ctx context.Context) *AdminProjectsLocationsSubscriptionsListCall { 1470 c.ctx_ = ctx 1471 return c 1472} 1473 1474// Header returns an http.Header that can be modified by the caller to 1475// add HTTP headers to the request. 1476func (c *AdminProjectsLocationsSubscriptionsListCall) Header() http.Header { 1477 if c.header_ == nil { 1478 c.header_ = make(http.Header) 1479 } 1480 return c.header_ 1481} 1482 1483func (c *AdminProjectsLocationsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) { 1484 reqHeaders := make(http.Header) 1485 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 1486 for k, v := range c.header_ { 1487 reqHeaders[k] = v 1488 } 1489 reqHeaders.Set("User-Agent", c.s.userAgent()) 1490 if c.ifNoneMatch_ != "" { 1491 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1492 } 1493 var body io.Reader = nil 1494 c.urlParams_.Set("alt", alt) 1495 c.urlParams_.Set("prettyPrint", "false") 1496 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/admin/{+parent}/subscriptions") 1497 urls += "?" + c.urlParams_.Encode() 1498 req, err := http.NewRequest("GET", urls, body) 1499 if err != nil { 1500 return nil, err 1501 } 1502 req.Header = reqHeaders 1503 googleapi.Expand(req.URL, map[string]string{ 1504 "parent": c.parent, 1505 }) 1506 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1507} 1508 1509// Do executes the "pubsublite.admin.projects.locations.subscriptions.list" call. 1510// Exactly one of *ListSubscriptionsResponse or error will be non-nil. 1511// Any non-2xx status code is an error. Response headers are in either 1512// *ListSubscriptionsResponse.ServerResponse.Header or (if a response 1513// was returned at all) in error.(*googleapi.Error).Header. Use 1514// googleapi.IsNotModified to check whether the returned error was 1515// because http.StatusNotModified was returned. 1516func (c *AdminProjectsLocationsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListSubscriptionsResponse, error) { 1517 gensupport.SetOptions(c.urlParams_, opts...) 1518 res, err := c.doRequest("json") 1519 if res != nil && res.StatusCode == http.StatusNotModified { 1520 if res.Body != nil { 1521 res.Body.Close() 1522 } 1523 return nil, &googleapi.Error{ 1524 Code: res.StatusCode, 1525 Header: res.Header, 1526 } 1527 } 1528 if err != nil { 1529 return nil, err 1530 } 1531 defer googleapi.CloseBody(res) 1532 if err := googleapi.CheckResponse(res); err != nil { 1533 return nil, err 1534 } 1535 ret := &ListSubscriptionsResponse{ 1536 ServerResponse: googleapi.ServerResponse{ 1537 Header: res.Header, 1538 HTTPStatusCode: res.StatusCode, 1539 }, 1540 } 1541 target := &ret 1542 if err := gensupport.DecodeResponse(target, res); err != nil { 1543 return nil, err 1544 } 1545 return ret, nil 1546 // { 1547 // "description": "Returns the list of subscriptions for the given project.", 1548 // "flatPath": "v1/admin/projects/{projectsId}/locations/{locationsId}/subscriptions", 1549 // "httpMethod": "GET", 1550 // "id": "pubsublite.admin.projects.locations.subscriptions.list", 1551 // "parameterOrder": [ 1552 // "parent" 1553 // ], 1554 // "parameters": { 1555 // "pageSize": { 1556 // "description": "The maximum number of subscriptions to return. The service may return fewer than this value. If unset or zero, all subscriptions for the parent will be returned.", 1557 // "format": "int32", 1558 // "location": "query", 1559 // "type": "integer" 1560 // }, 1561 // "pageToken": { 1562 // "description": "A page token, received from a previous `ListSubscriptions` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListSubscriptions` must match the call that provided the page token.", 1563 // "location": "query", 1564 // "type": "string" 1565 // }, 1566 // "parent": { 1567 // "description": "Required. The parent whose subscriptions are to be listed. Structured like `projects/{project_number}/locations/{location}`.", 1568 // "location": "path", 1569 // "pattern": "^projects/[^/]+/locations/[^/]+$", 1570 // "required": true, 1571 // "type": "string" 1572 // } 1573 // }, 1574 // "path": "v1/admin/{+parent}/subscriptions", 1575 // "response": { 1576 // "$ref": "ListSubscriptionsResponse" 1577 // }, 1578 // "scopes": [ 1579 // "https://www.googleapis.com/auth/cloud-platform" 1580 // ] 1581 // } 1582 1583} 1584 1585// Pages invokes f for each page of results. 1586// A non-nil error returned from f will halt the iteration. 1587// The provided context supersedes any context provided to the Context method. 1588func (c *AdminProjectsLocationsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListSubscriptionsResponse) error) error { 1589 c.ctx_ = ctx 1590 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1591 for { 1592 x, err := c.Do() 1593 if err != nil { 1594 return err 1595 } 1596 if err := f(x); err != nil { 1597 return err 1598 } 1599 if x.NextPageToken == "" { 1600 return nil 1601 } 1602 c.PageToken(x.NextPageToken) 1603 } 1604} 1605 1606// method id "pubsublite.admin.projects.locations.subscriptions.patch": 1607 1608type AdminProjectsLocationsSubscriptionsPatchCall struct { 1609 s *Service 1610 name string 1611 subscription *Subscription 1612 urlParams_ gensupport.URLParams 1613 ctx_ context.Context 1614 header_ http.Header 1615} 1616 1617// Patch: Updates properties of the specified subscription. 1618// 1619// - name: The name of the subscription. Structured like: 1620// projects/{project_number}/locations/{location}/subscriptions/{subscr 1621// iption_id}. 1622func (r *AdminProjectsLocationsSubscriptionsService) Patch(name string, subscription *Subscription) *AdminProjectsLocationsSubscriptionsPatchCall { 1623 c := &AdminProjectsLocationsSubscriptionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1624 c.name = name 1625 c.subscription = subscription 1626 return c 1627} 1628 1629// UpdateMask sets the optional parameter "updateMask": Required. A mask 1630// specifying the subscription fields to change. 1631func (c *AdminProjectsLocationsSubscriptionsPatchCall) UpdateMask(updateMask string) *AdminProjectsLocationsSubscriptionsPatchCall { 1632 c.urlParams_.Set("updateMask", updateMask) 1633 return c 1634} 1635 1636// Fields allows partial responses to be retrieved. See 1637// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1638// for more information. 1639func (c *AdminProjectsLocationsSubscriptionsPatchCall) Fields(s ...googleapi.Field) *AdminProjectsLocationsSubscriptionsPatchCall { 1640 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1641 return c 1642} 1643 1644// Context sets the context to be used in this call's Do method. Any 1645// pending HTTP request will be aborted if the provided context is 1646// canceled. 1647func (c *AdminProjectsLocationsSubscriptionsPatchCall) Context(ctx context.Context) *AdminProjectsLocationsSubscriptionsPatchCall { 1648 c.ctx_ = ctx 1649 return c 1650} 1651 1652// Header returns an http.Header that can be modified by the caller to 1653// add HTTP headers to the request. 1654func (c *AdminProjectsLocationsSubscriptionsPatchCall) Header() http.Header { 1655 if c.header_ == nil { 1656 c.header_ = make(http.Header) 1657 } 1658 return c.header_ 1659} 1660 1661func (c *AdminProjectsLocationsSubscriptionsPatchCall) doRequest(alt string) (*http.Response, error) { 1662 reqHeaders := make(http.Header) 1663 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 1664 for k, v := range c.header_ { 1665 reqHeaders[k] = v 1666 } 1667 reqHeaders.Set("User-Agent", c.s.userAgent()) 1668 var body io.Reader = nil 1669 body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription) 1670 if err != nil { 1671 return nil, err 1672 } 1673 reqHeaders.Set("Content-Type", "application/json") 1674 c.urlParams_.Set("alt", alt) 1675 c.urlParams_.Set("prettyPrint", "false") 1676 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/admin/{+name}") 1677 urls += "?" + c.urlParams_.Encode() 1678 req, err := http.NewRequest("PATCH", urls, body) 1679 if err != nil { 1680 return nil, err 1681 } 1682 req.Header = reqHeaders 1683 googleapi.Expand(req.URL, map[string]string{ 1684 "name": c.name, 1685 }) 1686 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1687} 1688 1689// Do executes the "pubsublite.admin.projects.locations.subscriptions.patch" call. 1690// Exactly one of *Subscription or error will be non-nil. Any non-2xx 1691// status code is an error. Response headers are in either 1692// *Subscription.ServerResponse.Header or (if a response was returned at 1693// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1694// to check whether the returned error was because 1695// http.StatusNotModified was returned. 1696func (c *AdminProjectsLocationsSubscriptionsPatchCall) Do(opts ...googleapi.CallOption) (*Subscription, error) { 1697 gensupport.SetOptions(c.urlParams_, opts...) 1698 res, err := c.doRequest("json") 1699 if res != nil && res.StatusCode == http.StatusNotModified { 1700 if res.Body != nil { 1701 res.Body.Close() 1702 } 1703 return nil, &googleapi.Error{ 1704 Code: res.StatusCode, 1705 Header: res.Header, 1706 } 1707 } 1708 if err != nil { 1709 return nil, err 1710 } 1711 defer googleapi.CloseBody(res) 1712 if err := googleapi.CheckResponse(res); err != nil { 1713 return nil, err 1714 } 1715 ret := &Subscription{ 1716 ServerResponse: googleapi.ServerResponse{ 1717 Header: res.Header, 1718 HTTPStatusCode: res.StatusCode, 1719 }, 1720 } 1721 target := &ret 1722 if err := gensupport.DecodeResponse(target, res); err != nil { 1723 return nil, err 1724 } 1725 return ret, nil 1726 // { 1727 // "description": "Updates properties of the specified subscription.", 1728 // "flatPath": "v1/admin/projects/{projectsId}/locations/{locationsId}/subscriptions/{subscriptionsId}", 1729 // "httpMethod": "PATCH", 1730 // "id": "pubsublite.admin.projects.locations.subscriptions.patch", 1731 // "parameterOrder": [ 1732 // "name" 1733 // ], 1734 // "parameters": { 1735 // "name": { 1736 // "description": "The name of the subscription. Structured like: projects/{project_number}/locations/{location}/subscriptions/{subscription_id}", 1737 // "location": "path", 1738 // "pattern": "^projects/[^/]+/locations/[^/]+/subscriptions/[^/]+$", 1739 // "required": true, 1740 // "type": "string" 1741 // }, 1742 // "updateMask": { 1743 // "description": "Required. A mask specifying the subscription fields to change.", 1744 // "format": "google-fieldmask", 1745 // "location": "query", 1746 // "type": "string" 1747 // } 1748 // }, 1749 // "path": "v1/admin/{+name}", 1750 // "request": { 1751 // "$ref": "Subscription" 1752 // }, 1753 // "response": { 1754 // "$ref": "Subscription" 1755 // }, 1756 // "scopes": [ 1757 // "https://www.googleapis.com/auth/cloud-platform" 1758 // ] 1759 // } 1760 1761} 1762 1763// method id "pubsublite.admin.projects.locations.topics.create": 1764 1765type AdminProjectsLocationsTopicsCreateCall struct { 1766 s *Service 1767 parent string 1768 topic *Topic 1769 urlParams_ gensupport.URLParams 1770 ctx_ context.Context 1771 header_ http.Header 1772} 1773 1774// Create: Creates a new topic. 1775// 1776// - parent: The parent location in which to create the topic. 1777// Structured like `projects/{project_number}/locations/{location}`. 1778func (r *AdminProjectsLocationsTopicsService) Create(parent string, topic *Topic) *AdminProjectsLocationsTopicsCreateCall { 1779 c := &AdminProjectsLocationsTopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1780 c.parent = parent 1781 c.topic = topic 1782 return c 1783} 1784 1785// TopicId sets the optional parameter "topicId": Required. The ID to 1786// use for the topic, which will become the final component of the 1787// topic's name. This value is structured like: `my-topic-name`. 1788func (c *AdminProjectsLocationsTopicsCreateCall) TopicId(topicId string) *AdminProjectsLocationsTopicsCreateCall { 1789 c.urlParams_.Set("topicId", topicId) 1790 return c 1791} 1792 1793// Fields allows partial responses to be retrieved. See 1794// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1795// for more information. 1796func (c *AdminProjectsLocationsTopicsCreateCall) Fields(s ...googleapi.Field) *AdminProjectsLocationsTopicsCreateCall { 1797 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1798 return c 1799} 1800 1801// Context sets the context to be used in this call's Do method. Any 1802// pending HTTP request will be aborted if the provided context is 1803// canceled. 1804func (c *AdminProjectsLocationsTopicsCreateCall) Context(ctx context.Context) *AdminProjectsLocationsTopicsCreateCall { 1805 c.ctx_ = ctx 1806 return c 1807} 1808 1809// Header returns an http.Header that can be modified by the caller to 1810// add HTTP headers to the request. 1811func (c *AdminProjectsLocationsTopicsCreateCall) Header() http.Header { 1812 if c.header_ == nil { 1813 c.header_ = make(http.Header) 1814 } 1815 return c.header_ 1816} 1817 1818func (c *AdminProjectsLocationsTopicsCreateCall) doRequest(alt string) (*http.Response, error) { 1819 reqHeaders := make(http.Header) 1820 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 1821 for k, v := range c.header_ { 1822 reqHeaders[k] = v 1823 } 1824 reqHeaders.Set("User-Agent", c.s.userAgent()) 1825 var body io.Reader = nil 1826 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 1827 if err != nil { 1828 return nil, err 1829 } 1830 reqHeaders.Set("Content-Type", "application/json") 1831 c.urlParams_.Set("alt", alt) 1832 c.urlParams_.Set("prettyPrint", "false") 1833 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/admin/{+parent}/topics") 1834 urls += "?" + c.urlParams_.Encode() 1835 req, err := http.NewRequest("POST", urls, body) 1836 if err != nil { 1837 return nil, err 1838 } 1839 req.Header = reqHeaders 1840 googleapi.Expand(req.URL, map[string]string{ 1841 "parent": c.parent, 1842 }) 1843 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1844} 1845 1846// Do executes the "pubsublite.admin.projects.locations.topics.create" call. 1847// Exactly one of *Topic or error will be non-nil. Any non-2xx status 1848// code is an error. Response headers are in either 1849// *Topic.ServerResponse.Header or (if a response was returned at all) 1850// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1851// check whether the returned error was because http.StatusNotModified 1852// was returned. 1853func (c *AdminProjectsLocationsTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 1854 gensupport.SetOptions(c.urlParams_, opts...) 1855 res, err := c.doRequest("json") 1856 if res != nil && res.StatusCode == http.StatusNotModified { 1857 if res.Body != nil { 1858 res.Body.Close() 1859 } 1860 return nil, &googleapi.Error{ 1861 Code: res.StatusCode, 1862 Header: res.Header, 1863 } 1864 } 1865 if err != nil { 1866 return nil, err 1867 } 1868 defer googleapi.CloseBody(res) 1869 if err := googleapi.CheckResponse(res); err != nil { 1870 return nil, err 1871 } 1872 ret := &Topic{ 1873 ServerResponse: googleapi.ServerResponse{ 1874 Header: res.Header, 1875 HTTPStatusCode: res.StatusCode, 1876 }, 1877 } 1878 target := &ret 1879 if err := gensupport.DecodeResponse(target, res); err != nil { 1880 return nil, err 1881 } 1882 return ret, nil 1883 // { 1884 // "description": "Creates a new topic.", 1885 // "flatPath": "v1/admin/projects/{projectsId}/locations/{locationsId}/topics", 1886 // "httpMethod": "POST", 1887 // "id": "pubsublite.admin.projects.locations.topics.create", 1888 // "parameterOrder": [ 1889 // "parent" 1890 // ], 1891 // "parameters": { 1892 // "parent": { 1893 // "description": "Required. The parent location in which to create the topic. Structured like `projects/{project_number}/locations/{location}`.", 1894 // "location": "path", 1895 // "pattern": "^projects/[^/]+/locations/[^/]+$", 1896 // "required": true, 1897 // "type": "string" 1898 // }, 1899 // "topicId": { 1900 // "description": "Required. The ID to use for the topic, which will become the final component of the topic's name. This value is structured like: `my-topic-name`.", 1901 // "location": "query", 1902 // "type": "string" 1903 // } 1904 // }, 1905 // "path": "v1/admin/{+parent}/topics", 1906 // "request": { 1907 // "$ref": "Topic" 1908 // }, 1909 // "response": { 1910 // "$ref": "Topic" 1911 // }, 1912 // "scopes": [ 1913 // "https://www.googleapis.com/auth/cloud-platform" 1914 // ] 1915 // } 1916 1917} 1918 1919// method id "pubsublite.admin.projects.locations.topics.delete": 1920 1921type AdminProjectsLocationsTopicsDeleteCall struct { 1922 s *Service 1923 name string 1924 urlParams_ gensupport.URLParams 1925 ctx_ context.Context 1926 header_ http.Header 1927} 1928 1929// Delete: Deletes the specified topic. 1930// 1931// - name: The name of the topic to delete. 1932func (r *AdminProjectsLocationsTopicsService) Delete(name string) *AdminProjectsLocationsTopicsDeleteCall { 1933 c := &AdminProjectsLocationsTopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1934 c.name = name 1935 return c 1936} 1937 1938// Fields allows partial responses to be retrieved. See 1939// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1940// for more information. 1941func (c *AdminProjectsLocationsTopicsDeleteCall) Fields(s ...googleapi.Field) *AdminProjectsLocationsTopicsDeleteCall { 1942 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1943 return c 1944} 1945 1946// Context sets the context to be used in this call's Do method. Any 1947// pending HTTP request will be aborted if the provided context is 1948// canceled. 1949func (c *AdminProjectsLocationsTopicsDeleteCall) Context(ctx context.Context) *AdminProjectsLocationsTopicsDeleteCall { 1950 c.ctx_ = ctx 1951 return c 1952} 1953 1954// Header returns an http.Header that can be modified by the caller to 1955// add HTTP headers to the request. 1956func (c *AdminProjectsLocationsTopicsDeleteCall) Header() http.Header { 1957 if c.header_ == nil { 1958 c.header_ = make(http.Header) 1959 } 1960 return c.header_ 1961} 1962 1963func (c *AdminProjectsLocationsTopicsDeleteCall) doRequest(alt string) (*http.Response, error) { 1964 reqHeaders := make(http.Header) 1965 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 1966 for k, v := range c.header_ { 1967 reqHeaders[k] = v 1968 } 1969 reqHeaders.Set("User-Agent", c.s.userAgent()) 1970 var body io.Reader = nil 1971 c.urlParams_.Set("alt", alt) 1972 c.urlParams_.Set("prettyPrint", "false") 1973 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/admin/{+name}") 1974 urls += "?" + c.urlParams_.Encode() 1975 req, err := http.NewRequest("DELETE", urls, body) 1976 if err != nil { 1977 return nil, err 1978 } 1979 req.Header = reqHeaders 1980 googleapi.Expand(req.URL, map[string]string{ 1981 "name": c.name, 1982 }) 1983 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1984} 1985 1986// Do executes the "pubsublite.admin.projects.locations.topics.delete" call. 1987// Exactly one of *Empty or error will be non-nil. Any non-2xx status 1988// code is an error. Response headers are in either 1989// *Empty.ServerResponse.Header or (if a response was returned at all) 1990// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1991// check whether the returned error was because http.StatusNotModified 1992// was returned. 1993func (c *AdminProjectsLocationsTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1994 gensupport.SetOptions(c.urlParams_, opts...) 1995 res, err := c.doRequest("json") 1996 if res != nil && res.StatusCode == http.StatusNotModified { 1997 if res.Body != nil { 1998 res.Body.Close() 1999 } 2000 return nil, &googleapi.Error{ 2001 Code: res.StatusCode, 2002 Header: res.Header, 2003 } 2004 } 2005 if err != nil { 2006 return nil, err 2007 } 2008 defer googleapi.CloseBody(res) 2009 if err := googleapi.CheckResponse(res); err != nil { 2010 return nil, err 2011 } 2012 ret := &Empty{ 2013 ServerResponse: googleapi.ServerResponse{ 2014 Header: res.Header, 2015 HTTPStatusCode: res.StatusCode, 2016 }, 2017 } 2018 target := &ret 2019 if err := gensupport.DecodeResponse(target, res); err != nil { 2020 return nil, err 2021 } 2022 return ret, nil 2023 // { 2024 // "description": "Deletes the specified topic.", 2025 // "flatPath": "v1/admin/projects/{projectsId}/locations/{locationsId}/topics/{topicsId}", 2026 // "httpMethod": "DELETE", 2027 // "id": "pubsublite.admin.projects.locations.topics.delete", 2028 // "parameterOrder": [ 2029 // "name" 2030 // ], 2031 // "parameters": { 2032 // "name": { 2033 // "description": "Required. The name of the topic to delete.", 2034 // "location": "path", 2035 // "pattern": "^projects/[^/]+/locations/[^/]+/topics/[^/]+$", 2036 // "required": true, 2037 // "type": "string" 2038 // } 2039 // }, 2040 // "path": "v1/admin/{+name}", 2041 // "response": { 2042 // "$ref": "Empty" 2043 // }, 2044 // "scopes": [ 2045 // "https://www.googleapis.com/auth/cloud-platform" 2046 // ] 2047 // } 2048 2049} 2050 2051// method id "pubsublite.admin.projects.locations.topics.get": 2052 2053type AdminProjectsLocationsTopicsGetCall struct { 2054 s *Service 2055 name string 2056 urlParams_ gensupport.URLParams 2057 ifNoneMatch_ string 2058 ctx_ context.Context 2059 header_ http.Header 2060} 2061 2062// Get: Returns the topic configuration. 2063// 2064// - name: The name of the topic whose configuration to return. 2065func (r *AdminProjectsLocationsTopicsService) Get(name string) *AdminProjectsLocationsTopicsGetCall { 2066 c := &AdminProjectsLocationsTopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2067 c.name = name 2068 return c 2069} 2070 2071// Fields allows partial responses to be retrieved. See 2072// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2073// for more information. 2074func (c *AdminProjectsLocationsTopicsGetCall) Fields(s ...googleapi.Field) *AdminProjectsLocationsTopicsGetCall { 2075 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2076 return c 2077} 2078 2079// IfNoneMatch sets the optional parameter which makes the operation 2080// fail if the object's ETag matches the given value. This is useful for 2081// getting updates only after the object has changed since the last 2082// request. Use googleapi.IsNotModified to check whether the response 2083// error from Do is the result of In-None-Match. 2084func (c *AdminProjectsLocationsTopicsGetCall) IfNoneMatch(entityTag string) *AdminProjectsLocationsTopicsGetCall { 2085 c.ifNoneMatch_ = entityTag 2086 return c 2087} 2088 2089// Context sets the context to be used in this call's Do method. Any 2090// pending HTTP request will be aborted if the provided context is 2091// canceled. 2092func (c *AdminProjectsLocationsTopicsGetCall) Context(ctx context.Context) *AdminProjectsLocationsTopicsGetCall { 2093 c.ctx_ = ctx 2094 return c 2095} 2096 2097// Header returns an http.Header that can be modified by the caller to 2098// add HTTP headers to the request. 2099func (c *AdminProjectsLocationsTopicsGetCall) Header() http.Header { 2100 if c.header_ == nil { 2101 c.header_ = make(http.Header) 2102 } 2103 return c.header_ 2104} 2105 2106func (c *AdminProjectsLocationsTopicsGetCall) doRequest(alt string) (*http.Response, error) { 2107 reqHeaders := make(http.Header) 2108 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 2109 for k, v := range c.header_ { 2110 reqHeaders[k] = v 2111 } 2112 reqHeaders.Set("User-Agent", c.s.userAgent()) 2113 if c.ifNoneMatch_ != "" { 2114 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2115 } 2116 var body io.Reader = nil 2117 c.urlParams_.Set("alt", alt) 2118 c.urlParams_.Set("prettyPrint", "false") 2119 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/admin/{+name}") 2120 urls += "?" + c.urlParams_.Encode() 2121 req, err := http.NewRequest("GET", urls, body) 2122 if err != nil { 2123 return nil, err 2124 } 2125 req.Header = reqHeaders 2126 googleapi.Expand(req.URL, map[string]string{ 2127 "name": c.name, 2128 }) 2129 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2130} 2131 2132// Do executes the "pubsublite.admin.projects.locations.topics.get" call. 2133// Exactly one of *Topic or error will be non-nil. Any non-2xx status 2134// code is an error. Response headers are in either 2135// *Topic.ServerResponse.Header or (if a response was returned at all) 2136// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2137// check whether the returned error was because http.StatusNotModified 2138// was returned. 2139func (c *AdminProjectsLocationsTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 2140 gensupport.SetOptions(c.urlParams_, opts...) 2141 res, err := c.doRequest("json") 2142 if res != nil && res.StatusCode == http.StatusNotModified { 2143 if res.Body != nil { 2144 res.Body.Close() 2145 } 2146 return nil, &googleapi.Error{ 2147 Code: res.StatusCode, 2148 Header: res.Header, 2149 } 2150 } 2151 if err != nil { 2152 return nil, err 2153 } 2154 defer googleapi.CloseBody(res) 2155 if err := googleapi.CheckResponse(res); err != nil { 2156 return nil, err 2157 } 2158 ret := &Topic{ 2159 ServerResponse: googleapi.ServerResponse{ 2160 Header: res.Header, 2161 HTTPStatusCode: res.StatusCode, 2162 }, 2163 } 2164 target := &ret 2165 if err := gensupport.DecodeResponse(target, res); err != nil { 2166 return nil, err 2167 } 2168 return ret, nil 2169 // { 2170 // "description": "Returns the topic configuration.", 2171 // "flatPath": "v1/admin/projects/{projectsId}/locations/{locationsId}/topics/{topicsId}", 2172 // "httpMethod": "GET", 2173 // "id": "pubsublite.admin.projects.locations.topics.get", 2174 // "parameterOrder": [ 2175 // "name" 2176 // ], 2177 // "parameters": { 2178 // "name": { 2179 // "description": "Required. The name of the topic whose configuration to return.", 2180 // "location": "path", 2181 // "pattern": "^projects/[^/]+/locations/[^/]+/topics/[^/]+$", 2182 // "required": true, 2183 // "type": "string" 2184 // } 2185 // }, 2186 // "path": "v1/admin/{+name}", 2187 // "response": { 2188 // "$ref": "Topic" 2189 // }, 2190 // "scopes": [ 2191 // "https://www.googleapis.com/auth/cloud-platform" 2192 // ] 2193 // } 2194 2195} 2196 2197// method id "pubsublite.admin.projects.locations.topics.getPartitions": 2198 2199type AdminProjectsLocationsTopicsGetPartitionsCall struct { 2200 s *Service 2201 name string 2202 urlParams_ gensupport.URLParams 2203 ifNoneMatch_ string 2204 ctx_ context.Context 2205 header_ http.Header 2206} 2207 2208// GetPartitions: Returns the partition information for the requested 2209// topic. 2210// 2211// - name: The topic whose partition information to return. 2212func (r *AdminProjectsLocationsTopicsService) GetPartitions(name string) *AdminProjectsLocationsTopicsGetPartitionsCall { 2213 c := &AdminProjectsLocationsTopicsGetPartitionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2214 c.name = name 2215 return c 2216} 2217 2218// Fields allows partial responses to be retrieved. See 2219// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2220// for more information. 2221func (c *AdminProjectsLocationsTopicsGetPartitionsCall) Fields(s ...googleapi.Field) *AdminProjectsLocationsTopicsGetPartitionsCall { 2222 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2223 return c 2224} 2225 2226// IfNoneMatch sets the optional parameter which makes the operation 2227// fail if the object's ETag matches the given value. This is useful for 2228// getting updates only after the object has changed since the last 2229// request. Use googleapi.IsNotModified to check whether the response 2230// error from Do is the result of In-None-Match. 2231func (c *AdminProjectsLocationsTopicsGetPartitionsCall) IfNoneMatch(entityTag string) *AdminProjectsLocationsTopicsGetPartitionsCall { 2232 c.ifNoneMatch_ = entityTag 2233 return c 2234} 2235 2236// Context sets the context to be used in this call's Do method. Any 2237// pending HTTP request will be aborted if the provided context is 2238// canceled. 2239func (c *AdminProjectsLocationsTopicsGetPartitionsCall) Context(ctx context.Context) *AdminProjectsLocationsTopicsGetPartitionsCall { 2240 c.ctx_ = ctx 2241 return c 2242} 2243 2244// Header returns an http.Header that can be modified by the caller to 2245// add HTTP headers to the request. 2246func (c *AdminProjectsLocationsTopicsGetPartitionsCall) Header() http.Header { 2247 if c.header_ == nil { 2248 c.header_ = make(http.Header) 2249 } 2250 return c.header_ 2251} 2252 2253func (c *AdminProjectsLocationsTopicsGetPartitionsCall) doRequest(alt string) (*http.Response, error) { 2254 reqHeaders := make(http.Header) 2255 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 2256 for k, v := range c.header_ { 2257 reqHeaders[k] = v 2258 } 2259 reqHeaders.Set("User-Agent", c.s.userAgent()) 2260 if c.ifNoneMatch_ != "" { 2261 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2262 } 2263 var body io.Reader = nil 2264 c.urlParams_.Set("alt", alt) 2265 c.urlParams_.Set("prettyPrint", "false") 2266 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/admin/{+name}/partitions") 2267 urls += "?" + c.urlParams_.Encode() 2268 req, err := http.NewRequest("GET", urls, body) 2269 if err != nil { 2270 return nil, err 2271 } 2272 req.Header = reqHeaders 2273 googleapi.Expand(req.URL, map[string]string{ 2274 "name": c.name, 2275 }) 2276 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2277} 2278 2279// Do executes the "pubsublite.admin.projects.locations.topics.getPartitions" call. 2280// Exactly one of *TopicPartitions or error will be non-nil. Any non-2xx 2281// status code is an error. Response headers are in either 2282// *TopicPartitions.ServerResponse.Header or (if a response was returned 2283// at all) in error.(*googleapi.Error).Header. Use 2284// googleapi.IsNotModified to check whether the returned error was 2285// because http.StatusNotModified was returned. 2286func (c *AdminProjectsLocationsTopicsGetPartitionsCall) Do(opts ...googleapi.CallOption) (*TopicPartitions, error) { 2287 gensupport.SetOptions(c.urlParams_, opts...) 2288 res, err := c.doRequest("json") 2289 if res != nil && res.StatusCode == http.StatusNotModified { 2290 if res.Body != nil { 2291 res.Body.Close() 2292 } 2293 return nil, &googleapi.Error{ 2294 Code: res.StatusCode, 2295 Header: res.Header, 2296 } 2297 } 2298 if err != nil { 2299 return nil, err 2300 } 2301 defer googleapi.CloseBody(res) 2302 if err := googleapi.CheckResponse(res); err != nil { 2303 return nil, err 2304 } 2305 ret := &TopicPartitions{ 2306 ServerResponse: googleapi.ServerResponse{ 2307 Header: res.Header, 2308 HTTPStatusCode: res.StatusCode, 2309 }, 2310 } 2311 target := &ret 2312 if err := gensupport.DecodeResponse(target, res); err != nil { 2313 return nil, err 2314 } 2315 return ret, nil 2316 // { 2317 // "description": "Returns the partition information for the requested topic.", 2318 // "flatPath": "v1/admin/projects/{projectsId}/locations/{locationsId}/topics/{topicsId}/partitions", 2319 // "httpMethod": "GET", 2320 // "id": "pubsublite.admin.projects.locations.topics.getPartitions", 2321 // "parameterOrder": [ 2322 // "name" 2323 // ], 2324 // "parameters": { 2325 // "name": { 2326 // "description": "Required. The topic whose partition information to return.", 2327 // "location": "path", 2328 // "pattern": "^projects/[^/]+/locations/[^/]+/topics/[^/]+$", 2329 // "required": true, 2330 // "type": "string" 2331 // } 2332 // }, 2333 // "path": "v1/admin/{+name}/partitions", 2334 // "response": { 2335 // "$ref": "TopicPartitions" 2336 // }, 2337 // "scopes": [ 2338 // "https://www.googleapis.com/auth/cloud-platform" 2339 // ] 2340 // } 2341 2342} 2343 2344// method id "pubsublite.admin.projects.locations.topics.list": 2345 2346type AdminProjectsLocationsTopicsListCall struct { 2347 s *Service 2348 parent string 2349 urlParams_ gensupport.URLParams 2350 ifNoneMatch_ string 2351 ctx_ context.Context 2352 header_ http.Header 2353} 2354 2355// List: Returns the list of topics for the given project. 2356// 2357// - parent: The parent whose topics are to be listed. Structured like 2358// `projects/{project_number}/locations/{location}`. 2359func (r *AdminProjectsLocationsTopicsService) List(parent string) *AdminProjectsLocationsTopicsListCall { 2360 c := &AdminProjectsLocationsTopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2361 c.parent = parent 2362 return c 2363} 2364 2365// PageSize sets the optional parameter "pageSize": The maximum number 2366// of topics to return. The service may return fewer than this value. If 2367// unset or zero, all topics for the parent will be returned. 2368func (c *AdminProjectsLocationsTopicsListCall) PageSize(pageSize int64) *AdminProjectsLocationsTopicsListCall { 2369 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2370 return c 2371} 2372 2373// PageToken sets the optional parameter "pageToken": A page token, 2374// received from a previous `ListTopics` call. Provide this to retrieve 2375// the subsequent page. When paginating, all other parameters provided 2376// to `ListTopics` must match the call that provided the page token. 2377func (c *AdminProjectsLocationsTopicsListCall) PageToken(pageToken string) *AdminProjectsLocationsTopicsListCall { 2378 c.urlParams_.Set("pageToken", pageToken) 2379 return c 2380} 2381 2382// Fields allows partial responses to be retrieved. See 2383// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2384// for more information. 2385func (c *AdminProjectsLocationsTopicsListCall) Fields(s ...googleapi.Field) *AdminProjectsLocationsTopicsListCall { 2386 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2387 return c 2388} 2389 2390// IfNoneMatch sets the optional parameter which makes the operation 2391// fail if the object's ETag matches the given value. This is useful for 2392// getting updates only after the object has changed since the last 2393// request. Use googleapi.IsNotModified to check whether the response 2394// error from Do is the result of In-None-Match. 2395func (c *AdminProjectsLocationsTopicsListCall) IfNoneMatch(entityTag string) *AdminProjectsLocationsTopicsListCall { 2396 c.ifNoneMatch_ = entityTag 2397 return c 2398} 2399 2400// Context sets the context to be used in this call's Do method. Any 2401// pending HTTP request will be aborted if the provided context is 2402// canceled. 2403func (c *AdminProjectsLocationsTopicsListCall) Context(ctx context.Context) *AdminProjectsLocationsTopicsListCall { 2404 c.ctx_ = ctx 2405 return c 2406} 2407 2408// Header returns an http.Header that can be modified by the caller to 2409// add HTTP headers to the request. 2410func (c *AdminProjectsLocationsTopicsListCall) Header() http.Header { 2411 if c.header_ == nil { 2412 c.header_ = make(http.Header) 2413 } 2414 return c.header_ 2415} 2416 2417func (c *AdminProjectsLocationsTopicsListCall) doRequest(alt string) (*http.Response, error) { 2418 reqHeaders := make(http.Header) 2419 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 2420 for k, v := range c.header_ { 2421 reqHeaders[k] = v 2422 } 2423 reqHeaders.Set("User-Agent", c.s.userAgent()) 2424 if c.ifNoneMatch_ != "" { 2425 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2426 } 2427 var body io.Reader = nil 2428 c.urlParams_.Set("alt", alt) 2429 c.urlParams_.Set("prettyPrint", "false") 2430 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/admin/{+parent}/topics") 2431 urls += "?" + c.urlParams_.Encode() 2432 req, err := http.NewRequest("GET", urls, body) 2433 if err != nil { 2434 return nil, err 2435 } 2436 req.Header = reqHeaders 2437 googleapi.Expand(req.URL, map[string]string{ 2438 "parent": c.parent, 2439 }) 2440 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2441} 2442 2443// Do executes the "pubsublite.admin.projects.locations.topics.list" call. 2444// Exactly one of *ListTopicsResponse or error will be non-nil. Any 2445// non-2xx status code is an error. Response headers are in either 2446// *ListTopicsResponse.ServerResponse.Header or (if a response was 2447// returned at all) in error.(*googleapi.Error).Header. Use 2448// googleapi.IsNotModified to check whether the returned error was 2449// because http.StatusNotModified was returned. 2450func (c *AdminProjectsLocationsTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicsResponse, error) { 2451 gensupport.SetOptions(c.urlParams_, opts...) 2452 res, err := c.doRequest("json") 2453 if res != nil && res.StatusCode == http.StatusNotModified { 2454 if res.Body != nil { 2455 res.Body.Close() 2456 } 2457 return nil, &googleapi.Error{ 2458 Code: res.StatusCode, 2459 Header: res.Header, 2460 } 2461 } 2462 if err != nil { 2463 return nil, err 2464 } 2465 defer googleapi.CloseBody(res) 2466 if err := googleapi.CheckResponse(res); err != nil { 2467 return nil, err 2468 } 2469 ret := &ListTopicsResponse{ 2470 ServerResponse: googleapi.ServerResponse{ 2471 Header: res.Header, 2472 HTTPStatusCode: res.StatusCode, 2473 }, 2474 } 2475 target := &ret 2476 if err := gensupport.DecodeResponse(target, res); err != nil { 2477 return nil, err 2478 } 2479 return ret, nil 2480 // { 2481 // "description": "Returns the list of topics for the given project.", 2482 // "flatPath": "v1/admin/projects/{projectsId}/locations/{locationsId}/topics", 2483 // "httpMethod": "GET", 2484 // "id": "pubsublite.admin.projects.locations.topics.list", 2485 // "parameterOrder": [ 2486 // "parent" 2487 // ], 2488 // "parameters": { 2489 // "pageSize": { 2490 // "description": "The maximum number of topics to return. The service may return fewer than this value. If unset or zero, all topics for the parent will be returned.", 2491 // "format": "int32", 2492 // "location": "query", 2493 // "type": "integer" 2494 // }, 2495 // "pageToken": { 2496 // "description": "A page token, received from a previous `ListTopics` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListTopics` must match the call that provided the page token.", 2497 // "location": "query", 2498 // "type": "string" 2499 // }, 2500 // "parent": { 2501 // "description": "Required. The parent whose topics are to be listed. Structured like `projects/{project_number}/locations/{location}`.", 2502 // "location": "path", 2503 // "pattern": "^projects/[^/]+/locations/[^/]+$", 2504 // "required": true, 2505 // "type": "string" 2506 // } 2507 // }, 2508 // "path": "v1/admin/{+parent}/topics", 2509 // "response": { 2510 // "$ref": "ListTopicsResponse" 2511 // }, 2512 // "scopes": [ 2513 // "https://www.googleapis.com/auth/cloud-platform" 2514 // ] 2515 // } 2516 2517} 2518 2519// Pages invokes f for each page of results. 2520// A non-nil error returned from f will halt the iteration. 2521// The provided context supersedes any context provided to the Context method. 2522func (c *AdminProjectsLocationsTopicsListCall) Pages(ctx context.Context, f func(*ListTopicsResponse) error) error { 2523 c.ctx_ = ctx 2524 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2525 for { 2526 x, err := c.Do() 2527 if err != nil { 2528 return err 2529 } 2530 if err := f(x); err != nil { 2531 return err 2532 } 2533 if x.NextPageToken == "" { 2534 return nil 2535 } 2536 c.PageToken(x.NextPageToken) 2537 } 2538} 2539 2540// method id "pubsublite.admin.projects.locations.topics.patch": 2541 2542type AdminProjectsLocationsTopicsPatchCall struct { 2543 s *Service 2544 name string 2545 topic *Topic 2546 urlParams_ gensupport.URLParams 2547 ctx_ context.Context 2548 header_ http.Header 2549} 2550 2551// Patch: Updates properties of the specified topic. 2552// 2553// - name: The name of the topic. Structured like: 2554// projects/{project_number}/locations/{location}/topics/{topic_id}. 2555func (r *AdminProjectsLocationsTopicsService) Patch(name string, topic *Topic) *AdminProjectsLocationsTopicsPatchCall { 2556 c := &AdminProjectsLocationsTopicsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2557 c.name = name 2558 c.topic = topic 2559 return c 2560} 2561 2562// UpdateMask sets the optional parameter "updateMask": Required. A mask 2563// specifying the topic fields to change. 2564func (c *AdminProjectsLocationsTopicsPatchCall) UpdateMask(updateMask string) *AdminProjectsLocationsTopicsPatchCall { 2565 c.urlParams_.Set("updateMask", updateMask) 2566 return c 2567} 2568 2569// Fields allows partial responses to be retrieved. See 2570// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2571// for more information. 2572func (c *AdminProjectsLocationsTopicsPatchCall) Fields(s ...googleapi.Field) *AdminProjectsLocationsTopicsPatchCall { 2573 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2574 return c 2575} 2576 2577// Context sets the context to be used in this call's Do method. Any 2578// pending HTTP request will be aborted if the provided context is 2579// canceled. 2580func (c *AdminProjectsLocationsTopicsPatchCall) Context(ctx context.Context) *AdminProjectsLocationsTopicsPatchCall { 2581 c.ctx_ = ctx 2582 return c 2583} 2584 2585// Header returns an http.Header that can be modified by the caller to 2586// add HTTP headers to the request. 2587func (c *AdminProjectsLocationsTopicsPatchCall) Header() http.Header { 2588 if c.header_ == nil { 2589 c.header_ = make(http.Header) 2590 } 2591 return c.header_ 2592} 2593 2594func (c *AdminProjectsLocationsTopicsPatchCall) doRequest(alt string) (*http.Response, error) { 2595 reqHeaders := make(http.Header) 2596 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 2597 for k, v := range c.header_ { 2598 reqHeaders[k] = v 2599 } 2600 reqHeaders.Set("User-Agent", c.s.userAgent()) 2601 var body io.Reader = nil 2602 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 2603 if err != nil { 2604 return nil, err 2605 } 2606 reqHeaders.Set("Content-Type", "application/json") 2607 c.urlParams_.Set("alt", alt) 2608 c.urlParams_.Set("prettyPrint", "false") 2609 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/admin/{+name}") 2610 urls += "?" + c.urlParams_.Encode() 2611 req, err := http.NewRequest("PATCH", urls, body) 2612 if err != nil { 2613 return nil, err 2614 } 2615 req.Header = reqHeaders 2616 googleapi.Expand(req.URL, map[string]string{ 2617 "name": c.name, 2618 }) 2619 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2620} 2621 2622// Do executes the "pubsublite.admin.projects.locations.topics.patch" call. 2623// Exactly one of *Topic or error will be non-nil. Any non-2xx status 2624// code is an error. Response headers are in either 2625// *Topic.ServerResponse.Header or (if a response was returned at all) 2626// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2627// check whether the returned error was because http.StatusNotModified 2628// was returned. 2629func (c *AdminProjectsLocationsTopicsPatchCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 2630 gensupport.SetOptions(c.urlParams_, opts...) 2631 res, err := c.doRequest("json") 2632 if res != nil && res.StatusCode == http.StatusNotModified { 2633 if res.Body != nil { 2634 res.Body.Close() 2635 } 2636 return nil, &googleapi.Error{ 2637 Code: res.StatusCode, 2638 Header: res.Header, 2639 } 2640 } 2641 if err != nil { 2642 return nil, err 2643 } 2644 defer googleapi.CloseBody(res) 2645 if err := googleapi.CheckResponse(res); err != nil { 2646 return nil, err 2647 } 2648 ret := &Topic{ 2649 ServerResponse: googleapi.ServerResponse{ 2650 Header: res.Header, 2651 HTTPStatusCode: res.StatusCode, 2652 }, 2653 } 2654 target := &ret 2655 if err := gensupport.DecodeResponse(target, res); err != nil { 2656 return nil, err 2657 } 2658 return ret, nil 2659 // { 2660 // "description": "Updates properties of the specified topic.", 2661 // "flatPath": "v1/admin/projects/{projectsId}/locations/{locationsId}/topics/{topicsId}", 2662 // "httpMethod": "PATCH", 2663 // "id": "pubsublite.admin.projects.locations.topics.patch", 2664 // "parameterOrder": [ 2665 // "name" 2666 // ], 2667 // "parameters": { 2668 // "name": { 2669 // "description": "The name of the topic. Structured like: projects/{project_number}/locations/{location}/topics/{topic_id}", 2670 // "location": "path", 2671 // "pattern": "^projects/[^/]+/locations/[^/]+/topics/[^/]+$", 2672 // "required": true, 2673 // "type": "string" 2674 // }, 2675 // "updateMask": { 2676 // "description": "Required. A mask specifying the topic fields to change.", 2677 // "format": "google-fieldmask", 2678 // "location": "query", 2679 // "type": "string" 2680 // } 2681 // }, 2682 // "path": "v1/admin/{+name}", 2683 // "request": { 2684 // "$ref": "Topic" 2685 // }, 2686 // "response": { 2687 // "$ref": "Topic" 2688 // }, 2689 // "scopes": [ 2690 // "https://www.googleapis.com/auth/cloud-platform" 2691 // ] 2692 // } 2693 2694} 2695 2696// method id "pubsublite.admin.projects.locations.topics.subscriptions.list": 2697 2698type AdminProjectsLocationsTopicsSubscriptionsListCall struct { 2699 s *Service 2700 name string 2701 urlParams_ gensupport.URLParams 2702 ifNoneMatch_ string 2703 ctx_ context.Context 2704 header_ http.Header 2705} 2706 2707// List: Lists the subscriptions attached to the specified topic. 2708// 2709// - name: The name of the topic whose subscriptions to list. 2710func (r *AdminProjectsLocationsTopicsSubscriptionsService) List(name string) *AdminProjectsLocationsTopicsSubscriptionsListCall { 2711 c := &AdminProjectsLocationsTopicsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2712 c.name = name 2713 return c 2714} 2715 2716// PageSize sets the optional parameter "pageSize": The maximum number 2717// of subscriptions to return. The service may return fewer than this 2718// value. If unset or zero, all subscriptions for the given topic will 2719// be returned. 2720func (c *AdminProjectsLocationsTopicsSubscriptionsListCall) PageSize(pageSize int64) *AdminProjectsLocationsTopicsSubscriptionsListCall { 2721 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2722 return c 2723} 2724 2725// PageToken sets the optional parameter "pageToken": A page token, 2726// received from a previous `ListTopicSubscriptions` call. Provide this 2727// to retrieve the subsequent page. When paginating, all other 2728// parameters provided to `ListTopicSubscriptions` must match the call 2729// that provided the page token. 2730func (c *AdminProjectsLocationsTopicsSubscriptionsListCall) PageToken(pageToken string) *AdminProjectsLocationsTopicsSubscriptionsListCall { 2731 c.urlParams_.Set("pageToken", pageToken) 2732 return c 2733} 2734 2735// Fields allows partial responses to be retrieved. See 2736// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2737// for more information. 2738func (c *AdminProjectsLocationsTopicsSubscriptionsListCall) Fields(s ...googleapi.Field) *AdminProjectsLocationsTopicsSubscriptionsListCall { 2739 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2740 return c 2741} 2742 2743// IfNoneMatch sets the optional parameter which makes the operation 2744// fail if the object's ETag matches the given value. This is useful for 2745// getting updates only after the object has changed since the last 2746// request. Use googleapi.IsNotModified to check whether the response 2747// error from Do is the result of In-None-Match. 2748func (c *AdminProjectsLocationsTopicsSubscriptionsListCall) IfNoneMatch(entityTag string) *AdminProjectsLocationsTopicsSubscriptionsListCall { 2749 c.ifNoneMatch_ = entityTag 2750 return c 2751} 2752 2753// Context sets the context to be used in this call's Do method. Any 2754// pending HTTP request will be aborted if the provided context is 2755// canceled. 2756func (c *AdminProjectsLocationsTopicsSubscriptionsListCall) Context(ctx context.Context) *AdminProjectsLocationsTopicsSubscriptionsListCall { 2757 c.ctx_ = ctx 2758 return c 2759} 2760 2761// Header returns an http.Header that can be modified by the caller to 2762// add HTTP headers to the request. 2763func (c *AdminProjectsLocationsTopicsSubscriptionsListCall) Header() http.Header { 2764 if c.header_ == nil { 2765 c.header_ = make(http.Header) 2766 } 2767 return c.header_ 2768} 2769 2770func (c *AdminProjectsLocationsTopicsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) { 2771 reqHeaders := make(http.Header) 2772 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 2773 for k, v := range c.header_ { 2774 reqHeaders[k] = v 2775 } 2776 reqHeaders.Set("User-Agent", c.s.userAgent()) 2777 if c.ifNoneMatch_ != "" { 2778 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2779 } 2780 var body io.Reader = nil 2781 c.urlParams_.Set("alt", alt) 2782 c.urlParams_.Set("prettyPrint", "false") 2783 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/admin/{+name}/subscriptions") 2784 urls += "?" + c.urlParams_.Encode() 2785 req, err := http.NewRequest("GET", urls, body) 2786 if err != nil { 2787 return nil, err 2788 } 2789 req.Header = reqHeaders 2790 googleapi.Expand(req.URL, map[string]string{ 2791 "name": c.name, 2792 }) 2793 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2794} 2795 2796// Do executes the "pubsublite.admin.projects.locations.topics.subscriptions.list" call. 2797// Exactly one of *ListTopicSubscriptionsResponse or error will be 2798// non-nil. Any non-2xx status code is an error. Response headers are in 2799// either *ListTopicSubscriptionsResponse.ServerResponse.Header or (if a 2800// response was returned at all) in error.(*googleapi.Error).Header. Use 2801// googleapi.IsNotModified to check whether the returned error was 2802// because http.StatusNotModified was returned. 2803func (c *AdminProjectsLocationsTopicsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListTopicSubscriptionsResponse, error) { 2804 gensupport.SetOptions(c.urlParams_, opts...) 2805 res, err := c.doRequest("json") 2806 if res != nil && res.StatusCode == http.StatusNotModified { 2807 if res.Body != nil { 2808 res.Body.Close() 2809 } 2810 return nil, &googleapi.Error{ 2811 Code: res.StatusCode, 2812 Header: res.Header, 2813 } 2814 } 2815 if err != nil { 2816 return nil, err 2817 } 2818 defer googleapi.CloseBody(res) 2819 if err := googleapi.CheckResponse(res); err != nil { 2820 return nil, err 2821 } 2822 ret := &ListTopicSubscriptionsResponse{ 2823 ServerResponse: googleapi.ServerResponse{ 2824 Header: res.Header, 2825 HTTPStatusCode: res.StatusCode, 2826 }, 2827 } 2828 target := &ret 2829 if err := gensupport.DecodeResponse(target, res); err != nil { 2830 return nil, err 2831 } 2832 return ret, nil 2833 // { 2834 // "description": "Lists the subscriptions attached to the specified topic.", 2835 // "flatPath": "v1/admin/projects/{projectsId}/locations/{locationsId}/topics/{topicsId}/subscriptions", 2836 // "httpMethod": "GET", 2837 // "id": "pubsublite.admin.projects.locations.topics.subscriptions.list", 2838 // "parameterOrder": [ 2839 // "name" 2840 // ], 2841 // "parameters": { 2842 // "name": { 2843 // "description": "Required. The name of the topic whose subscriptions to list.", 2844 // "location": "path", 2845 // "pattern": "^projects/[^/]+/locations/[^/]+/topics/[^/]+$", 2846 // "required": true, 2847 // "type": "string" 2848 // }, 2849 // "pageSize": { 2850 // "description": "The maximum number of subscriptions to return. The service may return fewer than this value. If unset or zero, all subscriptions for the given topic will be returned.", 2851 // "format": "int32", 2852 // "location": "query", 2853 // "type": "integer" 2854 // }, 2855 // "pageToken": { 2856 // "description": "A page token, received from a previous `ListTopicSubscriptions` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListTopicSubscriptions` must match the call that provided the page token.", 2857 // "location": "query", 2858 // "type": "string" 2859 // } 2860 // }, 2861 // "path": "v1/admin/{+name}/subscriptions", 2862 // "response": { 2863 // "$ref": "ListTopicSubscriptionsResponse" 2864 // }, 2865 // "scopes": [ 2866 // "https://www.googleapis.com/auth/cloud-platform" 2867 // ] 2868 // } 2869 2870} 2871 2872// Pages invokes f for each page of results. 2873// A non-nil error returned from f will halt the iteration. 2874// The provided context supersedes any context provided to the Context method. 2875func (c *AdminProjectsLocationsTopicsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListTopicSubscriptionsResponse) error) error { 2876 c.ctx_ = ctx 2877 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2878 for { 2879 x, err := c.Do() 2880 if err != nil { 2881 return err 2882 } 2883 if err := f(x); err != nil { 2884 return err 2885 } 2886 if x.NextPageToken == "" { 2887 return nil 2888 } 2889 c.PageToken(x.NextPageToken) 2890 } 2891} 2892 2893// method id "pubsublite.cursor.projects.locations.subscriptions.cursors.list": 2894 2895type CursorProjectsLocationsSubscriptionsCursorsListCall struct { 2896 s *Service 2897 parent string 2898 urlParams_ gensupport.URLParams 2899 ifNoneMatch_ string 2900 ctx_ context.Context 2901 header_ http.Header 2902} 2903 2904// List: Returns all committed cursor information for a subscription. 2905// 2906// - parent: The subscription for which to retrieve cursors. Structured 2907// like 2908// `projects/{project_number}/locations/{location}/subscriptions/{subsc 2909// ription_id}`. 2910func (r *CursorProjectsLocationsSubscriptionsCursorsService) List(parent string) *CursorProjectsLocationsSubscriptionsCursorsListCall { 2911 c := &CursorProjectsLocationsSubscriptionsCursorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2912 c.parent = parent 2913 return c 2914} 2915 2916// PageSize sets the optional parameter "pageSize": The maximum number 2917// of cursors to return. The service may return fewer than this value. 2918// If unset or zero, all cursors for the parent will be returned. 2919func (c *CursorProjectsLocationsSubscriptionsCursorsListCall) PageSize(pageSize int64) *CursorProjectsLocationsSubscriptionsCursorsListCall { 2920 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2921 return c 2922} 2923 2924// PageToken sets the optional parameter "pageToken": A page token, 2925// received from a previous `ListPartitionCursors` call. Provide this to 2926// retrieve the subsequent page. When paginating, all other parameters 2927// provided to `ListPartitionCursors` must match the call that provided 2928// the page token. 2929func (c *CursorProjectsLocationsSubscriptionsCursorsListCall) PageToken(pageToken string) *CursorProjectsLocationsSubscriptionsCursorsListCall { 2930 c.urlParams_.Set("pageToken", pageToken) 2931 return c 2932} 2933 2934// Fields allows partial responses to be retrieved. See 2935// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2936// for more information. 2937func (c *CursorProjectsLocationsSubscriptionsCursorsListCall) Fields(s ...googleapi.Field) *CursorProjectsLocationsSubscriptionsCursorsListCall { 2938 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2939 return c 2940} 2941 2942// IfNoneMatch sets the optional parameter which makes the operation 2943// fail if the object's ETag matches the given value. This is useful for 2944// getting updates only after the object has changed since the last 2945// request. Use googleapi.IsNotModified to check whether the response 2946// error from Do is the result of In-None-Match. 2947func (c *CursorProjectsLocationsSubscriptionsCursorsListCall) IfNoneMatch(entityTag string) *CursorProjectsLocationsSubscriptionsCursorsListCall { 2948 c.ifNoneMatch_ = entityTag 2949 return c 2950} 2951 2952// Context sets the context to be used in this call's Do method. Any 2953// pending HTTP request will be aborted if the provided context is 2954// canceled. 2955func (c *CursorProjectsLocationsSubscriptionsCursorsListCall) Context(ctx context.Context) *CursorProjectsLocationsSubscriptionsCursorsListCall { 2956 c.ctx_ = ctx 2957 return c 2958} 2959 2960// Header returns an http.Header that can be modified by the caller to 2961// add HTTP headers to the request. 2962func (c *CursorProjectsLocationsSubscriptionsCursorsListCall) Header() http.Header { 2963 if c.header_ == nil { 2964 c.header_ = make(http.Header) 2965 } 2966 return c.header_ 2967} 2968 2969func (c *CursorProjectsLocationsSubscriptionsCursorsListCall) doRequest(alt string) (*http.Response, error) { 2970 reqHeaders := make(http.Header) 2971 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 2972 for k, v := range c.header_ { 2973 reqHeaders[k] = v 2974 } 2975 reqHeaders.Set("User-Agent", c.s.userAgent()) 2976 if c.ifNoneMatch_ != "" { 2977 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2978 } 2979 var body io.Reader = nil 2980 c.urlParams_.Set("alt", alt) 2981 c.urlParams_.Set("prettyPrint", "false") 2982 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/cursor/{+parent}/cursors") 2983 urls += "?" + c.urlParams_.Encode() 2984 req, err := http.NewRequest("GET", urls, body) 2985 if err != nil { 2986 return nil, err 2987 } 2988 req.Header = reqHeaders 2989 googleapi.Expand(req.URL, map[string]string{ 2990 "parent": c.parent, 2991 }) 2992 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2993} 2994 2995// Do executes the "pubsublite.cursor.projects.locations.subscriptions.cursors.list" call. 2996// Exactly one of *ListPartitionCursorsResponse or error will be 2997// non-nil. Any non-2xx status code is an error. Response headers are in 2998// either *ListPartitionCursorsResponse.ServerResponse.Header or (if a 2999// response was returned at all) in error.(*googleapi.Error).Header. Use 3000// googleapi.IsNotModified to check whether the returned error was 3001// because http.StatusNotModified was returned. 3002func (c *CursorProjectsLocationsSubscriptionsCursorsListCall) Do(opts ...googleapi.CallOption) (*ListPartitionCursorsResponse, error) { 3003 gensupport.SetOptions(c.urlParams_, opts...) 3004 res, err := c.doRequest("json") 3005 if res != nil && res.StatusCode == http.StatusNotModified { 3006 if res.Body != nil { 3007 res.Body.Close() 3008 } 3009 return nil, &googleapi.Error{ 3010 Code: res.StatusCode, 3011 Header: res.Header, 3012 } 3013 } 3014 if err != nil { 3015 return nil, err 3016 } 3017 defer googleapi.CloseBody(res) 3018 if err := googleapi.CheckResponse(res); err != nil { 3019 return nil, err 3020 } 3021 ret := &ListPartitionCursorsResponse{ 3022 ServerResponse: googleapi.ServerResponse{ 3023 Header: res.Header, 3024 HTTPStatusCode: res.StatusCode, 3025 }, 3026 } 3027 target := &ret 3028 if err := gensupport.DecodeResponse(target, res); err != nil { 3029 return nil, err 3030 } 3031 return ret, nil 3032 // { 3033 // "description": "Returns all committed cursor information for a subscription.", 3034 // "flatPath": "v1/cursor/projects/{projectsId}/locations/{locationsId}/subscriptions/{subscriptionsId}/cursors", 3035 // "httpMethod": "GET", 3036 // "id": "pubsublite.cursor.projects.locations.subscriptions.cursors.list", 3037 // "parameterOrder": [ 3038 // "parent" 3039 // ], 3040 // "parameters": { 3041 // "pageSize": { 3042 // "description": "The maximum number of cursors to return. The service may return fewer than this value. If unset or zero, all cursors for the parent will be returned.", 3043 // "format": "int32", 3044 // "location": "query", 3045 // "type": "integer" 3046 // }, 3047 // "pageToken": { 3048 // "description": "A page token, received from a previous `ListPartitionCursors` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListPartitionCursors` must match the call that provided the page token.", 3049 // "location": "query", 3050 // "type": "string" 3051 // }, 3052 // "parent": { 3053 // "description": "Required. The subscription for which to retrieve cursors. Structured like `projects/{project_number}/locations/{location}/subscriptions/{subscription_id}`.", 3054 // "location": "path", 3055 // "pattern": "^projects/[^/]+/locations/[^/]+/subscriptions/[^/]+$", 3056 // "required": true, 3057 // "type": "string" 3058 // } 3059 // }, 3060 // "path": "v1/cursor/{+parent}/cursors", 3061 // "response": { 3062 // "$ref": "ListPartitionCursorsResponse" 3063 // }, 3064 // "scopes": [ 3065 // "https://www.googleapis.com/auth/cloud-platform" 3066 // ] 3067 // } 3068 3069} 3070 3071// Pages invokes f for each page of results. 3072// A non-nil error returned from f will halt the iteration. 3073// The provided context supersedes any context provided to the Context method. 3074func (c *CursorProjectsLocationsSubscriptionsCursorsListCall) Pages(ctx context.Context, f func(*ListPartitionCursorsResponse) error) error { 3075 c.ctx_ = ctx 3076 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3077 for { 3078 x, err := c.Do() 3079 if err != nil { 3080 return err 3081 } 3082 if err := f(x); err != nil { 3083 return err 3084 } 3085 if x.NextPageToken == "" { 3086 return nil 3087 } 3088 c.PageToken(x.NextPageToken) 3089 } 3090} 3091 3092// method id "pubsublite.topicStats.projects.locations.topics.computeHeadCursor": 3093 3094type TopicStatsProjectsLocationsTopicsComputeHeadCursorCall struct { 3095 s *Service 3096 topic string 3097 computeheadcursorrequest *ComputeHeadCursorRequest 3098 urlParams_ gensupport.URLParams 3099 ctx_ context.Context 3100 header_ http.Header 3101} 3102 3103// ComputeHeadCursor: Compute the head cursor for the partition. The 3104// head cursor's offset is guaranteed to be less than or equal to all 3105// messages which have not yet been acknowledged as published, and 3106// greater than the offset of any message whose publish has already been 3107// acknowledged. It is zero if there have never been messages in the 3108// partition. 3109// 3110// - topic: The topic for which we should compute the head cursor. 3111func (r *TopicStatsProjectsLocationsTopicsService) ComputeHeadCursor(topic string, computeheadcursorrequest *ComputeHeadCursorRequest) *TopicStatsProjectsLocationsTopicsComputeHeadCursorCall { 3112 c := &TopicStatsProjectsLocationsTopicsComputeHeadCursorCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3113 c.topic = topic 3114 c.computeheadcursorrequest = computeheadcursorrequest 3115 return c 3116} 3117 3118// Fields allows partial responses to be retrieved. See 3119// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3120// for more information. 3121func (c *TopicStatsProjectsLocationsTopicsComputeHeadCursorCall) Fields(s ...googleapi.Field) *TopicStatsProjectsLocationsTopicsComputeHeadCursorCall { 3122 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3123 return c 3124} 3125 3126// Context sets the context to be used in this call's Do method. Any 3127// pending HTTP request will be aborted if the provided context is 3128// canceled. 3129func (c *TopicStatsProjectsLocationsTopicsComputeHeadCursorCall) Context(ctx context.Context) *TopicStatsProjectsLocationsTopicsComputeHeadCursorCall { 3130 c.ctx_ = ctx 3131 return c 3132} 3133 3134// Header returns an http.Header that can be modified by the caller to 3135// add HTTP headers to the request. 3136func (c *TopicStatsProjectsLocationsTopicsComputeHeadCursorCall) Header() http.Header { 3137 if c.header_ == nil { 3138 c.header_ = make(http.Header) 3139 } 3140 return c.header_ 3141} 3142 3143func (c *TopicStatsProjectsLocationsTopicsComputeHeadCursorCall) doRequest(alt string) (*http.Response, error) { 3144 reqHeaders := make(http.Header) 3145 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 3146 for k, v := range c.header_ { 3147 reqHeaders[k] = v 3148 } 3149 reqHeaders.Set("User-Agent", c.s.userAgent()) 3150 var body io.Reader = nil 3151 body, err := googleapi.WithoutDataWrapper.JSONReader(c.computeheadcursorrequest) 3152 if err != nil { 3153 return nil, err 3154 } 3155 reqHeaders.Set("Content-Type", "application/json") 3156 c.urlParams_.Set("alt", alt) 3157 c.urlParams_.Set("prettyPrint", "false") 3158 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/topicStats/{+topic}:computeHeadCursor") 3159 urls += "?" + c.urlParams_.Encode() 3160 req, err := http.NewRequest("POST", urls, body) 3161 if err != nil { 3162 return nil, err 3163 } 3164 req.Header = reqHeaders 3165 googleapi.Expand(req.URL, map[string]string{ 3166 "topic": c.topic, 3167 }) 3168 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3169} 3170 3171// Do executes the "pubsublite.topicStats.projects.locations.topics.computeHeadCursor" call. 3172// Exactly one of *ComputeHeadCursorResponse or error will be non-nil. 3173// Any non-2xx status code is an error. Response headers are in either 3174// *ComputeHeadCursorResponse.ServerResponse.Header or (if a response 3175// was returned at all) in error.(*googleapi.Error).Header. Use 3176// googleapi.IsNotModified to check whether the returned error was 3177// because http.StatusNotModified was returned. 3178func (c *TopicStatsProjectsLocationsTopicsComputeHeadCursorCall) Do(opts ...googleapi.CallOption) (*ComputeHeadCursorResponse, error) { 3179 gensupport.SetOptions(c.urlParams_, opts...) 3180 res, err := c.doRequest("json") 3181 if res != nil && res.StatusCode == http.StatusNotModified { 3182 if res.Body != nil { 3183 res.Body.Close() 3184 } 3185 return nil, &googleapi.Error{ 3186 Code: res.StatusCode, 3187 Header: res.Header, 3188 } 3189 } 3190 if err != nil { 3191 return nil, err 3192 } 3193 defer googleapi.CloseBody(res) 3194 if err := googleapi.CheckResponse(res); err != nil { 3195 return nil, err 3196 } 3197 ret := &ComputeHeadCursorResponse{ 3198 ServerResponse: googleapi.ServerResponse{ 3199 Header: res.Header, 3200 HTTPStatusCode: res.StatusCode, 3201 }, 3202 } 3203 target := &ret 3204 if err := gensupport.DecodeResponse(target, res); err != nil { 3205 return nil, err 3206 } 3207 return ret, nil 3208 // { 3209 // "description": "Compute the head cursor for the partition. The head cursor's offset is guaranteed to be less than or equal to all messages which have not yet been acknowledged as published, and greater than the offset of any message whose publish has already been acknowledged. It is zero if there have never been messages in the partition.", 3210 // "flatPath": "v1/topicStats/projects/{projectsId}/locations/{locationsId}/topics/{topicsId}:computeHeadCursor", 3211 // "httpMethod": "POST", 3212 // "id": "pubsublite.topicStats.projects.locations.topics.computeHeadCursor", 3213 // "parameterOrder": [ 3214 // "topic" 3215 // ], 3216 // "parameters": { 3217 // "topic": { 3218 // "description": "Required. The topic for which we should compute the head cursor.", 3219 // "location": "path", 3220 // "pattern": "^projects/[^/]+/locations/[^/]+/topics/[^/]+$", 3221 // "required": true, 3222 // "type": "string" 3223 // } 3224 // }, 3225 // "path": "v1/topicStats/{+topic}:computeHeadCursor", 3226 // "request": { 3227 // "$ref": "ComputeHeadCursorRequest" 3228 // }, 3229 // "response": { 3230 // "$ref": "ComputeHeadCursorResponse" 3231 // }, 3232 // "scopes": [ 3233 // "https://www.googleapis.com/auth/cloud-platform" 3234 // ] 3235 // } 3236 3237} 3238 3239// method id "pubsublite.topicStats.projects.locations.topics.computeMessageStats": 3240 3241type TopicStatsProjectsLocationsTopicsComputeMessageStatsCall struct { 3242 s *Service 3243 topic string 3244 computemessagestatsrequest *ComputeMessageStatsRequest 3245 urlParams_ gensupport.URLParams 3246 ctx_ context.Context 3247 header_ http.Header 3248} 3249 3250// ComputeMessageStats: Compute statistics about a range of messages in 3251// a given topic and partition. 3252// 3253// - topic: The topic for which we should compute message stats. 3254func (r *TopicStatsProjectsLocationsTopicsService) ComputeMessageStats(topic string, computemessagestatsrequest *ComputeMessageStatsRequest) *TopicStatsProjectsLocationsTopicsComputeMessageStatsCall { 3255 c := &TopicStatsProjectsLocationsTopicsComputeMessageStatsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3256 c.topic = topic 3257 c.computemessagestatsrequest = computemessagestatsrequest 3258 return c 3259} 3260 3261// Fields allows partial responses to be retrieved. See 3262// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3263// for more information. 3264func (c *TopicStatsProjectsLocationsTopicsComputeMessageStatsCall) Fields(s ...googleapi.Field) *TopicStatsProjectsLocationsTopicsComputeMessageStatsCall { 3265 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3266 return c 3267} 3268 3269// Context sets the context to be used in this call's Do method. Any 3270// pending HTTP request will be aborted if the provided context is 3271// canceled. 3272func (c *TopicStatsProjectsLocationsTopicsComputeMessageStatsCall) Context(ctx context.Context) *TopicStatsProjectsLocationsTopicsComputeMessageStatsCall { 3273 c.ctx_ = ctx 3274 return c 3275} 3276 3277// Header returns an http.Header that can be modified by the caller to 3278// add HTTP headers to the request. 3279func (c *TopicStatsProjectsLocationsTopicsComputeMessageStatsCall) Header() http.Header { 3280 if c.header_ == nil { 3281 c.header_ = make(http.Header) 3282 } 3283 return c.header_ 3284} 3285 3286func (c *TopicStatsProjectsLocationsTopicsComputeMessageStatsCall) doRequest(alt string) (*http.Response, error) { 3287 reqHeaders := make(http.Header) 3288 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20210410") 3289 for k, v := range c.header_ { 3290 reqHeaders[k] = v 3291 } 3292 reqHeaders.Set("User-Agent", c.s.userAgent()) 3293 var body io.Reader = nil 3294 body, err := googleapi.WithoutDataWrapper.JSONReader(c.computemessagestatsrequest) 3295 if err != nil { 3296 return nil, err 3297 } 3298 reqHeaders.Set("Content-Type", "application/json") 3299 c.urlParams_.Set("alt", alt) 3300 c.urlParams_.Set("prettyPrint", "false") 3301 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/topicStats/{+topic}:computeMessageStats") 3302 urls += "?" + c.urlParams_.Encode() 3303 req, err := http.NewRequest("POST", urls, body) 3304 if err != nil { 3305 return nil, err 3306 } 3307 req.Header = reqHeaders 3308 googleapi.Expand(req.URL, map[string]string{ 3309 "topic": c.topic, 3310 }) 3311 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3312} 3313 3314// Do executes the "pubsublite.topicStats.projects.locations.topics.computeMessageStats" call. 3315// Exactly one of *ComputeMessageStatsResponse or error will be non-nil. 3316// Any non-2xx status code is an error. Response headers are in either 3317// *ComputeMessageStatsResponse.ServerResponse.Header or (if a response 3318// was returned at all) in error.(*googleapi.Error).Header. Use 3319// googleapi.IsNotModified to check whether the returned error was 3320// because http.StatusNotModified was returned. 3321func (c *TopicStatsProjectsLocationsTopicsComputeMessageStatsCall) Do(opts ...googleapi.CallOption) (*ComputeMessageStatsResponse, error) { 3322 gensupport.SetOptions(c.urlParams_, opts...) 3323 res, err := c.doRequest("json") 3324 if res != nil && res.StatusCode == http.StatusNotModified { 3325 if res.Body != nil { 3326 res.Body.Close() 3327 } 3328 return nil, &googleapi.Error{ 3329 Code: res.StatusCode, 3330 Header: res.Header, 3331 } 3332 } 3333 if err != nil { 3334 return nil, err 3335 } 3336 defer googleapi.CloseBody(res) 3337 if err := googleapi.CheckResponse(res); err != nil { 3338 return nil, err 3339 } 3340 ret := &ComputeMessageStatsResponse{ 3341 ServerResponse: googleapi.ServerResponse{ 3342 Header: res.Header, 3343 HTTPStatusCode: res.StatusCode, 3344 }, 3345 } 3346 target := &ret 3347 if err := gensupport.DecodeResponse(target, res); err != nil { 3348 return nil, err 3349 } 3350 return ret, nil 3351 // { 3352 // "description": "Compute statistics about a range of messages in a given topic and partition.", 3353 // "flatPath": "v1/topicStats/projects/{projectsId}/locations/{locationsId}/topics/{topicsId}:computeMessageStats", 3354 // "httpMethod": "POST", 3355 // "id": "pubsublite.topicStats.projects.locations.topics.computeMessageStats", 3356 // "parameterOrder": [ 3357 // "topic" 3358 // ], 3359 // "parameters": { 3360 // "topic": { 3361 // "description": "Required. The topic for which we should compute message stats.", 3362 // "location": "path", 3363 // "pattern": "^projects/[^/]+/locations/[^/]+/topics/[^/]+$", 3364 // "required": true, 3365 // "type": "string" 3366 // } 3367 // }, 3368 // "path": "v1/topicStats/{+topic}:computeMessageStats", 3369 // "request": { 3370 // "$ref": "ComputeMessageStatsRequest" 3371 // }, 3372 // "response": { 3373 // "$ref": "ComputeMessageStatsResponse" 3374 // }, 3375 // "scopes": [ 3376 // "https://www.googleapis.com/auth/cloud-platform" 3377 // ] 3378 // } 3379 3380} 3381