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