...

Source file src/google.golang.org/api/resourcesettings/v1/resourcesettings-gen.go

Documentation: google.golang.org/api/resourcesettings/v1

     1  // Copyright 2024 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  // # Library status
    12  //
    13  // These client libraries are officially supported by Google. However, this
    14  // library is considered complete and is in maintenance mode. This means
    15  // that we will address critical bugs and security issues but will not add
    16  // any new features.
    17  //
    18  // When possible, we recommend using our newer
    19  // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    20  // that are still actively being worked and iterated on.
    21  //
    22  // # Creating a client
    23  //
    24  // Usage example:
    25  //
    26  //	import "google.golang.org/api/resourcesettings/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	resourcesettingsService, err := resourcesettings.NewService(ctx)
    30  //
    31  // In this example, Google Application Default Credentials are used for
    32  // authentication. For information on how to create and obtain Application
    33  // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    34  //
    35  // # Other authentication options
    36  //
    37  // To use an API key for authentication (note: some APIs do not support API
    38  // keys), use [google.golang.org/api/option.WithAPIKey]:
    39  //
    40  //	resourcesettingsService, err := resourcesettings.NewService(ctx, option.WithAPIKey("AIza..."))
    41  //
    42  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    43  // flow, use [google.golang.org/api/option.WithTokenSource]:
    44  //
    45  //	config := &oauth2.Config{...}
    46  //	// ...
    47  //	token, err := config.Exchange(ctx, ...)
    48  //	resourcesettingsService, err := resourcesettings.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    49  //
    50  // See [google.golang.org/api/option.ClientOption] for details on options.
    51  package resourcesettings // import "google.golang.org/api/resourcesettings/v1"
    52  
    53  import (
    54  	"bytes"
    55  	"context"
    56  	"encoding/json"
    57  	"errors"
    58  	"fmt"
    59  	"io"
    60  	"net/http"
    61  	"net/url"
    62  	"strconv"
    63  	"strings"
    64  
    65  	googleapi "google.golang.org/api/googleapi"
    66  	internal "google.golang.org/api/internal"
    67  	gensupport "google.golang.org/api/internal/gensupport"
    68  	option "google.golang.org/api/option"
    69  	internaloption "google.golang.org/api/option/internaloption"
    70  	htransport "google.golang.org/api/transport/http"
    71  )
    72  
    73  // Always reference these packages, just in case the auto-generated code
    74  // below doesn't.
    75  var _ = bytes.NewBuffer
    76  var _ = strconv.Itoa
    77  var _ = fmt.Sprintf
    78  var _ = json.NewDecoder
    79  var _ = io.Copy
    80  var _ = url.Parse
    81  var _ = gensupport.MarshalJSON
    82  var _ = googleapi.Version
    83  var _ = errors.New
    84  var _ = strings.Replace
    85  var _ = context.Canceled
    86  var _ = internaloption.WithDefaultEndpoint
    87  var _ = internal.Version
    88  
    89  const apiId = "resourcesettings:v1"
    90  const apiName = "resourcesettings"
    91  const apiVersion = "v1"
    92  const basePath = "https://resourcesettings.googleapis.com/"
    93  const basePathTemplate = "https://resourcesettings.UNIVERSE_DOMAIN/"
    94  const mtlsBasePath = "https://resourcesettings.mtls.googleapis.com/"
    95  
    96  // OAuth2 scopes used by this API.
    97  const (
    98  	// See, edit, configure, and delete your Google Cloud data and see the email
    99  	// address for your Google Account.
   100  	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
   101  )
   102  
   103  // NewService creates a new Service.
   104  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   105  	scopesOption := internaloption.WithDefaultScopes(
   106  		"https://www.googleapis.com/auth/cloud-platform",
   107  	)
   108  	// NOTE: prepend, so we don't override user-specified scopes.
   109  	opts = append([]option.ClientOption{scopesOption}, opts...)
   110  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   111  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   112  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   113  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   114  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   115  	if err != nil {
   116  		return nil, err
   117  	}
   118  	s, err := New(client)
   119  	if err != nil {
   120  		return nil, err
   121  	}
   122  	if endpoint != "" {
   123  		s.BasePath = endpoint
   124  	}
   125  	return s, nil
   126  }
   127  
   128  // New creates a new Service. It uses the provided http.Client for requests.
   129  //
   130  // Deprecated: please use NewService instead.
   131  // To provide a custom HTTP client, use option.WithHTTPClient.
   132  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   133  func New(client *http.Client) (*Service, error) {
   134  	if client == nil {
   135  		return nil, errors.New("client is nil")
   136  	}
   137  	s := &Service{client: client, BasePath: basePath}
   138  	s.Folders = NewFoldersService(s)
   139  	s.Organizations = NewOrganizationsService(s)
   140  	s.Projects = NewProjectsService(s)
   141  	return s, nil
   142  }
   143  
   144  type Service struct {
   145  	client    *http.Client
   146  	BasePath  string // API endpoint base URL
   147  	UserAgent string // optional additional User-Agent fragment
   148  
   149  	Folders *FoldersService
   150  
   151  	Organizations *OrganizationsService
   152  
   153  	Projects *ProjectsService
   154  }
   155  
   156  func (s *Service) userAgent() string {
   157  	if s.UserAgent == "" {
   158  		return googleapi.UserAgent
   159  	}
   160  	return googleapi.UserAgent + " " + s.UserAgent
   161  }
   162  
   163  func NewFoldersService(s *Service) *FoldersService {
   164  	rs := &FoldersService{s: s}
   165  	rs.Settings = NewFoldersSettingsService(s)
   166  	return rs
   167  }
   168  
   169  type FoldersService struct {
   170  	s *Service
   171  
   172  	Settings *FoldersSettingsService
   173  }
   174  
   175  func NewFoldersSettingsService(s *Service) *FoldersSettingsService {
   176  	rs := &FoldersSettingsService{s: s}
   177  	return rs
   178  }
   179  
   180  type FoldersSettingsService struct {
   181  	s *Service
   182  }
   183  
   184  func NewOrganizationsService(s *Service) *OrganizationsService {
   185  	rs := &OrganizationsService{s: s}
   186  	rs.Settings = NewOrganizationsSettingsService(s)
   187  	return rs
   188  }
   189  
   190  type OrganizationsService struct {
   191  	s *Service
   192  
   193  	Settings *OrganizationsSettingsService
   194  }
   195  
   196  func NewOrganizationsSettingsService(s *Service) *OrganizationsSettingsService {
   197  	rs := &OrganizationsSettingsService{s: s}
   198  	return rs
   199  }
   200  
   201  type OrganizationsSettingsService struct {
   202  	s *Service
   203  }
   204  
   205  func NewProjectsService(s *Service) *ProjectsService {
   206  	rs := &ProjectsService{s: s}
   207  	rs.Settings = NewProjectsSettingsService(s)
   208  	return rs
   209  }
   210  
   211  type ProjectsService struct {
   212  	s *Service
   213  
   214  	Settings *ProjectsSettingsService
   215  }
   216  
   217  func NewProjectsSettingsService(s *Service) *ProjectsSettingsService {
   218  	rs := &ProjectsSettingsService{s: s}
   219  	return rs
   220  }
   221  
   222  type ProjectsSettingsService struct {
   223  	s *Service
   224  }
   225  
   226  // GoogleCloudResourcesettingsV1ListSettingsResponse: The response from
   227  // ListSettings.
   228  type GoogleCloudResourcesettingsV1ListSettingsResponse struct {
   229  	// NextPageToken: Unused. A page token used to retrieve the next page.
   230  	NextPageToken string `json:"nextPageToken,omitempty"`
   231  	// Settings: A list of settings that are available at the specified Cloud
   232  	// resource.
   233  	Settings []*GoogleCloudResourcesettingsV1Setting `json:"settings,omitempty"`
   234  
   235  	// ServerResponse contains the HTTP response code and headers from the server.
   236  	googleapi.ServerResponse `json:"-"`
   237  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   238  	// unconditionally include in API requests. By default, fields with empty or
   239  	// default values are omitted from API requests. See
   240  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   241  	// details.
   242  	ForceSendFields []string `json:"-"`
   243  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
   244  	// requests with the JSON null value. By default, fields with empty values are
   245  	// omitted from API requests. See
   246  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   247  	NullFields []string `json:"-"`
   248  }
   249  
   250  func (s *GoogleCloudResourcesettingsV1ListSettingsResponse) MarshalJSON() ([]byte, error) {
   251  	type NoMethod GoogleCloudResourcesettingsV1ListSettingsResponse
   252  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   253  }
   254  
   255  // GoogleCloudResourcesettingsV1Setting: The schema for settings.
   256  type GoogleCloudResourcesettingsV1Setting struct {
   257  	// EffectiveValue: Output only. The effective value of the setting at the given
   258  	// parent resource, evaluated based on the resource hierarchy The effective
   259  	// value evaluates to one of the following options, in this order. If an option
   260  	// is not valid or doesn't exist, then the next option is used: 1. The local
   261  	// setting value on the given resource: Setting.local_value 2. If one of the
   262  	// given resource's ancestors in the resource hierarchy have a local setting
   263  	// value, the local value at the nearest such ancestor. 3. The setting's
   264  	// default value: SettingMetadata.default_value 4. An empty value, defined as a
   265  	// `Value` with all fields unset. The data type of Value must always be
   266  	// consistent with the data type defined in Setting.metadata.
   267  	EffectiveValue *GoogleCloudResourcesettingsV1Value `json:"effectiveValue,omitempty"`
   268  	// Etag: A fingerprint used for optimistic concurrency. See UpdateSetting for
   269  	// more details.
   270  	Etag string `json:"etag,omitempty"`
   271  	// LocalValue: The configured value of the setting at the given parent
   272  	// resource, ignoring the resource hierarchy. The data type of Value must
   273  	// always be consistent with the data type defined in Setting.metadata.
   274  	LocalValue *GoogleCloudResourcesettingsV1Value `json:"localValue,omitempty"`
   275  	// Metadata: Output only. Metadata about a setting which is not editable by the
   276  	// end user.
   277  	Metadata *GoogleCloudResourcesettingsV1SettingMetadata `json:"metadata,omitempty"`
   278  	// Name: The resource name of the setting. Must be in one of the following
   279  	// forms: * `projects/{project_number}/settings/{setting_name}` *
   280  	// `folders/{folder_id}/settings/{setting_name}` *
   281  	// `organizations/{organization_id}/settings/{setting_name}` For example,
   282  	// "/projects/123/settings/gcp-enableMyFeature"
   283  	Name string `json:"name,omitempty"`
   284  
   285  	// ServerResponse contains the HTTP response code and headers from the server.
   286  	googleapi.ServerResponse `json:"-"`
   287  	// ForceSendFields is a list of field names (e.g. "EffectiveValue") to
   288  	// unconditionally include in API requests. By default, fields with empty or
   289  	// default values are omitted from API requests. See
   290  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   291  	// details.
   292  	ForceSendFields []string `json:"-"`
   293  	// NullFields is a list of field names (e.g. "EffectiveValue") to include in
   294  	// API requests with the JSON null value. By default, fields with empty values
   295  	// are omitted from API requests. See
   296  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   297  	NullFields []string `json:"-"`
   298  }
   299  
   300  func (s *GoogleCloudResourcesettingsV1Setting) MarshalJSON() ([]byte, error) {
   301  	type NoMethod GoogleCloudResourcesettingsV1Setting
   302  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   303  }
   304  
   305  // GoogleCloudResourcesettingsV1SettingMetadata: Metadata about a setting which
   306  // is not editable by the end user.
   307  type GoogleCloudResourcesettingsV1SettingMetadata struct {
   308  	// DataType: The data type for this setting.
   309  	//
   310  	// Possible values:
   311  	//   "DATA_TYPE_UNSPECIFIED" - Unspecified data type.
   312  	//   "BOOLEAN" - A boolean setting.
   313  	//   "STRING" - A string setting.
   314  	//   "STRING_SET" - A string set setting.
   315  	//   "ENUM_VALUE" - A Enum setting
   316  	//   "DURATION_VALUE" - A Duration setting
   317  	//   "STRING_MAP" - A string->string map setting
   318  	DataType string `json:"dataType,omitempty"`
   319  	// DefaultValue: The value provided by Setting.effective_value if no setting
   320  	// value is explicitly set. Note: not all settings have a default value.
   321  	DefaultValue *GoogleCloudResourcesettingsV1Value `json:"defaultValue,omitempty"`
   322  	// Description: A detailed description of what this setting does.
   323  	Description string `json:"description,omitempty"`
   324  	// DisplayName: The human readable name for this setting.
   325  	DisplayName string `json:"displayName,omitempty"`
   326  	// ReadOnly: A flag indicating that values of this setting cannot be modified.
   327  	// See documentation for the specific setting for updates and reasons.
   328  	ReadOnly bool `json:"readOnly,omitempty"`
   329  	// ForceSendFields is a list of field names (e.g. "DataType") to
   330  	// unconditionally include in API requests. By default, fields with empty or
   331  	// default values are omitted from API requests. See
   332  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   333  	// details.
   334  	ForceSendFields []string `json:"-"`
   335  	// NullFields is a list of field names (e.g. "DataType") to include in API
   336  	// requests with the JSON null value. By default, fields with empty values are
   337  	// omitted from API requests. See
   338  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   339  	NullFields []string `json:"-"`
   340  }
   341  
   342  func (s *GoogleCloudResourcesettingsV1SettingMetadata) MarshalJSON() ([]byte, error) {
   343  	type NoMethod GoogleCloudResourcesettingsV1SettingMetadata
   344  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   345  }
   346  
   347  // GoogleCloudResourcesettingsV1Value: The data in a setting value.
   348  type GoogleCloudResourcesettingsV1Value struct {
   349  	// BooleanValue: Defines this value as being a boolean value.
   350  	BooleanValue bool `json:"booleanValue,omitempty"`
   351  	// DurationValue: Defines this value as being a Duration.
   352  	DurationValue string `json:"durationValue,omitempty"`
   353  	// EnumValue: Defines this value as being a Enum.
   354  	EnumValue *GoogleCloudResourcesettingsV1ValueEnumValue `json:"enumValue,omitempty"`
   355  	// StringMapValue: Defines this value as being a StringMap.
   356  	StringMapValue *GoogleCloudResourcesettingsV1ValueStringMap `json:"stringMapValue,omitempty"`
   357  	// StringSetValue: Defines this value as being a StringSet.
   358  	StringSetValue *GoogleCloudResourcesettingsV1ValueStringSet `json:"stringSetValue,omitempty"`
   359  	// StringValue: Defines this value as being a string value.
   360  	StringValue string `json:"stringValue,omitempty"`
   361  	// ForceSendFields is a list of field names (e.g. "BooleanValue") to
   362  	// unconditionally include in API requests. By default, fields with empty or
   363  	// default values are omitted from API requests. See
   364  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   365  	// details.
   366  	ForceSendFields []string `json:"-"`
   367  	// NullFields is a list of field names (e.g. "BooleanValue") to include in API
   368  	// requests with the JSON null value. By default, fields with empty values are
   369  	// omitted from API requests. See
   370  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   371  	NullFields []string `json:"-"`
   372  }
   373  
   374  func (s *GoogleCloudResourcesettingsV1Value) MarshalJSON() ([]byte, error) {
   375  	type NoMethod GoogleCloudResourcesettingsV1Value
   376  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   377  }
   378  
   379  // GoogleCloudResourcesettingsV1ValueEnumValue: A enum value that can hold any
   380  // enum type setting values. Each enum type is represented by a number, this
   381  // representation is stored in the definitions.
   382  type GoogleCloudResourcesettingsV1ValueEnumValue struct {
   383  	// Value: The value of this enum
   384  	Value string `json:"value,omitempty"`
   385  	// ForceSendFields is a list of field names (e.g. "Value") to unconditionally
   386  	// include in API requests. By default, fields with empty or default values are
   387  	// omitted from API requests. See
   388  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   389  	// details.
   390  	ForceSendFields []string `json:"-"`
   391  	// NullFields is a list of field names (e.g. "Value") to include in API
   392  	// requests with the JSON null value. By default, fields with empty values are
   393  	// omitted from API requests. See
   394  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   395  	NullFields []string `json:"-"`
   396  }
   397  
   398  func (s *GoogleCloudResourcesettingsV1ValueEnumValue) MarshalJSON() ([]byte, error) {
   399  	type NoMethod GoogleCloudResourcesettingsV1ValueEnumValue
   400  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   401  }
   402  
   403  // GoogleCloudResourcesettingsV1ValueStringMap: A string->string map value that
   404  // can hold a map of string keys to string values. The maximum length of each
   405  // string is 200 characters and there can be a maximum of 50 key-value pairs in
   406  // the map.
   407  type GoogleCloudResourcesettingsV1ValueStringMap struct {
   408  	// Mappings: The key-value pairs in the map
   409  	Mappings map[string]string `json:"mappings,omitempty"`
   410  	// ForceSendFields is a list of field names (e.g. "Mappings") to
   411  	// unconditionally include in API requests. By default, fields with empty or
   412  	// default values are omitted from API requests. See
   413  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   414  	// details.
   415  	ForceSendFields []string `json:"-"`
   416  	// NullFields is a list of field names (e.g. "Mappings") to include in API
   417  	// requests with the JSON null value. By default, fields with empty values are
   418  	// omitted from API requests. See
   419  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   420  	NullFields []string `json:"-"`
   421  }
   422  
   423  func (s *GoogleCloudResourcesettingsV1ValueStringMap) MarshalJSON() ([]byte, error) {
   424  	type NoMethod GoogleCloudResourcesettingsV1ValueStringMap
   425  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   426  }
   427  
   428  // GoogleCloudResourcesettingsV1ValueStringSet: A string set value that can
   429  // hold a set of strings. The maximum length of each string is 200 characters
   430  // and there can be a maximum of 50 strings in the string set.
   431  type GoogleCloudResourcesettingsV1ValueStringSet struct {
   432  	// Values: The strings in the set
   433  	Values []string `json:"values,omitempty"`
   434  	// ForceSendFields is a list of field names (e.g. "Values") to unconditionally
   435  	// include in API requests. By default, fields with empty or default values are
   436  	// omitted from API requests. See
   437  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   438  	// details.
   439  	ForceSendFields []string `json:"-"`
   440  	// NullFields is a list of field names (e.g. "Values") to include in API
   441  	// requests with the JSON null value. By default, fields with empty values are
   442  	// omitted from API requests. See
   443  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   444  	NullFields []string `json:"-"`
   445  }
   446  
   447  func (s *GoogleCloudResourcesettingsV1ValueStringSet) MarshalJSON() ([]byte, error) {
   448  	type NoMethod GoogleCloudResourcesettingsV1ValueStringSet
   449  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   450  }
   451  
   452  type FoldersSettingsGetCall struct {
   453  	s            *Service
   454  	name         string
   455  	urlParams_   gensupport.URLParams
   456  	ifNoneMatch_ string
   457  	ctx_         context.Context
   458  	header_      http.Header
   459  }
   460  
   461  // Get: Returns a specified setting. Returns a `google.rpc.Status` with
   462  // `google.rpc.Code.NOT_FOUND` if the setting does not exist.
   463  //
   464  // - name: The name of the setting to get. See Setting for naming requirements.
   465  func (r *FoldersSettingsService) Get(name string) *FoldersSettingsGetCall {
   466  	c := &FoldersSettingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   467  	c.name = name
   468  	return c
   469  }
   470  
   471  // View sets the optional parameter "view": The SettingView for this request.
   472  //
   473  // Possible values:
   474  //
   475  //	"SETTING_VIEW_UNSPECIFIED" - The default / unset value. The API will
   476  //
   477  // default to the SETTING_VIEW_BASIC view.
   478  //
   479  //	"SETTING_VIEW_BASIC" - Include Setting.metadata, but nothing else. This is
   480  //
   481  // the default value (for both ListSettings and GetSetting).
   482  //
   483  //	"SETTING_VIEW_EFFECTIVE_VALUE" - Include Setting.effective_value, but
   484  //
   485  // nothing else.
   486  //
   487  //	"SETTING_VIEW_LOCAL_VALUE" - Include Setting.local_value, but nothing
   488  //
   489  // else.
   490  func (c *FoldersSettingsGetCall) View(view string) *FoldersSettingsGetCall {
   491  	c.urlParams_.Set("view", view)
   492  	return c
   493  }
   494  
   495  // Fields allows partial responses to be retrieved. See
   496  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   497  // details.
   498  func (c *FoldersSettingsGetCall) Fields(s ...googleapi.Field) *FoldersSettingsGetCall {
   499  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   500  	return c
   501  }
   502  
   503  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   504  // object's ETag matches the given value. This is useful for getting updates
   505  // only after the object has changed since the last request.
   506  func (c *FoldersSettingsGetCall) IfNoneMatch(entityTag string) *FoldersSettingsGetCall {
   507  	c.ifNoneMatch_ = entityTag
   508  	return c
   509  }
   510  
   511  // Context sets the context to be used in this call's Do method.
   512  func (c *FoldersSettingsGetCall) Context(ctx context.Context) *FoldersSettingsGetCall {
   513  	c.ctx_ = ctx
   514  	return c
   515  }
   516  
   517  // Header returns a http.Header that can be modified by the caller to add
   518  // headers to the request.
   519  func (c *FoldersSettingsGetCall) Header() http.Header {
   520  	if c.header_ == nil {
   521  		c.header_ = make(http.Header)
   522  	}
   523  	return c.header_
   524  }
   525  
   526  func (c *FoldersSettingsGetCall) doRequest(alt string) (*http.Response, error) {
   527  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   528  	if c.ifNoneMatch_ != "" {
   529  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   530  	}
   531  	var body io.Reader = nil
   532  	c.urlParams_.Set("alt", alt)
   533  	c.urlParams_.Set("prettyPrint", "false")
   534  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
   535  	urls += "?" + c.urlParams_.Encode()
   536  	req, err := http.NewRequest("GET", urls, body)
   537  	if err != nil {
   538  		return nil, err
   539  	}
   540  	req.Header = reqHeaders
   541  	googleapi.Expand(req.URL, map[string]string{
   542  		"name": c.name,
   543  	})
   544  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   545  }
   546  
   547  // Do executes the "resourcesettings.folders.settings.get" call.
   548  // Any non-2xx status code is an error. Response headers are in either
   549  // *GoogleCloudResourcesettingsV1Setting.ServerResponse.Header or (if a
   550  // response was returned at all) in error.(*googleapi.Error).Header. Use
   551  // googleapi.IsNotModified to check whether the returned error was because
   552  // http.StatusNotModified was returned.
   553  func (c *FoldersSettingsGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1Setting, error) {
   554  	gensupport.SetOptions(c.urlParams_, opts...)
   555  	res, err := c.doRequest("json")
   556  	if res != nil && res.StatusCode == http.StatusNotModified {
   557  		if res.Body != nil {
   558  			res.Body.Close()
   559  		}
   560  		return nil, gensupport.WrapError(&googleapi.Error{
   561  			Code:   res.StatusCode,
   562  			Header: res.Header,
   563  		})
   564  	}
   565  	if err != nil {
   566  		return nil, err
   567  	}
   568  	defer googleapi.CloseBody(res)
   569  	if err := googleapi.CheckResponse(res); err != nil {
   570  		return nil, gensupport.WrapError(err)
   571  	}
   572  	ret := &GoogleCloudResourcesettingsV1Setting{
   573  		ServerResponse: googleapi.ServerResponse{
   574  			Header:         res.Header,
   575  			HTTPStatusCode: res.StatusCode,
   576  		},
   577  	}
   578  	target := &ret
   579  	if err := gensupport.DecodeResponse(target, res); err != nil {
   580  		return nil, err
   581  	}
   582  	return ret, nil
   583  }
   584  
   585  type FoldersSettingsListCall struct {
   586  	s            *Service
   587  	parent       string
   588  	urlParams_   gensupport.URLParams
   589  	ifNoneMatch_ string
   590  	ctx_         context.Context
   591  	header_      http.Header
   592  }
   593  
   594  // List: Lists all the settings that are available on the Cloud resource
   595  // `parent`.
   596  //
   597  //   - parent: The project, folder, or organization that is the parent resource
   598  //     for this setting. Must be in one of the following forms: *
   599  //     `projects/{project_number}` * `projects/{project_id}` *
   600  //     `folders/{folder_id}` * `organizations/{organization_id}`.
   601  func (r *FoldersSettingsService) List(parent string) *FoldersSettingsListCall {
   602  	c := &FoldersSettingsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   603  	c.parent = parent
   604  	return c
   605  }
   606  
   607  // PageSize sets the optional parameter "pageSize": Unused. The size of the
   608  // page to be returned.
   609  func (c *FoldersSettingsListCall) PageSize(pageSize int64) *FoldersSettingsListCall {
   610  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
   611  	return c
   612  }
   613  
   614  // PageToken sets the optional parameter "pageToken": Unused. A page token used
   615  // to retrieve the next page.
   616  func (c *FoldersSettingsListCall) PageToken(pageToken string) *FoldersSettingsListCall {
   617  	c.urlParams_.Set("pageToken", pageToken)
   618  	return c
   619  }
   620  
   621  // View sets the optional parameter "view": The SettingView for this request.
   622  //
   623  // Possible values:
   624  //
   625  //	"SETTING_VIEW_UNSPECIFIED" - The default / unset value. The API will
   626  //
   627  // default to the SETTING_VIEW_BASIC view.
   628  //
   629  //	"SETTING_VIEW_BASIC" - Include Setting.metadata, but nothing else. This is
   630  //
   631  // the default value (for both ListSettings and GetSetting).
   632  //
   633  //	"SETTING_VIEW_EFFECTIVE_VALUE" - Include Setting.effective_value, but
   634  //
   635  // nothing else.
   636  //
   637  //	"SETTING_VIEW_LOCAL_VALUE" - Include Setting.local_value, but nothing
   638  //
   639  // else.
   640  func (c *FoldersSettingsListCall) View(view string) *FoldersSettingsListCall {
   641  	c.urlParams_.Set("view", view)
   642  	return c
   643  }
   644  
   645  // Fields allows partial responses to be retrieved. See
   646  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   647  // details.
   648  func (c *FoldersSettingsListCall) Fields(s ...googleapi.Field) *FoldersSettingsListCall {
   649  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   650  	return c
   651  }
   652  
   653  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   654  // object's ETag matches the given value. This is useful for getting updates
   655  // only after the object has changed since the last request.
   656  func (c *FoldersSettingsListCall) IfNoneMatch(entityTag string) *FoldersSettingsListCall {
   657  	c.ifNoneMatch_ = entityTag
   658  	return c
   659  }
   660  
   661  // Context sets the context to be used in this call's Do method.
   662  func (c *FoldersSettingsListCall) Context(ctx context.Context) *FoldersSettingsListCall {
   663  	c.ctx_ = ctx
   664  	return c
   665  }
   666  
   667  // Header returns a http.Header that can be modified by the caller to add
   668  // headers to the request.
   669  func (c *FoldersSettingsListCall) Header() http.Header {
   670  	if c.header_ == nil {
   671  		c.header_ = make(http.Header)
   672  	}
   673  	return c.header_
   674  }
   675  
   676  func (c *FoldersSettingsListCall) doRequest(alt string) (*http.Response, error) {
   677  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   678  	if c.ifNoneMatch_ != "" {
   679  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   680  	}
   681  	var body io.Reader = nil
   682  	c.urlParams_.Set("alt", alt)
   683  	c.urlParams_.Set("prettyPrint", "false")
   684  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/settings")
   685  	urls += "?" + c.urlParams_.Encode()
   686  	req, err := http.NewRequest("GET", urls, body)
   687  	if err != nil {
   688  		return nil, err
   689  	}
   690  	req.Header = reqHeaders
   691  	googleapi.Expand(req.URL, map[string]string{
   692  		"parent": c.parent,
   693  	})
   694  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   695  }
   696  
   697  // Do executes the "resourcesettings.folders.settings.list" call.
   698  // Any non-2xx status code is an error. Response headers are in either
   699  // *GoogleCloudResourcesettingsV1ListSettingsResponse.ServerResponse.Header or
   700  // (if a response was returned at all) in error.(*googleapi.Error).Header. Use
   701  // googleapi.IsNotModified to check whether the returned error was because
   702  // http.StatusNotModified was returned.
   703  func (c *FoldersSettingsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1ListSettingsResponse, error) {
   704  	gensupport.SetOptions(c.urlParams_, opts...)
   705  	res, err := c.doRequest("json")
   706  	if res != nil && res.StatusCode == http.StatusNotModified {
   707  		if res.Body != nil {
   708  			res.Body.Close()
   709  		}
   710  		return nil, gensupport.WrapError(&googleapi.Error{
   711  			Code:   res.StatusCode,
   712  			Header: res.Header,
   713  		})
   714  	}
   715  	if err != nil {
   716  		return nil, err
   717  	}
   718  	defer googleapi.CloseBody(res)
   719  	if err := googleapi.CheckResponse(res); err != nil {
   720  		return nil, gensupport.WrapError(err)
   721  	}
   722  	ret := &GoogleCloudResourcesettingsV1ListSettingsResponse{
   723  		ServerResponse: googleapi.ServerResponse{
   724  			Header:         res.Header,
   725  			HTTPStatusCode: res.StatusCode,
   726  		},
   727  	}
   728  	target := &ret
   729  	if err := gensupport.DecodeResponse(target, res); err != nil {
   730  		return nil, err
   731  	}
   732  	return ret, nil
   733  }
   734  
   735  // Pages invokes f for each page of results.
   736  // A non-nil error returned from f will halt the iteration.
   737  // The provided context supersedes any context provided to the Context method.
   738  func (c *FoldersSettingsListCall) Pages(ctx context.Context, f func(*GoogleCloudResourcesettingsV1ListSettingsResponse) error) error {
   739  	c.ctx_ = ctx
   740  	defer c.PageToken(c.urlParams_.Get("pageToken"))
   741  	for {
   742  		x, err := c.Do()
   743  		if err != nil {
   744  			return err
   745  		}
   746  		if err := f(x); err != nil {
   747  			return err
   748  		}
   749  		if x.NextPageToken == "" {
   750  			return nil
   751  		}
   752  		c.PageToken(x.NextPageToken)
   753  	}
   754  }
   755  
   756  type FoldersSettingsPatchCall struct {
   757  	s                                    *Service
   758  	name                                 string
   759  	googlecloudresourcesettingsv1setting *GoogleCloudResourcesettingsV1Setting
   760  	urlParams_                           gensupport.URLParams
   761  	ctx_                                 context.Context
   762  	header_                              http.Header
   763  }
   764  
   765  // Patch: Updates a specified setting. Returns a `google.rpc.Status` with
   766  // `google.rpc.Code.NOT_FOUND` if the setting does not exist. Returns a
   767  // `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if the
   768  // setting is flagged as read only. Returns a `google.rpc.Status` with
   769  // `google.rpc.Code.ABORTED` if the etag supplied in the request does not match
   770  // the persisted etag of the setting value. On success, the response will
   771  // contain only `name`, `local_value` and `etag`. The `metadata` and
   772  // `effective_value` cannot be updated through this API. Note: the supplied
   773  // setting will perform a full overwrite of the `local_value` field.
   774  //
   775  //   - name: The resource name of the setting. Must be in one of the following
   776  //     forms: * `projects/{project_number}/settings/{setting_name}` *
   777  //     `folders/{folder_id}/settings/{setting_name}` *
   778  //     `organizations/{organization_id}/settings/{setting_name}` For example,
   779  //     "/projects/123/settings/gcp-enableMyFeature".
   780  func (r *FoldersSettingsService) Patch(name string, googlecloudresourcesettingsv1setting *GoogleCloudResourcesettingsV1Setting) *FoldersSettingsPatchCall {
   781  	c := &FoldersSettingsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   782  	c.name = name
   783  	c.googlecloudresourcesettingsv1setting = googlecloudresourcesettingsv1setting
   784  	return c
   785  }
   786  
   787  // Fields allows partial responses to be retrieved. See
   788  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   789  // details.
   790  func (c *FoldersSettingsPatchCall) Fields(s ...googleapi.Field) *FoldersSettingsPatchCall {
   791  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   792  	return c
   793  }
   794  
   795  // Context sets the context to be used in this call's Do method.
   796  func (c *FoldersSettingsPatchCall) Context(ctx context.Context) *FoldersSettingsPatchCall {
   797  	c.ctx_ = ctx
   798  	return c
   799  }
   800  
   801  // Header returns a http.Header that can be modified by the caller to add
   802  // headers to the request.
   803  func (c *FoldersSettingsPatchCall) Header() http.Header {
   804  	if c.header_ == nil {
   805  		c.header_ = make(http.Header)
   806  	}
   807  	return c.header_
   808  }
   809  
   810  func (c *FoldersSettingsPatchCall) doRequest(alt string) (*http.Response, error) {
   811  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   812  	var body io.Reader = nil
   813  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudresourcesettingsv1setting)
   814  	if err != nil {
   815  		return nil, err
   816  	}
   817  	c.urlParams_.Set("alt", alt)
   818  	c.urlParams_.Set("prettyPrint", "false")
   819  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
   820  	urls += "?" + c.urlParams_.Encode()
   821  	req, err := http.NewRequest("PATCH", urls, body)
   822  	if err != nil {
   823  		return nil, err
   824  	}
   825  	req.Header = reqHeaders
   826  	googleapi.Expand(req.URL, map[string]string{
   827  		"name": c.name,
   828  	})
   829  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   830  }
   831  
   832  // Do executes the "resourcesettings.folders.settings.patch" call.
   833  // Any non-2xx status code is an error. Response headers are in either
   834  // *GoogleCloudResourcesettingsV1Setting.ServerResponse.Header or (if a
   835  // response was returned at all) in error.(*googleapi.Error).Header. Use
   836  // googleapi.IsNotModified to check whether the returned error was because
   837  // http.StatusNotModified was returned.
   838  func (c *FoldersSettingsPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1Setting, error) {
   839  	gensupport.SetOptions(c.urlParams_, opts...)
   840  	res, err := c.doRequest("json")
   841  	if res != nil && res.StatusCode == http.StatusNotModified {
   842  		if res.Body != nil {
   843  			res.Body.Close()
   844  		}
   845  		return nil, gensupport.WrapError(&googleapi.Error{
   846  			Code:   res.StatusCode,
   847  			Header: res.Header,
   848  		})
   849  	}
   850  	if err != nil {
   851  		return nil, err
   852  	}
   853  	defer googleapi.CloseBody(res)
   854  	if err := googleapi.CheckResponse(res); err != nil {
   855  		return nil, gensupport.WrapError(err)
   856  	}
   857  	ret := &GoogleCloudResourcesettingsV1Setting{
   858  		ServerResponse: googleapi.ServerResponse{
   859  			Header:         res.Header,
   860  			HTTPStatusCode: res.StatusCode,
   861  		},
   862  	}
   863  	target := &ret
   864  	if err := gensupport.DecodeResponse(target, res); err != nil {
   865  		return nil, err
   866  	}
   867  	return ret, nil
   868  }
   869  
   870  type OrganizationsSettingsGetCall struct {
   871  	s            *Service
   872  	name         string
   873  	urlParams_   gensupport.URLParams
   874  	ifNoneMatch_ string
   875  	ctx_         context.Context
   876  	header_      http.Header
   877  }
   878  
   879  // Get: Returns a specified setting. Returns a `google.rpc.Status` with
   880  // `google.rpc.Code.NOT_FOUND` if the setting does not exist.
   881  //
   882  // - name: The name of the setting to get. See Setting for naming requirements.
   883  func (r *OrganizationsSettingsService) Get(name string) *OrganizationsSettingsGetCall {
   884  	c := &OrganizationsSettingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   885  	c.name = name
   886  	return c
   887  }
   888  
   889  // View sets the optional parameter "view": The SettingView for this request.
   890  //
   891  // Possible values:
   892  //
   893  //	"SETTING_VIEW_UNSPECIFIED" - The default / unset value. The API will
   894  //
   895  // default to the SETTING_VIEW_BASIC view.
   896  //
   897  //	"SETTING_VIEW_BASIC" - Include Setting.metadata, but nothing else. This is
   898  //
   899  // the default value (for both ListSettings and GetSetting).
   900  //
   901  //	"SETTING_VIEW_EFFECTIVE_VALUE" - Include Setting.effective_value, but
   902  //
   903  // nothing else.
   904  //
   905  //	"SETTING_VIEW_LOCAL_VALUE" - Include Setting.local_value, but nothing
   906  //
   907  // else.
   908  func (c *OrganizationsSettingsGetCall) View(view string) *OrganizationsSettingsGetCall {
   909  	c.urlParams_.Set("view", view)
   910  	return c
   911  }
   912  
   913  // Fields allows partial responses to be retrieved. See
   914  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   915  // details.
   916  func (c *OrganizationsSettingsGetCall) Fields(s ...googleapi.Field) *OrganizationsSettingsGetCall {
   917  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   918  	return c
   919  }
   920  
   921  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   922  // object's ETag matches the given value. This is useful for getting updates
   923  // only after the object has changed since the last request.
   924  func (c *OrganizationsSettingsGetCall) IfNoneMatch(entityTag string) *OrganizationsSettingsGetCall {
   925  	c.ifNoneMatch_ = entityTag
   926  	return c
   927  }
   928  
   929  // Context sets the context to be used in this call's Do method.
   930  func (c *OrganizationsSettingsGetCall) Context(ctx context.Context) *OrganizationsSettingsGetCall {
   931  	c.ctx_ = ctx
   932  	return c
   933  }
   934  
   935  // Header returns a http.Header that can be modified by the caller to add
   936  // headers to the request.
   937  func (c *OrganizationsSettingsGetCall) Header() http.Header {
   938  	if c.header_ == nil {
   939  		c.header_ = make(http.Header)
   940  	}
   941  	return c.header_
   942  }
   943  
   944  func (c *OrganizationsSettingsGetCall) doRequest(alt string) (*http.Response, error) {
   945  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   946  	if c.ifNoneMatch_ != "" {
   947  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   948  	}
   949  	var body io.Reader = nil
   950  	c.urlParams_.Set("alt", alt)
   951  	c.urlParams_.Set("prettyPrint", "false")
   952  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
   953  	urls += "?" + c.urlParams_.Encode()
   954  	req, err := http.NewRequest("GET", urls, body)
   955  	if err != nil {
   956  		return nil, err
   957  	}
   958  	req.Header = reqHeaders
   959  	googleapi.Expand(req.URL, map[string]string{
   960  		"name": c.name,
   961  	})
   962  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   963  }
   964  
   965  // Do executes the "resourcesettings.organizations.settings.get" call.
   966  // Any non-2xx status code is an error. Response headers are in either
   967  // *GoogleCloudResourcesettingsV1Setting.ServerResponse.Header or (if a
   968  // response was returned at all) in error.(*googleapi.Error).Header. Use
   969  // googleapi.IsNotModified to check whether the returned error was because
   970  // http.StatusNotModified was returned.
   971  func (c *OrganizationsSettingsGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1Setting, error) {
   972  	gensupport.SetOptions(c.urlParams_, opts...)
   973  	res, err := c.doRequest("json")
   974  	if res != nil && res.StatusCode == http.StatusNotModified {
   975  		if res.Body != nil {
   976  			res.Body.Close()
   977  		}
   978  		return nil, gensupport.WrapError(&googleapi.Error{
   979  			Code:   res.StatusCode,
   980  			Header: res.Header,
   981  		})
   982  	}
   983  	if err != nil {
   984  		return nil, err
   985  	}
   986  	defer googleapi.CloseBody(res)
   987  	if err := googleapi.CheckResponse(res); err != nil {
   988  		return nil, gensupport.WrapError(err)
   989  	}
   990  	ret := &GoogleCloudResourcesettingsV1Setting{
   991  		ServerResponse: googleapi.ServerResponse{
   992  			Header:         res.Header,
   993  			HTTPStatusCode: res.StatusCode,
   994  		},
   995  	}
   996  	target := &ret
   997  	if err := gensupport.DecodeResponse(target, res); err != nil {
   998  		return nil, err
   999  	}
  1000  	return ret, nil
  1001  }
  1002  
  1003  type OrganizationsSettingsListCall struct {
  1004  	s            *Service
  1005  	parent       string
  1006  	urlParams_   gensupport.URLParams
  1007  	ifNoneMatch_ string
  1008  	ctx_         context.Context
  1009  	header_      http.Header
  1010  }
  1011  
  1012  // List: Lists all the settings that are available on the Cloud resource
  1013  // `parent`.
  1014  //
  1015  //   - parent: The project, folder, or organization that is the parent resource
  1016  //     for this setting. Must be in one of the following forms: *
  1017  //     `projects/{project_number}` * `projects/{project_id}` *
  1018  //     `folders/{folder_id}` * `organizations/{organization_id}`.
  1019  func (r *OrganizationsSettingsService) List(parent string) *OrganizationsSettingsListCall {
  1020  	c := &OrganizationsSettingsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1021  	c.parent = parent
  1022  	return c
  1023  }
  1024  
  1025  // PageSize sets the optional parameter "pageSize": Unused. The size of the
  1026  // page to be returned.
  1027  func (c *OrganizationsSettingsListCall) PageSize(pageSize int64) *OrganizationsSettingsListCall {
  1028  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1029  	return c
  1030  }
  1031  
  1032  // PageToken sets the optional parameter "pageToken": Unused. A page token used
  1033  // to retrieve the next page.
  1034  func (c *OrganizationsSettingsListCall) PageToken(pageToken string) *OrganizationsSettingsListCall {
  1035  	c.urlParams_.Set("pageToken", pageToken)
  1036  	return c
  1037  }
  1038  
  1039  // View sets the optional parameter "view": The SettingView for this request.
  1040  //
  1041  // Possible values:
  1042  //
  1043  //	"SETTING_VIEW_UNSPECIFIED" - The default / unset value. The API will
  1044  //
  1045  // default to the SETTING_VIEW_BASIC view.
  1046  //
  1047  //	"SETTING_VIEW_BASIC" - Include Setting.metadata, but nothing else. This is
  1048  //
  1049  // the default value (for both ListSettings and GetSetting).
  1050  //
  1051  //	"SETTING_VIEW_EFFECTIVE_VALUE" - Include Setting.effective_value, but
  1052  //
  1053  // nothing else.
  1054  //
  1055  //	"SETTING_VIEW_LOCAL_VALUE" - Include Setting.local_value, but nothing
  1056  //
  1057  // else.
  1058  func (c *OrganizationsSettingsListCall) View(view string) *OrganizationsSettingsListCall {
  1059  	c.urlParams_.Set("view", view)
  1060  	return c
  1061  }
  1062  
  1063  // Fields allows partial responses to be retrieved. See
  1064  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1065  // details.
  1066  func (c *OrganizationsSettingsListCall) Fields(s ...googleapi.Field) *OrganizationsSettingsListCall {
  1067  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1068  	return c
  1069  }
  1070  
  1071  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1072  // object's ETag matches the given value. This is useful for getting updates
  1073  // only after the object has changed since the last request.
  1074  func (c *OrganizationsSettingsListCall) IfNoneMatch(entityTag string) *OrganizationsSettingsListCall {
  1075  	c.ifNoneMatch_ = entityTag
  1076  	return c
  1077  }
  1078  
  1079  // Context sets the context to be used in this call's Do method.
  1080  func (c *OrganizationsSettingsListCall) Context(ctx context.Context) *OrganizationsSettingsListCall {
  1081  	c.ctx_ = ctx
  1082  	return c
  1083  }
  1084  
  1085  // Header returns a http.Header that can be modified by the caller to add
  1086  // headers to the request.
  1087  func (c *OrganizationsSettingsListCall) Header() http.Header {
  1088  	if c.header_ == nil {
  1089  		c.header_ = make(http.Header)
  1090  	}
  1091  	return c.header_
  1092  }
  1093  
  1094  func (c *OrganizationsSettingsListCall) doRequest(alt string) (*http.Response, error) {
  1095  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1096  	if c.ifNoneMatch_ != "" {
  1097  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1098  	}
  1099  	var body io.Reader = nil
  1100  	c.urlParams_.Set("alt", alt)
  1101  	c.urlParams_.Set("prettyPrint", "false")
  1102  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/settings")
  1103  	urls += "?" + c.urlParams_.Encode()
  1104  	req, err := http.NewRequest("GET", urls, body)
  1105  	if err != nil {
  1106  		return nil, err
  1107  	}
  1108  	req.Header = reqHeaders
  1109  	googleapi.Expand(req.URL, map[string]string{
  1110  		"parent": c.parent,
  1111  	})
  1112  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1113  }
  1114  
  1115  // Do executes the "resourcesettings.organizations.settings.list" call.
  1116  // Any non-2xx status code is an error. Response headers are in either
  1117  // *GoogleCloudResourcesettingsV1ListSettingsResponse.ServerResponse.Header or
  1118  // (if a response was returned at all) in error.(*googleapi.Error).Header. Use
  1119  // googleapi.IsNotModified to check whether the returned error was because
  1120  // http.StatusNotModified was returned.
  1121  func (c *OrganizationsSettingsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1ListSettingsResponse, error) {
  1122  	gensupport.SetOptions(c.urlParams_, opts...)
  1123  	res, err := c.doRequest("json")
  1124  	if res != nil && res.StatusCode == http.StatusNotModified {
  1125  		if res.Body != nil {
  1126  			res.Body.Close()
  1127  		}
  1128  		return nil, gensupport.WrapError(&googleapi.Error{
  1129  			Code:   res.StatusCode,
  1130  			Header: res.Header,
  1131  		})
  1132  	}
  1133  	if err != nil {
  1134  		return nil, err
  1135  	}
  1136  	defer googleapi.CloseBody(res)
  1137  	if err := googleapi.CheckResponse(res); err != nil {
  1138  		return nil, gensupport.WrapError(err)
  1139  	}
  1140  	ret := &GoogleCloudResourcesettingsV1ListSettingsResponse{
  1141  		ServerResponse: googleapi.ServerResponse{
  1142  			Header:         res.Header,
  1143  			HTTPStatusCode: res.StatusCode,
  1144  		},
  1145  	}
  1146  	target := &ret
  1147  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1148  		return nil, err
  1149  	}
  1150  	return ret, nil
  1151  }
  1152  
  1153  // Pages invokes f for each page of results.
  1154  // A non-nil error returned from f will halt the iteration.
  1155  // The provided context supersedes any context provided to the Context method.
  1156  func (c *OrganizationsSettingsListCall) Pages(ctx context.Context, f func(*GoogleCloudResourcesettingsV1ListSettingsResponse) error) error {
  1157  	c.ctx_ = ctx
  1158  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1159  	for {
  1160  		x, err := c.Do()
  1161  		if err != nil {
  1162  			return err
  1163  		}
  1164  		if err := f(x); err != nil {
  1165  			return err
  1166  		}
  1167  		if x.NextPageToken == "" {
  1168  			return nil
  1169  		}
  1170  		c.PageToken(x.NextPageToken)
  1171  	}
  1172  }
  1173  
  1174  type OrganizationsSettingsPatchCall struct {
  1175  	s                                    *Service
  1176  	name                                 string
  1177  	googlecloudresourcesettingsv1setting *GoogleCloudResourcesettingsV1Setting
  1178  	urlParams_                           gensupport.URLParams
  1179  	ctx_                                 context.Context
  1180  	header_                              http.Header
  1181  }
  1182  
  1183  // Patch: Updates a specified setting. Returns a `google.rpc.Status` with
  1184  // `google.rpc.Code.NOT_FOUND` if the setting does not exist. Returns a
  1185  // `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if the
  1186  // setting is flagged as read only. Returns a `google.rpc.Status` with
  1187  // `google.rpc.Code.ABORTED` if the etag supplied in the request does not match
  1188  // the persisted etag of the setting value. On success, the response will
  1189  // contain only `name`, `local_value` and `etag`. The `metadata` and
  1190  // `effective_value` cannot be updated through this API. Note: the supplied
  1191  // setting will perform a full overwrite of the `local_value` field.
  1192  //
  1193  //   - name: The resource name of the setting. Must be in one of the following
  1194  //     forms: * `projects/{project_number}/settings/{setting_name}` *
  1195  //     `folders/{folder_id}/settings/{setting_name}` *
  1196  //     `organizations/{organization_id}/settings/{setting_name}` For example,
  1197  //     "/projects/123/settings/gcp-enableMyFeature".
  1198  func (r *OrganizationsSettingsService) Patch(name string, googlecloudresourcesettingsv1setting *GoogleCloudResourcesettingsV1Setting) *OrganizationsSettingsPatchCall {
  1199  	c := &OrganizationsSettingsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1200  	c.name = name
  1201  	c.googlecloudresourcesettingsv1setting = googlecloudresourcesettingsv1setting
  1202  	return c
  1203  }
  1204  
  1205  // Fields allows partial responses to be retrieved. See
  1206  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1207  // details.
  1208  func (c *OrganizationsSettingsPatchCall) Fields(s ...googleapi.Field) *OrganizationsSettingsPatchCall {
  1209  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1210  	return c
  1211  }
  1212  
  1213  // Context sets the context to be used in this call's Do method.
  1214  func (c *OrganizationsSettingsPatchCall) Context(ctx context.Context) *OrganizationsSettingsPatchCall {
  1215  	c.ctx_ = ctx
  1216  	return c
  1217  }
  1218  
  1219  // Header returns a http.Header that can be modified by the caller to add
  1220  // headers to the request.
  1221  func (c *OrganizationsSettingsPatchCall) Header() http.Header {
  1222  	if c.header_ == nil {
  1223  		c.header_ = make(http.Header)
  1224  	}
  1225  	return c.header_
  1226  }
  1227  
  1228  func (c *OrganizationsSettingsPatchCall) doRequest(alt string) (*http.Response, error) {
  1229  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1230  	var body io.Reader = nil
  1231  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudresourcesettingsv1setting)
  1232  	if err != nil {
  1233  		return nil, err
  1234  	}
  1235  	c.urlParams_.Set("alt", alt)
  1236  	c.urlParams_.Set("prettyPrint", "false")
  1237  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1238  	urls += "?" + c.urlParams_.Encode()
  1239  	req, err := http.NewRequest("PATCH", urls, body)
  1240  	if err != nil {
  1241  		return nil, err
  1242  	}
  1243  	req.Header = reqHeaders
  1244  	googleapi.Expand(req.URL, map[string]string{
  1245  		"name": c.name,
  1246  	})
  1247  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1248  }
  1249  
  1250  // Do executes the "resourcesettings.organizations.settings.patch" call.
  1251  // Any non-2xx status code is an error. Response headers are in either
  1252  // *GoogleCloudResourcesettingsV1Setting.ServerResponse.Header or (if a
  1253  // response was returned at all) in error.(*googleapi.Error).Header. Use
  1254  // googleapi.IsNotModified to check whether the returned error was because
  1255  // http.StatusNotModified was returned.
  1256  func (c *OrganizationsSettingsPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1Setting, error) {
  1257  	gensupport.SetOptions(c.urlParams_, opts...)
  1258  	res, err := c.doRequest("json")
  1259  	if res != nil && res.StatusCode == http.StatusNotModified {
  1260  		if res.Body != nil {
  1261  			res.Body.Close()
  1262  		}
  1263  		return nil, gensupport.WrapError(&googleapi.Error{
  1264  			Code:   res.StatusCode,
  1265  			Header: res.Header,
  1266  		})
  1267  	}
  1268  	if err != nil {
  1269  		return nil, err
  1270  	}
  1271  	defer googleapi.CloseBody(res)
  1272  	if err := googleapi.CheckResponse(res); err != nil {
  1273  		return nil, gensupport.WrapError(err)
  1274  	}
  1275  	ret := &GoogleCloudResourcesettingsV1Setting{
  1276  		ServerResponse: googleapi.ServerResponse{
  1277  			Header:         res.Header,
  1278  			HTTPStatusCode: res.StatusCode,
  1279  		},
  1280  	}
  1281  	target := &ret
  1282  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1283  		return nil, err
  1284  	}
  1285  	return ret, nil
  1286  }
  1287  
  1288  type ProjectsSettingsGetCall struct {
  1289  	s            *Service
  1290  	name         string
  1291  	urlParams_   gensupport.URLParams
  1292  	ifNoneMatch_ string
  1293  	ctx_         context.Context
  1294  	header_      http.Header
  1295  }
  1296  
  1297  // Get: Returns a specified setting. Returns a `google.rpc.Status` with
  1298  // `google.rpc.Code.NOT_FOUND` if the setting does not exist.
  1299  //
  1300  // - name: The name of the setting to get. See Setting for naming requirements.
  1301  func (r *ProjectsSettingsService) Get(name string) *ProjectsSettingsGetCall {
  1302  	c := &ProjectsSettingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1303  	c.name = name
  1304  	return c
  1305  }
  1306  
  1307  // View sets the optional parameter "view": The SettingView for this request.
  1308  //
  1309  // Possible values:
  1310  //
  1311  //	"SETTING_VIEW_UNSPECIFIED" - The default / unset value. The API will
  1312  //
  1313  // default to the SETTING_VIEW_BASIC view.
  1314  //
  1315  //	"SETTING_VIEW_BASIC" - Include Setting.metadata, but nothing else. This is
  1316  //
  1317  // the default value (for both ListSettings and GetSetting).
  1318  //
  1319  //	"SETTING_VIEW_EFFECTIVE_VALUE" - Include Setting.effective_value, but
  1320  //
  1321  // nothing else.
  1322  //
  1323  //	"SETTING_VIEW_LOCAL_VALUE" - Include Setting.local_value, but nothing
  1324  //
  1325  // else.
  1326  func (c *ProjectsSettingsGetCall) View(view string) *ProjectsSettingsGetCall {
  1327  	c.urlParams_.Set("view", view)
  1328  	return c
  1329  }
  1330  
  1331  // Fields allows partial responses to be retrieved. See
  1332  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1333  // details.
  1334  func (c *ProjectsSettingsGetCall) Fields(s ...googleapi.Field) *ProjectsSettingsGetCall {
  1335  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1336  	return c
  1337  }
  1338  
  1339  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1340  // object's ETag matches the given value. This is useful for getting updates
  1341  // only after the object has changed since the last request.
  1342  func (c *ProjectsSettingsGetCall) IfNoneMatch(entityTag string) *ProjectsSettingsGetCall {
  1343  	c.ifNoneMatch_ = entityTag
  1344  	return c
  1345  }
  1346  
  1347  // Context sets the context to be used in this call's Do method.
  1348  func (c *ProjectsSettingsGetCall) Context(ctx context.Context) *ProjectsSettingsGetCall {
  1349  	c.ctx_ = ctx
  1350  	return c
  1351  }
  1352  
  1353  // Header returns a http.Header that can be modified by the caller to add
  1354  // headers to the request.
  1355  func (c *ProjectsSettingsGetCall) Header() http.Header {
  1356  	if c.header_ == nil {
  1357  		c.header_ = make(http.Header)
  1358  	}
  1359  	return c.header_
  1360  }
  1361  
  1362  func (c *ProjectsSettingsGetCall) doRequest(alt string) (*http.Response, error) {
  1363  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1364  	if c.ifNoneMatch_ != "" {
  1365  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1366  	}
  1367  	var body io.Reader = nil
  1368  	c.urlParams_.Set("alt", alt)
  1369  	c.urlParams_.Set("prettyPrint", "false")
  1370  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1371  	urls += "?" + c.urlParams_.Encode()
  1372  	req, err := http.NewRequest("GET", urls, body)
  1373  	if err != nil {
  1374  		return nil, err
  1375  	}
  1376  	req.Header = reqHeaders
  1377  	googleapi.Expand(req.URL, map[string]string{
  1378  		"name": c.name,
  1379  	})
  1380  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1381  }
  1382  
  1383  // Do executes the "resourcesettings.projects.settings.get" call.
  1384  // Any non-2xx status code is an error. Response headers are in either
  1385  // *GoogleCloudResourcesettingsV1Setting.ServerResponse.Header or (if a
  1386  // response was returned at all) in error.(*googleapi.Error).Header. Use
  1387  // googleapi.IsNotModified to check whether the returned error was because
  1388  // http.StatusNotModified was returned.
  1389  func (c *ProjectsSettingsGetCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1Setting, error) {
  1390  	gensupport.SetOptions(c.urlParams_, opts...)
  1391  	res, err := c.doRequest("json")
  1392  	if res != nil && res.StatusCode == http.StatusNotModified {
  1393  		if res.Body != nil {
  1394  			res.Body.Close()
  1395  		}
  1396  		return nil, gensupport.WrapError(&googleapi.Error{
  1397  			Code:   res.StatusCode,
  1398  			Header: res.Header,
  1399  		})
  1400  	}
  1401  	if err != nil {
  1402  		return nil, err
  1403  	}
  1404  	defer googleapi.CloseBody(res)
  1405  	if err := googleapi.CheckResponse(res); err != nil {
  1406  		return nil, gensupport.WrapError(err)
  1407  	}
  1408  	ret := &GoogleCloudResourcesettingsV1Setting{
  1409  		ServerResponse: googleapi.ServerResponse{
  1410  			Header:         res.Header,
  1411  			HTTPStatusCode: res.StatusCode,
  1412  		},
  1413  	}
  1414  	target := &ret
  1415  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1416  		return nil, err
  1417  	}
  1418  	return ret, nil
  1419  }
  1420  
  1421  type ProjectsSettingsListCall struct {
  1422  	s            *Service
  1423  	parent       string
  1424  	urlParams_   gensupport.URLParams
  1425  	ifNoneMatch_ string
  1426  	ctx_         context.Context
  1427  	header_      http.Header
  1428  }
  1429  
  1430  // List: Lists all the settings that are available on the Cloud resource
  1431  // `parent`.
  1432  //
  1433  //   - parent: The project, folder, or organization that is the parent resource
  1434  //     for this setting. Must be in one of the following forms: *
  1435  //     `projects/{project_number}` * `projects/{project_id}` *
  1436  //     `folders/{folder_id}` * `organizations/{organization_id}`.
  1437  func (r *ProjectsSettingsService) List(parent string) *ProjectsSettingsListCall {
  1438  	c := &ProjectsSettingsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1439  	c.parent = parent
  1440  	return c
  1441  }
  1442  
  1443  // PageSize sets the optional parameter "pageSize": Unused. The size of the
  1444  // page to be returned.
  1445  func (c *ProjectsSettingsListCall) PageSize(pageSize int64) *ProjectsSettingsListCall {
  1446  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1447  	return c
  1448  }
  1449  
  1450  // PageToken sets the optional parameter "pageToken": Unused. A page token used
  1451  // to retrieve the next page.
  1452  func (c *ProjectsSettingsListCall) PageToken(pageToken string) *ProjectsSettingsListCall {
  1453  	c.urlParams_.Set("pageToken", pageToken)
  1454  	return c
  1455  }
  1456  
  1457  // View sets the optional parameter "view": The SettingView for this request.
  1458  //
  1459  // Possible values:
  1460  //
  1461  //	"SETTING_VIEW_UNSPECIFIED" - The default / unset value. The API will
  1462  //
  1463  // default to the SETTING_VIEW_BASIC view.
  1464  //
  1465  //	"SETTING_VIEW_BASIC" - Include Setting.metadata, but nothing else. This is
  1466  //
  1467  // the default value (for both ListSettings and GetSetting).
  1468  //
  1469  //	"SETTING_VIEW_EFFECTIVE_VALUE" - Include Setting.effective_value, but
  1470  //
  1471  // nothing else.
  1472  //
  1473  //	"SETTING_VIEW_LOCAL_VALUE" - Include Setting.local_value, but nothing
  1474  //
  1475  // else.
  1476  func (c *ProjectsSettingsListCall) View(view string) *ProjectsSettingsListCall {
  1477  	c.urlParams_.Set("view", view)
  1478  	return c
  1479  }
  1480  
  1481  // Fields allows partial responses to be retrieved. See
  1482  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1483  // details.
  1484  func (c *ProjectsSettingsListCall) Fields(s ...googleapi.Field) *ProjectsSettingsListCall {
  1485  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1486  	return c
  1487  }
  1488  
  1489  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1490  // object's ETag matches the given value. This is useful for getting updates
  1491  // only after the object has changed since the last request.
  1492  func (c *ProjectsSettingsListCall) IfNoneMatch(entityTag string) *ProjectsSettingsListCall {
  1493  	c.ifNoneMatch_ = entityTag
  1494  	return c
  1495  }
  1496  
  1497  // Context sets the context to be used in this call's Do method.
  1498  func (c *ProjectsSettingsListCall) Context(ctx context.Context) *ProjectsSettingsListCall {
  1499  	c.ctx_ = ctx
  1500  	return c
  1501  }
  1502  
  1503  // Header returns a http.Header that can be modified by the caller to add
  1504  // headers to the request.
  1505  func (c *ProjectsSettingsListCall) Header() http.Header {
  1506  	if c.header_ == nil {
  1507  		c.header_ = make(http.Header)
  1508  	}
  1509  	return c.header_
  1510  }
  1511  
  1512  func (c *ProjectsSettingsListCall) doRequest(alt string) (*http.Response, error) {
  1513  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1514  	if c.ifNoneMatch_ != "" {
  1515  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1516  	}
  1517  	var body io.Reader = nil
  1518  	c.urlParams_.Set("alt", alt)
  1519  	c.urlParams_.Set("prettyPrint", "false")
  1520  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/settings")
  1521  	urls += "?" + c.urlParams_.Encode()
  1522  	req, err := http.NewRequest("GET", urls, body)
  1523  	if err != nil {
  1524  		return nil, err
  1525  	}
  1526  	req.Header = reqHeaders
  1527  	googleapi.Expand(req.URL, map[string]string{
  1528  		"parent": c.parent,
  1529  	})
  1530  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1531  }
  1532  
  1533  // Do executes the "resourcesettings.projects.settings.list" call.
  1534  // Any non-2xx status code is an error. Response headers are in either
  1535  // *GoogleCloudResourcesettingsV1ListSettingsResponse.ServerResponse.Header or
  1536  // (if a response was returned at all) in error.(*googleapi.Error).Header. Use
  1537  // googleapi.IsNotModified to check whether the returned error was because
  1538  // http.StatusNotModified was returned.
  1539  func (c *ProjectsSettingsListCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1ListSettingsResponse, error) {
  1540  	gensupport.SetOptions(c.urlParams_, opts...)
  1541  	res, err := c.doRequest("json")
  1542  	if res != nil && res.StatusCode == http.StatusNotModified {
  1543  		if res.Body != nil {
  1544  			res.Body.Close()
  1545  		}
  1546  		return nil, gensupport.WrapError(&googleapi.Error{
  1547  			Code:   res.StatusCode,
  1548  			Header: res.Header,
  1549  		})
  1550  	}
  1551  	if err != nil {
  1552  		return nil, err
  1553  	}
  1554  	defer googleapi.CloseBody(res)
  1555  	if err := googleapi.CheckResponse(res); err != nil {
  1556  		return nil, gensupport.WrapError(err)
  1557  	}
  1558  	ret := &GoogleCloudResourcesettingsV1ListSettingsResponse{
  1559  		ServerResponse: googleapi.ServerResponse{
  1560  			Header:         res.Header,
  1561  			HTTPStatusCode: res.StatusCode,
  1562  		},
  1563  	}
  1564  	target := &ret
  1565  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1566  		return nil, err
  1567  	}
  1568  	return ret, nil
  1569  }
  1570  
  1571  // Pages invokes f for each page of results.
  1572  // A non-nil error returned from f will halt the iteration.
  1573  // The provided context supersedes any context provided to the Context method.
  1574  func (c *ProjectsSettingsListCall) Pages(ctx context.Context, f func(*GoogleCloudResourcesettingsV1ListSettingsResponse) error) error {
  1575  	c.ctx_ = ctx
  1576  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1577  	for {
  1578  		x, err := c.Do()
  1579  		if err != nil {
  1580  			return err
  1581  		}
  1582  		if err := f(x); err != nil {
  1583  			return err
  1584  		}
  1585  		if x.NextPageToken == "" {
  1586  			return nil
  1587  		}
  1588  		c.PageToken(x.NextPageToken)
  1589  	}
  1590  }
  1591  
  1592  type ProjectsSettingsPatchCall struct {
  1593  	s                                    *Service
  1594  	name                                 string
  1595  	googlecloudresourcesettingsv1setting *GoogleCloudResourcesettingsV1Setting
  1596  	urlParams_                           gensupport.URLParams
  1597  	ctx_                                 context.Context
  1598  	header_                              http.Header
  1599  }
  1600  
  1601  // Patch: Updates a specified setting. Returns a `google.rpc.Status` with
  1602  // `google.rpc.Code.NOT_FOUND` if the setting does not exist. Returns a
  1603  // `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if the
  1604  // setting is flagged as read only. Returns a `google.rpc.Status` with
  1605  // `google.rpc.Code.ABORTED` if the etag supplied in the request does not match
  1606  // the persisted etag of the setting value. On success, the response will
  1607  // contain only `name`, `local_value` and `etag`. The `metadata` and
  1608  // `effective_value` cannot be updated through this API. Note: the supplied
  1609  // setting will perform a full overwrite of the `local_value` field.
  1610  //
  1611  //   - name: The resource name of the setting. Must be in one of the following
  1612  //     forms: * `projects/{project_number}/settings/{setting_name}` *
  1613  //     `folders/{folder_id}/settings/{setting_name}` *
  1614  //     `organizations/{organization_id}/settings/{setting_name}` For example,
  1615  //     "/projects/123/settings/gcp-enableMyFeature".
  1616  func (r *ProjectsSettingsService) Patch(name string, googlecloudresourcesettingsv1setting *GoogleCloudResourcesettingsV1Setting) *ProjectsSettingsPatchCall {
  1617  	c := &ProjectsSettingsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1618  	c.name = name
  1619  	c.googlecloudresourcesettingsv1setting = googlecloudresourcesettingsv1setting
  1620  	return c
  1621  }
  1622  
  1623  // Fields allows partial responses to be retrieved. See
  1624  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1625  // details.
  1626  func (c *ProjectsSettingsPatchCall) Fields(s ...googleapi.Field) *ProjectsSettingsPatchCall {
  1627  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1628  	return c
  1629  }
  1630  
  1631  // Context sets the context to be used in this call's Do method.
  1632  func (c *ProjectsSettingsPatchCall) Context(ctx context.Context) *ProjectsSettingsPatchCall {
  1633  	c.ctx_ = ctx
  1634  	return c
  1635  }
  1636  
  1637  // Header returns a http.Header that can be modified by the caller to add
  1638  // headers to the request.
  1639  func (c *ProjectsSettingsPatchCall) Header() http.Header {
  1640  	if c.header_ == nil {
  1641  		c.header_ = make(http.Header)
  1642  	}
  1643  	return c.header_
  1644  }
  1645  
  1646  func (c *ProjectsSettingsPatchCall) doRequest(alt string) (*http.Response, error) {
  1647  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1648  	var body io.Reader = nil
  1649  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudresourcesettingsv1setting)
  1650  	if err != nil {
  1651  		return nil, err
  1652  	}
  1653  	c.urlParams_.Set("alt", alt)
  1654  	c.urlParams_.Set("prettyPrint", "false")
  1655  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1656  	urls += "?" + c.urlParams_.Encode()
  1657  	req, err := http.NewRequest("PATCH", urls, body)
  1658  	if err != nil {
  1659  		return nil, err
  1660  	}
  1661  	req.Header = reqHeaders
  1662  	googleapi.Expand(req.URL, map[string]string{
  1663  		"name": c.name,
  1664  	})
  1665  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1666  }
  1667  
  1668  // Do executes the "resourcesettings.projects.settings.patch" call.
  1669  // Any non-2xx status code is an error. Response headers are in either
  1670  // *GoogleCloudResourcesettingsV1Setting.ServerResponse.Header or (if a
  1671  // response was returned at all) in error.(*googleapi.Error).Header. Use
  1672  // googleapi.IsNotModified to check whether the returned error was because
  1673  // http.StatusNotModified was returned.
  1674  func (c *ProjectsSettingsPatchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudResourcesettingsV1Setting, error) {
  1675  	gensupport.SetOptions(c.urlParams_, opts...)
  1676  	res, err := c.doRequest("json")
  1677  	if res != nil && res.StatusCode == http.StatusNotModified {
  1678  		if res.Body != nil {
  1679  			res.Body.Close()
  1680  		}
  1681  		return nil, gensupport.WrapError(&googleapi.Error{
  1682  			Code:   res.StatusCode,
  1683  			Header: res.Header,
  1684  		})
  1685  	}
  1686  	if err != nil {
  1687  		return nil, err
  1688  	}
  1689  	defer googleapi.CloseBody(res)
  1690  	if err := googleapi.CheckResponse(res); err != nil {
  1691  		return nil, gensupport.WrapError(err)
  1692  	}
  1693  	ret := &GoogleCloudResourcesettingsV1Setting{
  1694  		ServerResponse: googleapi.ServerResponse{
  1695  			Header:         res.Header,
  1696  			HTTPStatusCode: res.StatusCode,
  1697  		},
  1698  	}
  1699  	target := &ret
  1700  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1701  		return nil, err
  1702  	}
  1703  	return ret, nil
  1704  }
  1705  

View as plain text