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