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 resourcesettings provides access to the Resource Settings API. 8// 9// For product documentation, see: https://cloud.google.com/resource-manager/docs/resource-settings/overview 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/resourcesettings/v1" 16// ... 17// ctx := context.Background() 18// resourcesettingsService, err := resourcesettings.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// resourcesettingsService, err := resourcesettings.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// resourcesettingsService, err := resourcesettings.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 36// 37// See https://godoc.org/google.golang.org/api/option/ for details on options. 38package resourcesettings // import "google.golang.org/api/resourcesettings/v1" 39 40import ( 41 "bytes" 42 "context" 43 "encoding/json" 44 "errors" 45 "fmt" 46 "io" 47 "net/http" 48 "net/url" 49 "strconv" 50 "strings" 51 52 googleapi "google.golang.org/api/googleapi" 53 gensupport "google.golang.org/api/internal/gensupport" 54 option "google.golang.org/api/option" 55 internaloption "google.golang.org/api/option/internaloption" 56 htransport "google.golang.org/api/transport/http" 57) 58 59// Always reference these packages, just in case the auto-generated code 60// below doesn't. 61var _ = bytes.NewBuffer 62var _ = strconv.Itoa 63var _ = fmt.Sprintf 64var _ = json.NewDecoder 65var _ = io.Copy 66var _ = url.Parse 67var _ = gensupport.MarshalJSON 68var _ = googleapi.Version 69var _ = errors.New 70var _ = strings.Replace 71var _ = context.Canceled 72var _ = internaloption.WithDefaultEndpoint 73 74const apiId = "resourcesettings:v1" 75const apiName = "resourcesettings" 76const apiVersion = "v1" 77const basePath = "https://resourcesettings.googleapis.com/" 78const mtlsBasePath = "https://resourcesettings.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 Service. 88func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, 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 Service. 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) (*Service, error) { 116 if client == nil { 117 return nil, errors.New("client is nil") 118 } 119 s := &Service{client: client, BasePath: basePath} 120 s.Folders = NewFoldersService(s) 121 s.Organizations = NewOrganizationsService(s) 122 s.Projects = NewProjectsService(s) 123 return s, nil 124} 125 126type Service struct { 127 client *http.Client 128 BasePath string // API endpoint base URL 129 UserAgent string // optional additional User-Agent fragment 130 131 Folders *FoldersService 132 133 Organizations *OrganizationsService 134 135 Projects *ProjectsService 136} 137 138func (s *Service) userAgent() string { 139 if s.UserAgent == "" { 140 return googleapi.UserAgent 141 } 142 return googleapi.UserAgent + " " + s.UserAgent 143} 144 145func NewFoldersService(s *Service) *FoldersService { 146 rs := &FoldersService{s: s} 147 rs.Settings = NewFoldersSettingsService(s) 148 return rs 149} 150 151type FoldersService struct { 152 s *Service 153 154 Settings *FoldersSettingsService 155} 156 157func NewFoldersSettingsService(s *Service) *FoldersSettingsService { 158 rs := &FoldersSettingsService{s: s} 159 return rs 160} 161 162type FoldersSettingsService struct { 163 s *Service 164} 165 166func NewOrganizationsService(s *Service) *OrganizationsService { 167 rs := &OrganizationsService{s: s} 168 rs.Settings = NewOrganizationsSettingsService(s) 169 return rs 170} 171 172type OrganizationsService struct { 173 s *Service 174 175 Settings *OrganizationsSettingsService 176} 177 178func NewOrganizationsSettingsService(s *Service) *OrganizationsSettingsService { 179 rs := &OrganizationsSettingsService{s: s} 180 return rs 181} 182 183type OrganizationsSettingsService struct { 184 s *Service 185} 186 187func NewProjectsService(s *Service) *ProjectsService { 188 rs := &ProjectsService{s: s} 189 rs.Settings = NewProjectsSettingsService(s) 190 return rs 191} 192 193type ProjectsService struct { 194 s *Service 195 196 Settings *ProjectsSettingsService 197} 198 199func NewProjectsSettingsService(s *Service) *ProjectsSettingsService { 200 rs := &ProjectsSettingsService{s: s} 201 return rs 202} 203 204type ProjectsSettingsService struct { 205 s *Service 206} 207 208// GoogleCloudResourcesettingsV1ListSettingsResponse: The response from 209// ListSettings. 210type GoogleCloudResourcesettingsV1ListSettingsResponse struct { 211 // NextPageToken: Unused. A page token used to retrieve the next page. 212 NextPageToken string `json:"nextPageToken,omitempty"` 213 214 // Settings: A list of settings that are available at the specified 215 // Cloud resource. 216 Settings []*GoogleCloudResourcesettingsV1Setting `json:"settings,omitempty"` 217 218 // ServerResponse contains the HTTP response code and headers from the 219 // server. 220 googleapi.ServerResponse `json:"-"` 221 222 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 223 // unconditionally include in API requests. By default, fields with 224 // empty or default values are omitted from API requests. However, any 225 // non-pointer, non-interface field appearing in ForceSendFields will be 226 // sent to the server regardless of whether the field is empty or not. 227 // This may be used to include empty fields in Patch requests. 228 ForceSendFields []string `json:"-"` 229 230 // NullFields is a list of field names (e.g. "NextPageToken") to include 231 // in API requests with the JSON null value. By default, fields with 232 // empty values are omitted from API requests. However, any field with 233 // an empty value appearing in NullFields will be sent to the server as 234 // null. It is an error if a field in this list has a non-empty value. 235 // This may be used to include null fields in Patch requests. 236 NullFields []string `json:"-"` 237} 238 239func (s *GoogleCloudResourcesettingsV1ListSettingsResponse) MarshalJSON() ([]byte, error) { 240 type NoMethod GoogleCloudResourcesettingsV1ListSettingsResponse 241 raw := NoMethod(*s) 242 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 243} 244 245// GoogleCloudResourcesettingsV1Setting: The schema for settings. 246type GoogleCloudResourcesettingsV1Setting struct { 247 // EffectiveValue: Output only. The effective value of the setting at 248 // the given parent resource, evaluated based on the resource hierarchy 249 // The effective value evaluates to one of the following options, in 250 // this order. If an option is not valid or doesn't exist, then the next 251 // option is used: 1. The local setting value on the given resource: 252 // Setting.local_value 2. If one of the given resource's ancestors in 253 // the resource hierarchy have a local setting value, the local value at 254 // the nearest such ancestor. 3. The setting's default value: 255 // SettingMetadata.default_value 4. An empty value, defined as a `Value` 256 // with all fields unset. The data type of Value must always be 257 // consistent with the data type defined in Setting.metadata. 258 EffectiveValue *GoogleCloudResourcesettingsV1Value `json:"effectiveValue,omitempty"` 259 260 // Etag: A fingerprint used for optimistic concurrency. See 261 // UpdateSetting for more details. 262 Etag string `json:"etag,omitempty"` 263 264 // LocalValue: The configured value of the setting at the given parent 265 // resource, ignoring the resource hierarchy. The data type of Value 266 // must always be consistent with the data type defined in 267 // Setting.metadata. 268 LocalValue *GoogleCloudResourcesettingsV1Value `json:"localValue,omitempty"` 269 270 // Metadata: Output only. Metadata about a setting which is not editable 271 // by the end user. 272 Metadata *GoogleCloudResourcesettingsV1SettingMetadata `json:"metadata,omitempty"` 273 274 // Name: The resource name of the setting. Must be in one of the 275 // following forms: * 276 // `projects/{project_number}/settings/{setting_name}` * 277 // `folders/{folder_id}/settings/{setting_name}` * 278 // `organizations/{organization_id}/settings/{setting_name}` For 279 // example, "/projects/123/settings/gcp-enableMyFeature" 280 Name string `json:"name,omitempty"` 281 282 // ServerResponse contains the HTTP response code and headers from the 283 // server. 284 googleapi.ServerResponse `json:"-"` 285 286 // ForceSendFields is a list of field names (e.g. "EffectiveValue") to 287 // unconditionally include in API requests. By default, fields with 288 // empty or default values are omitted from API requests. However, any 289 // non-pointer, non-interface field appearing in ForceSendFields will be 290 // sent to the server regardless of whether the field is empty or not. 291 // This may be used to include empty fields in Patch requests. 292 ForceSendFields []string `json:"-"` 293 294 // NullFields is a list of field names (e.g. "EffectiveValue") to 295 // include in API requests with the JSON null value. By default, fields 296 // with empty values are omitted from API requests. However, any field 297 // with an empty value appearing in NullFields will be sent to the 298 // server as null. It is an error if a field in this list has a 299 // non-empty value. This may be used to include null fields in Patch 300 // requests. 301 NullFields []string `json:"-"` 302} 303 304func (s *GoogleCloudResourcesettingsV1Setting) MarshalJSON() ([]byte, error) { 305 type NoMethod GoogleCloudResourcesettingsV1Setting 306 raw := NoMethod(*s) 307 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 308} 309 310// GoogleCloudResourcesettingsV1SettingMetadata: Metadata about a 311// setting which is not editable by the end user. 312type GoogleCloudResourcesettingsV1SettingMetadata struct { 313 // DataType: The data type for this setting. 314 // 315 // Possible values: 316 // "DATA_TYPE_UNSPECIFIED" - Unspecified data type. 317 // "BOOLEAN" - A boolean setting. 318 // "STRING" - A string setting. 319 // "STRING_SET" - A string set setting. 320 // "ENUM_VALUE" - A Enum setting 321 // "DURATION_VALUE" - A Duration setting 322 // "STRING_MAP" - A string->string map setting 323 DataType string `json:"dataType,omitempty"` 324 325 // DefaultValue: The value provided by Setting.effective_value if no 326 // setting value is explicitly set. Note: not all settings have a 327 // default value. 328 DefaultValue *GoogleCloudResourcesettingsV1Value `json:"defaultValue,omitempty"` 329 330 // Description: A detailed description of what this setting does. 331 Description string `json:"description,omitempty"` 332 333 // DisplayName: The human readable name for this setting. 334 DisplayName string `json:"displayName,omitempty"` 335 336 // ReadOnly: A flag indicating that values of this setting cannot be 337 // modified. See documentation for the specific setting for updates and 338 // reasons. 339 ReadOnly bool `json:"readOnly,omitempty"` 340 341 // ForceSendFields is a list of field names (e.g. "DataType") to 342 // unconditionally include in API requests. By default, fields with 343 // empty or default values are omitted from API requests. However, any 344 // non-pointer, non-interface field appearing in ForceSendFields will be 345 // sent to the server regardless of whether the field is empty or not. 346 // This may be used to include empty fields in Patch requests. 347 ForceSendFields []string `json:"-"` 348 349 // NullFields is a list of field names (e.g. "DataType") to include in 350 // API requests with the JSON null value. By default, fields with empty 351 // values are omitted from API requests. However, any field with an 352 // empty value appearing in NullFields will be sent to the server as 353 // null. It is an error if a field in this list has a non-empty value. 354 // This may be used to include null fields in Patch requests. 355 NullFields []string `json:"-"` 356} 357 358func (s *GoogleCloudResourcesettingsV1SettingMetadata) MarshalJSON() ([]byte, error) { 359 type NoMethod GoogleCloudResourcesettingsV1SettingMetadata 360 raw := NoMethod(*s) 361 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 362} 363 364// GoogleCloudResourcesettingsV1Value: The data in a setting value. 365type GoogleCloudResourcesettingsV1Value struct { 366 // BooleanValue: Defines this value as being a boolean value. 367 BooleanValue bool `json:"booleanValue,omitempty"` 368 369 // DurationValue: Defines this value as being a Duration. 370 DurationValue string `json:"durationValue,omitempty"` 371 372 // EnumValue: Defines this value as being a Enum. 373 EnumValue *GoogleCloudResourcesettingsV1ValueEnumValue `json:"enumValue,omitempty"` 374 375 // StringMapValue: Defines this value as being a StringMap. 376 StringMapValue *GoogleCloudResourcesettingsV1ValueStringMap `json:"stringMapValue,omitempty"` 377 378 // StringSetValue: Defines this value as being a StringSet. 379 StringSetValue *GoogleCloudResourcesettingsV1ValueStringSet `json:"stringSetValue,omitempty"` 380 381 // StringValue: Defines this value as being a string value. 382 StringValue string `json:"stringValue,omitempty"` 383 384 // ForceSendFields is a list of field names (e.g. "BooleanValue") to 385 // unconditionally include in API requests. By default, fields with 386 // empty or default values are omitted from API requests. However, any 387 // non-pointer, non-interface field appearing in ForceSendFields will be 388 // sent to the server regardless of whether the field is empty or not. 389 // This may be used to include empty fields in Patch requests. 390 ForceSendFields []string `json:"-"` 391 392 // NullFields is a list of field names (e.g. "BooleanValue") to include 393 // in API requests with the JSON null value. By default, fields with 394 // empty values are omitted from API requests. However, any field with 395 // an empty value appearing in NullFields will be sent to the server as 396 // null. It is an error if a field in this list has a non-empty value. 397 // This may be used to include null fields in Patch requests. 398 NullFields []string `json:"-"` 399} 400 401func (s *GoogleCloudResourcesettingsV1Value) MarshalJSON() ([]byte, error) { 402 type NoMethod GoogleCloudResourcesettingsV1Value 403 raw := NoMethod(*s) 404 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 405} 406 407// GoogleCloudResourcesettingsV1ValueEnumValue: A enum value that can 408// hold any enum type setting values. Each enum type is represented by a 409// number, this representation is stored in the definitions. 410type GoogleCloudResourcesettingsV1ValueEnumValue struct { 411 // Value: The value of this enum 412 Value string `json:"value,omitempty"` 413 414 // ForceSendFields is a list of field names (e.g. "Value") to 415 // unconditionally include in API requests. By default, fields with 416 // empty or default values are omitted from API requests. However, any 417 // non-pointer, non-interface field appearing in ForceSendFields will be 418 // sent to the server regardless of whether the field is empty or not. 419 // This may be used to include empty fields in Patch requests. 420 ForceSendFields []string `json:"-"` 421 422 // NullFields is a list of field names (e.g. "Value") to include in API 423 // requests with the JSON null value. By default, fields with empty 424 // values are omitted from API requests. However, any field with an 425 // empty value appearing in NullFields will be sent to the server as 426 // null. It is an error if a field in this list has a non-empty value. 427 // This may be used to include null fields in Patch requests. 428 NullFields []string `json:"-"` 429} 430 431func (s *GoogleCloudResourcesettingsV1ValueEnumValue) MarshalJSON() ([]byte, error) { 432 type NoMethod GoogleCloudResourcesettingsV1ValueEnumValue 433 raw := NoMethod(*s) 434 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 435} 436 437// GoogleCloudResourcesettingsV1ValueStringMap: A string->string map 438// value that can hold a map of string keys to string values. The 439// maximum length of each string is 200 characters and there can be a 440// maximum of 50 key-value pairs in the map. 441type GoogleCloudResourcesettingsV1ValueStringMap struct { 442 // Mappings: The key-value pairs in the map 443 Mappings map[string]string `json:"mappings,omitempty"` 444 445 // ForceSendFields is a list of field names (e.g. "Mappings") to 446 // unconditionally include in API requests. By default, fields with 447 // empty or default values are omitted from API requests. However, any 448 // non-pointer, non-interface field appearing in ForceSendFields will be 449 // sent to the server regardless of whether the field is empty or not. 450 // This may be used to include empty fields in Patch requests. 451 ForceSendFields []string `json:"-"` 452 453 // NullFields is a list of field names (e.g. "Mappings") to include in 454 // API requests with the JSON null value. By default, fields with empty 455 // values are omitted from API requests. However, any field with an 456 // empty value appearing in NullFields will be sent to the server as 457 // null. It is an error if a field in this list has a non-empty value. 458 // This may be used to include null fields in Patch requests. 459 NullFields []string `json:"-"` 460} 461 462func (s *GoogleCloudResourcesettingsV1ValueStringMap) MarshalJSON() ([]byte, error) { 463 type NoMethod GoogleCloudResourcesettingsV1ValueStringMap 464 raw := NoMethod(*s) 465 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 466} 467 468// GoogleCloudResourcesettingsV1ValueStringSet: A string set value that 469// can hold a set of strings. The maximum length of each string is 200 470// characters and there can be a maximum of 50 strings in the string 471// set. 472type GoogleCloudResourcesettingsV1ValueStringSet struct { 473 // Values: The strings in the set 474 Values []string `json:"values,omitempty"` 475 476 // ForceSendFields is a list of field names (e.g. "Values") to 477 // unconditionally include in API requests. By default, fields with 478 // empty or default values are omitted from API requests. However, any 479 // non-pointer, non-interface field appearing in ForceSendFields will be 480 // sent to the server regardless of whether the field is empty or not. 481 // This may be used to include empty fields in Patch requests. 482 ForceSendFields []string `json:"-"` 483 484 // NullFields is a list of field names (e.g. "Values") to include in API 485 // requests with the JSON null value. By default, fields with empty 486 // values are omitted from API requests. However, any field with an 487 // empty value appearing in NullFields will be sent to the server as 488 // null. It is an error if a field in this list has a non-empty value. 489 // This may be used to include null fields in Patch requests. 490 NullFields []string `json:"-"` 491} 492 493func (s *GoogleCloudResourcesettingsV1ValueStringSet) MarshalJSON() ([]byte, error) { 494 type NoMethod GoogleCloudResourcesettingsV1ValueStringSet 495 raw := NoMethod(*s) 496 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 497} 498 499// method id "resourcesettings.folders.settings.get": 500 501type FoldersSettingsGetCall struct { 502 s *Service 503 name string 504 urlParams_ gensupport.URLParams 505 ifNoneMatch_ string 506 ctx_ context.Context 507 header_ http.Header 508} 509 510// Get: Returns a specified setting. Returns a `google.rpc.Status` with 511// `google.rpc.Code.NOT_FOUND` if the setting does not exist. 512// 513// - name: The name of the setting to get. See Setting for naming 514// requirements. 515func (r *FoldersSettingsService) Get(name string) *FoldersSettingsGetCall { 516 c := &FoldersSettingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 517 c.name = name 518 return c 519} 520 521// View sets the optional parameter "view": The SettingView for this 522// request. 523// 524// Possible values: 525// "SETTING_VIEW_UNSPECIFIED" - The default / unset value. The API 526// will default to the SETTING_VIEW_BASIC view. 527// "SETTING_VIEW_BASIC" - Include Setting.metadata, but nothing else. 528// This is the default value (for both ListSettings and GetSetting). 529// "SETTING_VIEW_EFFECTIVE_VALUE" - Include Setting.effective_value, 530// but nothing else. 531// "SETTING_VIEW_LOCAL_VALUE" - Include Setting.local_value, but 532// nothing else. 533func (c *FoldersSettingsGetCall) View(view string) *FoldersSettingsGetCall { 534 c.urlParams_.Set("view", view) 535 return c 536} 537 538// Fields allows partial responses to be retrieved. See 539// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 540// for more information. 541func (c *FoldersSettingsGetCall) Fields(s ...googleapi.Field) *FoldersSettingsGetCall { 542 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 543 return c 544} 545 546// IfNoneMatch sets the optional parameter which makes the operation 547// fail if the object's ETag matches the given value. This is useful for 548// getting updates only after the object has changed since the last 549// request. Use googleapi.IsNotModified to check whether the response 550// error from Do is the result of In-None-Match. 551func (c *FoldersSettingsGetCall) IfNoneMatch(entityTag string) *FoldersSettingsGetCall { 552 c.ifNoneMatch_ = entityTag 553 return c 554} 555 556// Context sets the context to be used in this call's Do method. Any 557// pending HTTP request will be aborted if the provided context is 558// canceled. 559func (c *FoldersSettingsGetCall) Context(ctx context.Context) *FoldersSettingsGetCall { 560 c.ctx_ = ctx 561 return c 562} 563 564// Header returns an http.Header that can be modified by the caller to 565// add HTTP headers to the request. 566func (c *FoldersSettingsGetCall) Header() http.Header { 567 if c.header_ == nil { 568 c.header_ = make(http.Header) 569 } 570 return c.header_ 571} 572 573func (c *FoldersSettingsGetCall) doRequest(alt string) (*http.Response, error) { 574 reqHeaders := make(http.Header) 575 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211027") 576 for k, v := range c.header_ { 577 reqHeaders[k] = v 578 } 579 reqHeaders.Set("User-Agent", c.s.userAgent()) 580 if c.ifNoneMatch_ != "" { 581 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 582 } 583 var body io.Reader = nil 584 c.urlParams_.Set("alt", alt) 585 c.urlParams_.Set("prettyPrint", "false") 586 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 587 urls += "?" + c.urlParams_.Encode() 588 req, err := http.NewRequest("GET", urls, body) 589 if err != nil { 590 return nil, err 591 } 592 req.Header = reqHeaders 593 googleapi.Expand(req.URL, map[string]string{ 594 "name": c.name, 595 }) 596 return gensupport.SendRequest(c.ctx_, c.s.client, req) 597} 598 599// Do executes the "resourcesettings.folders.settings.get" call. 600// Exactly one of *GoogleCloudResourcesettingsV1Setting or error will be 601// non-nil. Any non-2xx status code is an error. Response headers are in 602// either *GoogleCloudResourcesettingsV1Setting.ServerResponse.Header or 603// (if a response was returned at all) in 604// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 605// whether the returned error was because http.StatusNotModified was 606// returned. 607func (c *FoldersSettingsGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1Setting, error) { 608 gensupport.SetOptions(c.urlParams_, opts...) 609 res, err := c.doRequest("json") 610 if res != nil && res.StatusCode == http.StatusNotModified { 611 if res.Body != nil { 612 res.Body.Close() 613 } 614 return nil, &googleapi.Error{ 615 Code: res.StatusCode, 616 Header: res.Header, 617 } 618 } 619 if err != nil { 620 return nil, err 621 } 622 defer googleapi.CloseBody(res) 623 if err := googleapi.CheckResponse(res); err != nil { 624 return nil, err 625 } 626 ret := &GoogleCloudResourcesettingsV1Setting{ 627 ServerResponse: googleapi.ServerResponse{ 628 Header: res.Header, 629 HTTPStatusCode: res.StatusCode, 630 }, 631 } 632 target := &ret 633 if err := gensupport.DecodeResponse(target, res); err != nil { 634 return nil, err 635 } 636 return ret, nil 637 // { 638 // "description": "Returns a specified setting. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the setting does not exist.", 639 // "flatPath": "v1/folders/{foldersId}/settings/{settingsId}", 640 // "httpMethod": "GET", 641 // "id": "resourcesettings.folders.settings.get", 642 // "parameterOrder": [ 643 // "name" 644 // ], 645 // "parameters": { 646 // "name": { 647 // "description": "Required. The name of the setting to get. See Setting for naming requirements.", 648 // "location": "path", 649 // "pattern": "^folders/[^/]+/settings/[^/]+$", 650 // "required": true, 651 // "type": "string" 652 // }, 653 // "view": { 654 // "description": "The SettingView for this request.", 655 // "enum": [ 656 // "SETTING_VIEW_UNSPECIFIED", 657 // "SETTING_VIEW_BASIC", 658 // "SETTING_VIEW_EFFECTIVE_VALUE", 659 // "SETTING_VIEW_LOCAL_VALUE" 660 // ], 661 // "enumDescriptions": [ 662 // "The default / unset value. The API will default to the SETTING_VIEW_BASIC view.", 663 // "Include Setting.metadata, but nothing else. This is the default value (for both ListSettings and GetSetting).", 664 // "Include Setting.effective_value, but nothing else.", 665 // "Include Setting.local_value, but nothing else." 666 // ], 667 // "location": "query", 668 // "type": "string" 669 // } 670 // }, 671 // "path": "v1/{+name}", 672 // "response": { 673 // "$ref": "GoogleCloudResourcesettingsV1Setting" 674 // }, 675 // "scopes": [ 676 // "https://www.googleapis.com/auth/cloud-platform" 677 // ] 678 // } 679 680} 681 682// method id "resourcesettings.folders.settings.list": 683 684type FoldersSettingsListCall struct { 685 s *Service 686 parent string 687 urlParams_ gensupport.URLParams 688 ifNoneMatch_ string 689 ctx_ context.Context 690 header_ http.Header 691} 692 693// List: Lists all the settings that are available on the Cloud resource 694// `parent`. 695// 696// - parent: The project, folder, or organization that is the parent 697// resource for this setting. Must be in one of the following forms: * 698// `projects/{project_number}` * `projects/{project_id}` * 699// `folders/{folder_id}` * `organizations/{organization_id}`. 700func (r *FoldersSettingsService) List(parent string) *FoldersSettingsListCall { 701 c := &FoldersSettingsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 702 c.parent = parent 703 return c 704} 705 706// PageSize sets the optional parameter "pageSize": Unused. The size of 707// the page to be returned. 708func (c *FoldersSettingsListCall) PageSize(pageSize int64) *FoldersSettingsListCall { 709 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 710 return c 711} 712 713// PageToken sets the optional parameter "pageToken": Unused. A page 714// token used to retrieve the next page. 715func (c *FoldersSettingsListCall) PageToken(pageToken string) *FoldersSettingsListCall { 716 c.urlParams_.Set("pageToken", pageToken) 717 return c 718} 719 720// View sets the optional parameter "view": The SettingView for this 721// request. 722// 723// Possible values: 724// "SETTING_VIEW_UNSPECIFIED" - The default / unset value. The API 725// will default to the SETTING_VIEW_BASIC view. 726// "SETTING_VIEW_BASIC" - Include Setting.metadata, but nothing else. 727// This is the default value (for both ListSettings and GetSetting). 728// "SETTING_VIEW_EFFECTIVE_VALUE" - Include Setting.effective_value, 729// but nothing else. 730// "SETTING_VIEW_LOCAL_VALUE" - Include Setting.local_value, but 731// nothing else. 732func (c *FoldersSettingsListCall) View(view string) *FoldersSettingsListCall { 733 c.urlParams_.Set("view", view) 734 return c 735} 736 737// Fields allows partial responses to be retrieved. See 738// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 739// for more information. 740func (c *FoldersSettingsListCall) Fields(s ...googleapi.Field) *FoldersSettingsListCall { 741 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 742 return c 743} 744 745// IfNoneMatch sets the optional parameter which makes the operation 746// fail if the object's ETag matches the given value. This is useful for 747// getting updates only after the object has changed since the last 748// request. Use googleapi.IsNotModified to check whether the response 749// error from Do is the result of In-None-Match. 750func (c *FoldersSettingsListCall) IfNoneMatch(entityTag string) *FoldersSettingsListCall { 751 c.ifNoneMatch_ = entityTag 752 return c 753} 754 755// Context sets the context to be used in this call's Do method. Any 756// pending HTTP request will be aborted if the provided context is 757// canceled. 758func (c *FoldersSettingsListCall) Context(ctx context.Context) *FoldersSettingsListCall { 759 c.ctx_ = ctx 760 return c 761} 762 763// Header returns an http.Header that can be modified by the caller to 764// add HTTP headers to the request. 765func (c *FoldersSettingsListCall) Header() http.Header { 766 if c.header_ == nil { 767 c.header_ = make(http.Header) 768 } 769 return c.header_ 770} 771 772func (c *FoldersSettingsListCall) doRequest(alt string) (*http.Response, error) { 773 reqHeaders := make(http.Header) 774 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211027") 775 for k, v := range c.header_ { 776 reqHeaders[k] = v 777 } 778 reqHeaders.Set("User-Agent", c.s.userAgent()) 779 if c.ifNoneMatch_ != "" { 780 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 781 } 782 var body io.Reader = nil 783 c.urlParams_.Set("alt", alt) 784 c.urlParams_.Set("prettyPrint", "false") 785 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/settings") 786 urls += "?" + c.urlParams_.Encode() 787 req, err := http.NewRequest("GET", urls, body) 788 if err != nil { 789 return nil, err 790 } 791 req.Header = reqHeaders 792 googleapi.Expand(req.URL, map[string]string{ 793 "parent": c.parent, 794 }) 795 return gensupport.SendRequest(c.ctx_, c.s.client, req) 796} 797 798// Do executes the "resourcesettings.folders.settings.list" call. 799// Exactly one of *GoogleCloudResourcesettingsV1ListSettingsResponse or 800// error will be non-nil. Any non-2xx status code is an error. Response 801// headers are in either 802// *GoogleCloudResourcesettingsV1ListSettingsResponse.ServerResponse.Head 803// er or (if a response was returned at all) in 804// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 805// whether the returned error was because http.StatusNotModified was 806// returned. 807func (c *FoldersSettingsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1ListSettingsResponse, error) { 808 gensupport.SetOptions(c.urlParams_, opts...) 809 res, err := c.doRequest("json") 810 if res != nil && res.StatusCode == http.StatusNotModified { 811 if res.Body != nil { 812 res.Body.Close() 813 } 814 return nil, &googleapi.Error{ 815 Code: res.StatusCode, 816 Header: res.Header, 817 } 818 } 819 if err != nil { 820 return nil, err 821 } 822 defer googleapi.CloseBody(res) 823 if err := googleapi.CheckResponse(res); err != nil { 824 return nil, err 825 } 826 ret := &GoogleCloudResourcesettingsV1ListSettingsResponse{ 827 ServerResponse: googleapi.ServerResponse{ 828 Header: res.Header, 829 HTTPStatusCode: res.StatusCode, 830 }, 831 } 832 target := &ret 833 if err := gensupport.DecodeResponse(target, res); err != nil { 834 return nil, err 835 } 836 return ret, nil 837 // { 838 // "description": "Lists all the settings that are available on the Cloud resource `parent`.", 839 // "flatPath": "v1/folders/{foldersId}/settings", 840 // "httpMethod": "GET", 841 // "id": "resourcesettings.folders.settings.list", 842 // "parameterOrder": [ 843 // "parent" 844 // ], 845 // "parameters": { 846 // "pageSize": { 847 // "description": "Unused. The size of the page to be returned.", 848 // "format": "int32", 849 // "location": "query", 850 // "type": "integer" 851 // }, 852 // "pageToken": { 853 // "description": "Unused. A page token used to retrieve the next page.", 854 // "location": "query", 855 // "type": "string" 856 // }, 857 // "parent": { 858 // "description": "Required. The project, folder, or organization that is the parent resource for this setting. Must be in one of the following forms: * `projects/{project_number}` * `projects/{project_id}` * `folders/{folder_id}` * `organizations/{organization_id}`", 859 // "location": "path", 860 // "pattern": "^folders/[^/]+$", 861 // "required": true, 862 // "type": "string" 863 // }, 864 // "view": { 865 // "description": "The SettingView for this request.", 866 // "enum": [ 867 // "SETTING_VIEW_UNSPECIFIED", 868 // "SETTING_VIEW_BASIC", 869 // "SETTING_VIEW_EFFECTIVE_VALUE", 870 // "SETTING_VIEW_LOCAL_VALUE" 871 // ], 872 // "enumDescriptions": [ 873 // "The default / unset value. The API will default to the SETTING_VIEW_BASIC view.", 874 // "Include Setting.metadata, but nothing else. This is the default value (for both ListSettings and GetSetting).", 875 // "Include Setting.effective_value, but nothing else.", 876 // "Include Setting.local_value, but nothing else." 877 // ], 878 // "location": "query", 879 // "type": "string" 880 // } 881 // }, 882 // "path": "v1/{+parent}/settings", 883 // "response": { 884 // "$ref": "GoogleCloudResourcesettingsV1ListSettingsResponse" 885 // }, 886 // "scopes": [ 887 // "https://www.googleapis.com/auth/cloud-platform" 888 // ] 889 // } 890 891} 892 893// Pages invokes f for each page of results. 894// A non-nil error returned from f will halt the iteration. 895// The provided context supersedes any context provided to the Context method. 896func (c *FoldersSettingsListCall) Pages(ctx context.Context, f func(*GoogleCloudResourcesettingsV1ListSettingsResponse) error) error { 897 c.ctx_ = ctx 898 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 899 for { 900 x, err := c.Do() 901 if err != nil { 902 return err 903 } 904 if err := f(x); err != nil { 905 return err 906 } 907 if x.NextPageToken == "" { 908 return nil 909 } 910 c.PageToken(x.NextPageToken) 911 } 912} 913 914// method id "resourcesettings.folders.settings.patch": 915 916type FoldersSettingsPatchCall struct { 917 s *Service 918 name string 919 googlecloudresourcesettingsv1setting *GoogleCloudResourcesettingsV1Setting 920 urlParams_ gensupport.URLParams 921 ctx_ context.Context 922 header_ http.Header 923} 924 925// Patch: Updates a specified setting. Returns a `google.rpc.Status` 926// with `google.rpc.Code.NOT_FOUND` if the setting does not exist. 927// Returns a `google.rpc.Status` with 928// `google.rpc.Code.FAILED_PRECONDITION` if the setting is flagged as 929// read only. Returns a `google.rpc.Status` with 930// `google.rpc.Code.ABORTED` if the etag supplied in the request does 931// not match the persisted etag of the setting value. On success, the 932// response will contain only `name`, `local_value` and `etag`. The 933// `metadata` and `effective_value` cannot be updated through this API. 934// Note: the supplied setting will perform a full overwrite of the 935// `local_value` field. 936// 937// - name: The resource name of the setting. Must be in one of the 938// following forms: * 939// `projects/{project_number}/settings/{setting_name}` * 940// `folders/{folder_id}/settings/{setting_name}` * 941// `organizations/{organization_id}/settings/{setting_name}` For 942// example, "/projects/123/settings/gcp-enableMyFeature". 943func (r *FoldersSettingsService) Patch(name string, googlecloudresourcesettingsv1setting *GoogleCloudResourcesettingsV1Setting) *FoldersSettingsPatchCall { 944 c := &FoldersSettingsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 945 c.name = name 946 c.googlecloudresourcesettingsv1setting = googlecloudresourcesettingsv1setting 947 return c 948} 949 950// Fields allows partial responses to be retrieved. See 951// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 952// for more information. 953func (c *FoldersSettingsPatchCall) Fields(s ...googleapi.Field) *FoldersSettingsPatchCall { 954 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 955 return c 956} 957 958// Context sets the context to be used in this call's Do method. Any 959// pending HTTP request will be aborted if the provided context is 960// canceled. 961func (c *FoldersSettingsPatchCall) Context(ctx context.Context) *FoldersSettingsPatchCall { 962 c.ctx_ = ctx 963 return c 964} 965 966// Header returns an http.Header that can be modified by the caller to 967// add HTTP headers to the request. 968func (c *FoldersSettingsPatchCall) Header() http.Header { 969 if c.header_ == nil { 970 c.header_ = make(http.Header) 971 } 972 return c.header_ 973} 974 975func (c *FoldersSettingsPatchCall) doRequest(alt string) (*http.Response, error) { 976 reqHeaders := make(http.Header) 977 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211027") 978 for k, v := range c.header_ { 979 reqHeaders[k] = v 980 } 981 reqHeaders.Set("User-Agent", c.s.userAgent()) 982 var body io.Reader = nil 983 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudresourcesettingsv1setting) 984 if err != nil { 985 return nil, err 986 } 987 reqHeaders.Set("Content-Type", "application/json") 988 c.urlParams_.Set("alt", alt) 989 c.urlParams_.Set("prettyPrint", "false") 990 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 991 urls += "?" + c.urlParams_.Encode() 992 req, err := http.NewRequest("PATCH", urls, body) 993 if err != nil { 994 return nil, err 995 } 996 req.Header = reqHeaders 997 googleapi.Expand(req.URL, map[string]string{ 998 "name": c.name, 999 }) 1000 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1001} 1002 1003// Do executes the "resourcesettings.folders.settings.patch" call. 1004// Exactly one of *GoogleCloudResourcesettingsV1Setting or error will be 1005// non-nil. Any non-2xx status code is an error. Response headers are in 1006// either *GoogleCloudResourcesettingsV1Setting.ServerResponse.Header or 1007// (if a response was returned at all) in 1008// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1009// whether the returned error was because http.StatusNotModified was 1010// returned. 1011func (c *FoldersSettingsPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1Setting, error) { 1012 gensupport.SetOptions(c.urlParams_, opts...) 1013 res, err := c.doRequest("json") 1014 if res != nil && res.StatusCode == http.StatusNotModified { 1015 if res.Body != nil { 1016 res.Body.Close() 1017 } 1018 return nil, &googleapi.Error{ 1019 Code: res.StatusCode, 1020 Header: res.Header, 1021 } 1022 } 1023 if err != nil { 1024 return nil, err 1025 } 1026 defer googleapi.CloseBody(res) 1027 if err := googleapi.CheckResponse(res); err != nil { 1028 return nil, err 1029 } 1030 ret := &GoogleCloudResourcesettingsV1Setting{ 1031 ServerResponse: googleapi.ServerResponse{ 1032 Header: res.Header, 1033 HTTPStatusCode: res.StatusCode, 1034 }, 1035 } 1036 target := &ret 1037 if err := gensupport.DecodeResponse(target, res); err != nil { 1038 return nil, err 1039 } 1040 return ret, nil 1041 // { 1042 // "description": "Updates a specified setting. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the setting does not exist. Returns a `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if the setting is flagged as read only. Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request does not match the persisted etag of the setting value. On success, the response will contain only `name`, `local_value` and `etag`. The `metadata` and `effective_value` cannot be updated through this API. Note: the supplied setting will perform a full overwrite of the `local_value` field.", 1043 // "flatPath": "v1/folders/{foldersId}/settings/{settingsId}", 1044 // "httpMethod": "PATCH", 1045 // "id": "resourcesettings.folders.settings.patch", 1046 // "parameterOrder": [ 1047 // "name" 1048 // ], 1049 // "parameters": { 1050 // "name": { 1051 // "description": "The resource name of the setting. Must be in one of the following forms: * `projects/{project_number}/settings/{setting_name}` * `folders/{folder_id}/settings/{setting_name}` * `organizations/{organization_id}/settings/{setting_name}` For example, \"/projects/123/settings/gcp-enableMyFeature\"", 1052 // "location": "path", 1053 // "pattern": "^folders/[^/]+/settings/[^/]+$", 1054 // "required": true, 1055 // "type": "string" 1056 // } 1057 // }, 1058 // "path": "v1/{+name}", 1059 // "request": { 1060 // "$ref": "GoogleCloudResourcesettingsV1Setting" 1061 // }, 1062 // "response": { 1063 // "$ref": "GoogleCloudResourcesettingsV1Setting" 1064 // }, 1065 // "scopes": [ 1066 // "https://www.googleapis.com/auth/cloud-platform" 1067 // ] 1068 // } 1069 1070} 1071 1072// method id "resourcesettings.organizations.settings.get": 1073 1074type OrganizationsSettingsGetCall struct { 1075 s *Service 1076 name string 1077 urlParams_ gensupport.URLParams 1078 ifNoneMatch_ string 1079 ctx_ context.Context 1080 header_ http.Header 1081} 1082 1083// Get: Returns a specified setting. Returns a `google.rpc.Status` with 1084// `google.rpc.Code.NOT_FOUND` if the setting does not exist. 1085// 1086// - name: The name of the setting to get. See Setting for naming 1087// requirements. 1088func (r *OrganizationsSettingsService) Get(name string) *OrganizationsSettingsGetCall { 1089 c := &OrganizationsSettingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1090 c.name = name 1091 return c 1092} 1093 1094// View sets the optional parameter "view": The SettingView for this 1095// request. 1096// 1097// Possible values: 1098// "SETTING_VIEW_UNSPECIFIED" - The default / unset value. The API 1099// will default to the SETTING_VIEW_BASIC view. 1100// "SETTING_VIEW_BASIC" - Include Setting.metadata, but nothing else. 1101// This is the default value (for both ListSettings and GetSetting). 1102// "SETTING_VIEW_EFFECTIVE_VALUE" - Include Setting.effective_value, 1103// but nothing else. 1104// "SETTING_VIEW_LOCAL_VALUE" - Include Setting.local_value, but 1105// nothing else. 1106func (c *OrganizationsSettingsGetCall) View(view string) *OrganizationsSettingsGetCall { 1107 c.urlParams_.Set("view", view) 1108 return c 1109} 1110 1111// Fields allows partial responses to be retrieved. See 1112// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1113// for more information. 1114func (c *OrganizationsSettingsGetCall) Fields(s ...googleapi.Field) *OrganizationsSettingsGetCall { 1115 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1116 return c 1117} 1118 1119// IfNoneMatch sets the optional parameter which makes the operation 1120// fail if the object's ETag matches the given value. This is useful for 1121// getting updates only after the object has changed since the last 1122// request. Use googleapi.IsNotModified to check whether the response 1123// error from Do is the result of In-None-Match. 1124func (c *OrganizationsSettingsGetCall) IfNoneMatch(entityTag string) *OrganizationsSettingsGetCall { 1125 c.ifNoneMatch_ = entityTag 1126 return c 1127} 1128 1129// Context sets the context to be used in this call's Do method. Any 1130// pending HTTP request will be aborted if the provided context is 1131// canceled. 1132func (c *OrganizationsSettingsGetCall) Context(ctx context.Context) *OrganizationsSettingsGetCall { 1133 c.ctx_ = ctx 1134 return c 1135} 1136 1137// Header returns an http.Header that can be modified by the caller to 1138// add HTTP headers to the request. 1139func (c *OrganizationsSettingsGetCall) Header() http.Header { 1140 if c.header_ == nil { 1141 c.header_ = make(http.Header) 1142 } 1143 return c.header_ 1144} 1145 1146func (c *OrganizationsSettingsGetCall) doRequest(alt string) (*http.Response, error) { 1147 reqHeaders := make(http.Header) 1148 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211027") 1149 for k, v := range c.header_ { 1150 reqHeaders[k] = v 1151 } 1152 reqHeaders.Set("User-Agent", c.s.userAgent()) 1153 if c.ifNoneMatch_ != "" { 1154 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1155 } 1156 var body io.Reader = nil 1157 c.urlParams_.Set("alt", alt) 1158 c.urlParams_.Set("prettyPrint", "false") 1159 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 1160 urls += "?" + c.urlParams_.Encode() 1161 req, err := http.NewRequest("GET", urls, body) 1162 if err != nil { 1163 return nil, err 1164 } 1165 req.Header = reqHeaders 1166 googleapi.Expand(req.URL, map[string]string{ 1167 "name": c.name, 1168 }) 1169 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1170} 1171 1172// Do executes the "resourcesettings.organizations.settings.get" call. 1173// Exactly one of *GoogleCloudResourcesettingsV1Setting or error will be 1174// non-nil. Any non-2xx status code is an error. Response headers are in 1175// either *GoogleCloudResourcesettingsV1Setting.ServerResponse.Header or 1176// (if a response was returned at all) in 1177// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1178// whether the returned error was because http.StatusNotModified was 1179// returned. 1180func (c *OrganizationsSettingsGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1Setting, error) { 1181 gensupport.SetOptions(c.urlParams_, opts...) 1182 res, err := c.doRequest("json") 1183 if res != nil && res.StatusCode == http.StatusNotModified { 1184 if res.Body != nil { 1185 res.Body.Close() 1186 } 1187 return nil, &googleapi.Error{ 1188 Code: res.StatusCode, 1189 Header: res.Header, 1190 } 1191 } 1192 if err != nil { 1193 return nil, err 1194 } 1195 defer googleapi.CloseBody(res) 1196 if err := googleapi.CheckResponse(res); err != nil { 1197 return nil, err 1198 } 1199 ret := &GoogleCloudResourcesettingsV1Setting{ 1200 ServerResponse: googleapi.ServerResponse{ 1201 Header: res.Header, 1202 HTTPStatusCode: res.StatusCode, 1203 }, 1204 } 1205 target := &ret 1206 if err := gensupport.DecodeResponse(target, res); err != nil { 1207 return nil, err 1208 } 1209 return ret, nil 1210 // { 1211 // "description": "Returns a specified setting. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the setting does not exist.", 1212 // "flatPath": "v1/organizations/{organizationsId}/settings/{settingsId}", 1213 // "httpMethod": "GET", 1214 // "id": "resourcesettings.organizations.settings.get", 1215 // "parameterOrder": [ 1216 // "name" 1217 // ], 1218 // "parameters": { 1219 // "name": { 1220 // "description": "Required. The name of the setting to get. See Setting for naming requirements.", 1221 // "location": "path", 1222 // "pattern": "^organizations/[^/]+/settings/[^/]+$", 1223 // "required": true, 1224 // "type": "string" 1225 // }, 1226 // "view": { 1227 // "description": "The SettingView for this request.", 1228 // "enum": [ 1229 // "SETTING_VIEW_UNSPECIFIED", 1230 // "SETTING_VIEW_BASIC", 1231 // "SETTING_VIEW_EFFECTIVE_VALUE", 1232 // "SETTING_VIEW_LOCAL_VALUE" 1233 // ], 1234 // "enumDescriptions": [ 1235 // "The default / unset value. The API will default to the SETTING_VIEW_BASIC view.", 1236 // "Include Setting.metadata, but nothing else. This is the default value (for both ListSettings and GetSetting).", 1237 // "Include Setting.effective_value, but nothing else.", 1238 // "Include Setting.local_value, but nothing else." 1239 // ], 1240 // "location": "query", 1241 // "type": "string" 1242 // } 1243 // }, 1244 // "path": "v1/{+name}", 1245 // "response": { 1246 // "$ref": "GoogleCloudResourcesettingsV1Setting" 1247 // }, 1248 // "scopes": [ 1249 // "https://www.googleapis.com/auth/cloud-platform" 1250 // ] 1251 // } 1252 1253} 1254 1255// method id "resourcesettings.organizations.settings.list": 1256 1257type OrganizationsSettingsListCall struct { 1258 s *Service 1259 parent string 1260 urlParams_ gensupport.URLParams 1261 ifNoneMatch_ string 1262 ctx_ context.Context 1263 header_ http.Header 1264} 1265 1266// List: Lists all the settings that are available on the Cloud resource 1267// `parent`. 1268// 1269// - parent: The project, folder, or organization that is the parent 1270// resource for this setting. Must be in one of the following forms: * 1271// `projects/{project_number}` * `projects/{project_id}` * 1272// `folders/{folder_id}` * `organizations/{organization_id}`. 1273func (r *OrganizationsSettingsService) List(parent string) *OrganizationsSettingsListCall { 1274 c := &OrganizationsSettingsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1275 c.parent = parent 1276 return c 1277} 1278 1279// PageSize sets the optional parameter "pageSize": Unused. The size of 1280// the page to be returned. 1281func (c *OrganizationsSettingsListCall) PageSize(pageSize int64) *OrganizationsSettingsListCall { 1282 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1283 return c 1284} 1285 1286// PageToken sets the optional parameter "pageToken": Unused. A page 1287// token used to retrieve the next page. 1288func (c *OrganizationsSettingsListCall) PageToken(pageToken string) *OrganizationsSettingsListCall { 1289 c.urlParams_.Set("pageToken", pageToken) 1290 return c 1291} 1292 1293// View sets the optional parameter "view": The SettingView for this 1294// request. 1295// 1296// Possible values: 1297// "SETTING_VIEW_UNSPECIFIED" - The default / unset value. The API 1298// will default to the SETTING_VIEW_BASIC view. 1299// "SETTING_VIEW_BASIC" - Include Setting.metadata, but nothing else. 1300// This is the default value (for both ListSettings and GetSetting). 1301// "SETTING_VIEW_EFFECTIVE_VALUE" - Include Setting.effective_value, 1302// but nothing else. 1303// "SETTING_VIEW_LOCAL_VALUE" - Include Setting.local_value, but 1304// nothing else. 1305func (c *OrganizationsSettingsListCall) View(view string) *OrganizationsSettingsListCall { 1306 c.urlParams_.Set("view", view) 1307 return c 1308} 1309 1310// Fields allows partial responses to be retrieved. See 1311// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1312// for more information. 1313func (c *OrganizationsSettingsListCall) Fields(s ...googleapi.Field) *OrganizationsSettingsListCall { 1314 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1315 return c 1316} 1317 1318// IfNoneMatch sets the optional parameter which makes the operation 1319// fail if the object's ETag matches the given value. This is useful for 1320// getting updates only after the object has changed since the last 1321// request. Use googleapi.IsNotModified to check whether the response 1322// error from Do is the result of In-None-Match. 1323func (c *OrganizationsSettingsListCall) IfNoneMatch(entityTag string) *OrganizationsSettingsListCall { 1324 c.ifNoneMatch_ = entityTag 1325 return c 1326} 1327 1328// Context sets the context to be used in this call's Do method. Any 1329// pending HTTP request will be aborted if the provided context is 1330// canceled. 1331func (c *OrganizationsSettingsListCall) Context(ctx context.Context) *OrganizationsSettingsListCall { 1332 c.ctx_ = ctx 1333 return c 1334} 1335 1336// Header returns an http.Header that can be modified by the caller to 1337// add HTTP headers to the request. 1338func (c *OrganizationsSettingsListCall) Header() http.Header { 1339 if c.header_ == nil { 1340 c.header_ = make(http.Header) 1341 } 1342 return c.header_ 1343} 1344 1345func (c *OrganizationsSettingsListCall) doRequest(alt string) (*http.Response, error) { 1346 reqHeaders := make(http.Header) 1347 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211027") 1348 for k, v := range c.header_ { 1349 reqHeaders[k] = v 1350 } 1351 reqHeaders.Set("User-Agent", c.s.userAgent()) 1352 if c.ifNoneMatch_ != "" { 1353 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1354 } 1355 var body io.Reader = nil 1356 c.urlParams_.Set("alt", alt) 1357 c.urlParams_.Set("prettyPrint", "false") 1358 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/settings") 1359 urls += "?" + c.urlParams_.Encode() 1360 req, err := http.NewRequest("GET", urls, body) 1361 if err != nil { 1362 return nil, err 1363 } 1364 req.Header = reqHeaders 1365 googleapi.Expand(req.URL, map[string]string{ 1366 "parent": c.parent, 1367 }) 1368 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1369} 1370 1371// Do executes the "resourcesettings.organizations.settings.list" call. 1372// Exactly one of *GoogleCloudResourcesettingsV1ListSettingsResponse or 1373// error will be non-nil. Any non-2xx status code is an error. Response 1374// headers are in either 1375// *GoogleCloudResourcesettingsV1ListSettingsResponse.ServerResponse.Head 1376// er or (if a response was returned at all) in 1377// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1378// whether the returned error was because http.StatusNotModified was 1379// returned. 1380func (c *OrganizationsSettingsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1ListSettingsResponse, error) { 1381 gensupport.SetOptions(c.urlParams_, opts...) 1382 res, err := c.doRequest("json") 1383 if res != nil && res.StatusCode == http.StatusNotModified { 1384 if res.Body != nil { 1385 res.Body.Close() 1386 } 1387 return nil, &googleapi.Error{ 1388 Code: res.StatusCode, 1389 Header: res.Header, 1390 } 1391 } 1392 if err != nil { 1393 return nil, err 1394 } 1395 defer googleapi.CloseBody(res) 1396 if err := googleapi.CheckResponse(res); err != nil { 1397 return nil, err 1398 } 1399 ret := &GoogleCloudResourcesettingsV1ListSettingsResponse{ 1400 ServerResponse: googleapi.ServerResponse{ 1401 Header: res.Header, 1402 HTTPStatusCode: res.StatusCode, 1403 }, 1404 } 1405 target := &ret 1406 if err := gensupport.DecodeResponse(target, res); err != nil { 1407 return nil, err 1408 } 1409 return ret, nil 1410 // { 1411 // "description": "Lists all the settings that are available on the Cloud resource `parent`.", 1412 // "flatPath": "v1/organizations/{organizationsId}/settings", 1413 // "httpMethod": "GET", 1414 // "id": "resourcesettings.organizations.settings.list", 1415 // "parameterOrder": [ 1416 // "parent" 1417 // ], 1418 // "parameters": { 1419 // "pageSize": { 1420 // "description": "Unused. The size of the page to be returned.", 1421 // "format": "int32", 1422 // "location": "query", 1423 // "type": "integer" 1424 // }, 1425 // "pageToken": { 1426 // "description": "Unused. A page token used to retrieve the next page.", 1427 // "location": "query", 1428 // "type": "string" 1429 // }, 1430 // "parent": { 1431 // "description": "Required. The project, folder, or organization that is the parent resource for this setting. Must be in one of the following forms: * `projects/{project_number}` * `projects/{project_id}` * `folders/{folder_id}` * `organizations/{organization_id}`", 1432 // "location": "path", 1433 // "pattern": "^organizations/[^/]+$", 1434 // "required": true, 1435 // "type": "string" 1436 // }, 1437 // "view": { 1438 // "description": "The SettingView for this request.", 1439 // "enum": [ 1440 // "SETTING_VIEW_UNSPECIFIED", 1441 // "SETTING_VIEW_BASIC", 1442 // "SETTING_VIEW_EFFECTIVE_VALUE", 1443 // "SETTING_VIEW_LOCAL_VALUE" 1444 // ], 1445 // "enumDescriptions": [ 1446 // "The default / unset value. The API will default to the SETTING_VIEW_BASIC view.", 1447 // "Include Setting.metadata, but nothing else. This is the default value (for both ListSettings and GetSetting).", 1448 // "Include Setting.effective_value, but nothing else.", 1449 // "Include Setting.local_value, but nothing else." 1450 // ], 1451 // "location": "query", 1452 // "type": "string" 1453 // } 1454 // }, 1455 // "path": "v1/{+parent}/settings", 1456 // "response": { 1457 // "$ref": "GoogleCloudResourcesettingsV1ListSettingsResponse" 1458 // }, 1459 // "scopes": [ 1460 // "https://www.googleapis.com/auth/cloud-platform" 1461 // ] 1462 // } 1463 1464} 1465 1466// Pages invokes f for each page of results. 1467// A non-nil error returned from f will halt the iteration. 1468// The provided context supersedes any context provided to the Context method. 1469func (c *OrganizationsSettingsListCall) Pages(ctx context.Context, f func(*GoogleCloudResourcesettingsV1ListSettingsResponse) error) error { 1470 c.ctx_ = ctx 1471 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 1472 for { 1473 x, err := c.Do() 1474 if err != nil { 1475 return err 1476 } 1477 if err := f(x); err != nil { 1478 return err 1479 } 1480 if x.NextPageToken == "" { 1481 return nil 1482 } 1483 c.PageToken(x.NextPageToken) 1484 } 1485} 1486 1487// method id "resourcesettings.organizations.settings.patch": 1488 1489type OrganizationsSettingsPatchCall struct { 1490 s *Service 1491 name string 1492 googlecloudresourcesettingsv1setting *GoogleCloudResourcesettingsV1Setting 1493 urlParams_ gensupport.URLParams 1494 ctx_ context.Context 1495 header_ http.Header 1496} 1497 1498// Patch: Updates a specified setting. Returns a `google.rpc.Status` 1499// with `google.rpc.Code.NOT_FOUND` if the setting does not exist. 1500// Returns a `google.rpc.Status` with 1501// `google.rpc.Code.FAILED_PRECONDITION` if the setting is flagged as 1502// read only. Returns a `google.rpc.Status` with 1503// `google.rpc.Code.ABORTED` if the etag supplied in the request does 1504// not match the persisted etag of the setting value. On success, the 1505// response will contain only `name`, `local_value` and `etag`. The 1506// `metadata` and `effective_value` cannot be updated through this API. 1507// Note: the supplied setting will perform a full overwrite of the 1508// `local_value` field. 1509// 1510// - name: The resource name of the setting. Must be in one of the 1511// following forms: * 1512// `projects/{project_number}/settings/{setting_name}` * 1513// `folders/{folder_id}/settings/{setting_name}` * 1514// `organizations/{organization_id}/settings/{setting_name}` For 1515// example, "/projects/123/settings/gcp-enableMyFeature". 1516func (r *OrganizationsSettingsService) Patch(name string, googlecloudresourcesettingsv1setting *GoogleCloudResourcesettingsV1Setting) *OrganizationsSettingsPatchCall { 1517 c := &OrganizationsSettingsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1518 c.name = name 1519 c.googlecloudresourcesettingsv1setting = googlecloudresourcesettingsv1setting 1520 return c 1521} 1522 1523// Fields allows partial responses to be retrieved. See 1524// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1525// for more information. 1526func (c *OrganizationsSettingsPatchCall) Fields(s ...googleapi.Field) *OrganizationsSettingsPatchCall { 1527 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1528 return c 1529} 1530 1531// Context sets the context to be used in this call's Do method. Any 1532// pending HTTP request will be aborted if the provided context is 1533// canceled. 1534func (c *OrganizationsSettingsPatchCall) Context(ctx context.Context) *OrganizationsSettingsPatchCall { 1535 c.ctx_ = ctx 1536 return c 1537} 1538 1539// Header returns an http.Header that can be modified by the caller to 1540// add HTTP headers to the request. 1541func (c *OrganizationsSettingsPatchCall) Header() http.Header { 1542 if c.header_ == nil { 1543 c.header_ = make(http.Header) 1544 } 1545 return c.header_ 1546} 1547 1548func (c *OrganizationsSettingsPatchCall) doRequest(alt string) (*http.Response, error) { 1549 reqHeaders := make(http.Header) 1550 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211027") 1551 for k, v := range c.header_ { 1552 reqHeaders[k] = v 1553 } 1554 reqHeaders.Set("User-Agent", c.s.userAgent()) 1555 var body io.Reader = nil 1556 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudresourcesettingsv1setting) 1557 if err != nil { 1558 return nil, err 1559 } 1560 reqHeaders.Set("Content-Type", "application/json") 1561 c.urlParams_.Set("alt", alt) 1562 c.urlParams_.Set("prettyPrint", "false") 1563 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 1564 urls += "?" + c.urlParams_.Encode() 1565 req, err := http.NewRequest("PATCH", urls, body) 1566 if err != nil { 1567 return nil, err 1568 } 1569 req.Header = reqHeaders 1570 googleapi.Expand(req.URL, map[string]string{ 1571 "name": c.name, 1572 }) 1573 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1574} 1575 1576// Do executes the "resourcesettings.organizations.settings.patch" call. 1577// Exactly one of *GoogleCloudResourcesettingsV1Setting or error will be 1578// non-nil. Any non-2xx status code is an error. Response headers are in 1579// either *GoogleCloudResourcesettingsV1Setting.ServerResponse.Header or 1580// (if a response was returned at all) in 1581// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1582// whether the returned error was because http.StatusNotModified was 1583// returned. 1584func (c *OrganizationsSettingsPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1Setting, error) { 1585 gensupport.SetOptions(c.urlParams_, opts...) 1586 res, err := c.doRequest("json") 1587 if res != nil && res.StatusCode == http.StatusNotModified { 1588 if res.Body != nil { 1589 res.Body.Close() 1590 } 1591 return nil, &googleapi.Error{ 1592 Code: res.StatusCode, 1593 Header: res.Header, 1594 } 1595 } 1596 if err != nil { 1597 return nil, err 1598 } 1599 defer googleapi.CloseBody(res) 1600 if err := googleapi.CheckResponse(res); err != nil { 1601 return nil, err 1602 } 1603 ret := &GoogleCloudResourcesettingsV1Setting{ 1604 ServerResponse: googleapi.ServerResponse{ 1605 Header: res.Header, 1606 HTTPStatusCode: res.StatusCode, 1607 }, 1608 } 1609 target := &ret 1610 if err := gensupport.DecodeResponse(target, res); err != nil { 1611 return nil, err 1612 } 1613 return ret, nil 1614 // { 1615 // "description": "Updates a specified setting. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the setting does not exist. Returns a `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if the setting is flagged as read only. Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request does not match the persisted etag of the setting value. On success, the response will contain only `name`, `local_value` and `etag`. The `metadata` and `effective_value` cannot be updated through this API. Note: the supplied setting will perform a full overwrite of the `local_value` field.", 1616 // "flatPath": "v1/organizations/{organizationsId}/settings/{settingsId}", 1617 // "httpMethod": "PATCH", 1618 // "id": "resourcesettings.organizations.settings.patch", 1619 // "parameterOrder": [ 1620 // "name" 1621 // ], 1622 // "parameters": { 1623 // "name": { 1624 // "description": "The resource name of the setting. Must be in one of the following forms: * `projects/{project_number}/settings/{setting_name}` * `folders/{folder_id}/settings/{setting_name}` * `organizations/{organization_id}/settings/{setting_name}` For example, \"/projects/123/settings/gcp-enableMyFeature\"", 1625 // "location": "path", 1626 // "pattern": "^organizations/[^/]+/settings/[^/]+$", 1627 // "required": true, 1628 // "type": "string" 1629 // } 1630 // }, 1631 // "path": "v1/{+name}", 1632 // "request": { 1633 // "$ref": "GoogleCloudResourcesettingsV1Setting" 1634 // }, 1635 // "response": { 1636 // "$ref": "GoogleCloudResourcesettingsV1Setting" 1637 // }, 1638 // "scopes": [ 1639 // "https://www.googleapis.com/auth/cloud-platform" 1640 // ] 1641 // } 1642 1643} 1644 1645// method id "resourcesettings.projects.settings.get": 1646 1647type ProjectsSettingsGetCall struct { 1648 s *Service 1649 name string 1650 urlParams_ gensupport.URLParams 1651 ifNoneMatch_ string 1652 ctx_ context.Context 1653 header_ http.Header 1654} 1655 1656// Get: Returns a specified setting. Returns a `google.rpc.Status` with 1657// `google.rpc.Code.NOT_FOUND` if the setting does not exist. 1658// 1659// - name: The name of the setting to get. See Setting for naming 1660// requirements. 1661func (r *ProjectsSettingsService) Get(name string) *ProjectsSettingsGetCall { 1662 c := &ProjectsSettingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1663 c.name = name 1664 return c 1665} 1666 1667// View sets the optional parameter "view": The SettingView for this 1668// request. 1669// 1670// Possible values: 1671// "SETTING_VIEW_UNSPECIFIED" - The default / unset value. The API 1672// will default to the SETTING_VIEW_BASIC view. 1673// "SETTING_VIEW_BASIC" - Include Setting.metadata, but nothing else. 1674// This is the default value (for both ListSettings and GetSetting). 1675// "SETTING_VIEW_EFFECTIVE_VALUE" - Include Setting.effective_value, 1676// but nothing else. 1677// "SETTING_VIEW_LOCAL_VALUE" - Include Setting.local_value, but 1678// nothing else. 1679func (c *ProjectsSettingsGetCall) View(view string) *ProjectsSettingsGetCall { 1680 c.urlParams_.Set("view", view) 1681 return c 1682} 1683 1684// Fields allows partial responses to be retrieved. See 1685// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1686// for more information. 1687func (c *ProjectsSettingsGetCall) Fields(s ...googleapi.Field) *ProjectsSettingsGetCall { 1688 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1689 return c 1690} 1691 1692// IfNoneMatch sets the optional parameter which makes the operation 1693// fail if the object's ETag matches the given value. This is useful for 1694// getting updates only after the object has changed since the last 1695// request. Use googleapi.IsNotModified to check whether the response 1696// error from Do is the result of In-None-Match. 1697func (c *ProjectsSettingsGetCall) IfNoneMatch(entityTag string) *ProjectsSettingsGetCall { 1698 c.ifNoneMatch_ = entityTag 1699 return c 1700} 1701 1702// Context sets the context to be used in this call's Do method. Any 1703// pending HTTP request will be aborted if the provided context is 1704// canceled. 1705func (c *ProjectsSettingsGetCall) Context(ctx context.Context) *ProjectsSettingsGetCall { 1706 c.ctx_ = ctx 1707 return c 1708} 1709 1710// Header returns an http.Header that can be modified by the caller to 1711// add HTTP headers to the request. 1712func (c *ProjectsSettingsGetCall) Header() http.Header { 1713 if c.header_ == nil { 1714 c.header_ = make(http.Header) 1715 } 1716 return c.header_ 1717} 1718 1719func (c *ProjectsSettingsGetCall) doRequest(alt string) (*http.Response, error) { 1720 reqHeaders := make(http.Header) 1721 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211027") 1722 for k, v := range c.header_ { 1723 reqHeaders[k] = v 1724 } 1725 reqHeaders.Set("User-Agent", c.s.userAgent()) 1726 if c.ifNoneMatch_ != "" { 1727 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1728 } 1729 var body io.Reader = nil 1730 c.urlParams_.Set("alt", alt) 1731 c.urlParams_.Set("prettyPrint", "false") 1732 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 1733 urls += "?" + c.urlParams_.Encode() 1734 req, err := http.NewRequest("GET", urls, body) 1735 if err != nil { 1736 return nil, err 1737 } 1738 req.Header = reqHeaders 1739 googleapi.Expand(req.URL, map[string]string{ 1740 "name": c.name, 1741 }) 1742 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1743} 1744 1745// Do executes the "resourcesettings.projects.settings.get" call. 1746// Exactly one of *GoogleCloudResourcesettingsV1Setting or error will be 1747// non-nil. Any non-2xx status code is an error. Response headers are in 1748// either *GoogleCloudResourcesettingsV1Setting.ServerResponse.Header or 1749// (if a response was returned at all) in 1750// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1751// whether the returned error was because http.StatusNotModified was 1752// returned. 1753func (c *ProjectsSettingsGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1Setting, error) { 1754 gensupport.SetOptions(c.urlParams_, opts...) 1755 res, err := c.doRequest("json") 1756 if res != nil && res.StatusCode == http.StatusNotModified { 1757 if res.Body != nil { 1758 res.Body.Close() 1759 } 1760 return nil, &googleapi.Error{ 1761 Code: res.StatusCode, 1762 Header: res.Header, 1763 } 1764 } 1765 if err != nil { 1766 return nil, err 1767 } 1768 defer googleapi.CloseBody(res) 1769 if err := googleapi.CheckResponse(res); err != nil { 1770 return nil, err 1771 } 1772 ret := &GoogleCloudResourcesettingsV1Setting{ 1773 ServerResponse: googleapi.ServerResponse{ 1774 Header: res.Header, 1775 HTTPStatusCode: res.StatusCode, 1776 }, 1777 } 1778 target := &ret 1779 if err := gensupport.DecodeResponse(target, res); err != nil { 1780 return nil, err 1781 } 1782 return ret, nil 1783 // { 1784 // "description": "Returns a specified setting. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the setting does not exist.", 1785 // "flatPath": "v1/projects/{projectsId}/settings/{settingsId}", 1786 // "httpMethod": "GET", 1787 // "id": "resourcesettings.projects.settings.get", 1788 // "parameterOrder": [ 1789 // "name" 1790 // ], 1791 // "parameters": { 1792 // "name": { 1793 // "description": "Required. The name of the setting to get. See Setting for naming requirements.", 1794 // "location": "path", 1795 // "pattern": "^projects/[^/]+/settings/[^/]+$", 1796 // "required": true, 1797 // "type": "string" 1798 // }, 1799 // "view": { 1800 // "description": "The SettingView for this request.", 1801 // "enum": [ 1802 // "SETTING_VIEW_UNSPECIFIED", 1803 // "SETTING_VIEW_BASIC", 1804 // "SETTING_VIEW_EFFECTIVE_VALUE", 1805 // "SETTING_VIEW_LOCAL_VALUE" 1806 // ], 1807 // "enumDescriptions": [ 1808 // "The default / unset value. The API will default to the SETTING_VIEW_BASIC view.", 1809 // "Include Setting.metadata, but nothing else. This is the default value (for both ListSettings and GetSetting).", 1810 // "Include Setting.effective_value, but nothing else.", 1811 // "Include Setting.local_value, but nothing else." 1812 // ], 1813 // "location": "query", 1814 // "type": "string" 1815 // } 1816 // }, 1817 // "path": "v1/{+name}", 1818 // "response": { 1819 // "$ref": "GoogleCloudResourcesettingsV1Setting" 1820 // }, 1821 // "scopes": [ 1822 // "https://www.googleapis.com/auth/cloud-platform" 1823 // ] 1824 // } 1825 1826} 1827 1828// method id "resourcesettings.projects.settings.list": 1829 1830type ProjectsSettingsListCall struct { 1831 s *Service 1832 parent string 1833 urlParams_ gensupport.URLParams 1834 ifNoneMatch_ string 1835 ctx_ context.Context 1836 header_ http.Header 1837} 1838 1839// List: Lists all the settings that are available on the Cloud resource 1840// `parent`. 1841// 1842// - parent: The project, folder, or organization that is the parent 1843// resource for this setting. Must be in one of the following forms: * 1844// `projects/{project_number}` * `projects/{project_id}` * 1845// `folders/{folder_id}` * `organizations/{organization_id}`. 1846func (r *ProjectsSettingsService) List(parent string) *ProjectsSettingsListCall { 1847 c := &ProjectsSettingsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1848 c.parent = parent 1849 return c 1850} 1851 1852// PageSize sets the optional parameter "pageSize": Unused. The size of 1853// the page to be returned. 1854func (c *ProjectsSettingsListCall) PageSize(pageSize int64) *ProjectsSettingsListCall { 1855 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1856 return c 1857} 1858 1859// PageToken sets the optional parameter "pageToken": Unused. A page 1860// token used to retrieve the next page. 1861func (c *ProjectsSettingsListCall) PageToken(pageToken string) *ProjectsSettingsListCall { 1862 c.urlParams_.Set("pageToken", pageToken) 1863 return c 1864} 1865 1866// View sets the optional parameter "view": The SettingView for this 1867// request. 1868// 1869// Possible values: 1870// "SETTING_VIEW_UNSPECIFIED" - The default / unset value. The API 1871// will default to the SETTING_VIEW_BASIC view. 1872// "SETTING_VIEW_BASIC" - Include Setting.metadata, but nothing else. 1873// This is the default value (for both ListSettings and GetSetting). 1874// "SETTING_VIEW_EFFECTIVE_VALUE" - Include Setting.effective_value, 1875// but nothing else. 1876// "SETTING_VIEW_LOCAL_VALUE" - Include Setting.local_value, but 1877// nothing else. 1878func (c *ProjectsSettingsListCall) View(view string) *ProjectsSettingsListCall { 1879 c.urlParams_.Set("view", view) 1880 return c 1881} 1882 1883// Fields allows partial responses to be retrieved. See 1884// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1885// for more information. 1886func (c *ProjectsSettingsListCall) Fields(s ...googleapi.Field) *ProjectsSettingsListCall { 1887 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1888 return c 1889} 1890 1891// IfNoneMatch sets the optional parameter which makes the operation 1892// fail if the object's ETag matches the given value. This is useful for 1893// getting updates only after the object has changed since the last 1894// request. Use googleapi.IsNotModified to check whether the response 1895// error from Do is the result of In-None-Match. 1896func (c *ProjectsSettingsListCall) IfNoneMatch(entityTag string) *ProjectsSettingsListCall { 1897 c.ifNoneMatch_ = entityTag 1898 return c 1899} 1900 1901// Context sets the context to be used in this call's Do method. Any 1902// pending HTTP request will be aborted if the provided context is 1903// canceled. 1904func (c *ProjectsSettingsListCall) Context(ctx context.Context) *ProjectsSettingsListCall { 1905 c.ctx_ = ctx 1906 return c 1907} 1908 1909// Header returns an http.Header that can be modified by the caller to 1910// add HTTP headers to the request. 1911func (c *ProjectsSettingsListCall) Header() http.Header { 1912 if c.header_ == nil { 1913 c.header_ = make(http.Header) 1914 } 1915 return c.header_ 1916} 1917 1918func (c *ProjectsSettingsListCall) doRequest(alt string) (*http.Response, error) { 1919 reqHeaders := make(http.Header) 1920 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211027") 1921 for k, v := range c.header_ { 1922 reqHeaders[k] = v 1923 } 1924 reqHeaders.Set("User-Agent", c.s.userAgent()) 1925 if c.ifNoneMatch_ != "" { 1926 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1927 } 1928 var body io.Reader = nil 1929 c.urlParams_.Set("alt", alt) 1930 c.urlParams_.Set("prettyPrint", "false") 1931 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/settings") 1932 urls += "?" + c.urlParams_.Encode() 1933 req, err := http.NewRequest("GET", urls, body) 1934 if err != nil { 1935 return nil, err 1936 } 1937 req.Header = reqHeaders 1938 googleapi.Expand(req.URL, map[string]string{ 1939 "parent": c.parent, 1940 }) 1941 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1942} 1943 1944// Do executes the "resourcesettings.projects.settings.list" call. 1945// Exactly one of *GoogleCloudResourcesettingsV1ListSettingsResponse or 1946// error will be non-nil. Any non-2xx status code is an error. Response 1947// headers are in either 1948// *GoogleCloudResourcesettingsV1ListSettingsResponse.ServerResponse.Head 1949// er or (if a response was returned at all) in 1950// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1951// whether the returned error was because http.StatusNotModified was 1952// returned. 1953func (c *ProjectsSettingsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1ListSettingsResponse, error) { 1954 gensupport.SetOptions(c.urlParams_, opts...) 1955 res, err := c.doRequest("json") 1956 if res != nil && res.StatusCode == http.StatusNotModified { 1957 if res.Body != nil { 1958 res.Body.Close() 1959 } 1960 return nil, &googleapi.Error{ 1961 Code: res.StatusCode, 1962 Header: res.Header, 1963 } 1964 } 1965 if err != nil { 1966 return nil, err 1967 } 1968 defer googleapi.CloseBody(res) 1969 if err := googleapi.CheckResponse(res); err != nil { 1970 return nil, err 1971 } 1972 ret := &GoogleCloudResourcesettingsV1ListSettingsResponse{ 1973 ServerResponse: googleapi.ServerResponse{ 1974 Header: res.Header, 1975 HTTPStatusCode: res.StatusCode, 1976 }, 1977 } 1978 target := &ret 1979 if err := gensupport.DecodeResponse(target, res); err != nil { 1980 return nil, err 1981 } 1982 return ret, nil 1983 // { 1984 // "description": "Lists all the settings that are available on the Cloud resource `parent`.", 1985 // "flatPath": "v1/projects/{projectsId}/settings", 1986 // "httpMethod": "GET", 1987 // "id": "resourcesettings.projects.settings.list", 1988 // "parameterOrder": [ 1989 // "parent" 1990 // ], 1991 // "parameters": { 1992 // "pageSize": { 1993 // "description": "Unused. The size of the page to be returned.", 1994 // "format": "int32", 1995 // "location": "query", 1996 // "type": "integer" 1997 // }, 1998 // "pageToken": { 1999 // "description": "Unused. A page token used to retrieve the next page.", 2000 // "location": "query", 2001 // "type": "string" 2002 // }, 2003 // "parent": { 2004 // "description": "Required. The project, folder, or organization that is the parent resource for this setting. Must be in one of the following forms: * `projects/{project_number}` * `projects/{project_id}` * `folders/{folder_id}` * `organizations/{organization_id}`", 2005 // "location": "path", 2006 // "pattern": "^projects/[^/]+$", 2007 // "required": true, 2008 // "type": "string" 2009 // }, 2010 // "view": { 2011 // "description": "The SettingView for this request.", 2012 // "enum": [ 2013 // "SETTING_VIEW_UNSPECIFIED", 2014 // "SETTING_VIEW_BASIC", 2015 // "SETTING_VIEW_EFFECTIVE_VALUE", 2016 // "SETTING_VIEW_LOCAL_VALUE" 2017 // ], 2018 // "enumDescriptions": [ 2019 // "The default / unset value. The API will default to the SETTING_VIEW_BASIC view.", 2020 // "Include Setting.metadata, but nothing else. This is the default value (for both ListSettings and GetSetting).", 2021 // "Include Setting.effective_value, but nothing else.", 2022 // "Include Setting.local_value, but nothing else." 2023 // ], 2024 // "location": "query", 2025 // "type": "string" 2026 // } 2027 // }, 2028 // "path": "v1/{+parent}/settings", 2029 // "response": { 2030 // "$ref": "GoogleCloudResourcesettingsV1ListSettingsResponse" 2031 // }, 2032 // "scopes": [ 2033 // "https://www.googleapis.com/auth/cloud-platform" 2034 // ] 2035 // } 2036 2037} 2038 2039// Pages invokes f for each page of results. 2040// A non-nil error returned from f will halt the iteration. 2041// The provided context supersedes any context provided to the Context method. 2042func (c *ProjectsSettingsListCall) Pages(ctx context.Context, f func(*GoogleCloudResourcesettingsV1ListSettingsResponse) error) error { 2043 c.ctx_ = ctx 2044 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2045 for { 2046 x, err := c.Do() 2047 if err != nil { 2048 return err 2049 } 2050 if err := f(x); err != nil { 2051 return err 2052 } 2053 if x.NextPageToken == "" { 2054 return nil 2055 } 2056 c.PageToken(x.NextPageToken) 2057 } 2058} 2059 2060// method id "resourcesettings.projects.settings.patch": 2061 2062type ProjectsSettingsPatchCall struct { 2063 s *Service 2064 name string 2065 googlecloudresourcesettingsv1setting *GoogleCloudResourcesettingsV1Setting 2066 urlParams_ gensupport.URLParams 2067 ctx_ context.Context 2068 header_ http.Header 2069} 2070 2071// Patch: Updates a specified setting. Returns a `google.rpc.Status` 2072// with `google.rpc.Code.NOT_FOUND` if the setting does not exist. 2073// Returns a `google.rpc.Status` with 2074// `google.rpc.Code.FAILED_PRECONDITION` if the setting is flagged as 2075// read only. Returns a `google.rpc.Status` with 2076// `google.rpc.Code.ABORTED` if the etag supplied in the request does 2077// not match the persisted etag of the setting value. On success, the 2078// response will contain only `name`, `local_value` and `etag`. The 2079// `metadata` and `effective_value` cannot be updated through this API. 2080// Note: the supplied setting will perform a full overwrite of the 2081// `local_value` field. 2082// 2083// - name: The resource name of the setting. Must be in one of the 2084// following forms: * 2085// `projects/{project_number}/settings/{setting_name}` * 2086// `folders/{folder_id}/settings/{setting_name}` * 2087// `organizations/{organization_id}/settings/{setting_name}` For 2088// example, "/projects/123/settings/gcp-enableMyFeature". 2089func (r *ProjectsSettingsService) Patch(name string, googlecloudresourcesettingsv1setting *GoogleCloudResourcesettingsV1Setting) *ProjectsSettingsPatchCall { 2090 c := &ProjectsSettingsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2091 c.name = name 2092 c.googlecloudresourcesettingsv1setting = googlecloudresourcesettingsv1setting 2093 return c 2094} 2095 2096// Fields allows partial responses to be retrieved. See 2097// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2098// for more information. 2099func (c *ProjectsSettingsPatchCall) Fields(s ...googleapi.Field) *ProjectsSettingsPatchCall { 2100 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2101 return c 2102} 2103 2104// Context sets the context to be used in this call's Do method. Any 2105// pending HTTP request will be aborted if the provided context is 2106// canceled. 2107func (c *ProjectsSettingsPatchCall) Context(ctx context.Context) *ProjectsSettingsPatchCall { 2108 c.ctx_ = ctx 2109 return c 2110} 2111 2112// Header returns an http.Header that can be modified by the caller to 2113// add HTTP headers to the request. 2114func (c *ProjectsSettingsPatchCall) Header() http.Header { 2115 if c.header_ == nil { 2116 c.header_ = make(http.Header) 2117 } 2118 return c.header_ 2119} 2120 2121func (c *ProjectsSettingsPatchCall) doRequest(alt string) (*http.Response, error) { 2122 reqHeaders := make(http.Header) 2123 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20211027") 2124 for k, v := range c.header_ { 2125 reqHeaders[k] = v 2126 } 2127 reqHeaders.Set("User-Agent", c.s.userAgent()) 2128 var body io.Reader = nil 2129 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudresourcesettingsv1setting) 2130 if err != nil { 2131 return nil, err 2132 } 2133 reqHeaders.Set("Content-Type", "application/json") 2134 c.urlParams_.Set("alt", alt) 2135 c.urlParams_.Set("prettyPrint", "false") 2136 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}") 2137 urls += "?" + c.urlParams_.Encode() 2138 req, err := http.NewRequest("PATCH", urls, body) 2139 if err != nil { 2140 return nil, err 2141 } 2142 req.Header = reqHeaders 2143 googleapi.Expand(req.URL, map[string]string{ 2144 "name": c.name, 2145 }) 2146 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2147} 2148 2149// Do executes the "resourcesettings.projects.settings.patch" call. 2150// Exactly one of *GoogleCloudResourcesettingsV1Setting or error will be 2151// non-nil. Any non-2xx status code is an error. Response headers are in 2152// either *GoogleCloudResourcesettingsV1Setting.ServerResponse.Header or 2153// (if a response was returned at all) in 2154// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 2155// whether the returned error was because http.StatusNotModified was 2156// returned. 2157func (c *ProjectsSettingsPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1Setting, 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 := &GoogleCloudResourcesettingsV1Setting{ 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": "Updates a specified setting. Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the setting does not exist. Returns a `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if the setting is flagged as read only. Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request does not match the persisted etag of the setting value. On success, the response will contain only `name`, `local_value` and `etag`. The `metadata` and `effective_value` cannot be updated through this API. Note: the supplied setting will perform a full overwrite of the `local_value` field.", 2189 // "flatPath": "v1/projects/{projectsId}/settings/{settingsId}", 2190 // "httpMethod": "PATCH", 2191 // "id": "resourcesettings.projects.settings.patch", 2192 // "parameterOrder": [ 2193 // "name" 2194 // ], 2195 // "parameters": { 2196 // "name": { 2197 // "description": "The resource name of the setting. Must be in one of the following forms: * `projects/{project_number}/settings/{setting_name}` * `folders/{folder_id}/settings/{setting_name}` * `organizations/{organization_id}/settings/{setting_name}` For example, \"/projects/123/settings/gcp-enableMyFeature\"", 2198 // "location": "path", 2199 // "pattern": "^projects/[^/]+/settings/[^/]+$", 2200 // "required": true, 2201 // "type": "string" 2202 // } 2203 // }, 2204 // "path": "v1/{+name}", 2205 // "request": { 2206 // "$ref": "GoogleCloudResourcesettingsV1Setting" 2207 // }, 2208 // "response": { 2209 // "$ref": "GoogleCloudResourcesettingsV1Setting" 2210 // }, 2211 // "scopes": [ 2212 // "https://www.googleapis.com/auth/cloud-platform" 2213 // ] 2214 // } 2215 2216} 2217