1// Copyright 2020 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 pubsub provides access to the Cloud Pub/Sub API. 8// 9// This package is DEPRECATED. Use package cloud.google.com/go/pubsub instead. 10// 11// For product documentation, see: https://cloud.google.com/pubsub/docs 12// 13// Creating a client 14// 15// Usage example: 16// 17// import "google.golang.org/api/pubsub/v1beta2" 18// ... 19// ctx := context.Background() 20// pubsubService, err := pubsub.NewService(ctx) 21// 22// In this example, Google Application Default Credentials are used for authentication. 23// 24// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 25// 26// Other authentication options 27// 28// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 29// 30// pubsubService, err := pubsub.NewService(ctx, option.WithScopes(pubsub.PubsubScope)) 31// 32// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 33// 34// pubsubService, err := pubsub.NewService(ctx, option.WithAPIKey("AIza...")) 35// 36// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 37// 38// config := &oauth2.Config{...} 39// // ... 40// token, err := config.Exchange(ctx, ...) 41// pubsubService, err := pubsub.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 42// 43// See https://godoc.org/google.golang.org/api/option/ for details on options. 44package pubsub // import "google.golang.org/api/pubsub/v1beta2" 45 46import ( 47 "bytes" 48 "context" 49 "encoding/json" 50 "errors" 51 "fmt" 52 "io" 53 "net/http" 54 "net/url" 55 "strconv" 56 "strings" 57 58 googleapi "google.golang.org/api/googleapi" 59 gensupport "google.golang.org/api/internal/gensupport" 60 option "google.golang.org/api/option" 61 internaloption "google.golang.org/api/option/internaloption" 62 htransport "google.golang.org/api/transport/http" 63) 64 65// Always reference these packages, just in case the auto-generated code 66// below doesn't. 67var _ = bytes.NewBuffer 68var _ = strconv.Itoa 69var _ = fmt.Sprintf 70var _ = json.NewDecoder 71var _ = io.Copy 72var _ = url.Parse 73var _ = gensupport.MarshalJSON 74var _ = googleapi.Version 75var _ = errors.New 76var _ = strings.Replace 77var _ = context.Canceled 78var _ = internaloption.WithDefaultEndpoint 79 80const apiId = "pubsub:v1beta2" 81const apiName = "pubsub" 82const apiVersion = "v1beta2" 83const basePath = "https://pubsub.googleapis.com/" 84 85// OAuth2 scopes used by this API. 86const ( 87 // View and manage your data across Google Cloud Platform services 88 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 89 90 // View and manage Pub/Sub topics and subscriptions 91 PubsubScope = "https://www.googleapis.com/auth/pubsub" 92) 93 94// NewService creates a new Service. 95func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 96 scopesOption := option.WithScopes( 97 "https://www.googleapis.com/auth/cloud-platform", 98 "https://www.googleapis.com/auth/pubsub", 99 ) 100 // NOTE: prepend, so we don't override user-specified scopes. 101 opts = append([]option.ClientOption{scopesOption}, opts...) 102 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 103 client, endpoint, err := htransport.NewClient(ctx, opts...) 104 if err != nil { 105 return nil, err 106 } 107 s, err := New(client) 108 if err != nil { 109 return nil, err 110 } 111 if endpoint != "" { 112 s.BasePath = endpoint 113 } 114 return s, nil 115} 116 117// New creates a new Service. It uses the provided http.Client for requests. 118// 119// Deprecated: please use NewService instead. 120// To provide a custom HTTP client, use option.WithHTTPClient. 121// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 122func New(client *http.Client) (*Service, error) { 123 if client == nil { 124 return nil, errors.New("client is nil") 125 } 126 s := &Service{client: client, BasePath: basePath} 127 s.Projects = NewProjectsService(s) 128 return s, nil 129} 130 131type Service struct { 132 client *http.Client 133 BasePath string // API endpoint base URL 134 UserAgent string // optional additional User-Agent fragment 135 136 Projects *ProjectsService 137} 138 139func (s *Service) userAgent() string { 140 if s.UserAgent == "" { 141 return googleapi.UserAgent 142 } 143 return googleapi.UserAgent + " " + s.UserAgent 144} 145 146func NewProjectsService(s *Service) *ProjectsService { 147 rs := &ProjectsService{s: s} 148 rs.Subscriptions = NewProjectsSubscriptionsService(s) 149 rs.Topics = NewProjectsTopicsService(s) 150 return rs 151} 152 153type ProjectsService struct { 154 s *Service 155 156 Subscriptions *ProjectsSubscriptionsService 157 158 Topics *ProjectsTopicsService 159} 160 161func NewProjectsSubscriptionsService(s *Service) *ProjectsSubscriptionsService { 162 rs := &ProjectsSubscriptionsService{s: s} 163 return rs 164} 165 166type ProjectsSubscriptionsService struct { 167 s *Service 168} 169 170func NewProjectsTopicsService(s *Service) *ProjectsTopicsService { 171 rs := &ProjectsTopicsService{s: s} 172 rs.Subscriptions = NewProjectsTopicsSubscriptionsService(s) 173 return rs 174} 175 176type ProjectsTopicsService struct { 177 s *Service 178 179 Subscriptions *ProjectsTopicsSubscriptionsService 180} 181 182func NewProjectsTopicsSubscriptionsService(s *Service) *ProjectsTopicsSubscriptionsService { 183 rs := &ProjectsTopicsSubscriptionsService{s: s} 184 return rs 185} 186 187type ProjectsTopicsSubscriptionsService struct { 188 s *Service 189} 190 191// AcknowledgeRequest: Request for the Acknowledge method. 192type AcknowledgeRequest struct { 193 // AckIds: The acknowledgment ID for the messages being acknowledged 194 // that was returned 195 // by the Pub/Sub system in the `Pull` response. Must not be empty. 196 AckIds []string `json:"ackIds,omitempty"` 197 198 // ForceSendFields is a list of field names (e.g. "AckIds") to 199 // unconditionally include in API requests. By default, fields with 200 // empty values are omitted from API requests. However, any non-pointer, 201 // non-interface field appearing in ForceSendFields will be sent to the 202 // server regardless of whether the field is empty or not. This may be 203 // used to include empty fields in Patch requests. 204 ForceSendFields []string `json:"-"` 205 206 // NullFields is a list of field names (e.g. "AckIds") to include in API 207 // requests with the JSON null value. By default, fields with empty 208 // values are omitted from API requests. However, any field with an 209 // empty value appearing in NullFields will be sent to the server as 210 // null. It is an error if a field in this list has a non-empty value. 211 // This may be used to include null fields in Patch requests. 212 NullFields []string `json:"-"` 213} 214 215func (s *AcknowledgeRequest) MarshalJSON() ([]byte, error) { 216 type NoMethod AcknowledgeRequest 217 raw := NoMethod(*s) 218 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 219} 220 221// Binding: Associates `members` with a `role`. 222type Binding struct { 223 // Condition: The condition that is associated with this binding. 224 // NOTE: An unsatisfied condition will not allow user access via 225 // current 226 // binding. Different bindings, including their conditions, are 227 // examined 228 // independently. 229 Condition *Expr `json:"condition,omitempty"` 230 231 // Members: Specifies the identities requesting access for a Cloud 232 // Platform resource. 233 // `members` can have the following values: 234 // 235 // * `allUsers`: A special identifier that represents anyone who is 236 // on the internet; with or without a Google account. 237 // 238 // * `allAuthenticatedUsers`: A special identifier that represents 239 // anyone 240 // who is authenticated with a Google account or a service 241 // account. 242 // 243 // * `user:{emailid}`: An email address that represents a specific 244 // Google 245 // account. For example, `alice@example.com` . 246 // 247 // 248 // * `serviceAccount:{emailid}`: An email address that represents a 249 // service 250 // account. For example, 251 // `my-other-app@appspot.gserviceaccount.com`. 252 // 253 // * `group:{emailid}`: An email address that represents a Google 254 // group. 255 // For example, `admins@example.com`. 256 // 257 // * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus 258 // unique 259 // identifier) representing a user that has been recently deleted. 260 // For 261 // example, `alice@example.com?uid=123456789012345678901`. If the 262 // user is 263 // recovered, this value reverts to `user:{emailid}` and the 264 // recovered user 265 // retains the role in the binding. 266 // 267 // * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address 268 // (plus 269 // unique identifier) representing a service account that has been 270 // recently 271 // deleted. For example, 272 // 273 // `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. 274 // 275 // If the service account is undeleted, this value reverts to 276 // `serviceAccount:{emailid}` and the undeleted service account 277 // retains the 278 // role in the binding. 279 // 280 // * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus 281 // unique 282 // identifier) representing a Google group that has been recently 283 // deleted. For example, 284 // `admins@example.com?uid=123456789012345678901`. If 285 // the group is recovered, this value reverts to `group:{emailid}` 286 // and the 287 // recovered group retains the role in the binding. 288 // 289 // 290 // * `domain:{domain}`: The G Suite domain (primary) that represents all 291 // the 292 // users of that domain. For example, `google.com` or 293 // `example.com`. 294 // 295 // 296 Members []string `json:"members,omitempty"` 297 298 // Role: Role that is assigned to `members`. 299 // For example, `roles/viewer`, `roles/editor`, or `roles/owner`. 300 Role string `json:"role,omitempty"` 301 302 // ForceSendFields is a list of field names (e.g. "Condition") to 303 // unconditionally include in API requests. By default, fields with 304 // empty values are omitted from API requests. However, any non-pointer, 305 // non-interface field appearing in ForceSendFields will be sent to the 306 // server regardless of whether the field is empty or not. This may be 307 // used to include empty fields in Patch requests. 308 ForceSendFields []string `json:"-"` 309 310 // NullFields is a list of field names (e.g. "Condition") to include in 311 // API requests with the JSON null value. By default, fields with empty 312 // values are omitted from API requests. However, any field with an 313 // empty value appearing in NullFields will be sent to the server as 314 // null. It is an error if a field in this list has a non-empty value. 315 // This may be used to include null fields in Patch requests. 316 NullFields []string `json:"-"` 317} 318 319func (s *Binding) MarshalJSON() ([]byte, error) { 320 type NoMethod Binding 321 raw := NoMethod(*s) 322 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 323} 324 325// Empty: A generic empty message that you can re-use to avoid defining 326// duplicated 327// empty messages in your APIs. A typical example is to use it as the 328// request 329// or the response type of an API method. For instance: 330// 331// service Foo { 332// rpc Bar(google.protobuf.Empty) returns 333// (google.protobuf.Empty); 334// } 335// 336// The JSON representation for `Empty` is empty JSON object `{}`. 337type Empty struct { 338 // ServerResponse contains the HTTP response code and headers from the 339 // server. 340 googleapi.ServerResponse `json:"-"` 341} 342 343// Expr: Represents a textual expression in the Common Expression 344// Language (CEL) 345// syntax. CEL is a C-like expression language. The syntax and semantics 346// of CEL 347// are documented at https://github.com/google/cel-spec. 348// 349// Example (Comparison): 350// 351// title: "Summary size limit" 352// description: "Determines if a summary is less than 100 chars" 353// expression: "document.summary.size() < 100" 354// 355// Example (Equality): 356// 357// title: "Requestor is owner" 358// description: "Determines if requestor is the document owner" 359// expression: "document.owner == 360// request.auth.claims.email" 361// 362// Example (Logic): 363// 364// title: "Public documents" 365// description: "Determine whether the document should be publicly 366// visible" 367// expression: "document.type != 'private' && document.type != 368// 'internal'" 369// 370// Example (Data Manipulation): 371// 372// title: "Notification string" 373// description: "Create a notification string with a timestamp." 374// expression: "'New message received at ' + 375// string(document.create_time)" 376// 377// The exact variables and functions that may be referenced within an 378// expression 379// are determined by the service that evaluates it. See the 380// service 381// documentation for additional information. 382type Expr struct { 383 // Description: Optional. Description of the expression. This is a 384 // longer text which 385 // describes the expression, e.g. when hovered over it in a UI. 386 Description string `json:"description,omitempty"` 387 388 // Expression: Textual representation of an expression in Common 389 // Expression Language 390 // syntax. 391 Expression string `json:"expression,omitempty"` 392 393 // Location: Optional. String indicating the location of the expression 394 // for error 395 // reporting, e.g. a file name and a position in the file. 396 Location string `json:"location,omitempty"` 397 398 // Title: Optional. Title for the expression, i.e. a short string 399 // describing 400 // its purpose. This can be used e.g. in UIs which allow to enter 401 // the 402 // expression. 403 Title string `json:"title,omitempty"` 404 405 // ForceSendFields is a list of field names (e.g. "Description") to 406 // unconditionally include in API requests. By default, fields with 407 // empty values are omitted from API requests. However, any non-pointer, 408 // non-interface field appearing in ForceSendFields will be sent to the 409 // server regardless of whether the field is empty or not. This may be 410 // used to include empty fields in Patch requests. 411 ForceSendFields []string `json:"-"` 412 413 // NullFields is a list of field names (e.g. "Description") to include 414 // in API requests with the JSON null value. By default, fields with 415 // empty values are omitted from API requests. However, any field with 416 // an empty value appearing in NullFields will be sent to the server as 417 // null. It is an error if a field in this list has a non-empty value. 418 // This may be used to include null fields in Patch requests. 419 NullFields []string `json:"-"` 420} 421 422func (s *Expr) MarshalJSON() ([]byte, error) { 423 type NoMethod Expr 424 raw := NoMethod(*s) 425 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 426} 427 428// ListSubscriptionsResponse: Response for the `ListSubscriptions` 429// method. 430type ListSubscriptionsResponse struct { 431 // NextPageToken: If not empty, indicates that there may be more 432 // subscriptions that match 433 // the request; this value should be passed in a 434 // new 435 // `ListSubscriptionsRequest` to get more subscriptions. 436 NextPageToken string `json:"nextPageToken,omitempty"` 437 438 // Subscriptions: The subscriptions that match the request. 439 Subscriptions []*Subscription `json:"subscriptions,omitempty"` 440 441 // ServerResponse contains the HTTP response code and headers from the 442 // server. 443 googleapi.ServerResponse `json:"-"` 444 445 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 446 // unconditionally include in API requests. By default, fields with 447 // empty values are omitted from API requests. However, any non-pointer, 448 // non-interface field appearing in ForceSendFields will be sent to the 449 // server regardless of whether the field is empty or not. This may be 450 // used to include empty fields in Patch requests. 451 ForceSendFields []string `json:"-"` 452 453 // NullFields is a list of field names (e.g. "NextPageToken") to include 454 // in API requests with the JSON null value. By default, fields with 455 // empty values are omitted from API requests. However, any field with 456 // an empty value appearing in NullFields will be sent to the server as 457 // null. It is an error if a field in this list has a non-empty value. 458 // This may be used to include null fields in Patch requests. 459 NullFields []string `json:"-"` 460} 461 462func (s *ListSubscriptionsResponse) MarshalJSON() ([]byte, error) { 463 type NoMethod ListSubscriptionsResponse 464 raw := NoMethod(*s) 465 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 466} 467 468// ListTopicSubscriptionsResponse: Response for the 469// `ListTopicSubscriptions` method. 470type ListTopicSubscriptionsResponse struct { 471 // NextPageToken: If not empty, indicates that there may be more 472 // subscriptions that match 473 // the request; this value should be passed in a 474 // new 475 // `ListTopicSubscriptionsRequest` to get more subscriptions. 476 NextPageToken string `json:"nextPageToken,omitempty"` 477 478 // Subscriptions: The names of the subscriptions that match the request. 479 Subscriptions []string `json:"subscriptions,omitempty"` 480 481 // ServerResponse contains the HTTP response code and headers from the 482 // server. 483 googleapi.ServerResponse `json:"-"` 484 485 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 486 // unconditionally include in API requests. By default, fields with 487 // empty values are omitted from API requests. However, any non-pointer, 488 // non-interface field appearing in ForceSendFields will be sent to the 489 // server regardless of whether the field is empty or not. This may be 490 // used to include empty fields in Patch requests. 491 ForceSendFields []string `json:"-"` 492 493 // NullFields is a list of field names (e.g. "NextPageToken") to include 494 // in API requests with the JSON null value. By default, fields with 495 // empty values are omitted from API requests. However, any field with 496 // an empty value appearing in NullFields will be sent to the server as 497 // null. It is an error if a field in this list has a non-empty value. 498 // This may be used to include null fields in Patch requests. 499 NullFields []string `json:"-"` 500} 501 502func (s *ListTopicSubscriptionsResponse) MarshalJSON() ([]byte, error) { 503 type NoMethod ListTopicSubscriptionsResponse 504 raw := NoMethod(*s) 505 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 506} 507 508// ListTopicsResponse: Response for the `ListTopics` method. 509type ListTopicsResponse struct { 510 // NextPageToken: If not empty, indicates that there may be more topics 511 // that match the 512 // request; this value should be passed in a new `ListTopicsRequest`. 513 NextPageToken string `json:"nextPageToken,omitempty"` 514 515 // Topics: The resulting topics. 516 Topics []*Topic `json:"topics,omitempty"` 517 518 // ServerResponse contains the HTTP response code and headers from the 519 // server. 520 googleapi.ServerResponse `json:"-"` 521 522 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 523 // unconditionally include in API requests. By default, fields with 524 // empty values are omitted from API requests. However, any non-pointer, 525 // non-interface field appearing in ForceSendFields will be sent to the 526 // server regardless of whether the field is empty or not. This may be 527 // used to include empty fields in Patch requests. 528 ForceSendFields []string `json:"-"` 529 530 // NullFields is a list of field names (e.g. "NextPageToken") to include 531 // in API requests with the JSON null value. By default, fields with 532 // empty values are omitted from API requests. However, any field with 533 // an empty value appearing in NullFields will be sent to the server as 534 // null. It is an error if a field in this list has a non-empty value. 535 // This may be used to include null fields in Patch requests. 536 NullFields []string `json:"-"` 537} 538 539func (s *ListTopicsResponse) MarshalJSON() ([]byte, error) { 540 type NoMethod ListTopicsResponse 541 raw := NoMethod(*s) 542 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 543} 544 545// ModifyAckDeadlineRequest: Request for the ModifyAckDeadline method. 546type ModifyAckDeadlineRequest struct { 547 // AckDeadlineSeconds: The new ack deadline with respect to the time 548 // this request was sent to 549 // the Pub/Sub system. Must be >= 0. For example, if the value is 10, 550 // the new 551 // ack deadline will expire 10 seconds after the `ModifyAckDeadline` 552 // call 553 // was made. Specifying zero may immediately make the message available 554 // for 555 // another pull request. 556 AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"` 557 558 // AckId: The acknowledgment ID. Either this or ack_ids must be 559 // populated, but not 560 // both. 561 AckId string `json:"ackId,omitempty"` 562 563 // AckIds: List of acknowledgment IDs. 564 AckIds []string `json:"ackIds,omitempty"` 565 566 // ForceSendFields is a list of field names (e.g. "AckDeadlineSeconds") 567 // to unconditionally include in API requests. By default, fields with 568 // empty values are omitted from API requests. However, any non-pointer, 569 // non-interface field appearing in ForceSendFields will be sent to the 570 // server regardless of whether the field is empty or not. This may be 571 // used to include empty fields in Patch requests. 572 ForceSendFields []string `json:"-"` 573 574 // NullFields is a list of field names (e.g. "AckDeadlineSeconds") to 575 // include in API requests with the JSON null value. By default, fields 576 // with empty values are omitted from API requests. However, any field 577 // with an empty value appearing in NullFields will be sent to the 578 // server as null. It is an error if a field in this list has a 579 // non-empty value. This may be used to include null fields in Patch 580 // requests. 581 NullFields []string `json:"-"` 582} 583 584func (s *ModifyAckDeadlineRequest) MarshalJSON() ([]byte, error) { 585 type NoMethod ModifyAckDeadlineRequest 586 raw := NoMethod(*s) 587 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 588} 589 590// ModifyPushConfigRequest: Request for the ModifyPushConfig method. 591type ModifyPushConfigRequest struct { 592 // PushConfig: The push configuration for future deliveries. 593 // 594 // An empty `pushConfig` indicates that the Pub/Sub system should 595 // stop pushing messages from the given subscription and allow 596 // messages to be pulled and acknowledged - effectively pausing 597 // the subscription if `Pull` is not called. 598 PushConfig *PushConfig `json:"pushConfig,omitempty"` 599 600 // ForceSendFields is a list of field names (e.g. "PushConfig") to 601 // unconditionally include in API requests. By default, fields with 602 // empty values are omitted from API requests. However, any non-pointer, 603 // non-interface field appearing in ForceSendFields will be sent to the 604 // server regardless of whether the field is empty or not. This may be 605 // used to include empty fields in Patch requests. 606 ForceSendFields []string `json:"-"` 607 608 // NullFields is a list of field names (e.g. "PushConfig") to include in 609 // API requests with the JSON null value. By default, fields with empty 610 // values are omitted from API requests. However, any field with an 611 // empty value appearing in NullFields will be sent to the server as 612 // null. It is an error if a field in this list has a non-empty value. 613 // This may be used to include null fields in Patch requests. 614 NullFields []string `json:"-"` 615} 616 617func (s *ModifyPushConfigRequest) MarshalJSON() ([]byte, error) { 618 type NoMethod ModifyPushConfigRequest 619 raw := NoMethod(*s) 620 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 621} 622 623// OidcToken: Contains information needed for generating an 624// [OpenID 625// Connect 626// token](https://developers.google.com/identity/protocols/OpenID 627// Connect). 628type OidcToken struct { 629 // Audience: Audience to be used when generating OIDC token. The 630 // audience claim 631 // identifies the recipients that the JWT is intended for. The 632 // audience 633 // value is a single case-sensitive string. Having multiple values 634 // (array) 635 // for the audience field is not supported. More info about the OIDC 636 // JWT 637 // token audience here: 638 // https://tools.ietf.org/html/rfc7519#section-4.1.3 639 // Note: if not specified, the Push endpoint URL will be used. 640 Audience string `json:"audience,omitempty"` 641 642 // ServiceAccountEmail: [Service 643 // account 644 // email](https://cloud.google.com/iam/docs/service-accounts) 645 // to be used for generating the OIDC token. The caller 646 // (for 647 // CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) 648 // must 649 // have the iam.serviceAccounts.actAs permission for the service 650 // account. 651 ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"` 652 653 // ForceSendFields is a list of field names (e.g. "Audience") to 654 // unconditionally include in API requests. By default, fields with 655 // empty values are omitted from API requests. However, any non-pointer, 656 // non-interface field appearing in ForceSendFields will be sent to the 657 // server regardless of whether the field is empty or not. This may be 658 // used to include empty fields in Patch requests. 659 ForceSendFields []string `json:"-"` 660 661 // NullFields is a list of field names (e.g. "Audience") to include in 662 // API requests with the JSON null value. By default, fields with empty 663 // values are omitted from API requests. However, any field with an 664 // empty value appearing in NullFields will be sent to the server as 665 // null. It is an error if a field in this list has a non-empty value. 666 // This may be used to include null fields in Patch requests. 667 NullFields []string `json:"-"` 668} 669 670func (s *OidcToken) MarshalJSON() ([]byte, error) { 671 type NoMethod OidcToken 672 raw := NoMethod(*s) 673 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 674} 675 676// Policy: An Identity and Access Management (IAM) policy, which 677// specifies access 678// controls for Google Cloud resources. 679// 680// 681// A `Policy` is a collection of `bindings`. A `binding` binds one or 682// more 683// `members` to a single `role`. Members can be user accounts, service 684// accounts, 685// Google groups, and domains (such as G Suite). A `role` is a named 686// list of 687// permissions; each `role` can be an IAM predefined role or a 688// user-created 689// custom role. 690// 691// Optionally, a `binding` can specify a `condition`, which is a 692// logical 693// expression that allows access to a resource only if the expression 694// evaluates 695// to `true`. A condition can add constraints based on attributes of 696// the 697// request, the resource, or both. 698// 699// **JSON example:** 700// 701// { 702// "bindings": [ 703// { 704// "role": "roles/resourcemanager.organizationAdmin", 705// "members": [ 706// "user:mike@example.com", 707// "group:admins@example.com", 708// "domain:google.com", 709// 710// "serviceAccount:my-project-id@appspot.gserviceaccount.com" 711// ] 712// }, 713// { 714// "role": "roles/resourcemanager.organizationViewer", 715// "members": ["user:eve@example.com"], 716// "condition": { 717// "title": "expirable access", 718// "description": "Does not grant access after Sep 2020", 719// "expression": "request.time < 720// timestamp('2020-10-01T00:00:00.000Z')", 721// } 722// } 723// ], 724// "etag": "BwWWja0YfJA=", 725// "version": 3 726// } 727// 728// **YAML example:** 729// 730// bindings: 731// - members: 732// - user:mike@example.com 733// - group:admins@example.com 734// - domain:google.com 735// - serviceAccount:my-project-id@appspot.gserviceaccount.com 736// role: roles/resourcemanager.organizationAdmin 737// - members: 738// - user:eve@example.com 739// role: roles/resourcemanager.organizationViewer 740// condition: 741// title: expirable access 742// description: Does not grant access after Sep 2020 743// expression: request.time < 744// timestamp('2020-10-01T00:00:00.000Z') 745// - etag: BwWWja0YfJA= 746// - version: 3 747// 748// For a description of IAM and its features, see the 749// [IAM documentation](https://cloud.google.com/iam/docs/). 750type Policy struct { 751 // Bindings: Associates a list of `members` to a `role`. Optionally, may 752 // specify a 753 // `condition` that determines how and when the `bindings` are applied. 754 // Each 755 // of the `bindings` must contain at least one member. 756 Bindings []*Binding `json:"bindings,omitempty"` 757 758 // Etag: `etag` is used for optimistic concurrency control as a way to 759 // help 760 // prevent simultaneous updates of a policy from overwriting each 761 // other. 762 // It is strongly suggested that systems make use of the `etag` in 763 // the 764 // read-modify-write cycle to perform policy updates in order to avoid 765 // race 766 // conditions: An `etag` is returned in the response to `getIamPolicy`, 767 // and 768 // systems are expected to put that etag in the request to 769 // `setIamPolicy` to 770 // ensure that their change will be applied to the same version of the 771 // policy. 772 // 773 // **Important:** If you use IAM Conditions, you must include the `etag` 774 // field 775 // whenever you call `setIamPolicy`. If you omit this field, then IAM 776 // allows 777 // you to overwrite a version `3` policy with a version `1` policy, and 778 // all of 779 // the conditions in the version `3` policy are lost. 780 Etag string `json:"etag,omitempty"` 781 782 // Version: Specifies the format of the policy. 783 // 784 // Valid values are `0`, `1`, and `3`. Requests that specify an invalid 785 // value 786 // are rejected. 787 // 788 // Any operation that affects conditional role bindings must specify 789 // version 790 // `3`. This requirement applies to the following operations: 791 // 792 // * Getting a policy that includes a conditional role binding 793 // * Adding a conditional role binding to a policy 794 // * Changing a conditional role binding in a policy 795 // * Removing any role binding, with or without a condition, from a 796 // policy 797 // that includes conditions 798 // 799 // **Important:** If you use IAM Conditions, you must include the `etag` 800 // field 801 // whenever you call `setIamPolicy`. If you omit this field, then IAM 802 // allows 803 // you to overwrite a version `3` policy with a version `1` policy, and 804 // all of 805 // the conditions in the version `3` policy are lost. 806 // 807 // If a policy does not include any conditions, operations on that 808 // policy may 809 // specify any valid version or leave the field unset. 810 Version int64 `json:"version,omitempty"` 811 812 // ServerResponse contains the HTTP response code and headers from the 813 // server. 814 googleapi.ServerResponse `json:"-"` 815 816 // ForceSendFields is a list of field names (e.g. "Bindings") to 817 // unconditionally include in API requests. By default, fields with 818 // empty values are omitted from API requests. However, any non-pointer, 819 // non-interface field appearing in ForceSendFields will be sent to the 820 // server regardless of whether the field is empty or not. This may be 821 // used to include empty fields in Patch requests. 822 ForceSendFields []string `json:"-"` 823 824 // NullFields is a list of field names (e.g. "Bindings") to include in 825 // API requests with the JSON null value. By default, fields with empty 826 // values are omitted from API requests. However, any field with an 827 // empty value appearing in NullFields will be sent to the server as 828 // null. It is an error if a field in this list has a non-empty value. 829 // This may be used to include null fields in Patch requests. 830 NullFields []string `json:"-"` 831} 832 833func (s *Policy) MarshalJSON() ([]byte, error) { 834 type NoMethod Policy 835 raw := NoMethod(*s) 836 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 837} 838 839// PublishRequest: Request for the Publish method. 840type PublishRequest struct { 841 // Messages: The messages to publish. 842 Messages []*PubsubMessage `json:"messages,omitempty"` 843 844 // ForceSendFields is a list of field names (e.g. "Messages") to 845 // unconditionally include in API requests. By default, fields with 846 // empty values are omitted from API requests. However, any non-pointer, 847 // non-interface field appearing in ForceSendFields will be sent to the 848 // server regardless of whether the field is empty or not. This may be 849 // used to include empty fields in Patch requests. 850 ForceSendFields []string `json:"-"` 851 852 // NullFields is a list of field names (e.g. "Messages") to include in 853 // API requests with the JSON null value. By default, fields with empty 854 // values are omitted from API requests. However, any field with an 855 // empty value appearing in NullFields will be sent to the server as 856 // null. It is an error if a field in this list has a non-empty value. 857 // This may be used to include null fields in Patch requests. 858 NullFields []string `json:"-"` 859} 860 861func (s *PublishRequest) MarshalJSON() ([]byte, error) { 862 type NoMethod PublishRequest 863 raw := NoMethod(*s) 864 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 865} 866 867// PublishResponse: Response for the `Publish` method. 868type PublishResponse struct { 869 // MessageIds: The server-assigned ID of each published message, in the 870 // same order as 871 // the messages in the request. IDs are guaranteed to be unique 872 // within 873 // the topic. 874 MessageIds []string `json:"messageIds,omitempty"` 875 876 // ServerResponse contains the HTTP response code and headers from the 877 // server. 878 googleapi.ServerResponse `json:"-"` 879 880 // ForceSendFields is a list of field names (e.g. "MessageIds") to 881 // unconditionally include in API requests. By default, fields with 882 // empty values are omitted from API requests. However, any non-pointer, 883 // non-interface field appearing in ForceSendFields will be sent to the 884 // server regardless of whether the field is empty or not. This may be 885 // used to include empty fields in Patch requests. 886 ForceSendFields []string `json:"-"` 887 888 // NullFields is a list of field names (e.g. "MessageIds") to include in 889 // API requests with the JSON null value. By default, fields with empty 890 // values are omitted from API requests. However, any field with an 891 // empty value appearing in NullFields will be sent to the server as 892 // null. It is an error if a field in this list has a non-empty value. 893 // This may be used to include null fields in Patch requests. 894 NullFields []string `json:"-"` 895} 896 897func (s *PublishResponse) MarshalJSON() ([]byte, error) { 898 type NoMethod PublishResponse 899 raw := NoMethod(*s) 900 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 901} 902 903// PubsubMessage: A message data and its attributes. The message payload 904// must not be empty; 905// it must contain either a non-empty data field, or at least one 906// attribute. 907type PubsubMessage struct { 908 // Attributes: Optional attributes for this message. 909 Attributes map[string]string `json:"attributes,omitempty"` 910 911 // Data: The message payload. For JSON requests, the value of this field 912 // must be 913 // [base64-encoded](https://tools.ietf.org/html/rfc4648). 914 Data string `json:"data,omitempty"` 915 916 // MessageId: ID of this message, assigned by the server when the 917 // message is published. 918 // Guaranteed to be unique within the topic. This value may be read by 919 // a 920 // subscriber that receives a `PubsubMessage` via a `Pull` call or a 921 // push 922 // delivery. It must not be populated by the publisher in a `Publish` 923 // call. 924 MessageId string `json:"messageId,omitempty"` 925 926 // PublishTime: The time at which the message was published, populated 927 // by the server when 928 // it receives the `Publish` call. It must not be populated by 929 // the 930 // publisher in a `Publish` call. 931 PublishTime string `json:"publishTime,omitempty"` 932 933 // ForceSendFields is a list of field names (e.g. "Attributes") to 934 // unconditionally include in API requests. By default, fields with 935 // empty values are omitted from API requests. However, any non-pointer, 936 // non-interface field appearing in ForceSendFields will be sent to the 937 // server regardless of whether the field is empty or not. This may be 938 // used to include empty fields in Patch requests. 939 ForceSendFields []string `json:"-"` 940 941 // NullFields is a list of field names (e.g. "Attributes") to include in 942 // API requests with the JSON null value. By default, fields with empty 943 // values are omitted from API requests. However, any field with an 944 // empty value appearing in NullFields will be sent to the server as 945 // null. It is an error if a field in this list has a non-empty value. 946 // This may be used to include null fields in Patch requests. 947 NullFields []string `json:"-"` 948} 949 950func (s *PubsubMessage) MarshalJSON() ([]byte, error) { 951 type NoMethod PubsubMessage 952 raw := NoMethod(*s) 953 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 954} 955 956// PullRequest: Request for the `Pull` method. 957type PullRequest struct { 958 // MaxMessages: The maximum number of messages returned for this 959 // request. The Pub/Sub 960 // system may return fewer than the number specified. 961 MaxMessages int64 `json:"maxMessages,omitempty"` 962 963 // ReturnImmediately: If this is specified as true the system will 964 // respond immediately even if 965 // it is not able to return a message in the `Pull` response. Otherwise 966 // the 967 // system is allowed to wait until at least one message is available 968 // rather 969 // than returning no messages. The client may cancel the request if it 970 // does 971 // not wish to wait any longer for the response. 972 ReturnImmediately bool `json:"returnImmediately,omitempty"` 973 974 // ForceSendFields is a list of field names (e.g. "MaxMessages") to 975 // unconditionally include in API requests. By default, fields with 976 // empty values are omitted from API requests. However, any non-pointer, 977 // non-interface field appearing in ForceSendFields will be sent to the 978 // server regardless of whether the field is empty or not. This may be 979 // used to include empty fields in Patch requests. 980 ForceSendFields []string `json:"-"` 981 982 // NullFields is a list of field names (e.g. "MaxMessages") to include 983 // in API requests with the JSON null value. By default, fields with 984 // empty values are omitted from API requests. However, any field with 985 // an empty value appearing in NullFields will be sent to the server as 986 // null. It is an error if a field in this list has a non-empty value. 987 // This may be used to include null fields in Patch requests. 988 NullFields []string `json:"-"` 989} 990 991func (s *PullRequest) MarshalJSON() ([]byte, error) { 992 type NoMethod PullRequest 993 raw := NoMethod(*s) 994 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 995} 996 997// PullResponse: Response for the `Pull` method. 998type PullResponse struct { 999 // ReceivedMessages: Received Pub/Sub messages. The Pub/Sub system will 1000 // return zero messages if 1001 // there are no more available in the backlog. The Pub/Sub system may 1002 // return 1003 // fewer than the `maxMessages` requested even if there are more 1004 // messages 1005 // available in the backlog. 1006 ReceivedMessages []*ReceivedMessage `json:"receivedMessages,omitempty"` 1007 1008 // ServerResponse contains the HTTP response code and headers from the 1009 // server. 1010 googleapi.ServerResponse `json:"-"` 1011 1012 // ForceSendFields is a list of field names (e.g. "ReceivedMessages") to 1013 // unconditionally include in API requests. By default, fields with 1014 // empty values are omitted from API requests. However, any non-pointer, 1015 // non-interface field appearing in ForceSendFields will be sent to the 1016 // server regardless of whether the field is empty or not. This may be 1017 // used to include empty fields in Patch requests. 1018 ForceSendFields []string `json:"-"` 1019 1020 // NullFields is a list of field names (e.g. "ReceivedMessages") to 1021 // include in API requests with the JSON null value. By default, fields 1022 // with empty values are omitted from API requests. However, any field 1023 // with an empty value appearing in NullFields will be sent to the 1024 // server as null. It is an error if a field in this list has a 1025 // non-empty value. This may be used to include null fields in Patch 1026 // requests. 1027 NullFields []string `json:"-"` 1028} 1029 1030func (s *PullResponse) MarshalJSON() ([]byte, error) { 1031 type NoMethod PullResponse 1032 raw := NoMethod(*s) 1033 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1034} 1035 1036// PushConfig: Configuration for a push delivery endpoint. 1037type PushConfig struct { 1038 // Attributes: Endpoint configuration attributes. 1039 // 1040 // Every endpoint has a set of API supported attributes that can be used 1041 // to 1042 // control different aspects of the message delivery. 1043 // 1044 // The currently supported attribute is `x-goog-version`, which you 1045 // can 1046 // use to change the format of the push message. This 1047 // attribute 1048 // indicates the version of the data expected by the endpoint. 1049 // This 1050 // controls the shape of the envelope (i.e. its fields and 1051 // metadata). 1052 // The endpoint version is based on the version of the Pub/Sub 1053 // API. 1054 // 1055 // If not present during the `CreateSubscription` call, it will default 1056 // to 1057 // the version of the API used to make such call. If not present during 1058 // a 1059 // `ModifyPushConfig` call, its value will not be changed. 1060 // `GetSubscription` 1061 // calls will always return a valid version, even if the subscription 1062 // was 1063 // created without this attribute. 1064 // 1065 // The possible values for this attribute are: 1066 // 1067 // * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub 1068 // API. 1069 // * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub 1070 // API. 1071 Attributes map[string]string `json:"attributes,omitempty"` 1072 1073 // OidcToken: If specified, Pub/Sub will generate and attach an OIDC JWT 1074 // token as an 1075 // `Authorization` header in the HTTP request for every pushed message. 1076 OidcToken *OidcToken `json:"oidcToken,omitempty"` 1077 1078 // PushEndpoint: A URL locating the endpoint to which messages should be 1079 // pushed. 1080 // For example, a Webhook endpoint might use "https://example.com/push". 1081 PushEndpoint string `json:"pushEndpoint,omitempty"` 1082 1083 // ForceSendFields is a list of field names (e.g. "Attributes") to 1084 // unconditionally include in API requests. By default, fields with 1085 // empty values are omitted from API requests. However, any non-pointer, 1086 // non-interface field appearing in ForceSendFields will be sent to the 1087 // server regardless of whether the field is empty or not. This may be 1088 // used to include empty fields in Patch requests. 1089 ForceSendFields []string `json:"-"` 1090 1091 // NullFields is a list of field names (e.g. "Attributes") to include in 1092 // API requests with the JSON null value. By default, fields with empty 1093 // values are omitted from API requests. However, any field with an 1094 // empty value appearing in NullFields will be sent to the server as 1095 // null. It is an error if a field in this list has a non-empty value. 1096 // This may be used to include null fields in Patch requests. 1097 NullFields []string `json:"-"` 1098} 1099 1100func (s *PushConfig) MarshalJSON() ([]byte, error) { 1101 type NoMethod PushConfig 1102 raw := NoMethod(*s) 1103 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1104} 1105 1106// ReceivedMessage: A message and its corresponding acknowledgment ID. 1107type ReceivedMessage struct { 1108 // AckId: This ID can be used to acknowledge the received message. 1109 AckId string `json:"ackId,omitempty"` 1110 1111 // Message: The message. 1112 Message *PubsubMessage `json:"message,omitempty"` 1113 1114 // ForceSendFields is a list of field names (e.g. "AckId") to 1115 // unconditionally include in API requests. By default, fields with 1116 // empty values are omitted from API requests. However, any non-pointer, 1117 // non-interface field appearing in ForceSendFields will be sent to the 1118 // server regardless of whether the field is empty or not. This may be 1119 // used to include empty fields in Patch requests. 1120 ForceSendFields []string `json:"-"` 1121 1122 // NullFields is a list of field names (e.g. "AckId") to include in API 1123 // requests with the JSON null value. By default, fields with empty 1124 // values are omitted from API requests. However, any field with an 1125 // empty value appearing in NullFields will be sent to the server as 1126 // null. It is an error if a field in this list has a non-empty value. 1127 // This may be used to include null fields in Patch requests. 1128 NullFields []string `json:"-"` 1129} 1130 1131func (s *ReceivedMessage) MarshalJSON() ([]byte, error) { 1132 type NoMethod ReceivedMessage 1133 raw := NoMethod(*s) 1134 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1135} 1136 1137// SetIamPolicyRequest: Request message for `SetIamPolicy` method. 1138type SetIamPolicyRequest struct { 1139 // Policy: REQUIRED: The complete policy to be applied to the 1140 // `resource`. The size of 1141 // the policy is limited to a few 10s of KB. An empty policy is a 1142 // valid policy but certain Cloud Platform services (such as 1143 // Projects) 1144 // might reject them. 1145 Policy *Policy `json:"policy,omitempty"` 1146 1147 // ForceSendFields is a list of field names (e.g. "Policy") to 1148 // unconditionally include in API requests. By default, fields with 1149 // empty values are omitted from API requests. However, any non-pointer, 1150 // non-interface field appearing in ForceSendFields will be sent to the 1151 // server regardless of whether the field is empty or not. This may be 1152 // used to include empty fields in Patch requests. 1153 ForceSendFields []string `json:"-"` 1154 1155 // NullFields is a list of field names (e.g. "Policy") to include in API 1156 // requests with the JSON null value. By default, fields with empty 1157 // values are omitted from API requests. However, any field with an 1158 // empty value appearing in NullFields will be sent to the server as 1159 // null. It is an error if a field in this list has a non-empty value. 1160 // This may be used to include null fields in Patch requests. 1161 NullFields []string `json:"-"` 1162} 1163 1164func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) { 1165 type NoMethod SetIamPolicyRequest 1166 raw := NoMethod(*s) 1167 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1168} 1169 1170// Subscription: A subscription resource. 1171type Subscription struct { 1172 // AckDeadlineSeconds: This value is the maximum time after a subscriber 1173 // receives a message 1174 // before the subscriber should acknowledge the message. After 1175 // message 1176 // delivery but before the ack deadline expires and before the message 1177 // is 1178 // acknowledged, it is an outstanding message and will not be 1179 // delivered 1180 // again during that time (on a best-effort basis). 1181 // 1182 // For pull subscriptions, this value is used as the initial value for 1183 // the ack 1184 // deadline. To override this value for a given message, 1185 // call 1186 // `ModifyAckDeadline` with the corresponding `ack_id` if using 1187 // pull. 1188 // The maximum custom deadline you can specify is 600 seconds (10 1189 // minutes). 1190 // 1191 // For push delivery, this value is also used to set the request timeout 1192 // for 1193 // the call to the push endpoint. 1194 // 1195 // If the subscriber never acknowledges the message, the Pub/Sub 1196 // system will eventually redeliver the message. 1197 // 1198 // If this parameter is 0, a default value of 10 seconds is used. 1199 AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"` 1200 1201 // Name: The name of the subscription. It must have the 1202 // format 1203 // "projects/{project}/subscriptions/{subscription}". `{subscription}` 1204 // must 1205 // start with a letter, and contain only letters (`[A-Za-z]`), 1206 // numbers 1207 // (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes 1208 // (`~`), 1209 // plus (`+`) or percent signs (`%`). It must be between 3 and 255 1210 // characters 1211 // in length, and it must not start with "goog". 1212 Name string `json:"name,omitempty"` 1213 1214 // PushConfig: If push delivery is used with this subscription, this 1215 // field is 1216 // used to configure it. An empty `pushConfig` signifies that the 1217 // subscriber 1218 // will pull and ack messages using API methods. 1219 PushConfig *PushConfig `json:"pushConfig,omitempty"` 1220 1221 // Topic: The name of the topic from which this subscription is 1222 // receiving messages. 1223 // The value of this field will be `_deleted-topic_` if the topic has 1224 // been 1225 // deleted. 1226 Topic string `json:"topic,omitempty"` 1227 1228 // ServerResponse contains the HTTP response code and headers from the 1229 // server. 1230 googleapi.ServerResponse `json:"-"` 1231 1232 // ForceSendFields is a list of field names (e.g. "AckDeadlineSeconds") 1233 // to unconditionally include in API requests. By default, fields with 1234 // empty values are omitted from API requests. However, any non-pointer, 1235 // non-interface field appearing in ForceSendFields will be sent to the 1236 // server regardless of whether the field is empty or not. This may be 1237 // used to include empty fields in Patch requests. 1238 ForceSendFields []string `json:"-"` 1239 1240 // NullFields is a list of field names (e.g. "AckDeadlineSeconds") to 1241 // include in API requests with the JSON null value. By default, fields 1242 // with empty values are omitted from API requests. However, any field 1243 // with an empty value appearing in NullFields will be sent to the 1244 // server as null. It is an error if a field in this list has a 1245 // non-empty value. This may be used to include null fields in Patch 1246 // requests. 1247 NullFields []string `json:"-"` 1248} 1249 1250func (s *Subscription) MarshalJSON() ([]byte, error) { 1251 type NoMethod Subscription 1252 raw := NoMethod(*s) 1253 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1254} 1255 1256// TestIamPermissionsRequest: Request message for `TestIamPermissions` 1257// method. 1258type TestIamPermissionsRequest struct { 1259 // Permissions: The set of permissions to check for the `resource`. 1260 // Permissions with 1261 // wildcards (such as '*' or 'storage.*') are not allowed. For 1262 // more 1263 // information see 1264 // [IAM 1265 // Overview](https://cloud.google.com/iam/docs/overview#permissions). 1266 Permissions []string `json:"permissions,omitempty"` 1267 1268 // ForceSendFields is a list of field names (e.g. "Permissions") to 1269 // unconditionally include in API requests. By default, fields with 1270 // empty values are omitted from API requests. However, any non-pointer, 1271 // non-interface field appearing in ForceSendFields will be sent to the 1272 // server regardless of whether the field is empty or not. This may be 1273 // used to include empty fields in Patch requests. 1274 ForceSendFields []string `json:"-"` 1275 1276 // NullFields is a list of field names (e.g. "Permissions") to include 1277 // in API requests with the JSON null value. By default, fields with 1278 // empty values are omitted from API requests. However, any field with 1279 // an empty value appearing in NullFields will be sent to the server as 1280 // null. It is an error if a field in this list has a non-empty value. 1281 // This may be used to include null fields in Patch requests. 1282 NullFields []string `json:"-"` 1283} 1284 1285func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) { 1286 type NoMethod TestIamPermissionsRequest 1287 raw := NoMethod(*s) 1288 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1289} 1290 1291// TestIamPermissionsResponse: Response message for `TestIamPermissions` 1292// method. 1293type TestIamPermissionsResponse struct { 1294 // Permissions: A subset of `TestPermissionsRequest.permissions` that 1295 // the caller is 1296 // allowed. 1297 Permissions []string `json:"permissions,omitempty"` 1298 1299 // ServerResponse contains the HTTP response code and headers from the 1300 // server. 1301 googleapi.ServerResponse `json:"-"` 1302 1303 // ForceSendFields is a list of field names (e.g. "Permissions") to 1304 // unconditionally include in API requests. By default, fields with 1305 // empty values are omitted from API requests. However, any non-pointer, 1306 // non-interface field appearing in ForceSendFields will be sent to the 1307 // server regardless of whether the field is empty or not. This may be 1308 // used to include empty fields in Patch requests. 1309 ForceSendFields []string `json:"-"` 1310 1311 // NullFields is a list of field names (e.g. "Permissions") to include 1312 // in API requests with the JSON null value. By default, fields with 1313 // empty values are omitted from API requests. However, any field with 1314 // an empty value appearing in NullFields will be sent to the server as 1315 // null. It is an error if a field in this list has a non-empty value. 1316 // This may be used to include null fields in Patch requests. 1317 NullFields []string `json:"-"` 1318} 1319 1320func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) { 1321 type NoMethod TestIamPermissionsResponse 1322 raw := NoMethod(*s) 1323 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1324} 1325 1326// Topic: A topic resource. 1327type Topic struct { 1328 // Name: The name of the topic. It must have the 1329 // format 1330 // "projects/{project}/topics/{topic}". `{topic}` must start with a 1331 // letter, 1332 // and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes 1333 // (`-`), 1334 // underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or 1335 // percent 1336 // signs (`%`). It must be between 3 and 255 characters in length, and 1337 // it 1338 // must not start with "goog". 1339 Name string `json:"name,omitempty"` 1340 1341 // ServerResponse contains the HTTP response code and headers from the 1342 // server. 1343 googleapi.ServerResponse `json:"-"` 1344 1345 // ForceSendFields is a list of field names (e.g. "Name") to 1346 // unconditionally include in API requests. By default, fields with 1347 // empty values are omitted from API requests. However, any non-pointer, 1348 // non-interface field appearing in ForceSendFields will be sent to the 1349 // server regardless of whether the field is empty or not. This may be 1350 // used to include empty fields in Patch requests. 1351 ForceSendFields []string `json:"-"` 1352 1353 // NullFields is a list of field names (e.g. "Name") to include in API 1354 // requests with the JSON null value. By default, fields with empty 1355 // values are omitted from API requests. However, any field with an 1356 // empty value appearing in NullFields will be sent to the server as 1357 // null. It is an error if a field in this list has a non-empty value. 1358 // This may be used to include null fields in Patch requests. 1359 NullFields []string `json:"-"` 1360} 1361 1362func (s *Topic) MarshalJSON() ([]byte, error) { 1363 type NoMethod Topic 1364 raw := NoMethod(*s) 1365 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1366} 1367 1368// method id "pubsub.projects.subscriptions.acknowledge": 1369 1370type ProjectsSubscriptionsAcknowledgeCall struct { 1371 s *Service 1372 subscription string 1373 acknowledgerequest *AcknowledgeRequest 1374 urlParams_ gensupport.URLParams 1375 ctx_ context.Context 1376 header_ http.Header 1377} 1378 1379// Acknowledge: Acknowledges the messages associated with the `ack_ids` 1380// in the 1381// `AcknowledgeRequest`. The Pub/Sub system can remove the relevant 1382// messages 1383// from the subscription. 1384// 1385// Acknowledging a message whose ack deadline has expired may 1386// succeed, 1387// but such a message may be redelivered later. Acknowledging a message 1388// more 1389// than once will not result in an error. 1390func (r *ProjectsSubscriptionsService) Acknowledge(subscription string, acknowledgerequest *AcknowledgeRequest) *ProjectsSubscriptionsAcknowledgeCall { 1391 c := &ProjectsSubscriptionsAcknowledgeCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1392 c.subscription = subscription 1393 c.acknowledgerequest = acknowledgerequest 1394 return c 1395} 1396 1397// Fields allows partial responses to be retrieved. See 1398// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1399// for more information. 1400func (c *ProjectsSubscriptionsAcknowledgeCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsAcknowledgeCall { 1401 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1402 return c 1403} 1404 1405// Context sets the context to be used in this call's Do method. Any 1406// pending HTTP request will be aborted if the provided context is 1407// canceled. 1408func (c *ProjectsSubscriptionsAcknowledgeCall) Context(ctx context.Context) *ProjectsSubscriptionsAcknowledgeCall { 1409 c.ctx_ = ctx 1410 return c 1411} 1412 1413// Header returns an http.Header that can be modified by the caller to 1414// add HTTP headers to the request. 1415func (c *ProjectsSubscriptionsAcknowledgeCall) Header() http.Header { 1416 if c.header_ == nil { 1417 c.header_ = make(http.Header) 1418 } 1419 return c.header_ 1420} 1421 1422func (c *ProjectsSubscriptionsAcknowledgeCall) doRequest(alt string) (*http.Response, error) { 1423 reqHeaders := make(http.Header) 1424 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 1425 for k, v := range c.header_ { 1426 reqHeaders[k] = v 1427 } 1428 reqHeaders.Set("User-Agent", c.s.userAgent()) 1429 var body io.Reader = nil 1430 body, err := googleapi.WithoutDataWrapper.JSONReader(c.acknowledgerequest) 1431 if err != nil { 1432 return nil, err 1433 } 1434 reqHeaders.Set("Content-Type", "application/json") 1435 c.urlParams_.Set("alt", alt) 1436 c.urlParams_.Set("prettyPrint", "false") 1437 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:acknowledge") 1438 urls += "?" + c.urlParams_.Encode() 1439 req, err := http.NewRequest("POST", urls, body) 1440 if err != nil { 1441 return nil, err 1442 } 1443 req.Header = reqHeaders 1444 googleapi.Expand(req.URL, map[string]string{ 1445 "subscription": c.subscription, 1446 }) 1447 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1448} 1449 1450// Do executes the "pubsub.projects.subscriptions.acknowledge" call. 1451// Exactly one of *Empty or error will be non-nil. Any non-2xx status 1452// code is an error. Response headers are in either 1453// *Empty.ServerResponse.Header or (if a response was returned at all) 1454// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1455// check whether the returned error was because http.StatusNotModified 1456// was returned. 1457func (c *ProjectsSubscriptionsAcknowledgeCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1458 gensupport.SetOptions(c.urlParams_, opts...) 1459 res, err := c.doRequest("json") 1460 if res != nil && res.StatusCode == http.StatusNotModified { 1461 if res.Body != nil { 1462 res.Body.Close() 1463 } 1464 return nil, &googleapi.Error{ 1465 Code: res.StatusCode, 1466 Header: res.Header, 1467 } 1468 } 1469 if err != nil { 1470 return nil, err 1471 } 1472 defer googleapi.CloseBody(res) 1473 if err := googleapi.CheckResponse(res); err != nil { 1474 return nil, err 1475 } 1476 ret := &Empty{ 1477 ServerResponse: googleapi.ServerResponse{ 1478 Header: res.Header, 1479 HTTPStatusCode: res.StatusCode, 1480 }, 1481 } 1482 target := &ret 1483 if err := gensupport.DecodeResponse(target, res); err != nil { 1484 return nil, err 1485 } 1486 return ret, nil 1487 // { 1488 // "description": "Acknowledges the messages associated with the `ack_ids` in the\n`AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages\nfrom the subscription.\n\nAcknowledging a message whose ack deadline has expired may succeed,\nbut such a message may be redelivered later. Acknowledging a message more\nthan once will not result in an error.", 1489 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:acknowledge", 1490 // "httpMethod": "POST", 1491 // "id": "pubsub.projects.subscriptions.acknowledge", 1492 // "parameterOrder": [ 1493 // "subscription" 1494 // ], 1495 // "parameters": { 1496 // "subscription": { 1497 // "description": "The subscription whose message is being acknowledged.", 1498 // "location": "path", 1499 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 1500 // "required": true, 1501 // "type": "string" 1502 // } 1503 // }, 1504 // "path": "v1beta2/{+subscription}:acknowledge", 1505 // "request": { 1506 // "$ref": "AcknowledgeRequest" 1507 // }, 1508 // "response": { 1509 // "$ref": "Empty" 1510 // }, 1511 // "scopes": [ 1512 // "https://www.googleapis.com/auth/cloud-platform", 1513 // "https://www.googleapis.com/auth/pubsub" 1514 // ] 1515 // } 1516 1517} 1518 1519// method id "pubsub.projects.subscriptions.create": 1520 1521type ProjectsSubscriptionsCreateCall struct { 1522 s *Service 1523 name string 1524 subscription *Subscription 1525 urlParams_ gensupport.URLParams 1526 ctx_ context.Context 1527 header_ http.Header 1528} 1529 1530// Create: Creates a subscription to a given topic. 1531// If the subscription already exists, returns `ALREADY_EXISTS`. 1532// If the corresponding topic doesn't exist, returns `NOT_FOUND`. 1533// 1534// If the name is not provided in the request, the server will assign a 1535// random 1536// name for this subscription on the same project as the topic. Note 1537// that 1538// for REST API requests, you must specify a name. 1539func (r *ProjectsSubscriptionsService) Create(name string, subscription *Subscription) *ProjectsSubscriptionsCreateCall { 1540 c := &ProjectsSubscriptionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1541 c.name = name 1542 c.subscription = subscription 1543 return c 1544} 1545 1546// Fields allows partial responses to be retrieved. See 1547// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1548// for more information. 1549func (c *ProjectsSubscriptionsCreateCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsCreateCall { 1550 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1551 return c 1552} 1553 1554// Context sets the context to be used in this call's Do method. Any 1555// pending HTTP request will be aborted if the provided context is 1556// canceled. 1557func (c *ProjectsSubscriptionsCreateCall) Context(ctx context.Context) *ProjectsSubscriptionsCreateCall { 1558 c.ctx_ = ctx 1559 return c 1560} 1561 1562// Header returns an http.Header that can be modified by the caller to 1563// add HTTP headers to the request. 1564func (c *ProjectsSubscriptionsCreateCall) Header() http.Header { 1565 if c.header_ == nil { 1566 c.header_ = make(http.Header) 1567 } 1568 return c.header_ 1569} 1570 1571func (c *ProjectsSubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) { 1572 reqHeaders := make(http.Header) 1573 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 1574 for k, v := range c.header_ { 1575 reqHeaders[k] = v 1576 } 1577 reqHeaders.Set("User-Agent", c.s.userAgent()) 1578 var body io.Reader = nil 1579 body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription) 1580 if err != nil { 1581 return nil, err 1582 } 1583 reqHeaders.Set("Content-Type", "application/json") 1584 c.urlParams_.Set("alt", alt) 1585 c.urlParams_.Set("prettyPrint", "false") 1586 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}") 1587 urls += "?" + c.urlParams_.Encode() 1588 req, err := http.NewRequest("PUT", urls, body) 1589 if err != nil { 1590 return nil, err 1591 } 1592 req.Header = reqHeaders 1593 googleapi.Expand(req.URL, map[string]string{ 1594 "name": c.name, 1595 }) 1596 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1597} 1598 1599// Do executes the "pubsub.projects.subscriptions.create" call. 1600// Exactly one of *Subscription or error will be non-nil. Any non-2xx 1601// status code is an error. Response headers are in either 1602// *Subscription.ServerResponse.Header or (if a response was returned at 1603// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1604// to check whether the returned error was because 1605// http.StatusNotModified was returned. 1606func (c *ProjectsSubscriptionsCreateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) { 1607 gensupport.SetOptions(c.urlParams_, opts...) 1608 res, err := c.doRequest("json") 1609 if res != nil && res.StatusCode == http.StatusNotModified { 1610 if res.Body != nil { 1611 res.Body.Close() 1612 } 1613 return nil, &googleapi.Error{ 1614 Code: res.StatusCode, 1615 Header: res.Header, 1616 } 1617 } 1618 if err != nil { 1619 return nil, err 1620 } 1621 defer googleapi.CloseBody(res) 1622 if err := googleapi.CheckResponse(res); err != nil { 1623 return nil, err 1624 } 1625 ret := &Subscription{ 1626 ServerResponse: googleapi.ServerResponse{ 1627 Header: res.Header, 1628 HTTPStatusCode: res.StatusCode, 1629 }, 1630 } 1631 target := &ret 1632 if err := gensupport.DecodeResponse(target, res); err != nil { 1633 return nil, err 1634 } 1635 return ret, nil 1636 // { 1637 // "description": "Creates a subscription to a given topic.\nIf the subscription already exists, returns `ALREADY_EXISTS`.\nIf the corresponding topic doesn't exist, returns `NOT_FOUND`.\n\nIf the name is not provided in the request, the server will assign a random\nname for this subscription on the same project as the topic. Note that\nfor REST API requests, you must specify a name.", 1638 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}", 1639 // "httpMethod": "PUT", 1640 // "id": "pubsub.projects.subscriptions.create", 1641 // "parameterOrder": [ 1642 // "name" 1643 // ], 1644 // "parameters": { 1645 // "name": { 1646 // "description": "The name of the subscription. It must have the format\n`\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must\nstart with a letter, and contain only letters (`[A-Za-z]`), numbers\n(`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),\nplus (`+`) or percent signs (`%`). It must be between 3 and 255 characters\nin length, and it must not start with `\"goog\"`.", 1647 // "location": "path", 1648 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 1649 // "required": true, 1650 // "type": "string" 1651 // } 1652 // }, 1653 // "path": "v1beta2/{+name}", 1654 // "request": { 1655 // "$ref": "Subscription" 1656 // }, 1657 // "response": { 1658 // "$ref": "Subscription" 1659 // }, 1660 // "scopes": [ 1661 // "https://www.googleapis.com/auth/cloud-platform", 1662 // "https://www.googleapis.com/auth/pubsub" 1663 // ] 1664 // } 1665 1666} 1667 1668// method id "pubsub.projects.subscriptions.delete": 1669 1670type ProjectsSubscriptionsDeleteCall struct { 1671 s *Service 1672 subscription string 1673 urlParams_ gensupport.URLParams 1674 ctx_ context.Context 1675 header_ http.Header 1676} 1677 1678// Delete: Deletes an existing subscription. All pending messages in the 1679// subscription 1680// are immediately dropped. Calls to `Pull` after deletion will 1681// return 1682// `NOT_FOUND`. After a subscription is deleted, a new one may be 1683// created with 1684// the same name, but the new one has no association with the 1685// old 1686// subscription, or its topic unless the same topic is specified. 1687func (r *ProjectsSubscriptionsService) Delete(subscription string) *ProjectsSubscriptionsDeleteCall { 1688 c := &ProjectsSubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1689 c.subscription = subscription 1690 return c 1691} 1692 1693// Fields allows partial responses to be retrieved. See 1694// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1695// for more information. 1696func (c *ProjectsSubscriptionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsDeleteCall { 1697 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1698 return c 1699} 1700 1701// Context sets the context to be used in this call's Do method. Any 1702// pending HTTP request will be aborted if the provided context is 1703// canceled. 1704func (c *ProjectsSubscriptionsDeleteCall) Context(ctx context.Context) *ProjectsSubscriptionsDeleteCall { 1705 c.ctx_ = ctx 1706 return c 1707} 1708 1709// Header returns an http.Header that can be modified by the caller to 1710// add HTTP headers to the request. 1711func (c *ProjectsSubscriptionsDeleteCall) Header() http.Header { 1712 if c.header_ == nil { 1713 c.header_ = make(http.Header) 1714 } 1715 return c.header_ 1716} 1717 1718func (c *ProjectsSubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) { 1719 reqHeaders := make(http.Header) 1720 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 1721 for k, v := range c.header_ { 1722 reqHeaders[k] = v 1723 } 1724 reqHeaders.Set("User-Agent", c.s.userAgent()) 1725 var body io.Reader = nil 1726 c.urlParams_.Set("alt", alt) 1727 c.urlParams_.Set("prettyPrint", "false") 1728 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}") 1729 urls += "?" + c.urlParams_.Encode() 1730 req, err := http.NewRequest("DELETE", urls, body) 1731 if err != nil { 1732 return nil, err 1733 } 1734 req.Header = reqHeaders 1735 googleapi.Expand(req.URL, map[string]string{ 1736 "subscription": c.subscription, 1737 }) 1738 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1739} 1740 1741// Do executes the "pubsub.projects.subscriptions.delete" call. 1742// Exactly one of *Empty or error will be non-nil. Any non-2xx status 1743// code is an error. Response headers are in either 1744// *Empty.ServerResponse.Header or (if a response was returned at all) 1745// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1746// check whether the returned error was because http.StatusNotModified 1747// was returned. 1748func (c *ProjectsSubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 1749 gensupport.SetOptions(c.urlParams_, opts...) 1750 res, err := c.doRequest("json") 1751 if res != nil && res.StatusCode == http.StatusNotModified { 1752 if res.Body != nil { 1753 res.Body.Close() 1754 } 1755 return nil, &googleapi.Error{ 1756 Code: res.StatusCode, 1757 Header: res.Header, 1758 } 1759 } 1760 if err != nil { 1761 return nil, err 1762 } 1763 defer googleapi.CloseBody(res) 1764 if err := googleapi.CheckResponse(res); err != nil { 1765 return nil, err 1766 } 1767 ret := &Empty{ 1768 ServerResponse: googleapi.ServerResponse{ 1769 Header: res.Header, 1770 HTTPStatusCode: res.StatusCode, 1771 }, 1772 } 1773 target := &ret 1774 if err := gensupport.DecodeResponse(target, res); err != nil { 1775 return nil, err 1776 } 1777 return ret, nil 1778 // { 1779 // "description": "Deletes an existing subscription. All pending messages in the subscription\nare immediately dropped. Calls to `Pull` after deletion will return\n`NOT_FOUND`. After a subscription is deleted, a new one may be created with\nthe same name, but the new one has no association with the old\nsubscription, or its topic unless the same topic is specified.", 1780 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}", 1781 // "httpMethod": "DELETE", 1782 // "id": "pubsub.projects.subscriptions.delete", 1783 // "parameterOrder": [ 1784 // "subscription" 1785 // ], 1786 // "parameters": { 1787 // "subscription": { 1788 // "description": "The subscription to delete.", 1789 // "location": "path", 1790 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 1791 // "required": true, 1792 // "type": "string" 1793 // } 1794 // }, 1795 // "path": "v1beta2/{+subscription}", 1796 // "response": { 1797 // "$ref": "Empty" 1798 // }, 1799 // "scopes": [ 1800 // "https://www.googleapis.com/auth/cloud-platform", 1801 // "https://www.googleapis.com/auth/pubsub" 1802 // ] 1803 // } 1804 1805} 1806 1807// method id "pubsub.projects.subscriptions.get": 1808 1809type ProjectsSubscriptionsGetCall struct { 1810 s *Service 1811 subscription string 1812 urlParams_ gensupport.URLParams 1813 ifNoneMatch_ string 1814 ctx_ context.Context 1815 header_ http.Header 1816} 1817 1818// Get: Gets the configuration details of a subscription. 1819func (r *ProjectsSubscriptionsService) Get(subscription string) *ProjectsSubscriptionsGetCall { 1820 c := &ProjectsSubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1821 c.subscription = subscription 1822 return c 1823} 1824 1825// Fields allows partial responses to be retrieved. See 1826// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1827// for more information. 1828func (c *ProjectsSubscriptionsGetCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsGetCall { 1829 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1830 return c 1831} 1832 1833// IfNoneMatch sets the optional parameter which makes the operation 1834// fail if the object's ETag matches the given value. This is useful for 1835// getting updates only after the object has changed since the last 1836// request. Use googleapi.IsNotModified to check whether the response 1837// error from Do is the result of In-None-Match. 1838func (c *ProjectsSubscriptionsGetCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsGetCall { 1839 c.ifNoneMatch_ = entityTag 1840 return c 1841} 1842 1843// Context sets the context to be used in this call's Do method. Any 1844// pending HTTP request will be aborted if the provided context is 1845// canceled. 1846func (c *ProjectsSubscriptionsGetCall) Context(ctx context.Context) *ProjectsSubscriptionsGetCall { 1847 c.ctx_ = ctx 1848 return c 1849} 1850 1851// Header returns an http.Header that can be modified by the caller to 1852// add HTTP headers to the request. 1853func (c *ProjectsSubscriptionsGetCall) Header() http.Header { 1854 if c.header_ == nil { 1855 c.header_ = make(http.Header) 1856 } 1857 return c.header_ 1858} 1859 1860func (c *ProjectsSubscriptionsGetCall) doRequest(alt string) (*http.Response, error) { 1861 reqHeaders := make(http.Header) 1862 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 1863 for k, v := range c.header_ { 1864 reqHeaders[k] = v 1865 } 1866 reqHeaders.Set("User-Agent", c.s.userAgent()) 1867 if c.ifNoneMatch_ != "" { 1868 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1869 } 1870 var body io.Reader = nil 1871 c.urlParams_.Set("alt", alt) 1872 c.urlParams_.Set("prettyPrint", "false") 1873 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}") 1874 urls += "?" + c.urlParams_.Encode() 1875 req, err := http.NewRequest("GET", urls, body) 1876 if err != nil { 1877 return nil, err 1878 } 1879 req.Header = reqHeaders 1880 googleapi.Expand(req.URL, map[string]string{ 1881 "subscription": c.subscription, 1882 }) 1883 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1884} 1885 1886// Do executes the "pubsub.projects.subscriptions.get" call. 1887// Exactly one of *Subscription or error will be non-nil. Any non-2xx 1888// status code is an error. Response headers are in either 1889// *Subscription.ServerResponse.Header or (if a response was returned at 1890// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1891// to check whether the returned error was because 1892// http.StatusNotModified was returned. 1893func (c *ProjectsSubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) { 1894 gensupport.SetOptions(c.urlParams_, opts...) 1895 res, err := c.doRequest("json") 1896 if res != nil && res.StatusCode == http.StatusNotModified { 1897 if res.Body != nil { 1898 res.Body.Close() 1899 } 1900 return nil, &googleapi.Error{ 1901 Code: res.StatusCode, 1902 Header: res.Header, 1903 } 1904 } 1905 if err != nil { 1906 return nil, err 1907 } 1908 defer googleapi.CloseBody(res) 1909 if err := googleapi.CheckResponse(res); err != nil { 1910 return nil, err 1911 } 1912 ret := &Subscription{ 1913 ServerResponse: googleapi.ServerResponse{ 1914 Header: res.Header, 1915 HTTPStatusCode: res.StatusCode, 1916 }, 1917 } 1918 target := &ret 1919 if err := gensupport.DecodeResponse(target, res); err != nil { 1920 return nil, err 1921 } 1922 return ret, nil 1923 // { 1924 // "description": "Gets the configuration details of a subscription.", 1925 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}", 1926 // "httpMethod": "GET", 1927 // "id": "pubsub.projects.subscriptions.get", 1928 // "parameterOrder": [ 1929 // "subscription" 1930 // ], 1931 // "parameters": { 1932 // "subscription": { 1933 // "description": "The name of the subscription to get.", 1934 // "location": "path", 1935 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 1936 // "required": true, 1937 // "type": "string" 1938 // } 1939 // }, 1940 // "path": "v1beta2/{+subscription}", 1941 // "response": { 1942 // "$ref": "Subscription" 1943 // }, 1944 // "scopes": [ 1945 // "https://www.googleapis.com/auth/cloud-platform", 1946 // "https://www.googleapis.com/auth/pubsub" 1947 // ] 1948 // } 1949 1950} 1951 1952// method id "pubsub.projects.subscriptions.getIamPolicy": 1953 1954type ProjectsSubscriptionsGetIamPolicyCall struct { 1955 s *Service 1956 resource string 1957 urlParams_ gensupport.URLParams 1958 ifNoneMatch_ string 1959 ctx_ context.Context 1960 header_ http.Header 1961} 1962 1963// GetIamPolicy: Gets the access control policy for a resource. 1964// Returns an empty policy if the resource exists and does not have a 1965// policy 1966// set. 1967func (r *ProjectsSubscriptionsService) GetIamPolicy(resource string) *ProjectsSubscriptionsGetIamPolicyCall { 1968 c := &ProjectsSubscriptionsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1969 c.resource = resource 1970 return c 1971} 1972 1973// OptionsRequestedPolicyVersion sets the optional parameter 1974// "options.requestedPolicyVersion": The policy format version to be 1975// returned. 1976// 1977// Valid values are 0, 1, and 3. Requests specifying an invalid value 1978// will be 1979// rejected. 1980// 1981// Requests for policies with any conditional bindings must specify 1982// version 3. 1983// Policies without any conditional bindings may specify any valid value 1984// or 1985// leave the field unset. 1986func (c *ProjectsSubscriptionsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsSubscriptionsGetIamPolicyCall { 1987 c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion)) 1988 return c 1989} 1990 1991// Fields allows partial responses to be retrieved. See 1992// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1993// for more information. 1994func (c *ProjectsSubscriptionsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsGetIamPolicyCall { 1995 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1996 return c 1997} 1998 1999// IfNoneMatch sets the optional parameter which makes the operation 2000// fail if the object's ETag matches the given value. This is useful for 2001// getting updates only after the object has changed since the last 2002// request. Use googleapi.IsNotModified to check whether the response 2003// error from Do is the result of In-None-Match. 2004func (c *ProjectsSubscriptionsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsGetIamPolicyCall { 2005 c.ifNoneMatch_ = entityTag 2006 return c 2007} 2008 2009// Context sets the context to be used in this call's Do method. Any 2010// pending HTTP request will be aborted if the provided context is 2011// canceled. 2012func (c *ProjectsSubscriptionsGetIamPolicyCall) Context(ctx context.Context) *ProjectsSubscriptionsGetIamPolicyCall { 2013 c.ctx_ = ctx 2014 return c 2015} 2016 2017// Header returns an http.Header that can be modified by the caller to 2018// add HTTP headers to the request. 2019func (c *ProjectsSubscriptionsGetIamPolicyCall) Header() http.Header { 2020 if c.header_ == nil { 2021 c.header_ = make(http.Header) 2022 } 2023 return c.header_ 2024} 2025 2026func (c *ProjectsSubscriptionsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 2027 reqHeaders := make(http.Header) 2028 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2029 for k, v := range c.header_ { 2030 reqHeaders[k] = v 2031 } 2032 reqHeaders.Set("User-Agent", c.s.userAgent()) 2033 if c.ifNoneMatch_ != "" { 2034 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2035 } 2036 var body io.Reader = nil 2037 c.urlParams_.Set("alt", alt) 2038 c.urlParams_.Set("prettyPrint", "false") 2039 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:getIamPolicy") 2040 urls += "?" + c.urlParams_.Encode() 2041 req, err := http.NewRequest("GET", urls, body) 2042 if err != nil { 2043 return nil, err 2044 } 2045 req.Header = reqHeaders 2046 googleapi.Expand(req.URL, map[string]string{ 2047 "resource": c.resource, 2048 }) 2049 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2050} 2051 2052// Do executes the "pubsub.projects.subscriptions.getIamPolicy" call. 2053// Exactly one of *Policy or error will be non-nil. Any non-2xx status 2054// code is an error. Response headers are in either 2055// *Policy.ServerResponse.Header or (if a response was returned at all) 2056// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2057// check whether the returned error was because http.StatusNotModified 2058// was returned. 2059func (c *ProjectsSubscriptionsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 2060 gensupport.SetOptions(c.urlParams_, opts...) 2061 res, err := c.doRequest("json") 2062 if res != nil && res.StatusCode == http.StatusNotModified { 2063 if res.Body != nil { 2064 res.Body.Close() 2065 } 2066 return nil, &googleapi.Error{ 2067 Code: res.StatusCode, 2068 Header: res.Header, 2069 } 2070 } 2071 if err != nil { 2072 return nil, err 2073 } 2074 defer googleapi.CloseBody(res) 2075 if err := googleapi.CheckResponse(res); err != nil { 2076 return nil, err 2077 } 2078 ret := &Policy{ 2079 ServerResponse: googleapi.ServerResponse{ 2080 Header: res.Header, 2081 HTTPStatusCode: res.StatusCode, 2082 }, 2083 } 2084 target := &ret 2085 if err := gensupport.DecodeResponse(target, res); err != nil { 2086 return nil, err 2087 } 2088 return ret, nil 2089 // { 2090 // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.", 2091 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:getIamPolicy", 2092 // "httpMethod": "GET", 2093 // "id": "pubsub.projects.subscriptions.getIamPolicy", 2094 // "parameterOrder": [ 2095 // "resource" 2096 // ], 2097 // "parameters": { 2098 // "options.requestedPolicyVersion": { 2099 // "description": "Optional. The policy format version to be returned.\n\nValid values are 0, 1, and 3. Requests specifying an invalid value will be\nrejected.\n\nRequests for policies with any conditional bindings must specify version 3.\nPolicies without any conditional bindings may specify any valid value or\nleave the field unset.", 2100 // "format": "int32", 2101 // "location": "query", 2102 // "type": "integer" 2103 // }, 2104 // "resource": { 2105 // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.", 2106 // "location": "path", 2107 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 2108 // "required": true, 2109 // "type": "string" 2110 // } 2111 // }, 2112 // "path": "v1beta2/{+resource}:getIamPolicy", 2113 // "response": { 2114 // "$ref": "Policy" 2115 // }, 2116 // "scopes": [ 2117 // "https://www.googleapis.com/auth/cloud-platform", 2118 // "https://www.googleapis.com/auth/pubsub" 2119 // ] 2120 // } 2121 2122} 2123 2124// method id "pubsub.projects.subscriptions.list": 2125 2126type ProjectsSubscriptionsListCall struct { 2127 s *Service 2128 project string 2129 urlParams_ gensupport.URLParams 2130 ifNoneMatch_ string 2131 ctx_ context.Context 2132 header_ http.Header 2133} 2134 2135// List: Lists matching subscriptions. 2136func (r *ProjectsSubscriptionsService) List(project string) *ProjectsSubscriptionsListCall { 2137 c := &ProjectsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2138 c.project = project 2139 return c 2140} 2141 2142// PageSize sets the optional parameter "pageSize": Maximum number of 2143// subscriptions to return. 2144func (c *ProjectsSubscriptionsListCall) PageSize(pageSize int64) *ProjectsSubscriptionsListCall { 2145 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2146 return c 2147} 2148 2149// PageToken sets the optional parameter "pageToken": The value returned 2150// by the last `ListSubscriptionsResponse`; indicates that 2151// this is a continuation of a prior `ListSubscriptions` call, and that 2152// the 2153// system should return the next page of data. 2154func (c *ProjectsSubscriptionsListCall) PageToken(pageToken string) *ProjectsSubscriptionsListCall { 2155 c.urlParams_.Set("pageToken", pageToken) 2156 return c 2157} 2158 2159// Fields allows partial responses to be retrieved. See 2160// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2161// for more information. 2162func (c *ProjectsSubscriptionsListCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsListCall { 2163 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2164 return c 2165} 2166 2167// IfNoneMatch sets the optional parameter which makes the operation 2168// fail if the object's ETag matches the given value. This is useful for 2169// getting updates only after the object has changed since the last 2170// request. Use googleapi.IsNotModified to check whether the response 2171// error from Do is the result of In-None-Match. 2172func (c *ProjectsSubscriptionsListCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsListCall { 2173 c.ifNoneMatch_ = entityTag 2174 return c 2175} 2176 2177// Context sets the context to be used in this call's Do method. Any 2178// pending HTTP request will be aborted if the provided context is 2179// canceled. 2180func (c *ProjectsSubscriptionsListCall) Context(ctx context.Context) *ProjectsSubscriptionsListCall { 2181 c.ctx_ = ctx 2182 return c 2183} 2184 2185// Header returns an http.Header that can be modified by the caller to 2186// add HTTP headers to the request. 2187func (c *ProjectsSubscriptionsListCall) Header() http.Header { 2188 if c.header_ == nil { 2189 c.header_ = make(http.Header) 2190 } 2191 return c.header_ 2192} 2193 2194func (c *ProjectsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) { 2195 reqHeaders := make(http.Header) 2196 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2197 for k, v := range c.header_ { 2198 reqHeaders[k] = v 2199 } 2200 reqHeaders.Set("User-Agent", c.s.userAgent()) 2201 if c.ifNoneMatch_ != "" { 2202 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2203 } 2204 var body io.Reader = nil 2205 c.urlParams_.Set("alt", alt) 2206 c.urlParams_.Set("prettyPrint", "false") 2207 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+project}/subscriptions") 2208 urls += "?" + c.urlParams_.Encode() 2209 req, err := http.NewRequest("GET", urls, body) 2210 if err != nil { 2211 return nil, err 2212 } 2213 req.Header = reqHeaders 2214 googleapi.Expand(req.URL, map[string]string{ 2215 "project": c.project, 2216 }) 2217 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2218} 2219 2220// Do executes the "pubsub.projects.subscriptions.list" call. 2221// Exactly one of *ListSubscriptionsResponse or error will be non-nil. 2222// Any non-2xx status code is an error. Response headers are in either 2223// *ListSubscriptionsResponse.ServerResponse.Header or (if a response 2224// was returned at all) in error.(*googleapi.Error).Header. Use 2225// googleapi.IsNotModified to check whether the returned error was 2226// because http.StatusNotModified was returned. 2227func (c *ProjectsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListSubscriptionsResponse, error) { 2228 gensupport.SetOptions(c.urlParams_, opts...) 2229 res, err := c.doRequest("json") 2230 if res != nil && res.StatusCode == http.StatusNotModified { 2231 if res.Body != nil { 2232 res.Body.Close() 2233 } 2234 return nil, &googleapi.Error{ 2235 Code: res.StatusCode, 2236 Header: res.Header, 2237 } 2238 } 2239 if err != nil { 2240 return nil, err 2241 } 2242 defer googleapi.CloseBody(res) 2243 if err := googleapi.CheckResponse(res); err != nil { 2244 return nil, err 2245 } 2246 ret := &ListSubscriptionsResponse{ 2247 ServerResponse: googleapi.ServerResponse{ 2248 Header: res.Header, 2249 HTTPStatusCode: res.StatusCode, 2250 }, 2251 } 2252 target := &ret 2253 if err := gensupport.DecodeResponse(target, res); err != nil { 2254 return nil, err 2255 } 2256 return ret, nil 2257 // { 2258 // "description": "Lists matching subscriptions.", 2259 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions", 2260 // "httpMethod": "GET", 2261 // "id": "pubsub.projects.subscriptions.list", 2262 // "parameterOrder": [ 2263 // "project" 2264 // ], 2265 // "parameters": { 2266 // "pageSize": { 2267 // "description": "Maximum number of subscriptions to return.", 2268 // "format": "int32", 2269 // "location": "query", 2270 // "type": "integer" 2271 // }, 2272 // "pageToken": { 2273 // "description": "The value returned by the last `ListSubscriptionsResponse`; indicates that\nthis is a continuation of a prior `ListSubscriptions` call, and that the\nsystem should return the next page of data.", 2274 // "location": "query", 2275 // "type": "string" 2276 // }, 2277 // "project": { 2278 // "description": "The name of the cloud project that subscriptions belong to.", 2279 // "location": "path", 2280 // "pattern": "^projects/[^/]+$", 2281 // "required": true, 2282 // "type": "string" 2283 // } 2284 // }, 2285 // "path": "v1beta2/{+project}/subscriptions", 2286 // "response": { 2287 // "$ref": "ListSubscriptionsResponse" 2288 // }, 2289 // "scopes": [ 2290 // "https://www.googleapis.com/auth/cloud-platform", 2291 // "https://www.googleapis.com/auth/pubsub" 2292 // ] 2293 // } 2294 2295} 2296 2297// Pages invokes f for each page of results. 2298// A non-nil error returned from f will halt the iteration. 2299// The provided context supersedes any context provided to the Context method. 2300func (c *ProjectsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListSubscriptionsResponse) error) error { 2301 c.ctx_ = ctx 2302 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2303 for { 2304 x, err := c.Do() 2305 if err != nil { 2306 return err 2307 } 2308 if err := f(x); err != nil { 2309 return err 2310 } 2311 if x.NextPageToken == "" { 2312 return nil 2313 } 2314 c.PageToken(x.NextPageToken) 2315 } 2316} 2317 2318// method id "pubsub.projects.subscriptions.modifyAckDeadline": 2319 2320type ProjectsSubscriptionsModifyAckDeadlineCall struct { 2321 s *Service 2322 subscription string 2323 modifyackdeadlinerequest *ModifyAckDeadlineRequest 2324 urlParams_ gensupport.URLParams 2325 ctx_ context.Context 2326 header_ http.Header 2327} 2328 2329// ModifyAckDeadline: Modifies the ack deadline for a specific message. 2330// This method is useful 2331// to indicate that more time is needed to process a message by 2332// the 2333// subscriber, or to make the message available for redelivery if 2334// the 2335// processing was interrupted. Note that this does not modify 2336// the 2337// subscription-level `ackDeadlineSeconds` used for subsequent messages. 2338func (r *ProjectsSubscriptionsService) ModifyAckDeadline(subscription string, modifyackdeadlinerequest *ModifyAckDeadlineRequest) *ProjectsSubscriptionsModifyAckDeadlineCall { 2339 c := &ProjectsSubscriptionsModifyAckDeadlineCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2340 c.subscription = subscription 2341 c.modifyackdeadlinerequest = modifyackdeadlinerequest 2342 return c 2343} 2344 2345// Fields allows partial responses to be retrieved. See 2346// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2347// for more information. 2348func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsModifyAckDeadlineCall { 2349 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2350 return c 2351} 2352 2353// Context sets the context to be used in this call's Do method. Any 2354// pending HTTP request will be aborted if the provided context is 2355// canceled. 2356func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Context(ctx context.Context) *ProjectsSubscriptionsModifyAckDeadlineCall { 2357 c.ctx_ = ctx 2358 return c 2359} 2360 2361// Header returns an http.Header that can be modified by the caller to 2362// add HTTP headers to the request. 2363func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Header() http.Header { 2364 if c.header_ == nil { 2365 c.header_ = make(http.Header) 2366 } 2367 return c.header_ 2368} 2369 2370func (c *ProjectsSubscriptionsModifyAckDeadlineCall) doRequest(alt string) (*http.Response, error) { 2371 reqHeaders := make(http.Header) 2372 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2373 for k, v := range c.header_ { 2374 reqHeaders[k] = v 2375 } 2376 reqHeaders.Set("User-Agent", c.s.userAgent()) 2377 var body io.Reader = nil 2378 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyackdeadlinerequest) 2379 if err != nil { 2380 return nil, err 2381 } 2382 reqHeaders.Set("Content-Type", "application/json") 2383 c.urlParams_.Set("alt", alt) 2384 c.urlParams_.Set("prettyPrint", "false") 2385 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:modifyAckDeadline") 2386 urls += "?" + c.urlParams_.Encode() 2387 req, err := http.NewRequest("POST", urls, body) 2388 if err != nil { 2389 return nil, err 2390 } 2391 req.Header = reqHeaders 2392 googleapi.Expand(req.URL, map[string]string{ 2393 "subscription": c.subscription, 2394 }) 2395 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2396} 2397 2398// Do executes the "pubsub.projects.subscriptions.modifyAckDeadline" call. 2399// Exactly one of *Empty or error will be non-nil. Any non-2xx status 2400// code is an error. Response headers are in either 2401// *Empty.ServerResponse.Header or (if a response was returned at all) 2402// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2403// check whether the returned error was because http.StatusNotModified 2404// was returned. 2405func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 2406 gensupport.SetOptions(c.urlParams_, opts...) 2407 res, err := c.doRequest("json") 2408 if res != nil && res.StatusCode == http.StatusNotModified { 2409 if res.Body != nil { 2410 res.Body.Close() 2411 } 2412 return nil, &googleapi.Error{ 2413 Code: res.StatusCode, 2414 Header: res.Header, 2415 } 2416 } 2417 if err != nil { 2418 return nil, err 2419 } 2420 defer googleapi.CloseBody(res) 2421 if err := googleapi.CheckResponse(res); err != nil { 2422 return nil, err 2423 } 2424 ret := &Empty{ 2425 ServerResponse: googleapi.ServerResponse{ 2426 Header: res.Header, 2427 HTTPStatusCode: res.StatusCode, 2428 }, 2429 } 2430 target := &ret 2431 if err := gensupport.DecodeResponse(target, res); err != nil { 2432 return nil, err 2433 } 2434 return ret, nil 2435 // { 2436 // "description": "Modifies the ack deadline for a specific message. This method is useful\nto indicate that more time is needed to process a message by the\nsubscriber, or to make the message available for redelivery if the\nprocessing was interrupted. Note that this does not modify the\nsubscription-level `ackDeadlineSeconds` used for subsequent messages.", 2437 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:modifyAckDeadline", 2438 // "httpMethod": "POST", 2439 // "id": "pubsub.projects.subscriptions.modifyAckDeadline", 2440 // "parameterOrder": [ 2441 // "subscription" 2442 // ], 2443 // "parameters": { 2444 // "subscription": { 2445 // "description": "The name of the subscription.", 2446 // "location": "path", 2447 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 2448 // "required": true, 2449 // "type": "string" 2450 // } 2451 // }, 2452 // "path": "v1beta2/{+subscription}:modifyAckDeadline", 2453 // "request": { 2454 // "$ref": "ModifyAckDeadlineRequest" 2455 // }, 2456 // "response": { 2457 // "$ref": "Empty" 2458 // }, 2459 // "scopes": [ 2460 // "https://www.googleapis.com/auth/cloud-platform", 2461 // "https://www.googleapis.com/auth/pubsub" 2462 // ] 2463 // } 2464 2465} 2466 2467// method id "pubsub.projects.subscriptions.modifyPushConfig": 2468 2469type ProjectsSubscriptionsModifyPushConfigCall struct { 2470 s *Service 2471 subscription string 2472 modifypushconfigrequest *ModifyPushConfigRequest 2473 urlParams_ gensupport.URLParams 2474 ctx_ context.Context 2475 header_ http.Header 2476} 2477 2478// ModifyPushConfig: Modifies the `PushConfig` for a specified 2479// subscription. 2480// 2481// This may be used to change a push subscription to a pull one 2482// (signified by 2483// an empty `PushConfig`) or vice versa, or change the endpoint URL and 2484// other 2485// attributes of a push subscription. Messages will accumulate for 2486// delivery 2487// continuously through the call regardless of changes to the 2488// `PushConfig`. 2489func (r *ProjectsSubscriptionsService) ModifyPushConfig(subscription string, modifypushconfigrequest *ModifyPushConfigRequest) *ProjectsSubscriptionsModifyPushConfigCall { 2490 c := &ProjectsSubscriptionsModifyPushConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2491 c.subscription = subscription 2492 c.modifypushconfigrequest = modifypushconfigrequest 2493 return c 2494} 2495 2496// Fields allows partial responses to be retrieved. See 2497// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2498// for more information. 2499func (c *ProjectsSubscriptionsModifyPushConfigCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsModifyPushConfigCall { 2500 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2501 return c 2502} 2503 2504// Context sets the context to be used in this call's Do method. Any 2505// pending HTTP request will be aborted if the provided context is 2506// canceled. 2507func (c *ProjectsSubscriptionsModifyPushConfigCall) Context(ctx context.Context) *ProjectsSubscriptionsModifyPushConfigCall { 2508 c.ctx_ = ctx 2509 return c 2510} 2511 2512// Header returns an http.Header that can be modified by the caller to 2513// add HTTP headers to the request. 2514func (c *ProjectsSubscriptionsModifyPushConfigCall) Header() http.Header { 2515 if c.header_ == nil { 2516 c.header_ = make(http.Header) 2517 } 2518 return c.header_ 2519} 2520 2521func (c *ProjectsSubscriptionsModifyPushConfigCall) doRequest(alt string) (*http.Response, error) { 2522 reqHeaders := make(http.Header) 2523 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2524 for k, v := range c.header_ { 2525 reqHeaders[k] = v 2526 } 2527 reqHeaders.Set("User-Agent", c.s.userAgent()) 2528 var body io.Reader = nil 2529 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifypushconfigrequest) 2530 if err != nil { 2531 return nil, err 2532 } 2533 reqHeaders.Set("Content-Type", "application/json") 2534 c.urlParams_.Set("alt", alt) 2535 c.urlParams_.Set("prettyPrint", "false") 2536 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:modifyPushConfig") 2537 urls += "?" + c.urlParams_.Encode() 2538 req, err := http.NewRequest("POST", urls, body) 2539 if err != nil { 2540 return nil, err 2541 } 2542 req.Header = reqHeaders 2543 googleapi.Expand(req.URL, map[string]string{ 2544 "subscription": c.subscription, 2545 }) 2546 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2547} 2548 2549// Do executes the "pubsub.projects.subscriptions.modifyPushConfig" call. 2550// Exactly one of *Empty or error will be non-nil. Any non-2xx status 2551// code is an error. Response headers are in either 2552// *Empty.ServerResponse.Header or (if a response was returned at all) 2553// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2554// check whether the returned error was because http.StatusNotModified 2555// was returned. 2556func (c *ProjectsSubscriptionsModifyPushConfigCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 2557 gensupport.SetOptions(c.urlParams_, opts...) 2558 res, err := c.doRequest("json") 2559 if res != nil && res.StatusCode == http.StatusNotModified { 2560 if res.Body != nil { 2561 res.Body.Close() 2562 } 2563 return nil, &googleapi.Error{ 2564 Code: res.StatusCode, 2565 Header: res.Header, 2566 } 2567 } 2568 if err != nil { 2569 return nil, err 2570 } 2571 defer googleapi.CloseBody(res) 2572 if err := googleapi.CheckResponse(res); err != nil { 2573 return nil, err 2574 } 2575 ret := &Empty{ 2576 ServerResponse: googleapi.ServerResponse{ 2577 Header: res.Header, 2578 HTTPStatusCode: res.StatusCode, 2579 }, 2580 } 2581 target := &ret 2582 if err := gensupport.DecodeResponse(target, res); err != nil { 2583 return nil, err 2584 } 2585 return ret, nil 2586 // { 2587 // "description": "Modifies the `PushConfig` for a specified subscription.\n\nThis may be used to change a push subscription to a pull one (signified by\nan empty `PushConfig`) or vice versa, or change the endpoint URL and other\nattributes of a push subscription. Messages will accumulate for delivery\ncontinuously through the call regardless of changes to the `PushConfig`.", 2588 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:modifyPushConfig", 2589 // "httpMethod": "POST", 2590 // "id": "pubsub.projects.subscriptions.modifyPushConfig", 2591 // "parameterOrder": [ 2592 // "subscription" 2593 // ], 2594 // "parameters": { 2595 // "subscription": { 2596 // "description": "The name of the subscription.", 2597 // "location": "path", 2598 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 2599 // "required": true, 2600 // "type": "string" 2601 // } 2602 // }, 2603 // "path": "v1beta2/{+subscription}:modifyPushConfig", 2604 // "request": { 2605 // "$ref": "ModifyPushConfigRequest" 2606 // }, 2607 // "response": { 2608 // "$ref": "Empty" 2609 // }, 2610 // "scopes": [ 2611 // "https://www.googleapis.com/auth/cloud-platform", 2612 // "https://www.googleapis.com/auth/pubsub" 2613 // ] 2614 // } 2615 2616} 2617 2618// method id "pubsub.projects.subscriptions.pull": 2619 2620type ProjectsSubscriptionsPullCall struct { 2621 s *Service 2622 subscription string 2623 pullrequest *PullRequest 2624 urlParams_ gensupport.URLParams 2625 ctx_ context.Context 2626 header_ http.Header 2627} 2628 2629// Pull: Pulls messages from the server. Returns an empty list if there 2630// are no 2631// messages available in the backlog. The server may return 2632// `UNAVAILABLE` if 2633// there are too many concurrent pull requests pending for the 2634// given 2635// subscription. 2636func (r *ProjectsSubscriptionsService) Pull(subscription string, pullrequest *PullRequest) *ProjectsSubscriptionsPullCall { 2637 c := &ProjectsSubscriptionsPullCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2638 c.subscription = subscription 2639 c.pullrequest = pullrequest 2640 return c 2641} 2642 2643// Fields allows partial responses to be retrieved. See 2644// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2645// for more information. 2646func (c *ProjectsSubscriptionsPullCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsPullCall { 2647 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2648 return c 2649} 2650 2651// Context sets the context to be used in this call's Do method. Any 2652// pending HTTP request will be aborted if the provided context is 2653// canceled. 2654func (c *ProjectsSubscriptionsPullCall) Context(ctx context.Context) *ProjectsSubscriptionsPullCall { 2655 c.ctx_ = ctx 2656 return c 2657} 2658 2659// Header returns an http.Header that can be modified by the caller to 2660// add HTTP headers to the request. 2661func (c *ProjectsSubscriptionsPullCall) Header() http.Header { 2662 if c.header_ == nil { 2663 c.header_ = make(http.Header) 2664 } 2665 return c.header_ 2666} 2667 2668func (c *ProjectsSubscriptionsPullCall) doRequest(alt string) (*http.Response, error) { 2669 reqHeaders := make(http.Header) 2670 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2671 for k, v := range c.header_ { 2672 reqHeaders[k] = v 2673 } 2674 reqHeaders.Set("User-Agent", c.s.userAgent()) 2675 var body io.Reader = nil 2676 body, err := googleapi.WithoutDataWrapper.JSONReader(c.pullrequest) 2677 if err != nil { 2678 return nil, err 2679 } 2680 reqHeaders.Set("Content-Type", "application/json") 2681 c.urlParams_.Set("alt", alt) 2682 c.urlParams_.Set("prettyPrint", "false") 2683 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:pull") 2684 urls += "?" + c.urlParams_.Encode() 2685 req, err := http.NewRequest("POST", urls, body) 2686 if err != nil { 2687 return nil, err 2688 } 2689 req.Header = reqHeaders 2690 googleapi.Expand(req.URL, map[string]string{ 2691 "subscription": c.subscription, 2692 }) 2693 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2694} 2695 2696// Do executes the "pubsub.projects.subscriptions.pull" call. 2697// Exactly one of *PullResponse or error will be non-nil. Any non-2xx 2698// status code is an error. Response headers are in either 2699// *PullResponse.ServerResponse.Header or (if a response was returned at 2700// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2701// to check whether the returned error was because 2702// http.StatusNotModified was returned. 2703func (c *ProjectsSubscriptionsPullCall) Do(opts ...googleapi.CallOption) (*PullResponse, error) { 2704 gensupport.SetOptions(c.urlParams_, opts...) 2705 res, err := c.doRequest("json") 2706 if res != nil && res.StatusCode == http.StatusNotModified { 2707 if res.Body != nil { 2708 res.Body.Close() 2709 } 2710 return nil, &googleapi.Error{ 2711 Code: res.StatusCode, 2712 Header: res.Header, 2713 } 2714 } 2715 if err != nil { 2716 return nil, err 2717 } 2718 defer googleapi.CloseBody(res) 2719 if err := googleapi.CheckResponse(res); err != nil { 2720 return nil, err 2721 } 2722 ret := &PullResponse{ 2723 ServerResponse: googleapi.ServerResponse{ 2724 Header: res.Header, 2725 HTTPStatusCode: res.StatusCode, 2726 }, 2727 } 2728 target := &ret 2729 if err := gensupport.DecodeResponse(target, res); err != nil { 2730 return nil, err 2731 } 2732 return ret, nil 2733 // { 2734 // "description": "Pulls messages from the server. Returns an empty list if there are no\nmessages available in the backlog. The server may return `UNAVAILABLE` if\nthere are too many concurrent pull requests pending for the given\nsubscription.", 2735 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:pull", 2736 // "httpMethod": "POST", 2737 // "id": "pubsub.projects.subscriptions.pull", 2738 // "parameterOrder": [ 2739 // "subscription" 2740 // ], 2741 // "parameters": { 2742 // "subscription": { 2743 // "description": "The subscription from which messages should be pulled.", 2744 // "location": "path", 2745 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 2746 // "required": true, 2747 // "type": "string" 2748 // } 2749 // }, 2750 // "path": "v1beta2/{+subscription}:pull", 2751 // "request": { 2752 // "$ref": "PullRequest" 2753 // }, 2754 // "response": { 2755 // "$ref": "PullResponse" 2756 // }, 2757 // "scopes": [ 2758 // "https://www.googleapis.com/auth/cloud-platform", 2759 // "https://www.googleapis.com/auth/pubsub" 2760 // ] 2761 // } 2762 2763} 2764 2765// method id "pubsub.projects.subscriptions.setIamPolicy": 2766 2767type ProjectsSubscriptionsSetIamPolicyCall struct { 2768 s *Service 2769 resource string 2770 setiampolicyrequest *SetIamPolicyRequest 2771 urlParams_ gensupport.URLParams 2772 ctx_ context.Context 2773 header_ http.Header 2774} 2775 2776// SetIamPolicy: Sets the access control policy on the specified 2777// resource. Replaces any 2778// existing policy. 2779// 2780// Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and 2781// PERMISSION_DENIED 2782func (r *ProjectsSubscriptionsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsSubscriptionsSetIamPolicyCall { 2783 c := &ProjectsSubscriptionsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2784 c.resource = resource 2785 c.setiampolicyrequest = setiampolicyrequest 2786 return c 2787} 2788 2789// Fields allows partial responses to be retrieved. See 2790// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2791// for more information. 2792func (c *ProjectsSubscriptionsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsSetIamPolicyCall { 2793 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2794 return c 2795} 2796 2797// Context sets the context to be used in this call's Do method. Any 2798// pending HTTP request will be aborted if the provided context is 2799// canceled. 2800func (c *ProjectsSubscriptionsSetIamPolicyCall) Context(ctx context.Context) *ProjectsSubscriptionsSetIamPolicyCall { 2801 c.ctx_ = ctx 2802 return c 2803} 2804 2805// Header returns an http.Header that can be modified by the caller to 2806// add HTTP headers to the request. 2807func (c *ProjectsSubscriptionsSetIamPolicyCall) Header() http.Header { 2808 if c.header_ == nil { 2809 c.header_ = make(http.Header) 2810 } 2811 return c.header_ 2812} 2813 2814func (c *ProjectsSubscriptionsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 2815 reqHeaders := make(http.Header) 2816 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2817 for k, v := range c.header_ { 2818 reqHeaders[k] = v 2819 } 2820 reqHeaders.Set("User-Agent", c.s.userAgent()) 2821 var body io.Reader = nil 2822 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest) 2823 if err != nil { 2824 return nil, err 2825 } 2826 reqHeaders.Set("Content-Type", "application/json") 2827 c.urlParams_.Set("alt", alt) 2828 c.urlParams_.Set("prettyPrint", "false") 2829 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:setIamPolicy") 2830 urls += "?" + c.urlParams_.Encode() 2831 req, err := http.NewRequest("POST", urls, body) 2832 if err != nil { 2833 return nil, err 2834 } 2835 req.Header = reqHeaders 2836 googleapi.Expand(req.URL, map[string]string{ 2837 "resource": c.resource, 2838 }) 2839 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2840} 2841 2842// Do executes the "pubsub.projects.subscriptions.setIamPolicy" call. 2843// Exactly one of *Policy or error will be non-nil. Any non-2xx status 2844// code is an error. Response headers are in either 2845// *Policy.ServerResponse.Header or (if a response was returned at all) 2846// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2847// check whether the returned error was because http.StatusNotModified 2848// was returned. 2849func (c *ProjectsSubscriptionsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 2850 gensupport.SetOptions(c.urlParams_, opts...) 2851 res, err := c.doRequest("json") 2852 if res != nil && res.StatusCode == http.StatusNotModified { 2853 if res.Body != nil { 2854 res.Body.Close() 2855 } 2856 return nil, &googleapi.Error{ 2857 Code: res.StatusCode, 2858 Header: res.Header, 2859 } 2860 } 2861 if err != nil { 2862 return nil, err 2863 } 2864 defer googleapi.CloseBody(res) 2865 if err := googleapi.CheckResponse(res); err != nil { 2866 return nil, err 2867 } 2868 ret := &Policy{ 2869 ServerResponse: googleapi.ServerResponse{ 2870 Header: res.Header, 2871 HTTPStatusCode: res.StatusCode, 2872 }, 2873 } 2874 target := &ret 2875 if err := gensupport.DecodeResponse(target, res); err != nil { 2876 return nil, err 2877 } 2878 return ret, nil 2879 // { 2880 // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.\n\nCan return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED", 2881 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:setIamPolicy", 2882 // "httpMethod": "POST", 2883 // "id": "pubsub.projects.subscriptions.setIamPolicy", 2884 // "parameterOrder": [ 2885 // "resource" 2886 // ], 2887 // "parameters": { 2888 // "resource": { 2889 // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.", 2890 // "location": "path", 2891 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 2892 // "required": true, 2893 // "type": "string" 2894 // } 2895 // }, 2896 // "path": "v1beta2/{+resource}:setIamPolicy", 2897 // "request": { 2898 // "$ref": "SetIamPolicyRequest" 2899 // }, 2900 // "response": { 2901 // "$ref": "Policy" 2902 // }, 2903 // "scopes": [ 2904 // "https://www.googleapis.com/auth/cloud-platform", 2905 // "https://www.googleapis.com/auth/pubsub" 2906 // ] 2907 // } 2908 2909} 2910 2911// method id "pubsub.projects.subscriptions.testIamPermissions": 2912 2913type ProjectsSubscriptionsTestIamPermissionsCall struct { 2914 s *Service 2915 resource string 2916 testiampermissionsrequest *TestIamPermissionsRequest 2917 urlParams_ gensupport.URLParams 2918 ctx_ context.Context 2919 header_ http.Header 2920} 2921 2922// TestIamPermissions: Returns permissions that a caller has on the 2923// specified resource. 2924// If the resource does not exist, this will return an empty set 2925// of 2926// permissions, not a NOT_FOUND error. 2927// 2928// Note: This operation is designed to be used for building 2929// permission-aware 2930// UIs and command-line tools, not for authorization checking. This 2931// operation 2932// may "fail open" without warning. 2933func (r *ProjectsSubscriptionsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsSubscriptionsTestIamPermissionsCall { 2934 c := &ProjectsSubscriptionsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2935 c.resource = resource 2936 c.testiampermissionsrequest = testiampermissionsrequest 2937 return c 2938} 2939 2940// Fields allows partial responses to be retrieved. See 2941// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2942// for more information. 2943func (c *ProjectsSubscriptionsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsTestIamPermissionsCall { 2944 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2945 return c 2946} 2947 2948// Context sets the context to be used in this call's Do method. Any 2949// pending HTTP request will be aborted if the provided context is 2950// canceled. 2951func (c *ProjectsSubscriptionsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsSubscriptionsTestIamPermissionsCall { 2952 c.ctx_ = ctx 2953 return c 2954} 2955 2956// Header returns an http.Header that can be modified by the caller to 2957// add HTTP headers to the request. 2958func (c *ProjectsSubscriptionsTestIamPermissionsCall) Header() http.Header { 2959 if c.header_ == nil { 2960 c.header_ = make(http.Header) 2961 } 2962 return c.header_ 2963} 2964 2965func (c *ProjectsSubscriptionsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 2966 reqHeaders := make(http.Header) 2967 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 2968 for k, v := range c.header_ { 2969 reqHeaders[k] = v 2970 } 2971 reqHeaders.Set("User-Agent", c.s.userAgent()) 2972 var body io.Reader = nil 2973 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest) 2974 if err != nil { 2975 return nil, err 2976 } 2977 reqHeaders.Set("Content-Type", "application/json") 2978 c.urlParams_.Set("alt", alt) 2979 c.urlParams_.Set("prettyPrint", "false") 2980 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:testIamPermissions") 2981 urls += "?" + c.urlParams_.Encode() 2982 req, err := http.NewRequest("POST", urls, body) 2983 if err != nil { 2984 return nil, err 2985 } 2986 req.Header = reqHeaders 2987 googleapi.Expand(req.URL, map[string]string{ 2988 "resource": c.resource, 2989 }) 2990 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2991} 2992 2993// Do executes the "pubsub.projects.subscriptions.testIamPermissions" call. 2994// Exactly one of *TestIamPermissionsResponse or error will be non-nil. 2995// Any non-2xx status code is an error. Response headers are in either 2996// *TestIamPermissionsResponse.ServerResponse.Header or (if a response 2997// was returned at all) in error.(*googleapi.Error).Header. Use 2998// googleapi.IsNotModified to check whether the returned error was 2999// because http.StatusNotModified was returned. 3000func (c *ProjectsSubscriptionsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 3001 gensupport.SetOptions(c.urlParams_, opts...) 3002 res, err := c.doRequest("json") 3003 if res != nil && res.StatusCode == http.StatusNotModified { 3004 if res.Body != nil { 3005 res.Body.Close() 3006 } 3007 return nil, &googleapi.Error{ 3008 Code: res.StatusCode, 3009 Header: res.Header, 3010 } 3011 } 3012 if err != nil { 3013 return nil, err 3014 } 3015 defer googleapi.CloseBody(res) 3016 if err := googleapi.CheckResponse(res); err != nil { 3017 return nil, err 3018 } 3019 ret := &TestIamPermissionsResponse{ 3020 ServerResponse: googleapi.ServerResponse{ 3021 Header: res.Header, 3022 HTTPStatusCode: res.StatusCode, 3023 }, 3024 } 3025 target := &ret 3026 if err := gensupport.DecodeResponse(target, res); err != nil { 3027 return nil, err 3028 } 3029 return ret, nil 3030 // { 3031 // "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.\n\nNote: This operation is designed to be used for building permission-aware\nUIs and command-line tools, not for authorization checking. This operation\nmay \"fail open\" without warning.", 3032 // "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:testIamPermissions", 3033 // "httpMethod": "POST", 3034 // "id": "pubsub.projects.subscriptions.testIamPermissions", 3035 // "parameterOrder": [ 3036 // "resource" 3037 // ], 3038 // "parameters": { 3039 // "resource": { 3040 // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.", 3041 // "location": "path", 3042 // "pattern": "^projects/[^/]+/subscriptions/[^/]+$", 3043 // "required": true, 3044 // "type": "string" 3045 // } 3046 // }, 3047 // "path": "v1beta2/{+resource}:testIamPermissions", 3048 // "request": { 3049 // "$ref": "TestIamPermissionsRequest" 3050 // }, 3051 // "response": { 3052 // "$ref": "TestIamPermissionsResponse" 3053 // }, 3054 // "scopes": [ 3055 // "https://www.googleapis.com/auth/cloud-platform", 3056 // "https://www.googleapis.com/auth/pubsub" 3057 // ] 3058 // } 3059 3060} 3061 3062// method id "pubsub.projects.topics.create": 3063 3064type ProjectsTopicsCreateCall struct { 3065 s *Service 3066 name string 3067 topic *Topic 3068 urlParams_ gensupport.URLParams 3069 ctx_ context.Context 3070 header_ http.Header 3071} 3072 3073// Create: Creates the given topic with the given name. 3074func (r *ProjectsTopicsService) Create(name string, topic *Topic) *ProjectsTopicsCreateCall { 3075 c := &ProjectsTopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3076 c.name = name 3077 c.topic = topic 3078 return c 3079} 3080 3081// Fields allows partial responses to be retrieved. See 3082// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3083// for more information. 3084func (c *ProjectsTopicsCreateCall) Fields(s ...googleapi.Field) *ProjectsTopicsCreateCall { 3085 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3086 return c 3087} 3088 3089// Context sets the context to be used in this call's Do method. Any 3090// pending HTTP request will be aborted if the provided context is 3091// canceled. 3092func (c *ProjectsTopicsCreateCall) Context(ctx context.Context) *ProjectsTopicsCreateCall { 3093 c.ctx_ = ctx 3094 return c 3095} 3096 3097// Header returns an http.Header that can be modified by the caller to 3098// add HTTP headers to the request. 3099func (c *ProjectsTopicsCreateCall) Header() http.Header { 3100 if c.header_ == nil { 3101 c.header_ = make(http.Header) 3102 } 3103 return c.header_ 3104} 3105 3106func (c *ProjectsTopicsCreateCall) doRequest(alt string) (*http.Response, error) { 3107 reqHeaders := make(http.Header) 3108 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3109 for k, v := range c.header_ { 3110 reqHeaders[k] = v 3111 } 3112 reqHeaders.Set("User-Agent", c.s.userAgent()) 3113 var body io.Reader = nil 3114 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic) 3115 if err != nil { 3116 return nil, err 3117 } 3118 reqHeaders.Set("Content-Type", "application/json") 3119 c.urlParams_.Set("alt", alt) 3120 c.urlParams_.Set("prettyPrint", "false") 3121 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}") 3122 urls += "?" + c.urlParams_.Encode() 3123 req, err := http.NewRequest("PUT", urls, body) 3124 if err != nil { 3125 return nil, err 3126 } 3127 req.Header = reqHeaders 3128 googleapi.Expand(req.URL, map[string]string{ 3129 "name": c.name, 3130 }) 3131 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3132} 3133 3134// Do executes the "pubsub.projects.topics.create" call. 3135// Exactly one of *Topic or error will be non-nil. Any non-2xx status 3136// code is an error. Response headers are in either 3137// *Topic.ServerResponse.Header or (if a response was returned at all) 3138// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3139// check whether the returned error was because http.StatusNotModified 3140// was returned. 3141func (c *ProjectsTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 3142 gensupport.SetOptions(c.urlParams_, opts...) 3143 res, err := c.doRequest("json") 3144 if res != nil && res.StatusCode == http.StatusNotModified { 3145 if res.Body != nil { 3146 res.Body.Close() 3147 } 3148 return nil, &googleapi.Error{ 3149 Code: res.StatusCode, 3150 Header: res.Header, 3151 } 3152 } 3153 if err != nil { 3154 return nil, err 3155 } 3156 defer googleapi.CloseBody(res) 3157 if err := googleapi.CheckResponse(res); err != nil { 3158 return nil, err 3159 } 3160 ret := &Topic{ 3161 ServerResponse: googleapi.ServerResponse{ 3162 Header: res.Header, 3163 HTTPStatusCode: res.StatusCode, 3164 }, 3165 } 3166 target := &ret 3167 if err := gensupport.DecodeResponse(target, res); err != nil { 3168 return nil, err 3169 } 3170 return ret, nil 3171 // { 3172 // "description": "Creates the given topic with the given name.", 3173 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}", 3174 // "httpMethod": "PUT", 3175 // "id": "pubsub.projects.topics.create", 3176 // "parameterOrder": [ 3177 // "name" 3178 // ], 3179 // "parameters": { 3180 // "name": { 3181 // "description": "The name of the topic. It must have the format\n`\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,\nand contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),\nunderscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent\nsigns (`%`). It must be between 3 and 255 characters in length, and it\nmust not start with `\"goog\"`.", 3182 // "location": "path", 3183 // "pattern": "^projects/[^/]+/topics/[^/]+$", 3184 // "required": true, 3185 // "type": "string" 3186 // } 3187 // }, 3188 // "path": "v1beta2/{+name}", 3189 // "request": { 3190 // "$ref": "Topic" 3191 // }, 3192 // "response": { 3193 // "$ref": "Topic" 3194 // }, 3195 // "scopes": [ 3196 // "https://www.googleapis.com/auth/cloud-platform", 3197 // "https://www.googleapis.com/auth/pubsub" 3198 // ] 3199 // } 3200 3201} 3202 3203// method id "pubsub.projects.topics.delete": 3204 3205type ProjectsTopicsDeleteCall struct { 3206 s *Service 3207 topic string 3208 urlParams_ gensupport.URLParams 3209 ctx_ context.Context 3210 header_ http.Header 3211} 3212 3213// Delete: Deletes the topic with the given name. Returns `NOT_FOUND` if 3214// the topic 3215// does not exist. After a topic is deleted, a new topic may be created 3216// with 3217// the same name; this is an entirely new topic with none of the 3218// old 3219// configuration or subscriptions. Existing subscriptions to this topic 3220// are 3221// not deleted, but their `topic` field is set to `_deleted-topic_`. 3222func (r *ProjectsTopicsService) Delete(topic string) *ProjectsTopicsDeleteCall { 3223 c := &ProjectsTopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3224 c.topic = topic 3225 return c 3226} 3227 3228// Fields allows partial responses to be retrieved. See 3229// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3230// for more information. 3231func (c *ProjectsTopicsDeleteCall) Fields(s ...googleapi.Field) *ProjectsTopicsDeleteCall { 3232 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3233 return c 3234} 3235 3236// Context sets the context to be used in this call's Do method. Any 3237// pending HTTP request will be aborted if the provided context is 3238// canceled. 3239func (c *ProjectsTopicsDeleteCall) Context(ctx context.Context) *ProjectsTopicsDeleteCall { 3240 c.ctx_ = ctx 3241 return c 3242} 3243 3244// Header returns an http.Header that can be modified by the caller to 3245// add HTTP headers to the request. 3246func (c *ProjectsTopicsDeleteCall) Header() http.Header { 3247 if c.header_ == nil { 3248 c.header_ = make(http.Header) 3249 } 3250 return c.header_ 3251} 3252 3253func (c *ProjectsTopicsDeleteCall) doRequest(alt string) (*http.Response, error) { 3254 reqHeaders := make(http.Header) 3255 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3256 for k, v := range c.header_ { 3257 reqHeaders[k] = v 3258 } 3259 reqHeaders.Set("User-Agent", c.s.userAgent()) 3260 var body io.Reader = nil 3261 c.urlParams_.Set("alt", alt) 3262 c.urlParams_.Set("prettyPrint", "false") 3263 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}") 3264 urls += "?" + c.urlParams_.Encode() 3265 req, err := http.NewRequest("DELETE", urls, body) 3266 if err != nil { 3267 return nil, err 3268 } 3269 req.Header = reqHeaders 3270 googleapi.Expand(req.URL, map[string]string{ 3271 "topic": c.topic, 3272 }) 3273 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3274} 3275 3276// Do executes the "pubsub.projects.topics.delete" call. 3277// Exactly one of *Empty or error will be non-nil. Any non-2xx status 3278// code is an error. Response headers are in either 3279// *Empty.ServerResponse.Header or (if a response was returned at all) 3280// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3281// check whether the returned error was because http.StatusNotModified 3282// was returned. 3283func (c *ProjectsTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) { 3284 gensupport.SetOptions(c.urlParams_, opts...) 3285 res, err := c.doRequest("json") 3286 if res != nil && res.StatusCode == http.StatusNotModified { 3287 if res.Body != nil { 3288 res.Body.Close() 3289 } 3290 return nil, &googleapi.Error{ 3291 Code: res.StatusCode, 3292 Header: res.Header, 3293 } 3294 } 3295 if err != nil { 3296 return nil, err 3297 } 3298 defer googleapi.CloseBody(res) 3299 if err := googleapi.CheckResponse(res); err != nil { 3300 return nil, err 3301 } 3302 ret := &Empty{ 3303 ServerResponse: googleapi.ServerResponse{ 3304 Header: res.Header, 3305 HTTPStatusCode: res.StatusCode, 3306 }, 3307 } 3308 target := &ret 3309 if err := gensupport.DecodeResponse(target, res); err != nil { 3310 return nil, err 3311 } 3312 return ret, nil 3313 // { 3314 // "description": "Deletes the topic with the given name. Returns `NOT_FOUND` if the topic\ndoes not exist. After a topic is deleted, a new topic may be created with\nthe same name; this is an entirely new topic with none of the old\nconfiguration or subscriptions. Existing subscriptions to this topic are\nnot deleted, but their `topic` field is set to `_deleted-topic_`.", 3315 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}", 3316 // "httpMethod": "DELETE", 3317 // "id": "pubsub.projects.topics.delete", 3318 // "parameterOrder": [ 3319 // "topic" 3320 // ], 3321 // "parameters": { 3322 // "topic": { 3323 // "description": "Name of the topic to delete.", 3324 // "location": "path", 3325 // "pattern": "^projects/[^/]+/topics/[^/]+$", 3326 // "required": true, 3327 // "type": "string" 3328 // } 3329 // }, 3330 // "path": "v1beta2/{+topic}", 3331 // "response": { 3332 // "$ref": "Empty" 3333 // }, 3334 // "scopes": [ 3335 // "https://www.googleapis.com/auth/cloud-platform", 3336 // "https://www.googleapis.com/auth/pubsub" 3337 // ] 3338 // } 3339 3340} 3341 3342// method id "pubsub.projects.topics.get": 3343 3344type ProjectsTopicsGetCall struct { 3345 s *Service 3346 topic string 3347 urlParams_ gensupport.URLParams 3348 ifNoneMatch_ string 3349 ctx_ context.Context 3350 header_ http.Header 3351} 3352 3353// Get: Gets the configuration of a topic. 3354func (r *ProjectsTopicsService) Get(topic string) *ProjectsTopicsGetCall { 3355 c := &ProjectsTopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3356 c.topic = topic 3357 return c 3358} 3359 3360// Fields allows partial responses to be retrieved. See 3361// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3362// for more information. 3363func (c *ProjectsTopicsGetCall) Fields(s ...googleapi.Field) *ProjectsTopicsGetCall { 3364 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3365 return c 3366} 3367 3368// IfNoneMatch sets the optional parameter which makes the operation 3369// fail if the object's ETag matches the given value. This is useful for 3370// getting updates only after the object has changed since the last 3371// request. Use googleapi.IsNotModified to check whether the response 3372// error from Do is the result of In-None-Match. 3373func (c *ProjectsTopicsGetCall) IfNoneMatch(entityTag string) *ProjectsTopicsGetCall { 3374 c.ifNoneMatch_ = entityTag 3375 return c 3376} 3377 3378// Context sets the context to be used in this call's Do method. Any 3379// pending HTTP request will be aborted if the provided context is 3380// canceled. 3381func (c *ProjectsTopicsGetCall) Context(ctx context.Context) *ProjectsTopicsGetCall { 3382 c.ctx_ = ctx 3383 return c 3384} 3385 3386// Header returns an http.Header that can be modified by the caller to 3387// add HTTP headers to the request. 3388func (c *ProjectsTopicsGetCall) Header() http.Header { 3389 if c.header_ == nil { 3390 c.header_ = make(http.Header) 3391 } 3392 return c.header_ 3393} 3394 3395func (c *ProjectsTopicsGetCall) doRequest(alt string) (*http.Response, error) { 3396 reqHeaders := make(http.Header) 3397 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3398 for k, v := range c.header_ { 3399 reqHeaders[k] = v 3400 } 3401 reqHeaders.Set("User-Agent", c.s.userAgent()) 3402 if c.ifNoneMatch_ != "" { 3403 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3404 } 3405 var body io.Reader = nil 3406 c.urlParams_.Set("alt", alt) 3407 c.urlParams_.Set("prettyPrint", "false") 3408 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}") 3409 urls += "?" + c.urlParams_.Encode() 3410 req, err := http.NewRequest("GET", urls, body) 3411 if err != nil { 3412 return nil, err 3413 } 3414 req.Header = reqHeaders 3415 googleapi.Expand(req.URL, map[string]string{ 3416 "topic": c.topic, 3417 }) 3418 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3419} 3420 3421// Do executes the "pubsub.projects.topics.get" call. 3422// Exactly one of *Topic or error will be non-nil. Any non-2xx status 3423// code is an error. Response headers are in either 3424// *Topic.ServerResponse.Header or (if a response was returned at all) 3425// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3426// check whether the returned error was because http.StatusNotModified 3427// was returned. 3428func (c *ProjectsTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) { 3429 gensupport.SetOptions(c.urlParams_, opts...) 3430 res, err := c.doRequest("json") 3431 if res != nil && res.StatusCode == http.StatusNotModified { 3432 if res.Body != nil { 3433 res.Body.Close() 3434 } 3435 return nil, &googleapi.Error{ 3436 Code: res.StatusCode, 3437 Header: res.Header, 3438 } 3439 } 3440 if err != nil { 3441 return nil, err 3442 } 3443 defer googleapi.CloseBody(res) 3444 if err := googleapi.CheckResponse(res); err != nil { 3445 return nil, err 3446 } 3447 ret := &Topic{ 3448 ServerResponse: googleapi.ServerResponse{ 3449 Header: res.Header, 3450 HTTPStatusCode: res.StatusCode, 3451 }, 3452 } 3453 target := &ret 3454 if err := gensupport.DecodeResponse(target, res); err != nil { 3455 return nil, err 3456 } 3457 return ret, nil 3458 // { 3459 // "description": "Gets the configuration of a topic.", 3460 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}", 3461 // "httpMethod": "GET", 3462 // "id": "pubsub.projects.topics.get", 3463 // "parameterOrder": [ 3464 // "topic" 3465 // ], 3466 // "parameters": { 3467 // "topic": { 3468 // "description": "The name of the topic to get.", 3469 // "location": "path", 3470 // "pattern": "^projects/[^/]+/topics/[^/]+$", 3471 // "required": true, 3472 // "type": "string" 3473 // } 3474 // }, 3475 // "path": "v1beta2/{+topic}", 3476 // "response": { 3477 // "$ref": "Topic" 3478 // }, 3479 // "scopes": [ 3480 // "https://www.googleapis.com/auth/cloud-platform", 3481 // "https://www.googleapis.com/auth/pubsub" 3482 // ] 3483 // } 3484 3485} 3486 3487// method id "pubsub.projects.topics.getIamPolicy": 3488 3489type ProjectsTopicsGetIamPolicyCall struct { 3490 s *Service 3491 resource string 3492 urlParams_ gensupport.URLParams 3493 ifNoneMatch_ string 3494 ctx_ context.Context 3495 header_ http.Header 3496} 3497 3498// GetIamPolicy: Gets the access control policy for a resource. 3499// Returns an empty policy if the resource exists and does not have a 3500// policy 3501// set. 3502func (r *ProjectsTopicsService) GetIamPolicy(resource string) *ProjectsTopicsGetIamPolicyCall { 3503 c := &ProjectsTopicsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3504 c.resource = resource 3505 return c 3506} 3507 3508// OptionsRequestedPolicyVersion sets the optional parameter 3509// "options.requestedPolicyVersion": The policy format version to be 3510// returned. 3511// 3512// Valid values are 0, 1, and 3. Requests specifying an invalid value 3513// will be 3514// rejected. 3515// 3516// Requests for policies with any conditional bindings must specify 3517// version 3. 3518// Policies without any conditional bindings may specify any valid value 3519// or 3520// leave the field unset. 3521func (c *ProjectsTopicsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsTopicsGetIamPolicyCall { 3522 c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion)) 3523 return c 3524} 3525 3526// Fields allows partial responses to be retrieved. See 3527// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3528// for more information. 3529func (c *ProjectsTopicsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsTopicsGetIamPolicyCall { 3530 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3531 return c 3532} 3533 3534// IfNoneMatch sets the optional parameter which makes the operation 3535// fail if the object's ETag matches the given value. This is useful for 3536// getting updates only after the object has changed since the last 3537// request. Use googleapi.IsNotModified to check whether the response 3538// error from Do is the result of In-None-Match. 3539func (c *ProjectsTopicsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsTopicsGetIamPolicyCall { 3540 c.ifNoneMatch_ = entityTag 3541 return c 3542} 3543 3544// Context sets the context to be used in this call's Do method. Any 3545// pending HTTP request will be aborted if the provided context is 3546// canceled. 3547func (c *ProjectsTopicsGetIamPolicyCall) Context(ctx context.Context) *ProjectsTopicsGetIamPolicyCall { 3548 c.ctx_ = ctx 3549 return c 3550} 3551 3552// Header returns an http.Header that can be modified by the caller to 3553// add HTTP headers to the request. 3554func (c *ProjectsTopicsGetIamPolicyCall) Header() http.Header { 3555 if c.header_ == nil { 3556 c.header_ = make(http.Header) 3557 } 3558 return c.header_ 3559} 3560 3561func (c *ProjectsTopicsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 3562 reqHeaders := make(http.Header) 3563 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3564 for k, v := range c.header_ { 3565 reqHeaders[k] = v 3566 } 3567 reqHeaders.Set("User-Agent", c.s.userAgent()) 3568 if c.ifNoneMatch_ != "" { 3569 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3570 } 3571 var body io.Reader = nil 3572 c.urlParams_.Set("alt", alt) 3573 c.urlParams_.Set("prettyPrint", "false") 3574 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:getIamPolicy") 3575 urls += "?" + c.urlParams_.Encode() 3576 req, err := http.NewRequest("GET", urls, body) 3577 if err != nil { 3578 return nil, err 3579 } 3580 req.Header = reqHeaders 3581 googleapi.Expand(req.URL, map[string]string{ 3582 "resource": c.resource, 3583 }) 3584 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3585} 3586 3587// Do executes the "pubsub.projects.topics.getIamPolicy" call. 3588// Exactly one of *Policy or error will be non-nil. Any non-2xx status 3589// code is an error. Response headers are in either 3590// *Policy.ServerResponse.Header or (if a response was returned at all) 3591// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3592// check whether the returned error was because http.StatusNotModified 3593// was returned. 3594func (c *ProjectsTopicsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 3595 gensupport.SetOptions(c.urlParams_, opts...) 3596 res, err := c.doRequest("json") 3597 if res != nil && res.StatusCode == http.StatusNotModified { 3598 if res.Body != nil { 3599 res.Body.Close() 3600 } 3601 return nil, &googleapi.Error{ 3602 Code: res.StatusCode, 3603 Header: res.Header, 3604 } 3605 } 3606 if err != nil { 3607 return nil, err 3608 } 3609 defer googleapi.CloseBody(res) 3610 if err := googleapi.CheckResponse(res); err != nil { 3611 return nil, err 3612 } 3613 ret := &Policy{ 3614 ServerResponse: googleapi.ServerResponse{ 3615 Header: res.Header, 3616 HTTPStatusCode: res.StatusCode, 3617 }, 3618 } 3619 target := &ret 3620 if err := gensupport.DecodeResponse(target, res); err != nil { 3621 return nil, err 3622 } 3623 return ret, nil 3624 // { 3625 // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.", 3626 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:getIamPolicy", 3627 // "httpMethod": "GET", 3628 // "id": "pubsub.projects.topics.getIamPolicy", 3629 // "parameterOrder": [ 3630 // "resource" 3631 // ], 3632 // "parameters": { 3633 // "options.requestedPolicyVersion": { 3634 // "description": "Optional. The policy format version to be returned.\n\nValid values are 0, 1, and 3. Requests specifying an invalid value will be\nrejected.\n\nRequests for policies with any conditional bindings must specify version 3.\nPolicies without any conditional bindings may specify any valid value or\nleave the field unset.", 3635 // "format": "int32", 3636 // "location": "query", 3637 // "type": "integer" 3638 // }, 3639 // "resource": { 3640 // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.", 3641 // "location": "path", 3642 // "pattern": "^projects/[^/]+/topics/[^/]+$", 3643 // "required": true, 3644 // "type": "string" 3645 // } 3646 // }, 3647 // "path": "v1beta2/{+resource}:getIamPolicy", 3648 // "response": { 3649 // "$ref": "Policy" 3650 // }, 3651 // "scopes": [ 3652 // "https://www.googleapis.com/auth/cloud-platform", 3653 // "https://www.googleapis.com/auth/pubsub" 3654 // ] 3655 // } 3656 3657} 3658 3659// method id "pubsub.projects.topics.list": 3660 3661type ProjectsTopicsListCall struct { 3662 s *Service 3663 project string 3664 urlParams_ gensupport.URLParams 3665 ifNoneMatch_ string 3666 ctx_ context.Context 3667 header_ http.Header 3668} 3669 3670// List: Lists matching topics. 3671func (r *ProjectsTopicsService) List(project string) *ProjectsTopicsListCall { 3672 c := &ProjectsTopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3673 c.project = project 3674 return c 3675} 3676 3677// PageSize sets the optional parameter "pageSize": Maximum number of 3678// topics to return. 3679func (c *ProjectsTopicsListCall) PageSize(pageSize int64) *ProjectsTopicsListCall { 3680 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3681 return c 3682} 3683 3684// PageToken sets the optional parameter "pageToken": The value returned 3685// by the last `ListTopicsResponse`; indicates that this is 3686// a continuation of a prior `ListTopics` call, and that the system 3687// should 3688// return the next page of data. 3689func (c *ProjectsTopicsListCall) PageToken(pageToken string) *ProjectsTopicsListCall { 3690 c.urlParams_.Set("pageToken", pageToken) 3691 return c 3692} 3693 3694// Fields allows partial responses to be retrieved. See 3695// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3696// for more information. 3697func (c *ProjectsTopicsListCall) Fields(s ...googleapi.Field) *ProjectsTopicsListCall { 3698 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3699 return c 3700} 3701 3702// IfNoneMatch sets the optional parameter which makes the operation 3703// fail if the object's ETag matches the given value. This is useful for 3704// getting updates only after the object has changed since the last 3705// request. Use googleapi.IsNotModified to check whether the response 3706// error from Do is the result of In-None-Match. 3707func (c *ProjectsTopicsListCall) IfNoneMatch(entityTag string) *ProjectsTopicsListCall { 3708 c.ifNoneMatch_ = entityTag 3709 return c 3710} 3711 3712// Context sets the context to be used in this call's Do method. Any 3713// pending HTTP request will be aborted if the provided context is 3714// canceled. 3715func (c *ProjectsTopicsListCall) Context(ctx context.Context) *ProjectsTopicsListCall { 3716 c.ctx_ = ctx 3717 return c 3718} 3719 3720// Header returns an http.Header that can be modified by the caller to 3721// add HTTP headers to the request. 3722func (c *ProjectsTopicsListCall) Header() http.Header { 3723 if c.header_ == nil { 3724 c.header_ = make(http.Header) 3725 } 3726 return c.header_ 3727} 3728 3729func (c *ProjectsTopicsListCall) doRequest(alt string) (*http.Response, error) { 3730 reqHeaders := make(http.Header) 3731 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3732 for k, v := range c.header_ { 3733 reqHeaders[k] = v 3734 } 3735 reqHeaders.Set("User-Agent", c.s.userAgent()) 3736 if c.ifNoneMatch_ != "" { 3737 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3738 } 3739 var body io.Reader = nil 3740 c.urlParams_.Set("alt", alt) 3741 c.urlParams_.Set("prettyPrint", "false") 3742 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+project}/topics") 3743 urls += "?" + c.urlParams_.Encode() 3744 req, err := http.NewRequest("GET", urls, body) 3745 if err != nil { 3746 return nil, err 3747 } 3748 req.Header = reqHeaders 3749 googleapi.Expand(req.URL, map[string]string{ 3750 "project": c.project, 3751 }) 3752 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3753} 3754 3755// Do executes the "pubsub.projects.topics.list" call. 3756// Exactly one of *ListTopicsResponse or error will be non-nil. Any 3757// non-2xx status code is an error. Response headers are in either 3758// *ListTopicsResponse.ServerResponse.Header or (if a response was 3759// returned at all) in error.(*googleapi.Error).Header. Use 3760// googleapi.IsNotModified to check whether the returned error was 3761// because http.StatusNotModified was returned. 3762func (c *ProjectsTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicsResponse, error) { 3763 gensupport.SetOptions(c.urlParams_, opts...) 3764 res, err := c.doRequest("json") 3765 if res != nil && res.StatusCode == http.StatusNotModified { 3766 if res.Body != nil { 3767 res.Body.Close() 3768 } 3769 return nil, &googleapi.Error{ 3770 Code: res.StatusCode, 3771 Header: res.Header, 3772 } 3773 } 3774 if err != nil { 3775 return nil, err 3776 } 3777 defer googleapi.CloseBody(res) 3778 if err := googleapi.CheckResponse(res); err != nil { 3779 return nil, err 3780 } 3781 ret := &ListTopicsResponse{ 3782 ServerResponse: googleapi.ServerResponse{ 3783 Header: res.Header, 3784 HTTPStatusCode: res.StatusCode, 3785 }, 3786 } 3787 target := &ret 3788 if err := gensupport.DecodeResponse(target, res); err != nil { 3789 return nil, err 3790 } 3791 return ret, nil 3792 // { 3793 // "description": "Lists matching topics.", 3794 // "flatPath": "v1beta2/projects/{projectsId}/topics", 3795 // "httpMethod": "GET", 3796 // "id": "pubsub.projects.topics.list", 3797 // "parameterOrder": [ 3798 // "project" 3799 // ], 3800 // "parameters": { 3801 // "pageSize": { 3802 // "description": "Maximum number of topics to return.", 3803 // "format": "int32", 3804 // "location": "query", 3805 // "type": "integer" 3806 // }, 3807 // "pageToken": { 3808 // "description": "The value returned by the last `ListTopicsResponse`; indicates that this is\na continuation of a prior `ListTopics` call, and that the system should\nreturn the next page of data.", 3809 // "location": "query", 3810 // "type": "string" 3811 // }, 3812 // "project": { 3813 // "description": "The name of the cloud project that topics belong to.", 3814 // "location": "path", 3815 // "pattern": "^projects/[^/]+$", 3816 // "required": true, 3817 // "type": "string" 3818 // } 3819 // }, 3820 // "path": "v1beta2/{+project}/topics", 3821 // "response": { 3822 // "$ref": "ListTopicsResponse" 3823 // }, 3824 // "scopes": [ 3825 // "https://www.googleapis.com/auth/cloud-platform", 3826 // "https://www.googleapis.com/auth/pubsub" 3827 // ] 3828 // } 3829 3830} 3831 3832// Pages invokes f for each page of results. 3833// A non-nil error returned from f will halt the iteration. 3834// The provided context supersedes any context provided to the Context method. 3835func (c *ProjectsTopicsListCall) Pages(ctx context.Context, f func(*ListTopicsResponse) error) error { 3836 c.ctx_ = ctx 3837 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3838 for { 3839 x, err := c.Do() 3840 if err != nil { 3841 return err 3842 } 3843 if err := f(x); err != nil { 3844 return err 3845 } 3846 if x.NextPageToken == "" { 3847 return nil 3848 } 3849 c.PageToken(x.NextPageToken) 3850 } 3851} 3852 3853// method id "pubsub.projects.topics.publish": 3854 3855type ProjectsTopicsPublishCall struct { 3856 s *Service 3857 topic string 3858 publishrequest *PublishRequest 3859 urlParams_ gensupport.URLParams 3860 ctx_ context.Context 3861 header_ http.Header 3862} 3863 3864// Publish: Adds one or more messages to the topic. Returns `NOT_FOUND` 3865// if the topic 3866// does not exist. The message payload must not be empty; it must 3867// contain 3868// either a non-empty data field, or at least one attribute. 3869func (r *ProjectsTopicsService) Publish(topic string, publishrequest *PublishRequest) *ProjectsTopicsPublishCall { 3870 c := &ProjectsTopicsPublishCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3871 c.topic = topic 3872 c.publishrequest = publishrequest 3873 return c 3874} 3875 3876// Fields allows partial responses to be retrieved. See 3877// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3878// for more information. 3879func (c *ProjectsTopicsPublishCall) Fields(s ...googleapi.Field) *ProjectsTopicsPublishCall { 3880 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3881 return c 3882} 3883 3884// Context sets the context to be used in this call's Do method. Any 3885// pending HTTP request will be aborted if the provided context is 3886// canceled. 3887func (c *ProjectsTopicsPublishCall) Context(ctx context.Context) *ProjectsTopicsPublishCall { 3888 c.ctx_ = ctx 3889 return c 3890} 3891 3892// Header returns an http.Header that can be modified by the caller to 3893// add HTTP headers to the request. 3894func (c *ProjectsTopicsPublishCall) Header() http.Header { 3895 if c.header_ == nil { 3896 c.header_ = make(http.Header) 3897 } 3898 return c.header_ 3899} 3900 3901func (c *ProjectsTopicsPublishCall) doRequest(alt string) (*http.Response, error) { 3902 reqHeaders := make(http.Header) 3903 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 3904 for k, v := range c.header_ { 3905 reqHeaders[k] = v 3906 } 3907 reqHeaders.Set("User-Agent", c.s.userAgent()) 3908 var body io.Reader = nil 3909 body, err := googleapi.WithoutDataWrapper.JSONReader(c.publishrequest) 3910 if err != nil { 3911 return nil, err 3912 } 3913 reqHeaders.Set("Content-Type", "application/json") 3914 c.urlParams_.Set("alt", alt) 3915 c.urlParams_.Set("prettyPrint", "false") 3916 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}:publish") 3917 urls += "?" + c.urlParams_.Encode() 3918 req, err := http.NewRequest("POST", urls, body) 3919 if err != nil { 3920 return nil, err 3921 } 3922 req.Header = reqHeaders 3923 googleapi.Expand(req.URL, map[string]string{ 3924 "topic": c.topic, 3925 }) 3926 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3927} 3928 3929// Do executes the "pubsub.projects.topics.publish" call. 3930// Exactly one of *PublishResponse or error will be non-nil. Any non-2xx 3931// status code is an error. Response headers are in either 3932// *PublishResponse.ServerResponse.Header or (if a response was returned 3933// at all) in error.(*googleapi.Error).Header. Use 3934// googleapi.IsNotModified to check whether the returned error was 3935// because http.StatusNotModified was returned. 3936func (c *ProjectsTopicsPublishCall) Do(opts ...googleapi.CallOption) (*PublishResponse, error) { 3937 gensupport.SetOptions(c.urlParams_, opts...) 3938 res, err := c.doRequest("json") 3939 if res != nil && res.StatusCode == http.StatusNotModified { 3940 if res.Body != nil { 3941 res.Body.Close() 3942 } 3943 return nil, &googleapi.Error{ 3944 Code: res.StatusCode, 3945 Header: res.Header, 3946 } 3947 } 3948 if err != nil { 3949 return nil, err 3950 } 3951 defer googleapi.CloseBody(res) 3952 if err := googleapi.CheckResponse(res); err != nil { 3953 return nil, err 3954 } 3955 ret := &PublishResponse{ 3956 ServerResponse: googleapi.ServerResponse{ 3957 Header: res.Header, 3958 HTTPStatusCode: res.StatusCode, 3959 }, 3960 } 3961 target := &ret 3962 if err := gensupport.DecodeResponse(target, res); err != nil { 3963 return nil, err 3964 } 3965 return ret, nil 3966 // { 3967 // "description": "Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic\ndoes not exist. The message payload must not be empty; it must contain\n either a non-empty data field, or at least one attribute.", 3968 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:publish", 3969 // "httpMethod": "POST", 3970 // "id": "pubsub.projects.topics.publish", 3971 // "parameterOrder": [ 3972 // "topic" 3973 // ], 3974 // "parameters": { 3975 // "topic": { 3976 // "description": "The messages in the request will be published on this topic.", 3977 // "location": "path", 3978 // "pattern": "^projects/[^/]+/topics/[^/]+$", 3979 // "required": true, 3980 // "type": "string" 3981 // } 3982 // }, 3983 // "path": "v1beta2/{+topic}:publish", 3984 // "request": { 3985 // "$ref": "PublishRequest" 3986 // }, 3987 // "response": { 3988 // "$ref": "PublishResponse" 3989 // }, 3990 // "scopes": [ 3991 // "https://www.googleapis.com/auth/cloud-platform", 3992 // "https://www.googleapis.com/auth/pubsub" 3993 // ] 3994 // } 3995 3996} 3997 3998// method id "pubsub.projects.topics.setIamPolicy": 3999 4000type ProjectsTopicsSetIamPolicyCall struct { 4001 s *Service 4002 resource string 4003 setiampolicyrequest *SetIamPolicyRequest 4004 urlParams_ gensupport.URLParams 4005 ctx_ context.Context 4006 header_ http.Header 4007} 4008 4009// SetIamPolicy: Sets the access control policy on the specified 4010// resource. Replaces any 4011// existing policy. 4012// 4013// Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and 4014// PERMISSION_DENIED 4015func (r *ProjectsTopicsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsTopicsSetIamPolicyCall { 4016 c := &ProjectsTopicsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4017 c.resource = resource 4018 c.setiampolicyrequest = setiampolicyrequest 4019 return c 4020} 4021 4022// Fields allows partial responses to be retrieved. See 4023// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4024// for more information. 4025func (c *ProjectsTopicsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsTopicsSetIamPolicyCall { 4026 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4027 return c 4028} 4029 4030// Context sets the context to be used in this call's Do method. Any 4031// pending HTTP request will be aborted if the provided context is 4032// canceled. 4033func (c *ProjectsTopicsSetIamPolicyCall) Context(ctx context.Context) *ProjectsTopicsSetIamPolicyCall { 4034 c.ctx_ = ctx 4035 return c 4036} 4037 4038// Header returns an http.Header that can be modified by the caller to 4039// add HTTP headers to the request. 4040func (c *ProjectsTopicsSetIamPolicyCall) Header() http.Header { 4041 if c.header_ == nil { 4042 c.header_ = make(http.Header) 4043 } 4044 return c.header_ 4045} 4046 4047func (c *ProjectsTopicsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { 4048 reqHeaders := make(http.Header) 4049 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 4050 for k, v := range c.header_ { 4051 reqHeaders[k] = v 4052 } 4053 reqHeaders.Set("User-Agent", c.s.userAgent()) 4054 var body io.Reader = nil 4055 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest) 4056 if err != nil { 4057 return nil, err 4058 } 4059 reqHeaders.Set("Content-Type", "application/json") 4060 c.urlParams_.Set("alt", alt) 4061 c.urlParams_.Set("prettyPrint", "false") 4062 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:setIamPolicy") 4063 urls += "?" + c.urlParams_.Encode() 4064 req, err := http.NewRequest("POST", urls, body) 4065 if err != nil { 4066 return nil, err 4067 } 4068 req.Header = reqHeaders 4069 googleapi.Expand(req.URL, map[string]string{ 4070 "resource": c.resource, 4071 }) 4072 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4073} 4074 4075// Do executes the "pubsub.projects.topics.setIamPolicy" call. 4076// Exactly one of *Policy or error will be non-nil. Any non-2xx status 4077// code is an error. Response headers are in either 4078// *Policy.ServerResponse.Header or (if a response was returned at all) 4079// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4080// check whether the returned error was because http.StatusNotModified 4081// was returned. 4082func (c *ProjectsTopicsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) { 4083 gensupport.SetOptions(c.urlParams_, opts...) 4084 res, err := c.doRequest("json") 4085 if res != nil && res.StatusCode == http.StatusNotModified { 4086 if res.Body != nil { 4087 res.Body.Close() 4088 } 4089 return nil, &googleapi.Error{ 4090 Code: res.StatusCode, 4091 Header: res.Header, 4092 } 4093 } 4094 if err != nil { 4095 return nil, err 4096 } 4097 defer googleapi.CloseBody(res) 4098 if err := googleapi.CheckResponse(res); err != nil { 4099 return nil, err 4100 } 4101 ret := &Policy{ 4102 ServerResponse: googleapi.ServerResponse{ 4103 Header: res.Header, 4104 HTTPStatusCode: res.StatusCode, 4105 }, 4106 } 4107 target := &ret 4108 if err := gensupport.DecodeResponse(target, res); err != nil { 4109 return nil, err 4110 } 4111 return ret, nil 4112 // { 4113 // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.\n\nCan return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED", 4114 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:setIamPolicy", 4115 // "httpMethod": "POST", 4116 // "id": "pubsub.projects.topics.setIamPolicy", 4117 // "parameterOrder": [ 4118 // "resource" 4119 // ], 4120 // "parameters": { 4121 // "resource": { 4122 // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.", 4123 // "location": "path", 4124 // "pattern": "^projects/[^/]+/topics/[^/]+$", 4125 // "required": true, 4126 // "type": "string" 4127 // } 4128 // }, 4129 // "path": "v1beta2/{+resource}:setIamPolicy", 4130 // "request": { 4131 // "$ref": "SetIamPolicyRequest" 4132 // }, 4133 // "response": { 4134 // "$ref": "Policy" 4135 // }, 4136 // "scopes": [ 4137 // "https://www.googleapis.com/auth/cloud-platform", 4138 // "https://www.googleapis.com/auth/pubsub" 4139 // ] 4140 // } 4141 4142} 4143 4144// method id "pubsub.projects.topics.testIamPermissions": 4145 4146type ProjectsTopicsTestIamPermissionsCall struct { 4147 s *Service 4148 resource string 4149 testiampermissionsrequest *TestIamPermissionsRequest 4150 urlParams_ gensupport.URLParams 4151 ctx_ context.Context 4152 header_ http.Header 4153} 4154 4155// TestIamPermissions: Returns permissions that a caller has on the 4156// specified resource. 4157// If the resource does not exist, this will return an empty set 4158// of 4159// permissions, not a NOT_FOUND error. 4160// 4161// Note: This operation is designed to be used for building 4162// permission-aware 4163// UIs and command-line tools, not for authorization checking. This 4164// operation 4165// may "fail open" without warning. 4166func (r *ProjectsTopicsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsTopicsTestIamPermissionsCall { 4167 c := &ProjectsTopicsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4168 c.resource = resource 4169 c.testiampermissionsrequest = testiampermissionsrequest 4170 return c 4171} 4172 4173// Fields allows partial responses to be retrieved. See 4174// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4175// for more information. 4176func (c *ProjectsTopicsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsTopicsTestIamPermissionsCall { 4177 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4178 return c 4179} 4180 4181// Context sets the context to be used in this call's Do method. Any 4182// pending HTTP request will be aborted if the provided context is 4183// canceled. 4184func (c *ProjectsTopicsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsTopicsTestIamPermissionsCall { 4185 c.ctx_ = ctx 4186 return c 4187} 4188 4189// Header returns an http.Header that can be modified by the caller to 4190// add HTTP headers to the request. 4191func (c *ProjectsTopicsTestIamPermissionsCall) Header() http.Header { 4192 if c.header_ == nil { 4193 c.header_ = make(http.Header) 4194 } 4195 return c.header_ 4196} 4197 4198func (c *ProjectsTopicsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { 4199 reqHeaders := make(http.Header) 4200 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 4201 for k, v := range c.header_ { 4202 reqHeaders[k] = v 4203 } 4204 reqHeaders.Set("User-Agent", c.s.userAgent()) 4205 var body io.Reader = nil 4206 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest) 4207 if err != nil { 4208 return nil, err 4209 } 4210 reqHeaders.Set("Content-Type", "application/json") 4211 c.urlParams_.Set("alt", alt) 4212 c.urlParams_.Set("prettyPrint", "false") 4213 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:testIamPermissions") 4214 urls += "?" + c.urlParams_.Encode() 4215 req, err := http.NewRequest("POST", urls, body) 4216 if err != nil { 4217 return nil, err 4218 } 4219 req.Header = reqHeaders 4220 googleapi.Expand(req.URL, map[string]string{ 4221 "resource": c.resource, 4222 }) 4223 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4224} 4225 4226// Do executes the "pubsub.projects.topics.testIamPermissions" call. 4227// Exactly one of *TestIamPermissionsResponse or error will be non-nil. 4228// Any non-2xx status code is an error. Response headers are in either 4229// *TestIamPermissionsResponse.ServerResponse.Header or (if a response 4230// was returned at all) in error.(*googleapi.Error).Header. Use 4231// googleapi.IsNotModified to check whether the returned error was 4232// because http.StatusNotModified was returned. 4233func (c *ProjectsTopicsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) { 4234 gensupport.SetOptions(c.urlParams_, opts...) 4235 res, err := c.doRequest("json") 4236 if res != nil && res.StatusCode == http.StatusNotModified { 4237 if res.Body != nil { 4238 res.Body.Close() 4239 } 4240 return nil, &googleapi.Error{ 4241 Code: res.StatusCode, 4242 Header: res.Header, 4243 } 4244 } 4245 if err != nil { 4246 return nil, err 4247 } 4248 defer googleapi.CloseBody(res) 4249 if err := googleapi.CheckResponse(res); err != nil { 4250 return nil, err 4251 } 4252 ret := &TestIamPermissionsResponse{ 4253 ServerResponse: googleapi.ServerResponse{ 4254 Header: res.Header, 4255 HTTPStatusCode: res.StatusCode, 4256 }, 4257 } 4258 target := &ret 4259 if err := gensupport.DecodeResponse(target, res); err != nil { 4260 return nil, err 4261 } 4262 return ret, nil 4263 // { 4264 // "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.\n\nNote: This operation is designed to be used for building permission-aware\nUIs and command-line tools, not for authorization checking. This operation\nmay \"fail open\" without warning.", 4265 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:testIamPermissions", 4266 // "httpMethod": "POST", 4267 // "id": "pubsub.projects.topics.testIamPermissions", 4268 // "parameterOrder": [ 4269 // "resource" 4270 // ], 4271 // "parameters": { 4272 // "resource": { 4273 // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.", 4274 // "location": "path", 4275 // "pattern": "^projects/[^/]+/topics/[^/]+$", 4276 // "required": true, 4277 // "type": "string" 4278 // } 4279 // }, 4280 // "path": "v1beta2/{+resource}:testIamPermissions", 4281 // "request": { 4282 // "$ref": "TestIamPermissionsRequest" 4283 // }, 4284 // "response": { 4285 // "$ref": "TestIamPermissionsResponse" 4286 // }, 4287 // "scopes": [ 4288 // "https://www.googleapis.com/auth/cloud-platform", 4289 // "https://www.googleapis.com/auth/pubsub" 4290 // ] 4291 // } 4292 4293} 4294 4295// method id "pubsub.projects.topics.subscriptions.list": 4296 4297type ProjectsTopicsSubscriptionsListCall struct { 4298 s *Service 4299 topic string 4300 urlParams_ gensupport.URLParams 4301 ifNoneMatch_ string 4302 ctx_ context.Context 4303 header_ http.Header 4304} 4305 4306// List: Lists the name of the subscriptions for this topic. 4307func (r *ProjectsTopicsSubscriptionsService) List(topic string) *ProjectsTopicsSubscriptionsListCall { 4308 c := &ProjectsTopicsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4309 c.topic = topic 4310 return c 4311} 4312 4313// PageSize sets the optional parameter "pageSize": Maximum number of 4314// subscription names to return. 4315func (c *ProjectsTopicsSubscriptionsListCall) PageSize(pageSize int64) *ProjectsTopicsSubscriptionsListCall { 4316 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 4317 return c 4318} 4319 4320// PageToken sets the optional parameter "pageToken": The value returned 4321// by the last `ListTopicSubscriptionsResponse`; indicates 4322// that this is a continuation of a prior `ListTopicSubscriptions` call, 4323// and 4324// that the system should return the next page of data. 4325func (c *ProjectsTopicsSubscriptionsListCall) PageToken(pageToken string) *ProjectsTopicsSubscriptionsListCall { 4326 c.urlParams_.Set("pageToken", pageToken) 4327 return c 4328} 4329 4330// Fields allows partial responses to be retrieved. See 4331// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4332// for more information. 4333func (c *ProjectsTopicsSubscriptionsListCall) Fields(s ...googleapi.Field) *ProjectsTopicsSubscriptionsListCall { 4334 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4335 return c 4336} 4337 4338// IfNoneMatch sets the optional parameter which makes the operation 4339// fail if the object's ETag matches the given value. This is useful for 4340// getting updates only after the object has changed since the last 4341// request. Use googleapi.IsNotModified to check whether the response 4342// error from Do is the result of In-None-Match. 4343func (c *ProjectsTopicsSubscriptionsListCall) IfNoneMatch(entityTag string) *ProjectsTopicsSubscriptionsListCall { 4344 c.ifNoneMatch_ = entityTag 4345 return c 4346} 4347 4348// Context sets the context to be used in this call's Do method. Any 4349// pending HTTP request will be aborted if the provided context is 4350// canceled. 4351func (c *ProjectsTopicsSubscriptionsListCall) Context(ctx context.Context) *ProjectsTopicsSubscriptionsListCall { 4352 c.ctx_ = ctx 4353 return c 4354} 4355 4356// Header returns an http.Header that can be modified by the caller to 4357// add HTTP headers to the request. 4358func (c *ProjectsTopicsSubscriptionsListCall) Header() http.Header { 4359 if c.header_ == nil { 4360 c.header_ = make(http.Header) 4361 } 4362 return c.header_ 4363} 4364 4365func (c *ProjectsTopicsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) { 4366 reqHeaders := make(http.Header) 4367 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200302") 4368 for k, v := range c.header_ { 4369 reqHeaders[k] = v 4370 } 4371 reqHeaders.Set("User-Agent", c.s.userAgent()) 4372 if c.ifNoneMatch_ != "" { 4373 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4374 } 4375 var body io.Reader = nil 4376 c.urlParams_.Set("alt", alt) 4377 c.urlParams_.Set("prettyPrint", "false") 4378 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}/subscriptions") 4379 urls += "?" + c.urlParams_.Encode() 4380 req, err := http.NewRequest("GET", urls, body) 4381 if err != nil { 4382 return nil, err 4383 } 4384 req.Header = reqHeaders 4385 googleapi.Expand(req.URL, map[string]string{ 4386 "topic": c.topic, 4387 }) 4388 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4389} 4390 4391// Do executes the "pubsub.projects.topics.subscriptions.list" call. 4392// Exactly one of *ListTopicSubscriptionsResponse or error will be 4393// non-nil. Any non-2xx status code is an error. Response headers are in 4394// either *ListTopicSubscriptionsResponse.ServerResponse.Header or (if a 4395// response was returned at all) in error.(*googleapi.Error).Header. Use 4396// googleapi.IsNotModified to check whether the returned error was 4397// because http.StatusNotModified was returned. 4398func (c *ProjectsTopicsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListTopicSubscriptionsResponse, error) { 4399 gensupport.SetOptions(c.urlParams_, opts...) 4400 res, err := c.doRequest("json") 4401 if res != nil && res.StatusCode == http.StatusNotModified { 4402 if res.Body != nil { 4403 res.Body.Close() 4404 } 4405 return nil, &googleapi.Error{ 4406 Code: res.StatusCode, 4407 Header: res.Header, 4408 } 4409 } 4410 if err != nil { 4411 return nil, err 4412 } 4413 defer googleapi.CloseBody(res) 4414 if err := googleapi.CheckResponse(res); err != nil { 4415 return nil, err 4416 } 4417 ret := &ListTopicSubscriptionsResponse{ 4418 ServerResponse: googleapi.ServerResponse{ 4419 Header: res.Header, 4420 HTTPStatusCode: res.StatusCode, 4421 }, 4422 } 4423 target := &ret 4424 if err := gensupport.DecodeResponse(target, res); err != nil { 4425 return nil, err 4426 } 4427 return ret, nil 4428 // { 4429 // "description": "Lists the name of the subscriptions for this topic.", 4430 // "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}/subscriptions", 4431 // "httpMethod": "GET", 4432 // "id": "pubsub.projects.topics.subscriptions.list", 4433 // "parameterOrder": [ 4434 // "topic" 4435 // ], 4436 // "parameters": { 4437 // "pageSize": { 4438 // "description": "Maximum number of subscription names to return.", 4439 // "format": "int32", 4440 // "location": "query", 4441 // "type": "integer" 4442 // }, 4443 // "pageToken": { 4444 // "description": "The value returned by the last `ListTopicSubscriptionsResponse`; indicates\nthat this is a continuation of a prior `ListTopicSubscriptions` call, and\nthat the system should return the next page of data.", 4445 // "location": "query", 4446 // "type": "string" 4447 // }, 4448 // "topic": { 4449 // "description": "The name of the topic that subscriptions are attached to.", 4450 // "location": "path", 4451 // "pattern": "^projects/[^/]+/topics/[^/]+$", 4452 // "required": true, 4453 // "type": "string" 4454 // } 4455 // }, 4456 // "path": "v1beta2/{+topic}/subscriptions", 4457 // "response": { 4458 // "$ref": "ListTopicSubscriptionsResponse" 4459 // }, 4460 // "scopes": [ 4461 // "https://www.googleapis.com/auth/cloud-platform", 4462 // "https://www.googleapis.com/auth/pubsub" 4463 // ] 4464 // } 4465 4466} 4467 4468// Pages invokes f for each page of results. 4469// A non-nil error returned from f will halt the iteration. 4470// The provided context supersedes any context provided to the Context method. 4471func (c *ProjectsTopicsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListTopicSubscriptionsResponse) error) error { 4472 c.ctx_ = ctx 4473 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4474 for { 4475 x, err := c.Do() 4476 if err != nil { 4477 return err 4478 } 4479 if err := f(x); err != nil { 4480 return err 4481 } 4482 if x.NextPageToken == "" { 4483 return nil 4484 } 4485 c.PageToken(x.NextPageToken) 4486 } 4487} 4488