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