...

Source file src/google.golang.org/api/accessapproval/v1beta1/accessapproval-gen.go

Documentation: google.golang.org/api/accessapproval/v1beta1

     1  // Copyright 2020 Google LLC.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Code generated file. DO NOT EDIT.
     6  
     7  // Package accessapproval provides access to the Access Approval API.
     8  //
     9  // For product documentation, see: https://cloud.google.com/access-approval/docs
    10  //
    11  // # Creating a client
    12  //
    13  // Usage example:
    14  //
    15  //	import "google.golang.org/api/accessapproval/v1beta1"
    16  //	...
    17  //	ctx := context.Background()
    18  //	accessapprovalService, err := accessapproval.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  //	accessapprovalService, err := accessapproval.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  //	accessapprovalService, err := accessapproval.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    36  //
    37  // See https://godoc.org/google.golang.org/api/option/ for details on options.
    38  package accessapproval // import "google.golang.org/api/accessapproval/v1beta1"
    39  
    40  import (
    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.
    61  var _ = bytes.NewBuffer
    62  var _ = strconv.Itoa
    63  var _ = fmt.Sprintf
    64  var _ = json.NewDecoder
    65  var _ = io.Copy
    66  var _ = url.Parse
    67  var _ = gensupport.MarshalJSON
    68  var _ = googleapi.Version
    69  var _ = errors.New
    70  var _ = strings.Replace
    71  var _ = context.Canceled
    72  var _ = internaloption.WithDefaultEndpoint
    73  
    74  const apiId = "accessapproval:v1beta1"
    75  const apiName = "accessapproval"
    76  const apiVersion = "v1beta1"
    77  const basePath = "https://accessapproval.googleapis.com/"
    78  const mtlsBasePath = "https://accessapproval.mtls.googleapis.com/"
    79  
    80  // OAuth2 scopes used by this API.
    81  const (
    82  	// View and manage your data across Google Cloud Platform services
    83  	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
    84  )
    85  
    86  // NewService creates a new Service.
    87  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
    88  	scopesOption := option.WithScopes(
    89  		"https://www.googleapis.com/auth/cloud-platform",
    90  	)
    91  	// NOTE: prepend, so we don't override user-specified scopes.
    92  	opts = append([]option.ClientOption{scopesOption}, opts...)
    93  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
    94  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
    95  	client, endpoint, err := htransport.NewClient(ctx, opts...)
    96  	if err != nil {
    97  		return nil, err
    98  	}
    99  	s, err := New(client)
   100  	if err != nil {
   101  		return nil, err
   102  	}
   103  	if endpoint != "" {
   104  		s.BasePath = endpoint
   105  	}
   106  	return s, nil
   107  }
   108  
   109  // New creates a new Service. It uses the provided http.Client for requests.
   110  //
   111  // Deprecated: please use NewService instead.
   112  // To provide a custom HTTP client, use option.WithHTTPClient.
   113  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   114  func New(client *http.Client) (*Service, error) {
   115  	if client == nil {
   116  		return nil, errors.New("client is nil")
   117  	}
   118  	s := &Service{client: client, BasePath: basePath}
   119  	s.Folders = NewFoldersService(s)
   120  	s.Organizations = NewOrganizationsService(s)
   121  	s.Projects = NewProjectsService(s)
   122  	return s, nil
   123  }
   124  
   125  type Service struct {
   126  	client    *http.Client
   127  	BasePath  string // API endpoint base URL
   128  	UserAgent string // optional additional User-Agent fragment
   129  
   130  	Folders *FoldersService
   131  
   132  	Organizations *OrganizationsService
   133  
   134  	Projects *ProjectsService
   135  }
   136  
   137  func (s *Service) userAgent() string {
   138  	if s.UserAgent == "" {
   139  		return googleapi.UserAgent
   140  	}
   141  	return googleapi.UserAgent + " " + s.UserAgent
   142  }
   143  
   144  func NewFoldersService(s *Service) *FoldersService {
   145  	rs := &FoldersService{s: s}
   146  	rs.ApprovalRequests = NewFoldersApprovalRequestsService(s)
   147  	return rs
   148  }
   149  
   150  type FoldersService struct {
   151  	s *Service
   152  
   153  	ApprovalRequests *FoldersApprovalRequestsService
   154  }
   155  
   156  func NewFoldersApprovalRequestsService(s *Service) *FoldersApprovalRequestsService {
   157  	rs := &FoldersApprovalRequestsService{s: s}
   158  	return rs
   159  }
   160  
   161  type FoldersApprovalRequestsService struct {
   162  	s *Service
   163  }
   164  
   165  func NewOrganizationsService(s *Service) *OrganizationsService {
   166  	rs := &OrganizationsService{s: s}
   167  	rs.ApprovalRequests = NewOrganizationsApprovalRequestsService(s)
   168  	return rs
   169  }
   170  
   171  type OrganizationsService struct {
   172  	s *Service
   173  
   174  	ApprovalRequests *OrganizationsApprovalRequestsService
   175  }
   176  
   177  func NewOrganizationsApprovalRequestsService(s *Service) *OrganizationsApprovalRequestsService {
   178  	rs := &OrganizationsApprovalRequestsService{s: s}
   179  	return rs
   180  }
   181  
   182  type OrganizationsApprovalRequestsService struct {
   183  	s *Service
   184  }
   185  
   186  func NewProjectsService(s *Service) *ProjectsService {
   187  	rs := &ProjectsService{s: s}
   188  	rs.ApprovalRequests = NewProjectsApprovalRequestsService(s)
   189  	return rs
   190  }
   191  
   192  type ProjectsService struct {
   193  	s *Service
   194  
   195  	ApprovalRequests *ProjectsApprovalRequestsService
   196  }
   197  
   198  func NewProjectsApprovalRequestsService(s *Service) *ProjectsApprovalRequestsService {
   199  	rs := &ProjectsApprovalRequestsService{s: s}
   200  	return rs
   201  }
   202  
   203  type ProjectsApprovalRequestsService struct {
   204  	s *Service
   205  }
   206  
   207  // AccessApprovalSettings: Settings on a Project/Folder/Organization
   208  // related to Access Approval.
   209  type AccessApprovalSettings struct {
   210  	// EnrolledAncestor: Output only. This field is read only (not settable
   211  	// via
   212  	// UpdateAccessAccessApprovalSettings method). If the field is true,
   213  	// that
   214  	// indicates that at least one service is enrolled for Access Approval
   215  	// in one
   216  	// or more ancestors of the Project or Folder (this field will always
   217  	// be
   218  	// unset for the organization since organizations do not have
   219  	// ancestors).
   220  	EnrolledAncestor bool `json:"enrolledAncestor,omitempty"`
   221  
   222  	// EnrolledServices: A list of Google Cloud Services for which the given
   223  	// resource has Access
   224  	// Approval enrolled. Access requests for the resource given by name
   225  	// against
   226  	// any of these services contained here will be required to have
   227  	// explicit
   228  	// approval. If name refers to an organization, enrollment can be done
   229  	// for
   230  	// individual services. If name refers to a folder or project,
   231  	// enrollment can
   232  	// only be done on an all or nothing basis.
   233  	//
   234  	// If a cloud_product is repeated in this list, the first entry will
   235  	// be
   236  	// honored and all following entries will be discarded. A maximum of
   237  	// 10
   238  	// enrolled services will be enforced, to be expanded as the set of
   239  	// supported
   240  	// services is expanded.
   241  	EnrolledServices []*EnrolledService `json:"enrolledServices,omitempty"`
   242  
   243  	// Name: The resource name of the settings. Format is one of:
   244  	// <ol>
   245  	//   <li>"projects/{project_id}/accessApprovalSettings"</li>
   246  	//   <li>"folders/{folder_id}/accessApprovalSettings"</li>
   247  	//
   248  	// <li>"organizations/{organization_id}/accessApprovalSettings"</li>
   249  	// <ol>
   250  	Name string `json:"name,omitempty"`
   251  
   252  	// NotificationEmails: A list of email addresses to which notifications
   253  	// relating to approval
   254  	// requests should be sent. Notifications relating to a resource will be
   255  	// sent
   256  	// to all emails in the settings of ancestor resources of that resource.
   257  	// A
   258  	// maximum of 50 email addresses are allowed.
   259  	NotificationEmails []string `json:"notificationEmails,omitempty"`
   260  
   261  	// ServerResponse contains the HTTP response code and headers from the
   262  	// server.
   263  	googleapi.ServerResponse `json:"-"`
   264  
   265  	// ForceSendFields is a list of field names (e.g. "EnrolledAncestor") to
   266  	// unconditionally include in API requests. By default, fields with
   267  	// empty values are omitted from API requests. However, any non-pointer,
   268  	// non-interface field appearing in ForceSendFields will be sent to the
   269  	// server regardless of whether the field is empty or not. This may be
   270  	// used to include empty fields in Patch requests.
   271  	ForceSendFields []string `json:"-"`
   272  
   273  	// NullFields is a list of field names (e.g. "EnrolledAncestor") to
   274  	// include in API requests with the JSON null value. By default, fields
   275  	// with empty values are omitted from API requests. However, any field
   276  	// with an empty value appearing in NullFields will be sent to the
   277  	// server as null. It is an error if a field in this list has a
   278  	// non-empty value. This may be used to include null fields in Patch
   279  	// requests.
   280  	NullFields []string `json:"-"`
   281  }
   282  
   283  func (s *AccessApprovalSettings) MarshalJSON() ([]byte, error) {
   284  	type NoMethod AccessApprovalSettings
   285  	raw := NoMethod(*s)
   286  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   287  }
   288  
   289  // AccessLocations: Home office and physical location of the principal.
   290  type AccessLocations struct {
   291  	// PrincipalOfficeCountry: The "home office" location of the principal.
   292  	// A two-letter country code
   293  	// (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or a region code. In
   294  	// some
   295  	// limited situations Google systems may refer refer to a region code
   296  	// instead
   297  	// of a country code.
   298  	// Possible Region Codes:
   299  	// <ol>
   300  	//   <li>ASI: Asia</li>
   301  	//   <li>EUR: Europe</li>
   302  	//   <li>OCE: Oceania</li>
   303  	//   <li>AFR: Africa</li>
   304  	//   <li>NAM: North America</li>
   305  	//   <li>SAM: South America</li>
   306  	//   <li>ANT: Antarctica</li>
   307  	//   <li>ANY: Any location</li>
   308  	// </ol>
   309  	PrincipalOfficeCountry string `json:"principalOfficeCountry,omitempty"`
   310  
   311  	// PrincipalPhysicalLocationCountry: Physical location of the principal
   312  	// at the time of the access. A
   313  	// two-letter country code (ISO 3166-1 alpha-2), such as "US", "DE" or
   314  	// "GB" or
   315  	// a region code. In some limited situations Google systems may refer
   316  	// refer to
   317  	// a region code instead of a country code.
   318  	// Possible Region Codes:
   319  	// <ol>
   320  	//   <li>ASI: Asia</li>
   321  	//   <li>EUR: Europe</li>
   322  	//   <li>OCE: Oceania</li>
   323  	//   <li>AFR: Africa</li>
   324  	//   <li>NAM: North America</li>
   325  	//   <li>SAM: South America</li>
   326  	//   <li>ANT: Antarctica</li>
   327  	//   <li>ANY: Any location</li>
   328  	// </ol>
   329  	PrincipalPhysicalLocationCountry string `json:"principalPhysicalLocationCountry,omitempty"`
   330  
   331  	// ForceSendFields is a list of field names (e.g.
   332  	// "PrincipalOfficeCountry") to unconditionally include in API requests.
   333  	// By default, fields with empty values are omitted from API requests.
   334  	// However, any non-pointer, non-interface field appearing in
   335  	// ForceSendFields will be sent to the server regardless of whether the
   336  	// field is empty or not. This may be used to include empty fields in
   337  	// Patch requests.
   338  	ForceSendFields []string `json:"-"`
   339  
   340  	// NullFields is a list of field names (e.g. "PrincipalOfficeCountry")
   341  	// to include in API requests with the JSON null value. By default,
   342  	// fields with empty values are omitted from API requests. However, any
   343  	// field with an empty value appearing in NullFields will be sent to the
   344  	// server as null. It is an error if a field in this list has a
   345  	// non-empty value. This may be used to include null fields in Patch
   346  	// requests.
   347  	NullFields []string `json:"-"`
   348  }
   349  
   350  func (s *AccessLocations) MarshalJSON() ([]byte, error) {
   351  	type NoMethod AccessLocations
   352  	raw := NoMethod(*s)
   353  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   354  }
   355  
   356  type AccessReason struct {
   357  	// Detail: More detail about certain reason types. See comments for each
   358  	// type above.
   359  	Detail string `json:"detail,omitempty"`
   360  
   361  	// Type: Type of access justification.
   362  	//
   363  	// Possible values:
   364  	//   "TYPE_UNSPECIFIED" - Default value for proto, shouldn't be used.
   365  	//   "CUSTOMER_INITIATED_SUPPORT" - Customer made a request or raised an
   366  	// issue that required the principal to
   367  	// access customer data. `detail` is of the form ("#####" is the issue
   368  	// ID):
   369  	// <ol>
   370  	//   <li>"Feedback Report: #####"</li>
   371  	//   <li>"Case Number: #####"</li>
   372  	//   <li>"Case ID: #####"</li>
   373  	//   <li>"E-PIN Reference: #####"</li>
   374  	//   <li>"Google-#####"</li>
   375  	//   <li>"T-#####"</li>
   376  	// </ol>
   377  	//   "GOOGLE_INITIATED_SERVICE" - The principal accessed customer data
   378  	// in order to diagnose or resolve a
   379  	// suspected issue in services or a known outage. Often this access is
   380  	// used
   381  	// to confirm that customers are not affected by a suspected service
   382  	// issue
   383  	// or to remediate a reversible system issue.
   384  	//   "GOOGLE_INITIATED_REVIEW" - Google initiated service for security,
   385  	// fraud, abuse, or compliance
   386  	// purposes.
   387  	Type string `json:"type,omitempty"`
   388  
   389  	// ForceSendFields is a list of field names (e.g. "Detail") to
   390  	// unconditionally include in API requests. By default, fields with
   391  	// empty values are omitted from API requests. However, any non-pointer,
   392  	// non-interface field appearing in ForceSendFields will be sent to the
   393  	// server regardless of whether the field is empty or not. This may be
   394  	// used to include empty fields in Patch requests.
   395  	ForceSendFields []string `json:"-"`
   396  
   397  	// NullFields is a list of field names (e.g. "Detail") to include in API
   398  	// requests with the JSON null value. By default, fields with empty
   399  	// values are omitted from API requests. However, any field with an
   400  	// empty value appearing in NullFields will be sent to the server as
   401  	// null. It is an error if a field in this list has a non-empty value.
   402  	// This may be used to include null fields in Patch requests.
   403  	NullFields []string `json:"-"`
   404  }
   405  
   406  func (s *AccessReason) MarshalJSON() ([]byte, error) {
   407  	type NoMethod AccessReason
   408  	raw := NoMethod(*s)
   409  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   410  }
   411  
   412  // ApprovalRequest: A request for the customer to approve access to a
   413  // resource.
   414  type ApprovalRequest struct {
   415  	// Approve: Access was approved.
   416  	Approve *ApproveDecision `json:"approve,omitempty"`
   417  
   418  	// Dismiss: The request was dismissed.
   419  	Dismiss *DismissDecision `json:"dismiss,omitempty"`
   420  
   421  	// Name: The resource name of the request. Format
   422  	// is
   423  	// "{projects|folders|organizations}/{id}/approvalRequests/{approval_r
   424  	// equest_id}".
   425  	Name string `json:"name,omitempty"`
   426  
   427  	// RequestTime: The time at which approval was requested.
   428  	RequestTime string `json:"requestTime,omitempty"`
   429  
   430  	// RequestedExpiration: The requested expiration for the approval. If
   431  	// the request is approved,
   432  	// access will be granted from the time of approval until the expiration
   433  	// time.
   434  	RequestedExpiration string `json:"requestedExpiration,omitempty"`
   435  
   436  	// RequestedLocations: The locations for which approval is being
   437  	// requested.
   438  	RequestedLocations *AccessLocations `json:"requestedLocations,omitempty"`
   439  
   440  	// RequestedReason: The justification for which approval is being
   441  	// requested.
   442  	RequestedReason *AccessReason `json:"requestedReason,omitempty"`
   443  
   444  	// RequestedResourceName: The resource for which approval is being
   445  	// requested. The format of the
   446  	// resource name is defined
   447  	// at
   448  	// https://cloud.google.com/apis/design/resource_names. The resource
   449  	// name here
   450  	// may either be a "full" resource name
   451  	// (e.g.
   452  	// "//library.googleapis.com/shelves/shelf1/books/book2") or a
   453  	// "relative"
   454  	// resource name (e.g. "shelves/shelf1/books/book2") as described in
   455  	// the
   456  	// resource name specification.
   457  	RequestedResourceName string `json:"requestedResourceName,omitempty"`
   458  
   459  	// RequestedResourceProperties: Properties related to the resource
   460  	// represented by requested_resource_name.
   461  	RequestedResourceProperties *ResourceProperties `json:"requestedResourceProperties,omitempty"`
   462  
   463  	// ServerResponse contains the HTTP response code and headers from the
   464  	// server.
   465  	googleapi.ServerResponse `json:"-"`
   466  
   467  	// ForceSendFields is a list of field names (e.g. "Approve") to
   468  	// unconditionally include in API requests. By default, fields with
   469  	// empty values are omitted from API requests. However, any non-pointer,
   470  	// non-interface field appearing in ForceSendFields will be sent to the
   471  	// server regardless of whether the field is empty or not. This may be
   472  	// used to include empty fields in Patch requests.
   473  	ForceSendFields []string `json:"-"`
   474  
   475  	// NullFields is a list of field names (e.g. "Approve") to include in
   476  	// API requests with the JSON null value. By default, fields with empty
   477  	// values are omitted from API requests. However, any field with an
   478  	// empty value appearing in NullFields will be sent to the server as
   479  	// null. It is an error if a field in this list has a non-empty value.
   480  	// This may be used to include null fields in Patch requests.
   481  	NullFields []string `json:"-"`
   482  }
   483  
   484  func (s *ApprovalRequest) MarshalJSON() ([]byte, error) {
   485  	type NoMethod ApprovalRequest
   486  	raw := NoMethod(*s)
   487  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   488  }
   489  
   490  // ApproveApprovalRequestMessage: Request to approve an ApprovalRequest.
   491  type ApproveApprovalRequestMessage struct {
   492  	// ExpireTime: The expiration time of this approval.
   493  	ExpireTime string `json:"expireTime,omitempty"`
   494  
   495  	// ForceSendFields is a list of field names (e.g. "ExpireTime") to
   496  	// unconditionally include in API requests. By default, fields with
   497  	// empty values are omitted from API requests. However, any non-pointer,
   498  	// non-interface field appearing in ForceSendFields will be sent to the
   499  	// server regardless of whether the field is empty or not. This may be
   500  	// used to include empty fields in Patch requests.
   501  	ForceSendFields []string `json:"-"`
   502  
   503  	// NullFields is a list of field names (e.g. "ExpireTime") to include in
   504  	// API requests with the JSON null value. By default, fields with empty
   505  	// values are omitted from API requests. However, any field with an
   506  	// empty value appearing in NullFields will be sent to the server as
   507  	// null. It is an error if a field in this list has a non-empty value.
   508  	// This may be used to include null fields in Patch requests.
   509  	NullFields []string `json:"-"`
   510  }
   511  
   512  func (s *ApproveApprovalRequestMessage) MarshalJSON() ([]byte, error) {
   513  	type NoMethod ApproveApprovalRequestMessage
   514  	raw := NoMethod(*s)
   515  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   516  }
   517  
   518  // ApproveDecision: A decision that has been made to approve access to a
   519  // resource.
   520  type ApproveDecision struct {
   521  	// ApproveTime: The time at which approval was granted.
   522  	ApproveTime string `json:"approveTime,omitempty"`
   523  
   524  	// ExpireTime: The time at which the approval expires.
   525  	ExpireTime string `json:"expireTime,omitempty"`
   526  
   527  	// ForceSendFields is a list of field names (e.g. "ApproveTime") to
   528  	// unconditionally include in API requests. By default, fields with
   529  	// empty values are omitted from API requests. However, any non-pointer,
   530  	// non-interface field appearing in ForceSendFields will be sent to the
   531  	// server regardless of whether the field is empty or not. This may be
   532  	// used to include empty fields in Patch requests.
   533  	ForceSendFields []string `json:"-"`
   534  
   535  	// NullFields is a list of field names (e.g. "ApproveTime") to include
   536  	// in API requests with the JSON null value. By default, fields with
   537  	// empty values are omitted from API requests. However, any field with
   538  	// an empty value appearing in NullFields will be sent to the server as
   539  	// null. It is an error if a field in this list has a non-empty value.
   540  	// This may be used to include null fields in Patch requests.
   541  	NullFields []string `json:"-"`
   542  }
   543  
   544  func (s *ApproveDecision) MarshalJSON() ([]byte, error) {
   545  	type NoMethod ApproveDecision
   546  	raw := NoMethod(*s)
   547  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   548  }
   549  
   550  // DismissApprovalRequestMessage: Request to dismiss an approval
   551  // request.
   552  type DismissApprovalRequestMessage struct {
   553  }
   554  
   555  // DismissDecision: A decision that has been made to dismiss an approval
   556  // request.
   557  type DismissDecision struct {
   558  	// DismissTime: The time at which the approval request was dismissed.
   559  	DismissTime string `json:"dismissTime,omitempty"`
   560  
   561  	// ForceSendFields is a list of field names (e.g. "DismissTime") to
   562  	// unconditionally include in API requests. By default, fields with
   563  	// empty values are omitted from API requests. However, any non-pointer,
   564  	// non-interface field appearing in ForceSendFields will be sent to the
   565  	// server regardless of whether the field is empty or not. This may be
   566  	// used to include empty fields in Patch requests.
   567  	ForceSendFields []string `json:"-"`
   568  
   569  	// NullFields is a list of field names (e.g. "DismissTime") to include
   570  	// in API requests with the JSON null value. By default, fields with
   571  	// empty values are omitted from API requests. However, any field with
   572  	// an empty value appearing in NullFields will be sent to the server as
   573  	// null. It is an error if a field in this list has a non-empty value.
   574  	// This may be used to include null fields in Patch requests.
   575  	NullFields []string `json:"-"`
   576  }
   577  
   578  func (s *DismissDecision) MarshalJSON() ([]byte, error) {
   579  	type NoMethod DismissDecision
   580  	raw := NoMethod(*s)
   581  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   582  }
   583  
   584  // Empty: A generic empty message that you can re-use to avoid defining
   585  // duplicated
   586  // empty messages in your APIs. A typical example is to use it as the
   587  // request
   588  // or the response type of an API method. For instance:
   589  //
   590  //	service Foo {
   591  //	  rpc Bar(google.protobuf.Empty) returns
   592  //
   593  // (google.protobuf.Empty);
   594  //
   595  //	}
   596  //
   597  // The JSON representation for `Empty` is empty JSON object `{}`.
   598  type Empty struct {
   599  	// ServerResponse contains the HTTP response code and headers from the
   600  	// server.
   601  	googleapi.ServerResponse `json:"-"`
   602  }
   603  
   604  // EnrolledService: Represents the enrollment of a cloud resource into a
   605  // specific service.
   606  type EnrolledService struct {
   607  	// CloudProduct: The product for which Access Approval will be enrolled.
   608  	// Allowed values are
   609  	// listed below (case-sensitive):
   610  	// <ol>
   611  	//   <li>all</li>
   612  	//   <li>appengine.googleapis.com</li>
   613  	//   <li>bigquery.googleapis.com</li>
   614  	//   <li>bigtable.googleapis.com</li>
   615  	//   <li>cloudkms.googleapis.com</li>
   616  	//   <li>compute.googleapis.com</li>
   617  	//   <li>dataflow.googleapis.com</li>
   618  	//   <li>iam.googleapis.com</li>
   619  	//   <li>pubsub.googleapis.com</li>
   620  	//   <li>storage.googleapis.com</li>
   621  	// <ol>
   622  	CloudProduct string `json:"cloudProduct,omitempty"`
   623  
   624  	// EnrollmentLevel: The enrollment level of the service.
   625  	//
   626  	// Possible values:
   627  	//   "ENROLLMENT_LEVEL_UNSPECIFIED" - Default value for proto, shouldn't
   628  	// be used.
   629  	//   "BLOCK_ALL" - Service is enrolled in Access Approval for all
   630  	// requests
   631  	EnrollmentLevel string `json:"enrollmentLevel,omitempty"`
   632  
   633  	// ForceSendFields is a list of field names (e.g. "CloudProduct") to
   634  	// unconditionally include in API requests. By default, fields with
   635  	// empty values are omitted from API requests. However, any non-pointer,
   636  	// non-interface field appearing in ForceSendFields will be sent to the
   637  	// server regardless of whether the field is empty or not. This may be
   638  	// used to include empty fields in Patch requests.
   639  	ForceSendFields []string `json:"-"`
   640  
   641  	// NullFields is a list of field names (e.g. "CloudProduct") to include
   642  	// in API requests with the JSON null value. By default, fields with
   643  	// empty values are omitted from API requests. However, any field with
   644  	// an empty value appearing in NullFields will be sent to the server as
   645  	// null. It is an error if a field in this list has a non-empty value.
   646  	// This may be used to include null fields in Patch requests.
   647  	NullFields []string `json:"-"`
   648  }
   649  
   650  func (s *EnrolledService) MarshalJSON() ([]byte, error) {
   651  	type NoMethod EnrolledService
   652  	raw := NoMethod(*s)
   653  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   654  }
   655  
   656  // ListApprovalRequestsResponse: Response to listing of ApprovalRequest
   657  // objects.
   658  type ListApprovalRequestsResponse struct {
   659  	// ApprovalRequests: Approval request details.
   660  	ApprovalRequests []*ApprovalRequest `json:"approvalRequests,omitempty"`
   661  
   662  	// NextPageToken: Token to retrieve the next page of results, or empty
   663  	// if there are no more.
   664  	NextPageToken string `json:"nextPageToken,omitempty"`
   665  
   666  	// ServerResponse contains the HTTP response code and headers from the
   667  	// server.
   668  	googleapi.ServerResponse `json:"-"`
   669  
   670  	// ForceSendFields is a list of field names (e.g. "ApprovalRequests") to
   671  	// unconditionally include in API requests. By default, fields with
   672  	// empty values are omitted from API requests. However, any non-pointer,
   673  	// non-interface field appearing in ForceSendFields will be sent to the
   674  	// server regardless of whether the field is empty or not. This may be
   675  	// used to include empty fields in Patch requests.
   676  	ForceSendFields []string `json:"-"`
   677  
   678  	// NullFields is a list of field names (e.g. "ApprovalRequests") to
   679  	// include in API requests with the JSON null value. By default, fields
   680  	// with empty values are omitted from API requests. However, any field
   681  	// with an empty value appearing in NullFields will be sent to the
   682  	// server as null. It is an error if a field in this list has a
   683  	// non-empty value. This may be used to include null fields in Patch
   684  	// requests.
   685  	NullFields []string `json:"-"`
   686  }
   687  
   688  func (s *ListApprovalRequestsResponse) MarshalJSON() ([]byte, error) {
   689  	type NoMethod ListApprovalRequestsResponse
   690  	raw := NoMethod(*s)
   691  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   692  }
   693  
   694  // ResourceProperties: The properties associated with the resource of
   695  // the request.
   696  type ResourceProperties struct {
   697  	// ExcludesDescendants: Whether an approval will exclude the descendants
   698  	// of the resource being
   699  	// requested.
   700  	ExcludesDescendants bool `json:"excludesDescendants,omitempty"`
   701  
   702  	// ForceSendFields is a list of field names (e.g. "ExcludesDescendants")
   703  	// to unconditionally include in API requests. By default, fields with
   704  	// empty values are omitted from API requests. However, any non-pointer,
   705  	// non-interface field appearing in ForceSendFields will be sent to the
   706  	// server regardless of whether the field is empty or not. This may be
   707  	// used to include empty fields in Patch requests.
   708  	ForceSendFields []string `json:"-"`
   709  
   710  	// NullFields is a list of field names (e.g. "ExcludesDescendants") to
   711  	// include in API requests with the JSON null value. By default, fields
   712  	// with empty values are omitted from API requests. However, any field
   713  	// with an empty value appearing in NullFields will be sent to the
   714  	// server as null. It is an error if a field in this list has a
   715  	// non-empty value. This may be used to include null fields in Patch
   716  	// requests.
   717  	NullFields []string `json:"-"`
   718  }
   719  
   720  func (s *ResourceProperties) MarshalJSON() ([]byte, error) {
   721  	type NoMethod ResourceProperties
   722  	raw := NoMethod(*s)
   723  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   724  }
   725  
   726  // method id "accessapproval.folders.deleteAccessApprovalSettings":
   727  
   728  type FoldersDeleteAccessApprovalSettingsCall struct {
   729  	s          *Service
   730  	name       string
   731  	urlParams_ gensupport.URLParams
   732  	ctx_       context.Context
   733  	header_    http.Header
   734  }
   735  
   736  // DeleteAccessApprovalSettings: Deletes the settings associated with a
   737  // project, folder, or organization.
   738  // This will have the effect of disabling Access Approval for the
   739  // project,
   740  // folder, or organization, but only if all ancestors also have
   741  // Access
   742  // Approval disabled. If Access Approval is enabled at a higher level of
   743  // the
   744  // hierarchy, then Access Approval will still be enabled at this level
   745  // as
   746  // the settings are inherited.
   747  func (r *FoldersService) DeleteAccessApprovalSettings(name string) *FoldersDeleteAccessApprovalSettingsCall {
   748  	c := &FoldersDeleteAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   749  	c.name = name
   750  	return c
   751  }
   752  
   753  // Fields allows partial responses to be retrieved. See
   754  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
   755  // for more information.
   756  func (c *FoldersDeleteAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *FoldersDeleteAccessApprovalSettingsCall {
   757  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   758  	return c
   759  }
   760  
   761  // Context sets the context to be used in this call's Do method. Any
   762  // pending HTTP request will be aborted if the provided context is
   763  // canceled.
   764  func (c *FoldersDeleteAccessApprovalSettingsCall) Context(ctx context.Context) *FoldersDeleteAccessApprovalSettingsCall {
   765  	c.ctx_ = ctx
   766  	return c
   767  }
   768  
   769  // Header returns an http.Header that can be modified by the caller to
   770  // add HTTP headers to the request.
   771  func (c *FoldersDeleteAccessApprovalSettingsCall) Header() http.Header {
   772  	if c.header_ == nil {
   773  		c.header_ = make(http.Header)
   774  	}
   775  	return c.header_
   776  }
   777  
   778  func (c *FoldersDeleteAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) {
   779  	reqHeaders := make(http.Header)
   780  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
   781  	for k, v := range c.header_ {
   782  		reqHeaders[k] = v
   783  	}
   784  	reqHeaders.Set("User-Agent", c.s.userAgent())
   785  	var body io.Reader = nil
   786  	c.urlParams_.Set("alt", alt)
   787  	c.urlParams_.Set("prettyPrint", "false")
   788  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
   789  	urls += "?" + c.urlParams_.Encode()
   790  	req, err := http.NewRequest("DELETE", urls, body)
   791  	if err != nil {
   792  		return nil, err
   793  	}
   794  	req.Header = reqHeaders
   795  	googleapi.Expand(req.URL, map[string]string{
   796  		"name": c.name,
   797  	})
   798  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   799  }
   800  
   801  // Do executes the "accessapproval.folders.deleteAccessApprovalSettings" call.
   802  // Exactly one of *Empty or error will be non-nil. Any non-2xx status
   803  // code is an error. Response headers are in either
   804  // *Empty.ServerResponse.Header or (if a response was returned at all)
   805  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   806  // check whether the returned error was because http.StatusNotModified
   807  // was returned.
   808  func (c *FoldersDeleteAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
   809  	gensupport.SetOptions(c.urlParams_, opts...)
   810  	res, err := c.doRequest("json")
   811  	if res != nil && res.StatusCode == http.StatusNotModified {
   812  		if res.Body != nil {
   813  			res.Body.Close()
   814  		}
   815  		return nil, &googleapi.Error{
   816  			Code:   res.StatusCode,
   817  			Header: res.Header,
   818  		}
   819  	}
   820  	if err != nil {
   821  		return nil, err
   822  	}
   823  	defer googleapi.CloseBody(res)
   824  	if err := googleapi.CheckResponse(res); err != nil {
   825  		return nil, err
   826  	}
   827  	ret := &Empty{
   828  		ServerResponse: googleapi.ServerResponse{
   829  			Header:         res.Header,
   830  			HTTPStatusCode: res.StatusCode,
   831  		},
   832  	}
   833  	target := &ret
   834  	if err := gensupport.DecodeResponse(target, res); err != nil {
   835  		return nil, err
   836  	}
   837  	return ret, nil
   838  	// {
   839  	//   "description": "Deletes the settings associated with a project, folder, or organization.\nThis will have the effect of disabling Access Approval for the project,\nfolder, or organization, but only if all ancestors also have Access\nApproval disabled. If Access Approval is enabled at a higher level of the\nhierarchy, then Access Approval will still be enabled at this level as\nthe settings are inherited.",
   840  	//   "flatPath": "v1beta1/folders/{foldersId}/accessApprovalSettings",
   841  	//   "httpMethod": "DELETE",
   842  	//   "id": "accessapproval.folders.deleteAccessApprovalSettings",
   843  	//   "parameterOrder": [
   844  	//     "name"
   845  	//   ],
   846  	//   "parameters": {
   847  	//     "name": {
   848  	//       "description": "Name of the AccessApprovalSettings to delete.",
   849  	//       "location": "path",
   850  	//       "pattern": "^folders/[^/]+/accessApprovalSettings$",
   851  	//       "required": true,
   852  	//       "type": "string"
   853  	//     }
   854  	//   },
   855  	//   "path": "v1beta1/{+name}",
   856  	//   "response": {
   857  	//     "$ref": "Empty"
   858  	//   },
   859  	//   "scopes": [
   860  	//     "https://www.googleapis.com/auth/cloud-platform"
   861  	//   ]
   862  	// }
   863  
   864  }
   865  
   866  // method id "accessapproval.folders.getAccessApprovalSettings":
   867  
   868  type FoldersGetAccessApprovalSettingsCall struct {
   869  	s            *Service
   870  	name         string
   871  	urlParams_   gensupport.URLParams
   872  	ifNoneMatch_ string
   873  	ctx_         context.Context
   874  	header_      http.Header
   875  }
   876  
   877  // GetAccessApprovalSettings: Gets the settings associated with a
   878  // project, folder, or organization.
   879  func (r *FoldersService) GetAccessApprovalSettings(name string) *FoldersGetAccessApprovalSettingsCall {
   880  	c := &FoldersGetAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   881  	c.name = name
   882  	return c
   883  }
   884  
   885  // Fields allows partial responses to be retrieved. See
   886  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
   887  // for more information.
   888  func (c *FoldersGetAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *FoldersGetAccessApprovalSettingsCall {
   889  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   890  	return c
   891  }
   892  
   893  // IfNoneMatch sets the optional parameter which makes the operation
   894  // fail if the object's ETag matches the given value. This is useful for
   895  // getting updates only after the object has changed since the last
   896  // request. Use googleapi.IsNotModified to check whether the response
   897  // error from Do is the result of In-None-Match.
   898  func (c *FoldersGetAccessApprovalSettingsCall) IfNoneMatch(entityTag string) *FoldersGetAccessApprovalSettingsCall {
   899  	c.ifNoneMatch_ = entityTag
   900  	return c
   901  }
   902  
   903  // Context sets the context to be used in this call's Do method. Any
   904  // pending HTTP request will be aborted if the provided context is
   905  // canceled.
   906  func (c *FoldersGetAccessApprovalSettingsCall) Context(ctx context.Context) *FoldersGetAccessApprovalSettingsCall {
   907  	c.ctx_ = ctx
   908  	return c
   909  }
   910  
   911  // Header returns an http.Header that can be modified by the caller to
   912  // add HTTP headers to the request.
   913  func (c *FoldersGetAccessApprovalSettingsCall) Header() http.Header {
   914  	if c.header_ == nil {
   915  		c.header_ = make(http.Header)
   916  	}
   917  	return c.header_
   918  }
   919  
   920  func (c *FoldersGetAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) {
   921  	reqHeaders := make(http.Header)
   922  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
   923  	for k, v := range c.header_ {
   924  		reqHeaders[k] = v
   925  	}
   926  	reqHeaders.Set("User-Agent", c.s.userAgent())
   927  	if c.ifNoneMatch_ != "" {
   928  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   929  	}
   930  	var body io.Reader = nil
   931  	c.urlParams_.Set("alt", alt)
   932  	c.urlParams_.Set("prettyPrint", "false")
   933  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
   934  	urls += "?" + c.urlParams_.Encode()
   935  	req, err := http.NewRequest("GET", urls, body)
   936  	if err != nil {
   937  		return nil, err
   938  	}
   939  	req.Header = reqHeaders
   940  	googleapi.Expand(req.URL, map[string]string{
   941  		"name": c.name,
   942  	})
   943  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   944  }
   945  
   946  // Do executes the "accessapproval.folders.getAccessApprovalSettings" call.
   947  // Exactly one of *AccessApprovalSettings or error will be non-nil. Any
   948  // non-2xx status code is an error. Response headers are in either
   949  // *AccessApprovalSettings.ServerResponse.Header or (if a response was
   950  // returned at all) in error.(*googleapi.Error).Header. Use
   951  // googleapi.IsNotModified to check whether the returned error was
   952  // because http.StatusNotModified was returned.
   953  func (c *FoldersGetAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*AccessApprovalSettings, error) {
   954  	gensupport.SetOptions(c.urlParams_, opts...)
   955  	res, err := c.doRequest("json")
   956  	if res != nil && res.StatusCode == http.StatusNotModified {
   957  		if res.Body != nil {
   958  			res.Body.Close()
   959  		}
   960  		return nil, &googleapi.Error{
   961  			Code:   res.StatusCode,
   962  			Header: res.Header,
   963  		}
   964  	}
   965  	if err != nil {
   966  		return nil, err
   967  	}
   968  	defer googleapi.CloseBody(res)
   969  	if err := googleapi.CheckResponse(res); err != nil {
   970  		return nil, err
   971  	}
   972  	ret := &AccessApprovalSettings{
   973  		ServerResponse: googleapi.ServerResponse{
   974  			Header:         res.Header,
   975  			HTTPStatusCode: res.StatusCode,
   976  		},
   977  	}
   978  	target := &ret
   979  	if err := gensupport.DecodeResponse(target, res); err != nil {
   980  		return nil, err
   981  	}
   982  	return ret, nil
   983  	// {
   984  	//   "description": "Gets the settings associated with a project, folder, or organization.",
   985  	//   "flatPath": "v1beta1/folders/{foldersId}/accessApprovalSettings",
   986  	//   "httpMethod": "GET",
   987  	//   "id": "accessapproval.folders.getAccessApprovalSettings",
   988  	//   "parameterOrder": [
   989  	//     "name"
   990  	//   ],
   991  	//   "parameters": {
   992  	//     "name": {
   993  	//       "description": "Name of the AccessApprovalSettings to retrieve.",
   994  	//       "location": "path",
   995  	//       "pattern": "^folders/[^/]+/accessApprovalSettings$",
   996  	//       "required": true,
   997  	//       "type": "string"
   998  	//     }
   999  	//   },
  1000  	//   "path": "v1beta1/{+name}",
  1001  	//   "response": {
  1002  	//     "$ref": "AccessApprovalSettings"
  1003  	//   },
  1004  	//   "scopes": [
  1005  	//     "https://www.googleapis.com/auth/cloud-platform"
  1006  	//   ]
  1007  	// }
  1008  
  1009  }
  1010  
  1011  // method id "accessapproval.folders.updateAccessApprovalSettings":
  1012  
  1013  type FoldersUpdateAccessApprovalSettingsCall struct {
  1014  	s                      *Service
  1015  	name                   string
  1016  	accessapprovalsettings *AccessApprovalSettings
  1017  	urlParams_             gensupport.URLParams
  1018  	ctx_                   context.Context
  1019  	header_                http.Header
  1020  }
  1021  
  1022  // UpdateAccessApprovalSettings: Updates the settings associated with a
  1023  // project, folder, or organization.
  1024  // Settings to update are determined by the value of field_mask.
  1025  func (r *FoldersService) UpdateAccessApprovalSettings(name string, accessapprovalsettings *AccessApprovalSettings) *FoldersUpdateAccessApprovalSettingsCall {
  1026  	c := &FoldersUpdateAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1027  	c.name = name
  1028  	c.accessapprovalsettings = accessapprovalsettings
  1029  	return c
  1030  }
  1031  
  1032  // UpdateMask sets the optional parameter "updateMask": For the
  1033  // `FieldMask` definition,
  1034  // see
  1035  // https://developers.google.com/protocol-buffers/docs/reference/goog
  1036  // le.protobuf#fieldmask
  1037  // If this field is left unset, only the notification_emails field will
  1038  // be
  1039  // updated.
  1040  func (c *FoldersUpdateAccessApprovalSettingsCall) UpdateMask(updateMask string) *FoldersUpdateAccessApprovalSettingsCall {
  1041  	c.urlParams_.Set("updateMask", updateMask)
  1042  	return c
  1043  }
  1044  
  1045  // Fields allows partial responses to be retrieved. See
  1046  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1047  // for more information.
  1048  func (c *FoldersUpdateAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *FoldersUpdateAccessApprovalSettingsCall {
  1049  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1050  	return c
  1051  }
  1052  
  1053  // Context sets the context to be used in this call's Do method. Any
  1054  // pending HTTP request will be aborted if the provided context is
  1055  // canceled.
  1056  func (c *FoldersUpdateAccessApprovalSettingsCall) Context(ctx context.Context) *FoldersUpdateAccessApprovalSettingsCall {
  1057  	c.ctx_ = ctx
  1058  	return c
  1059  }
  1060  
  1061  // Header returns an http.Header that can be modified by the caller to
  1062  // add HTTP headers to the request.
  1063  func (c *FoldersUpdateAccessApprovalSettingsCall) Header() http.Header {
  1064  	if c.header_ == nil {
  1065  		c.header_ = make(http.Header)
  1066  	}
  1067  	return c.header_
  1068  }
  1069  
  1070  func (c *FoldersUpdateAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) {
  1071  	reqHeaders := make(http.Header)
  1072  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  1073  	for k, v := range c.header_ {
  1074  		reqHeaders[k] = v
  1075  	}
  1076  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1077  	var body io.Reader = nil
  1078  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.accessapprovalsettings)
  1079  	if err != nil {
  1080  		return nil, err
  1081  	}
  1082  	reqHeaders.Set("Content-Type", "application/json")
  1083  	c.urlParams_.Set("alt", alt)
  1084  	c.urlParams_.Set("prettyPrint", "false")
  1085  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  1086  	urls += "?" + c.urlParams_.Encode()
  1087  	req, err := http.NewRequest("PATCH", urls, body)
  1088  	if err != nil {
  1089  		return nil, err
  1090  	}
  1091  	req.Header = reqHeaders
  1092  	googleapi.Expand(req.URL, map[string]string{
  1093  		"name": c.name,
  1094  	})
  1095  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1096  }
  1097  
  1098  // Do executes the "accessapproval.folders.updateAccessApprovalSettings" call.
  1099  // Exactly one of *AccessApprovalSettings or error will be non-nil. Any
  1100  // non-2xx status code is an error. Response headers are in either
  1101  // *AccessApprovalSettings.ServerResponse.Header or (if a response was
  1102  // returned at all) in error.(*googleapi.Error).Header. Use
  1103  // googleapi.IsNotModified to check whether the returned error was
  1104  // because http.StatusNotModified was returned.
  1105  func (c *FoldersUpdateAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*AccessApprovalSettings, error) {
  1106  	gensupport.SetOptions(c.urlParams_, opts...)
  1107  	res, err := c.doRequest("json")
  1108  	if res != nil && res.StatusCode == http.StatusNotModified {
  1109  		if res.Body != nil {
  1110  			res.Body.Close()
  1111  		}
  1112  		return nil, &googleapi.Error{
  1113  			Code:   res.StatusCode,
  1114  			Header: res.Header,
  1115  		}
  1116  	}
  1117  	if err != nil {
  1118  		return nil, err
  1119  	}
  1120  	defer googleapi.CloseBody(res)
  1121  	if err := googleapi.CheckResponse(res); err != nil {
  1122  		return nil, err
  1123  	}
  1124  	ret := &AccessApprovalSettings{
  1125  		ServerResponse: googleapi.ServerResponse{
  1126  			Header:         res.Header,
  1127  			HTTPStatusCode: res.StatusCode,
  1128  		},
  1129  	}
  1130  	target := &ret
  1131  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1132  		return nil, err
  1133  	}
  1134  	return ret, nil
  1135  	// {
  1136  	//   "description": "Updates the settings associated with a project, folder, or organization.\nSettings to update are determined by the value of field_mask.",
  1137  	//   "flatPath": "v1beta1/folders/{foldersId}/accessApprovalSettings",
  1138  	//   "httpMethod": "PATCH",
  1139  	//   "id": "accessapproval.folders.updateAccessApprovalSettings",
  1140  	//   "parameterOrder": [
  1141  	//     "name"
  1142  	//   ],
  1143  	//   "parameters": {
  1144  	//     "name": {
  1145  	//       "description": "The resource name of the settings. Format is one of:\n\u003col\u003e\n  \u003cli\u003e\"projects/{project_id}/accessApprovalSettings\"\u003c/li\u003e\n  \u003cli\u003e\"folders/{folder_id}/accessApprovalSettings\"\u003c/li\u003e\n  \u003cli\u003e\"organizations/{organization_id}/accessApprovalSettings\"\u003c/li\u003e\n\u003col\u003e",
  1146  	//       "location": "path",
  1147  	//       "pattern": "^folders/[^/]+/accessApprovalSettings$",
  1148  	//       "required": true,
  1149  	//       "type": "string"
  1150  	//     },
  1151  	//     "updateMask": {
  1152  	//       "description": "For the `FieldMask` definition, see\nhttps://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask\nIf this field is left unset, only the notification_emails field will be\nupdated.",
  1153  	//       "format": "google-fieldmask",
  1154  	//       "location": "query",
  1155  	//       "type": "string"
  1156  	//     }
  1157  	//   },
  1158  	//   "path": "v1beta1/{+name}",
  1159  	//   "request": {
  1160  	//     "$ref": "AccessApprovalSettings"
  1161  	//   },
  1162  	//   "response": {
  1163  	//     "$ref": "AccessApprovalSettings"
  1164  	//   },
  1165  	//   "scopes": [
  1166  	//     "https://www.googleapis.com/auth/cloud-platform"
  1167  	//   ]
  1168  	// }
  1169  
  1170  }
  1171  
  1172  // method id "accessapproval.folders.approvalRequests.approve":
  1173  
  1174  type FoldersApprovalRequestsApproveCall struct {
  1175  	s                             *Service
  1176  	name                          string
  1177  	approveapprovalrequestmessage *ApproveApprovalRequestMessage
  1178  	urlParams_                    gensupport.URLParams
  1179  	ctx_                          context.Context
  1180  	header_                       http.Header
  1181  }
  1182  
  1183  // Approve: Approves a request and returns the updated
  1184  // ApprovalRequest.
  1185  //
  1186  // Returns NOT_FOUND if the request does not exist.
  1187  // Returns
  1188  // FAILED_PRECONDITION if the request exists but is not in a pending
  1189  // state.
  1190  func (r *FoldersApprovalRequestsService) Approve(name string, approveapprovalrequestmessage *ApproveApprovalRequestMessage) *FoldersApprovalRequestsApproveCall {
  1191  	c := &FoldersApprovalRequestsApproveCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1192  	c.name = name
  1193  	c.approveapprovalrequestmessage = approveapprovalrequestmessage
  1194  	return c
  1195  }
  1196  
  1197  // Fields allows partial responses to be retrieved. See
  1198  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1199  // for more information.
  1200  func (c *FoldersApprovalRequestsApproveCall) Fields(s ...googleapi.Field) *FoldersApprovalRequestsApproveCall {
  1201  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1202  	return c
  1203  }
  1204  
  1205  // Context sets the context to be used in this call's Do method. Any
  1206  // pending HTTP request will be aborted if the provided context is
  1207  // canceled.
  1208  func (c *FoldersApprovalRequestsApproveCall) Context(ctx context.Context) *FoldersApprovalRequestsApproveCall {
  1209  	c.ctx_ = ctx
  1210  	return c
  1211  }
  1212  
  1213  // Header returns an http.Header that can be modified by the caller to
  1214  // add HTTP headers to the request.
  1215  func (c *FoldersApprovalRequestsApproveCall) Header() http.Header {
  1216  	if c.header_ == nil {
  1217  		c.header_ = make(http.Header)
  1218  	}
  1219  	return c.header_
  1220  }
  1221  
  1222  func (c *FoldersApprovalRequestsApproveCall) doRequest(alt string) (*http.Response, error) {
  1223  	reqHeaders := make(http.Header)
  1224  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  1225  	for k, v := range c.header_ {
  1226  		reqHeaders[k] = v
  1227  	}
  1228  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1229  	var body io.Reader = nil
  1230  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.approveapprovalrequestmessage)
  1231  	if err != nil {
  1232  		return nil, err
  1233  	}
  1234  	reqHeaders.Set("Content-Type", "application/json")
  1235  	c.urlParams_.Set("alt", alt)
  1236  	c.urlParams_.Set("prettyPrint", "false")
  1237  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:approve")
  1238  	urls += "?" + c.urlParams_.Encode()
  1239  	req, err := http.NewRequest("POST", 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 "accessapproval.folders.approvalRequests.approve" call.
  1251  // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx
  1252  // status code is an error. Response headers are in either
  1253  // *ApprovalRequest.ServerResponse.Header or (if a response was returned
  1254  // at all) in error.(*googleapi.Error).Header. Use
  1255  // googleapi.IsNotModified to check whether the returned error was
  1256  // because http.StatusNotModified was returned.
  1257  func (c *FoldersApprovalRequestsApproveCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) {
  1258  	gensupport.SetOptions(c.urlParams_, opts...)
  1259  	res, err := c.doRequest("json")
  1260  	if res != nil && res.StatusCode == http.StatusNotModified {
  1261  		if res.Body != nil {
  1262  			res.Body.Close()
  1263  		}
  1264  		return nil, &googleapi.Error{
  1265  			Code:   res.StatusCode,
  1266  			Header: res.Header,
  1267  		}
  1268  	}
  1269  	if err != nil {
  1270  		return nil, err
  1271  	}
  1272  	defer googleapi.CloseBody(res)
  1273  	if err := googleapi.CheckResponse(res); err != nil {
  1274  		return nil, err
  1275  	}
  1276  	ret := &ApprovalRequest{
  1277  		ServerResponse: googleapi.ServerResponse{
  1278  			Header:         res.Header,
  1279  			HTTPStatusCode: res.StatusCode,
  1280  		},
  1281  	}
  1282  	target := &ret
  1283  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1284  		return nil, err
  1285  	}
  1286  	return ret, nil
  1287  	// {
  1288  	//   "description": "Approves a request and returns the updated ApprovalRequest.\n\nReturns NOT_FOUND if the request does not exist. Returns\nFAILED_PRECONDITION if the request exists but is not in a pending state.",
  1289  	//   "flatPath": "v1beta1/folders/{foldersId}/approvalRequests/{approvalRequestsId}:approve",
  1290  	//   "httpMethod": "POST",
  1291  	//   "id": "accessapproval.folders.approvalRequests.approve",
  1292  	//   "parameterOrder": [
  1293  	//     "name"
  1294  	//   ],
  1295  	//   "parameters": {
  1296  	//     "name": {
  1297  	//       "description": "Name of the approval request to approve.",
  1298  	//       "location": "path",
  1299  	//       "pattern": "^folders/[^/]+/approvalRequests/[^/]+$",
  1300  	//       "required": true,
  1301  	//       "type": "string"
  1302  	//     }
  1303  	//   },
  1304  	//   "path": "v1beta1/{+name}:approve",
  1305  	//   "request": {
  1306  	//     "$ref": "ApproveApprovalRequestMessage"
  1307  	//   },
  1308  	//   "response": {
  1309  	//     "$ref": "ApprovalRequest"
  1310  	//   },
  1311  	//   "scopes": [
  1312  	//     "https://www.googleapis.com/auth/cloud-platform"
  1313  	//   ]
  1314  	// }
  1315  
  1316  }
  1317  
  1318  // method id "accessapproval.folders.approvalRequests.dismiss":
  1319  
  1320  type FoldersApprovalRequestsDismissCall struct {
  1321  	s                             *Service
  1322  	name                          string
  1323  	dismissapprovalrequestmessage *DismissApprovalRequestMessage
  1324  	urlParams_                    gensupport.URLParams
  1325  	ctx_                          context.Context
  1326  	header_                       http.Header
  1327  }
  1328  
  1329  // Dismiss: Dismisses a request. Returns the updated
  1330  // ApprovalRequest.
  1331  //
  1332  // NOTE: This does not deny access to the resource if another request
  1333  // has been
  1334  // made and approved. It is equivalent in effect to ignoring the
  1335  // request
  1336  // altogether.
  1337  //
  1338  // Returns NOT_FOUND if the request does not exist.
  1339  //
  1340  // Returns FAILED_PRECONDITION if the request exists but is not in a
  1341  // pending
  1342  // state.
  1343  func (r *FoldersApprovalRequestsService) Dismiss(name string, dismissapprovalrequestmessage *DismissApprovalRequestMessage) *FoldersApprovalRequestsDismissCall {
  1344  	c := &FoldersApprovalRequestsDismissCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1345  	c.name = name
  1346  	c.dismissapprovalrequestmessage = dismissapprovalrequestmessage
  1347  	return c
  1348  }
  1349  
  1350  // Fields allows partial responses to be retrieved. See
  1351  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1352  // for more information.
  1353  func (c *FoldersApprovalRequestsDismissCall) Fields(s ...googleapi.Field) *FoldersApprovalRequestsDismissCall {
  1354  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1355  	return c
  1356  }
  1357  
  1358  // Context sets the context to be used in this call's Do method. Any
  1359  // pending HTTP request will be aborted if the provided context is
  1360  // canceled.
  1361  func (c *FoldersApprovalRequestsDismissCall) Context(ctx context.Context) *FoldersApprovalRequestsDismissCall {
  1362  	c.ctx_ = ctx
  1363  	return c
  1364  }
  1365  
  1366  // Header returns an http.Header that can be modified by the caller to
  1367  // add HTTP headers to the request.
  1368  func (c *FoldersApprovalRequestsDismissCall) Header() http.Header {
  1369  	if c.header_ == nil {
  1370  		c.header_ = make(http.Header)
  1371  	}
  1372  	return c.header_
  1373  }
  1374  
  1375  func (c *FoldersApprovalRequestsDismissCall) doRequest(alt string) (*http.Response, error) {
  1376  	reqHeaders := make(http.Header)
  1377  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  1378  	for k, v := range c.header_ {
  1379  		reqHeaders[k] = v
  1380  	}
  1381  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1382  	var body io.Reader = nil
  1383  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.dismissapprovalrequestmessage)
  1384  	if err != nil {
  1385  		return nil, err
  1386  	}
  1387  	reqHeaders.Set("Content-Type", "application/json")
  1388  	c.urlParams_.Set("alt", alt)
  1389  	c.urlParams_.Set("prettyPrint", "false")
  1390  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:dismiss")
  1391  	urls += "?" + c.urlParams_.Encode()
  1392  	req, err := http.NewRequest("POST", urls, body)
  1393  	if err != nil {
  1394  		return nil, err
  1395  	}
  1396  	req.Header = reqHeaders
  1397  	googleapi.Expand(req.URL, map[string]string{
  1398  		"name": c.name,
  1399  	})
  1400  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1401  }
  1402  
  1403  // Do executes the "accessapproval.folders.approvalRequests.dismiss" call.
  1404  // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx
  1405  // status code is an error. Response headers are in either
  1406  // *ApprovalRequest.ServerResponse.Header or (if a response was returned
  1407  // at all) in error.(*googleapi.Error).Header. Use
  1408  // googleapi.IsNotModified to check whether the returned error was
  1409  // because http.StatusNotModified was returned.
  1410  func (c *FoldersApprovalRequestsDismissCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) {
  1411  	gensupport.SetOptions(c.urlParams_, opts...)
  1412  	res, err := c.doRequest("json")
  1413  	if res != nil && res.StatusCode == http.StatusNotModified {
  1414  		if res.Body != nil {
  1415  			res.Body.Close()
  1416  		}
  1417  		return nil, &googleapi.Error{
  1418  			Code:   res.StatusCode,
  1419  			Header: res.Header,
  1420  		}
  1421  	}
  1422  	if err != nil {
  1423  		return nil, err
  1424  	}
  1425  	defer googleapi.CloseBody(res)
  1426  	if err := googleapi.CheckResponse(res); err != nil {
  1427  		return nil, err
  1428  	}
  1429  	ret := &ApprovalRequest{
  1430  		ServerResponse: googleapi.ServerResponse{
  1431  			Header:         res.Header,
  1432  			HTTPStatusCode: res.StatusCode,
  1433  		},
  1434  	}
  1435  	target := &ret
  1436  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1437  		return nil, err
  1438  	}
  1439  	return ret, nil
  1440  	// {
  1441  	//   "description": "Dismisses a request. Returns the updated ApprovalRequest.\n\nNOTE: This does not deny access to the resource if another request has been\nmade and approved. It is equivalent in effect to ignoring the request\naltogether.\n\nReturns NOT_FOUND if the request does not exist.\n\nReturns FAILED_PRECONDITION if the request exists but is not in a pending\nstate.",
  1442  	//   "flatPath": "v1beta1/folders/{foldersId}/approvalRequests/{approvalRequestsId}:dismiss",
  1443  	//   "httpMethod": "POST",
  1444  	//   "id": "accessapproval.folders.approvalRequests.dismiss",
  1445  	//   "parameterOrder": [
  1446  	//     "name"
  1447  	//   ],
  1448  	//   "parameters": {
  1449  	//     "name": {
  1450  	//       "description": "Name of the ApprovalRequest to dismiss.",
  1451  	//       "location": "path",
  1452  	//       "pattern": "^folders/[^/]+/approvalRequests/[^/]+$",
  1453  	//       "required": true,
  1454  	//       "type": "string"
  1455  	//     }
  1456  	//   },
  1457  	//   "path": "v1beta1/{+name}:dismiss",
  1458  	//   "request": {
  1459  	//     "$ref": "DismissApprovalRequestMessage"
  1460  	//   },
  1461  	//   "response": {
  1462  	//     "$ref": "ApprovalRequest"
  1463  	//   },
  1464  	//   "scopes": [
  1465  	//     "https://www.googleapis.com/auth/cloud-platform"
  1466  	//   ]
  1467  	// }
  1468  
  1469  }
  1470  
  1471  // method id "accessapproval.folders.approvalRequests.get":
  1472  
  1473  type FoldersApprovalRequestsGetCall struct {
  1474  	s            *Service
  1475  	name         string
  1476  	urlParams_   gensupport.URLParams
  1477  	ifNoneMatch_ string
  1478  	ctx_         context.Context
  1479  	header_      http.Header
  1480  }
  1481  
  1482  // Get: Gets an approval request. Returns NOT_FOUND if the request does
  1483  // not exist.
  1484  func (r *FoldersApprovalRequestsService) Get(name string) *FoldersApprovalRequestsGetCall {
  1485  	c := &FoldersApprovalRequestsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1486  	c.name = name
  1487  	return c
  1488  }
  1489  
  1490  // Fields allows partial responses to be retrieved. See
  1491  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1492  // for more information.
  1493  func (c *FoldersApprovalRequestsGetCall) Fields(s ...googleapi.Field) *FoldersApprovalRequestsGetCall {
  1494  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1495  	return c
  1496  }
  1497  
  1498  // IfNoneMatch sets the optional parameter which makes the operation
  1499  // fail if the object's ETag matches the given value. This is useful for
  1500  // getting updates only after the object has changed since the last
  1501  // request. Use googleapi.IsNotModified to check whether the response
  1502  // error from Do is the result of In-None-Match.
  1503  func (c *FoldersApprovalRequestsGetCall) IfNoneMatch(entityTag string) *FoldersApprovalRequestsGetCall {
  1504  	c.ifNoneMatch_ = entityTag
  1505  	return c
  1506  }
  1507  
  1508  // Context sets the context to be used in this call's Do method. Any
  1509  // pending HTTP request will be aborted if the provided context is
  1510  // canceled.
  1511  func (c *FoldersApprovalRequestsGetCall) Context(ctx context.Context) *FoldersApprovalRequestsGetCall {
  1512  	c.ctx_ = ctx
  1513  	return c
  1514  }
  1515  
  1516  // Header returns an http.Header that can be modified by the caller to
  1517  // add HTTP headers to the request.
  1518  func (c *FoldersApprovalRequestsGetCall) Header() http.Header {
  1519  	if c.header_ == nil {
  1520  		c.header_ = make(http.Header)
  1521  	}
  1522  	return c.header_
  1523  }
  1524  
  1525  func (c *FoldersApprovalRequestsGetCall) doRequest(alt string) (*http.Response, error) {
  1526  	reqHeaders := make(http.Header)
  1527  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  1528  	for k, v := range c.header_ {
  1529  		reqHeaders[k] = v
  1530  	}
  1531  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1532  	if c.ifNoneMatch_ != "" {
  1533  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1534  	}
  1535  	var body io.Reader = nil
  1536  	c.urlParams_.Set("alt", alt)
  1537  	c.urlParams_.Set("prettyPrint", "false")
  1538  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  1539  	urls += "?" + c.urlParams_.Encode()
  1540  	req, err := http.NewRequest("GET", urls, body)
  1541  	if err != nil {
  1542  		return nil, err
  1543  	}
  1544  	req.Header = reqHeaders
  1545  	googleapi.Expand(req.URL, map[string]string{
  1546  		"name": c.name,
  1547  	})
  1548  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1549  }
  1550  
  1551  // Do executes the "accessapproval.folders.approvalRequests.get" call.
  1552  // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx
  1553  // status code is an error. Response headers are in either
  1554  // *ApprovalRequest.ServerResponse.Header or (if a response was returned
  1555  // at all) in error.(*googleapi.Error).Header. Use
  1556  // googleapi.IsNotModified to check whether the returned error was
  1557  // because http.StatusNotModified was returned.
  1558  func (c *FoldersApprovalRequestsGetCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) {
  1559  	gensupport.SetOptions(c.urlParams_, opts...)
  1560  	res, err := c.doRequest("json")
  1561  	if res != nil && res.StatusCode == http.StatusNotModified {
  1562  		if res.Body != nil {
  1563  			res.Body.Close()
  1564  		}
  1565  		return nil, &googleapi.Error{
  1566  			Code:   res.StatusCode,
  1567  			Header: res.Header,
  1568  		}
  1569  	}
  1570  	if err != nil {
  1571  		return nil, err
  1572  	}
  1573  	defer googleapi.CloseBody(res)
  1574  	if err := googleapi.CheckResponse(res); err != nil {
  1575  		return nil, err
  1576  	}
  1577  	ret := &ApprovalRequest{
  1578  		ServerResponse: googleapi.ServerResponse{
  1579  			Header:         res.Header,
  1580  			HTTPStatusCode: res.StatusCode,
  1581  		},
  1582  	}
  1583  	target := &ret
  1584  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1585  		return nil, err
  1586  	}
  1587  	return ret, nil
  1588  	// {
  1589  	//   "description": "Gets an approval request. Returns NOT_FOUND if the request does not exist.",
  1590  	//   "flatPath": "v1beta1/folders/{foldersId}/approvalRequests/{approvalRequestsId}",
  1591  	//   "httpMethod": "GET",
  1592  	//   "id": "accessapproval.folders.approvalRequests.get",
  1593  	//   "parameterOrder": [
  1594  	//     "name"
  1595  	//   ],
  1596  	//   "parameters": {
  1597  	//     "name": {
  1598  	//       "description": "Name of the approval request to retrieve.",
  1599  	//       "location": "path",
  1600  	//       "pattern": "^folders/[^/]+/approvalRequests/[^/]+$",
  1601  	//       "required": true,
  1602  	//       "type": "string"
  1603  	//     }
  1604  	//   },
  1605  	//   "path": "v1beta1/{+name}",
  1606  	//   "response": {
  1607  	//     "$ref": "ApprovalRequest"
  1608  	//   },
  1609  	//   "scopes": [
  1610  	//     "https://www.googleapis.com/auth/cloud-platform"
  1611  	//   ]
  1612  	// }
  1613  
  1614  }
  1615  
  1616  // method id "accessapproval.folders.approvalRequests.list":
  1617  
  1618  type FoldersApprovalRequestsListCall struct {
  1619  	s            *Service
  1620  	parent       string
  1621  	urlParams_   gensupport.URLParams
  1622  	ifNoneMatch_ string
  1623  	ctx_         context.Context
  1624  	header_      http.Header
  1625  }
  1626  
  1627  // List: Lists approval requests associated with a project, folder, or
  1628  // organization.
  1629  // Approval requests can be filtered by state (pending, active,
  1630  // dismissed).
  1631  // The order is reverse chronological.
  1632  func (r *FoldersApprovalRequestsService) List(parent string) *FoldersApprovalRequestsListCall {
  1633  	c := &FoldersApprovalRequestsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1634  	c.parent = parent
  1635  	return c
  1636  }
  1637  
  1638  // Filter sets the optional parameter "filter": A filter on the type of
  1639  // approval requests to retrieve. Must be one of the
  1640  // following values:
  1641  // <ol>
  1642  //
  1643  //	<li>[not set]: Requests that are pending or have active
  1644  //
  1645  // approvals.</li>
  1646  //
  1647  //	<li>ALL: All requests.</li>
  1648  //	<li>PENDING: Only pending requests.</li>
  1649  //	<li>ACTIVE: Only active (i.e. currently approved) requests.</li>
  1650  //	<li>DISMISSED: Only dismissed (including expired) requests.</li>
  1651  //	<li>HISTORY: Active and dismissed (including expired)
  1652  //
  1653  // requests.</li>
  1654  // </ol>
  1655  func (c *FoldersApprovalRequestsListCall) Filter(filter string) *FoldersApprovalRequestsListCall {
  1656  	c.urlParams_.Set("filter", filter)
  1657  	return c
  1658  }
  1659  
  1660  // PageSize sets the optional parameter "pageSize": Requested page size.
  1661  func (c *FoldersApprovalRequestsListCall) PageSize(pageSize int64) *FoldersApprovalRequestsListCall {
  1662  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1663  	return c
  1664  }
  1665  
  1666  // PageToken sets the optional parameter "pageToken": A token
  1667  // identifying the page of results to return.
  1668  func (c *FoldersApprovalRequestsListCall) PageToken(pageToken string) *FoldersApprovalRequestsListCall {
  1669  	c.urlParams_.Set("pageToken", pageToken)
  1670  	return c
  1671  }
  1672  
  1673  // Fields allows partial responses to be retrieved. See
  1674  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1675  // for more information.
  1676  func (c *FoldersApprovalRequestsListCall) Fields(s ...googleapi.Field) *FoldersApprovalRequestsListCall {
  1677  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1678  	return c
  1679  }
  1680  
  1681  // IfNoneMatch sets the optional parameter which makes the operation
  1682  // fail if the object's ETag matches the given value. This is useful for
  1683  // getting updates only after the object has changed since the last
  1684  // request. Use googleapi.IsNotModified to check whether the response
  1685  // error from Do is the result of In-None-Match.
  1686  func (c *FoldersApprovalRequestsListCall) IfNoneMatch(entityTag string) *FoldersApprovalRequestsListCall {
  1687  	c.ifNoneMatch_ = entityTag
  1688  	return c
  1689  }
  1690  
  1691  // Context sets the context to be used in this call's Do method. Any
  1692  // pending HTTP request will be aborted if the provided context is
  1693  // canceled.
  1694  func (c *FoldersApprovalRequestsListCall) Context(ctx context.Context) *FoldersApprovalRequestsListCall {
  1695  	c.ctx_ = ctx
  1696  	return c
  1697  }
  1698  
  1699  // Header returns an http.Header that can be modified by the caller to
  1700  // add HTTP headers to the request.
  1701  func (c *FoldersApprovalRequestsListCall) Header() http.Header {
  1702  	if c.header_ == nil {
  1703  		c.header_ = make(http.Header)
  1704  	}
  1705  	return c.header_
  1706  }
  1707  
  1708  func (c *FoldersApprovalRequestsListCall) doRequest(alt string) (*http.Response, error) {
  1709  	reqHeaders := make(http.Header)
  1710  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  1711  	for k, v := range c.header_ {
  1712  		reqHeaders[k] = v
  1713  	}
  1714  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1715  	if c.ifNoneMatch_ != "" {
  1716  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1717  	}
  1718  	var body io.Reader = nil
  1719  	c.urlParams_.Set("alt", alt)
  1720  	c.urlParams_.Set("prettyPrint", "false")
  1721  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/approvalRequests")
  1722  	urls += "?" + c.urlParams_.Encode()
  1723  	req, err := http.NewRequest("GET", urls, body)
  1724  	if err != nil {
  1725  		return nil, err
  1726  	}
  1727  	req.Header = reqHeaders
  1728  	googleapi.Expand(req.URL, map[string]string{
  1729  		"parent": c.parent,
  1730  	})
  1731  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1732  }
  1733  
  1734  // Do executes the "accessapproval.folders.approvalRequests.list" call.
  1735  // Exactly one of *ListApprovalRequestsResponse or error will be
  1736  // non-nil. Any non-2xx status code is an error. Response headers are in
  1737  // either *ListApprovalRequestsResponse.ServerResponse.Header or (if a
  1738  // response was returned at all) in error.(*googleapi.Error).Header. Use
  1739  // googleapi.IsNotModified to check whether the returned error was
  1740  // because http.StatusNotModified was returned.
  1741  func (c *FoldersApprovalRequestsListCall) Do(opts ...googleapi.CallOption) (*ListApprovalRequestsResponse, error) {
  1742  	gensupport.SetOptions(c.urlParams_, opts...)
  1743  	res, err := c.doRequest("json")
  1744  	if res != nil && res.StatusCode == http.StatusNotModified {
  1745  		if res.Body != nil {
  1746  			res.Body.Close()
  1747  		}
  1748  		return nil, &googleapi.Error{
  1749  			Code:   res.StatusCode,
  1750  			Header: res.Header,
  1751  		}
  1752  	}
  1753  	if err != nil {
  1754  		return nil, err
  1755  	}
  1756  	defer googleapi.CloseBody(res)
  1757  	if err := googleapi.CheckResponse(res); err != nil {
  1758  		return nil, err
  1759  	}
  1760  	ret := &ListApprovalRequestsResponse{
  1761  		ServerResponse: googleapi.ServerResponse{
  1762  			Header:         res.Header,
  1763  			HTTPStatusCode: res.StatusCode,
  1764  		},
  1765  	}
  1766  	target := &ret
  1767  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1768  		return nil, err
  1769  	}
  1770  	return ret, nil
  1771  	// {
  1772  	//   "description": "Lists approval requests associated with a project, folder, or organization.\nApproval requests can be filtered by state (pending, active, dismissed).\nThe order is reverse chronological.",
  1773  	//   "flatPath": "v1beta1/folders/{foldersId}/approvalRequests",
  1774  	//   "httpMethod": "GET",
  1775  	//   "id": "accessapproval.folders.approvalRequests.list",
  1776  	//   "parameterOrder": [
  1777  	//     "parent"
  1778  	//   ],
  1779  	//   "parameters": {
  1780  	//     "filter": {
  1781  	//       "description": "A filter on the type of approval requests to retrieve. Must be one of the\nfollowing values:\n\u003col\u003e\n  \u003cli\u003e[not set]: Requests that are pending or have active approvals.\u003c/li\u003e\n  \u003cli\u003eALL: All requests.\u003c/li\u003e\n  \u003cli\u003ePENDING: Only pending requests.\u003c/li\u003e\n  \u003cli\u003eACTIVE: Only active (i.e. currently approved) requests.\u003c/li\u003e\n  \u003cli\u003eDISMISSED: Only dismissed (including expired) requests.\u003c/li\u003e\n  \u003cli\u003eHISTORY: Active and dismissed (including expired) requests.\u003c/li\u003e\n\u003c/ol\u003e",
  1782  	//       "location": "query",
  1783  	//       "type": "string"
  1784  	//     },
  1785  	//     "pageSize": {
  1786  	//       "description": "Requested page size.",
  1787  	//       "format": "int32",
  1788  	//       "location": "query",
  1789  	//       "type": "integer"
  1790  	//     },
  1791  	//     "pageToken": {
  1792  	//       "description": "A token identifying the page of results to return.",
  1793  	//       "location": "query",
  1794  	//       "type": "string"
  1795  	//     },
  1796  	//     "parent": {
  1797  	//       "description": "The parent resource. This may be \"projects/{project_id}\",\n\"folders/{folder_id}\", or \"organizations/{organization_id}\".",
  1798  	//       "location": "path",
  1799  	//       "pattern": "^folders/[^/]+$",
  1800  	//       "required": true,
  1801  	//       "type": "string"
  1802  	//     }
  1803  	//   },
  1804  	//   "path": "v1beta1/{+parent}/approvalRequests",
  1805  	//   "response": {
  1806  	//     "$ref": "ListApprovalRequestsResponse"
  1807  	//   },
  1808  	//   "scopes": [
  1809  	//     "https://www.googleapis.com/auth/cloud-platform"
  1810  	//   ]
  1811  	// }
  1812  
  1813  }
  1814  
  1815  // Pages invokes f for each page of results.
  1816  // A non-nil error returned from f will halt the iteration.
  1817  // The provided context supersedes any context provided to the Context method.
  1818  func (c *FoldersApprovalRequestsListCall) Pages(ctx context.Context, f func(*ListApprovalRequestsResponse) error) error {
  1819  	c.ctx_ = ctx
  1820  	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1821  	for {
  1822  		x, err := c.Do()
  1823  		if err != nil {
  1824  			return err
  1825  		}
  1826  		if err := f(x); err != nil {
  1827  			return err
  1828  		}
  1829  		if x.NextPageToken == "" {
  1830  			return nil
  1831  		}
  1832  		c.PageToken(x.NextPageToken)
  1833  	}
  1834  }
  1835  
  1836  // method id "accessapproval.organizations.deleteAccessApprovalSettings":
  1837  
  1838  type OrganizationsDeleteAccessApprovalSettingsCall struct {
  1839  	s          *Service
  1840  	name       string
  1841  	urlParams_ gensupport.URLParams
  1842  	ctx_       context.Context
  1843  	header_    http.Header
  1844  }
  1845  
  1846  // DeleteAccessApprovalSettings: Deletes the settings associated with a
  1847  // project, folder, or organization.
  1848  // This will have the effect of disabling Access Approval for the
  1849  // project,
  1850  // folder, or organization, but only if all ancestors also have
  1851  // Access
  1852  // Approval disabled. If Access Approval is enabled at a higher level of
  1853  // the
  1854  // hierarchy, then Access Approval will still be enabled at this level
  1855  // as
  1856  // the settings are inherited.
  1857  func (r *OrganizationsService) DeleteAccessApprovalSettings(name string) *OrganizationsDeleteAccessApprovalSettingsCall {
  1858  	c := &OrganizationsDeleteAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1859  	c.name = name
  1860  	return c
  1861  }
  1862  
  1863  // Fields allows partial responses to be retrieved. See
  1864  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1865  // for more information.
  1866  func (c *OrganizationsDeleteAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *OrganizationsDeleteAccessApprovalSettingsCall {
  1867  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1868  	return c
  1869  }
  1870  
  1871  // Context sets the context to be used in this call's Do method. Any
  1872  // pending HTTP request will be aborted if the provided context is
  1873  // canceled.
  1874  func (c *OrganizationsDeleteAccessApprovalSettingsCall) Context(ctx context.Context) *OrganizationsDeleteAccessApprovalSettingsCall {
  1875  	c.ctx_ = ctx
  1876  	return c
  1877  }
  1878  
  1879  // Header returns an http.Header that can be modified by the caller to
  1880  // add HTTP headers to the request.
  1881  func (c *OrganizationsDeleteAccessApprovalSettingsCall) Header() http.Header {
  1882  	if c.header_ == nil {
  1883  		c.header_ = make(http.Header)
  1884  	}
  1885  	return c.header_
  1886  }
  1887  
  1888  func (c *OrganizationsDeleteAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) {
  1889  	reqHeaders := make(http.Header)
  1890  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  1891  	for k, v := range c.header_ {
  1892  		reqHeaders[k] = v
  1893  	}
  1894  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1895  	var body io.Reader = nil
  1896  	c.urlParams_.Set("alt", alt)
  1897  	c.urlParams_.Set("prettyPrint", "false")
  1898  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  1899  	urls += "?" + c.urlParams_.Encode()
  1900  	req, err := http.NewRequest("DELETE", urls, body)
  1901  	if err != nil {
  1902  		return nil, err
  1903  	}
  1904  	req.Header = reqHeaders
  1905  	googleapi.Expand(req.URL, map[string]string{
  1906  		"name": c.name,
  1907  	})
  1908  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1909  }
  1910  
  1911  // Do executes the "accessapproval.organizations.deleteAccessApprovalSettings" call.
  1912  // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1913  // code is an error. Response headers are in either
  1914  // *Empty.ServerResponse.Header or (if a response was returned at all)
  1915  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1916  // check whether the returned error was because http.StatusNotModified
  1917  // was returned.
  1918  func (c *OrganizationsDeleteAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1919  	gensupport.SetOptions(c.urlParams_, opts...)
  1920  	res, err := c.doRequest("json")
  1921  	if res != nil && res.StatusCode == http.StatusNotModified {
  1922  		if res.Body != nil {
  1923  			res.Body.Close()
  1924  		}
  1925  		return nil, &googleapi.Error{
  1926  			Code:   res.StatusCode,
  1927  			Header: res.Header,
  1928  		}
  1929  	}
  1930  	if err != nil {
  1931  		return nil, err
  1932  	}
  1933  	defer googleapi.CloseBody(res)
  1934  	if err := googleapi.CheckResponse(res); err != nil {
  1935  		return nil, err
  1936  	}
  1937  	ret := &Empty{
  1938  		ServerResponse: googleapi.ServerResponse{
  1939  			Header:         res.Header,
  1940  			HTTPStatusCode: res.StatusCode,
  1941  		},
  1942  	}
  1943  	target := &ret
  1944  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1945  		return nil, err
  1946  	}
  1947  	return ret, nil
  1948  	// {
  1949  	//   "description": "Deletes the settings associated with a project, folder, or organization.\nThis will have the effect of disabling Access Approval for the project,\nfolder, or organization, but only if all ancestors also have Access\nApproval disabled. If Access Approval is enabled at a higher level of the\nhierarchy, then Access Approval will still be enabled at this level as\nthe settings are inherited.",
  1950  	//   "flatPath": "v1beta1/organizations/{organizationsId}/accessApprovalSettings",
  1951  	//   "httpMethod": "DELETE",
  1952  	//   "id": "accessapproval.organizations.deleteAccessApprovalSettings",
  1953  	//   "parameterOrder": [
  1954  	//     "name"
  1955  	//   ],
  1956  	//   "parameters": {
  1957  	//     "name": {
  1958  	//       "description": "Name of the AccessApprovalSettings to delete.",
  1959  	//       "location": "path",
  1960  	//       "pattern": "^organizations/[^/]+/accessApprovalSettings$",
  1961  	//       "required": true,
  1962  	//       "type": "string"
  1963  	//     }
  1964  	//   },
  1965  	//   "path": "v1beta1/{+name}",
  1966  	//   "response": {
  1967  	//     "$ref": "Empty"
  1968  	//   },
  1969  	//   "scopes": [
  1970  	//     "https://www.googleapis.com/auth/cloud-platform"
  1971  	//   ]
  1972  	// }
  1973  
  1974  }
  1975  
  1976  // method id "accessapproval.organizations.getAccessApprovalSettings":
  1977  
  1978  type OrganizationsGetAccessApprovalSettingsCall struct {
  1979  	s            *Service
  1980  	name         string
  1981  	urlParams_   gensupport.URLParams
  1982  	ifNoneMatch_ string
  1983  	ctx_         context.Context
  1984  	header_      http.Header
  1985  }
  1986  
  1987  // GetAccessApprovalSettings: Gets the settings associated with a
  1988  // project, folder, or organization.
  1989  func (r *OrganizationsService) GetAccessApprovalSettings(name string) *OrganizationsGetAccessApprovalSettingsCall {
  1990  	c := &OrganizationsGetAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1991  	c.name = name
  1992  	return c
  1993  }
  1994  
  1995  // Fields allows partial responses to be retrieved. See
  1996  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1997  // for more information.
  1998  func (c *OrganizationsGetAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *OrganizationsGetAccessApprovalSettingsCall {
  1999  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2000  	return c
  2001  }
  2002  
  2003  // IfNoneMatch sets the optional parameter which makes the operation
  2004  // fail if the object's ETag matches the given value. This is useful for
  2005  // getting updates only after the object has changed since the last
  2006  // request. Use googleapi.IsNotModified to check whether the response
  2007  // error from Do is the result of In-None-Match.
  2008  func (c *OrganizationsGetAccessApprovalSettingsCall) IfNoneMatch(entityTag string) *OrganizationsGetAccessApprovalSettingsCall {
  2009  	c.ifNoneMatch_ = entityTag
  2010  	return c
  2011  }
  2012  
  2013  // Context sets the context to be used in this call's Do method. Any
  2014  // pending HTTP request will be aborted if the provided context is
  2015  // canceled.
  2016  func (c *OrganizationsGetAccessApprovalSettingsCall) Context(ctx context.Context) *OrganizationsGetAccessApprovalSettingsCall {
  2017  	c.ctx_ = ctx
  2018  	return c
  2019  }
  2020  
  2021  // Header returns an http.Header that can be modified by the caller to
  2022  // add HTTP headers to the request.
  2023  func (c *OrganizationsGetAccessApprovalSettingsCall) Header() http.Header {
  2024  	if c.header_ == nil {
  2025  		c.header_ = make(http.Header)
  2026  	}
  2027  	return c.header_
  2028  }
  2029  
  2030  func (c *OrganizationsGetAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) {
  2031  	reqHeaders := make(http.Header)
  2032  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  2033  	for k, v := range c.header_ {
  2034  		reqHeaders[k] = v
  2035  	}
  2036  	reqHeaders.Set("User-Agent", c.s.userAgent())
  2037  	if c.ifNoneMatch_ != "" {
  2038  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2039  	}
  2040  	var body io.Reader = nil
  2041  	c.urlParams_.Set("alt", alt)
  2042  	c.urlParams_.Set("prettyPrint", "false")
  2043  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  2044  	urls += "?" + c.urlParams_.Encode()
  2045  	req, err := http.NewRequest("GET", urls, body)
  2046  	if err != nil {
  2047  		return nil, err
  2048  	}
  2049  	req.Header = reqHeaders
  2050  	googleapi.Expand(req.URL, map[string]string{
  2051  		"name": c.name,
  2052  	})
  2053  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2054  }
  2055  
  2056  // Do executes the "accessapproval.organizations.getAccessApprovalSettings" call.
  2057  // Exactly one of *AccessApprovalSettings or error will be non-nil. Any
  2058  // non-2xx status code is an error. Response headers are in either
  2059  // *AccessApprovalSettings.ServerResponse.Header or (if a response was
  2060  // returned at all) in error.(*googleapi.Error).Header. Use
  2061  // googleapi.IsNotModified to check whether the returned error was
  2062  // because http.StatusNotModified was returned.
  2063  func (c *OrganizationsGetAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*AccessApprovalSettings, error) {
  2064  	gensupport.SetOptions(c.urlParams_, opts...)
  2065  	res, err := c.doRequest("json")
  2066  	if res != nil && res.StatusCode == http.StatusNotModified {
  2067  		if res.Body != nil {
  2068  			res.Body.Close()
  2069  		}
  2070  		return nil, &googleapi.Error{
  2071  			Code:   res.StatusCode,
  2072  			Header: res.Header,
  2073  		}
  2074  	}
  2075  	if err != nil {
  2076  		return nil, err
  2077  	}
  2078  	defer googleapi.CloseBody(res)
  2079  	if err := googleapi.CheckResponse(res); err != nil {
  2080  		return nil, err
  2081  	}
  2082  	ret := &AccessApprovalSettings{
  2083  		ServerResponse: googleapi.ServerResponse{
  2084  			Header:         res.Header,
  2085  			HTTPStatusCode: res.StatusCode,
  2086  		},
  2087  	}
  2088  	target := &ret
  2089  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2090  		return nil, err
  2091  	}
  2092  	return ret, nil
  2093  	// {
  2094  	//   "description": "Gets the settings associated with a project, folder, or organization.",
  2095  	//   "flatPath": "v1beta1/organizations/{organizationsId}/accessApprovalSettings",
  2096  	//   "httpMethod": "GET",
  2097  	//   "id": "accessapproval.organizations.getAccessApprovalSettings",
  2098  	//   "parameterOrder": [
  2099  	//     "name"
  2100  	//   ],
  2101  	//   "parameters": {
  2102  	//     "name": {
  2103  	//       "description": "Name of the AccessApprovalSettings to retrieve.",
  2104  	//       "location": "path",
  2105  	//       "pattern": "^organizations/[^/]+/accessApprovalSettings$",
  2106  	//       "required": true,
  2107  	//       "type": "string"
  2108  	//     }
  2109  	//   },
  2110  	//   "path": "v1beta1/{+name}",
  2111  	//   "response": {
  2112  	//     "$ref": "AccessApprovalSettings"
  2113  	//   },
  2114  	//   "scopes": [
  2115  	//     "https://www.googleapis.com/auth/cloud-platform"
  2116  	//   ]
  2117  	// }
  2118  
  2119  }
  2120  
  2121  // method id "accessapproval.organizations.updateAccessApprovalSettings":
  2122  
  2123  type OrganizationsUpdateAccessApprovalSettingsCall struct {
  2124  	s                      *Service
  2125  	name                   string
  2126  	accessapprovalsettings *AccessApprovalSettings
  2127  	urlParams_             gensupport.URLParams
  2128  	ctx_                   context.Context
  2129  	header_                http.Header
  2130  }
  2131  
  2132  // UpdateAccessApprovalSettings: Updates the settings associated with a
  2133  // project, folder, or organization.
  2134  // Settings to update are determined by the value of field_mask.
  2135  func (r *OrganizationsService) UpdateAccessApprovalSettings(name string, accessapprovalsettings *AccessApprovalSettings) *OrganizationsUpdateAccessApprovalSettingsCall {
  2136  	c := &OrganizationsUpdateAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2137  	c.name = name
  2138  	c.accessapprovalsettings = accessapprovalsettings
  2139  	return c
  2140  }
  2141  
  2142  // UpdateMask sets the optional parameter "updateMask": For the
  2143  // `FieldMask` definition,
  2144  // see
  2145  // https://developers.google.com/protocol-buffers/docs/reference/goog
  2146  // le.protobuf#fieldmask
  2147  // If this field is left unset, only the notification_emails field will
  2148  // be
  2149  // updated.
  2150  func (c *OrganizationsUpdateAccessApprovalSettingsCall) UpdateMask(updateMask string) *OrganizationsUpdateAccessApprovalSettingsCall {
  2151  	c.urlParams_.Set("updateMask", updateMask)
  2152  	return c
  2153  }
  2154  
  2155  // Fields allows partial responses to be retrieved. See
  2156  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2157  // for more information.
  2158  func (c *OrganizationsUpdateAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *OrganizationsUpdateAccessApprovalSettingsCall {
  2159  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2160  	return c
  2161  }
  2162  
  2163  // Context sets the context to be used in this call's Do method. Any
  2164  // pending HTTP request will be aborted if the provided context is
  2165  // canceled.
  2166  func (c *OrganizationsUpdateAccessApprovalSettingsCall) Context(ctx context.Context) *OrganizationsUpdateAccessApprovalSettingsCall {
  2167  	c.ctx_ = ctx
  2168  	return c
  2169  }
  2170  
  2171  // Header returns an http.Header that can be modified by the caller to
  2172  // add HTTP headers to the request.
  2173  func (c *OrganizationsUpdateAccessApprovalSettingsCall) Header() http.Header {
  2174  	if c.header_ == nil {
  2175  		c.header_ = make(http.Header)
  2176  	}
  2177  	return c.header_
  2178  }
  2179  
  2180  func (c *OrganizationsUpdateAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) {
  2181  	reqHeaders := make(http.Header)
  2182  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  2183  	for k, v := range c.header_ {
  2184  		reqHeaders[k] = v
  2185  	}
  2186  	reqHeaders.Set("User-Agent", c.s.userAgent())
  2187  	var body io.Reader = nil
  2188  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.accessapprovalsettings)
  2189  	if err != nil {
  2190  		return nil, err
  2191  	}
  2192  	reqHeaders.Set("Content-Type", "application/json")
  2193  	c.urlParams_.Set("alt", alt)
  2194  	c.urlParams_.Set("prettyPrint", "false")
  2195  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  2196  	urls += "?" + c.urlParams_.Encode()
  2197  	req, err := http.NewRequest("PATCH", urls, body)
  2198  	if err != nil {
  2199  		return nil, err
  2200  	}
  2201  	req.Header = reqHeaders
  2202  	googleapi.Expand(req.URL, map[string]string{
  2203  		"name": c.name,
  2204  	})
  2205  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2206  }
  2207  
  2208  // Do executes the "accessapproval.organizations.updateAccessApprovalSettings" call.
  2209  // Exactly one of *AccessApprovalSettings or error will be non-nil. Any
  2210  // non-2xx status code is an error. Response headers are in either
  2211  // *AccessApprovalSettings.ServerResponse.Header or (if a response was
  2212  // returned at all) in error.(*googleapi.Error).Header. Use
  2213  // googleapi.IsNotModified to check whether the returned error was
  2214  // because http.StatusNotModified was returned.
  2215  func (c *OrganizationsUpdateAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*AccessApprovalSettings, error) {
  2216  	gensupport.SetOptions(c.urlParams_, opts...)
  2217  	res, err := c.doRequest("json")
  2218  	if res != nil && res.StatusCode == http.StatusNotModified {
  2219  		if res.Body != nil {
  2220  			res.Body.Close()
  2221  		}
  2222  		return nil, &googleapi.Error{
  2223  			Code:   res.StatusCode,
  2224  			Header: res.Header,
  2225  		}
  2226  	}
  2227  	if err != nil {
  2228  		return nil, err
  2229  	}
  2230  	defer googleapi.CloseBody(res)
  2231  	if err := googleapi.CheckResponse(res); err != nil {
  2232  		return nil, err
  2233  	}
  2234  	ret := &AccessApprovalSettings{
  2235  		ServerResponse: googleapi.ServerResponse{
  2236  			Header:         res.Header,
  2237  			HTTPStatusCode: res.StatusCode,
  2238  		},
  2239  	}
  2240  	target := &ret
  2241  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2242  		return nil, err
  2243  	}
  2244  	return ret, nil
  2245  	// {
  2246  	//   "description": "Updates the settings associated with a project, folder, or organization.\nSettings to update are determined by the value of field_mask.",
  2247  	//   "flatPath": "v1beta1/organizations/{organizationsId}/accessApprovalSettings",
  2248  	//   "httpMethod": "PATCH",
  2249  	//   "id": "accessapproval.organizations.updateAccessApprovalSettings",
  2250  	//   "parameterOrder": [
  2251  	//     "name"
  2252  	//   ],
  2253  	//   "parameters": {
  2254  	//     "name": {
  2255  	//       "description": "The resource name of the settings. Format is one of:\n\u003col\u003e\n  \u003cli\u003e\"projects/{project_id}/accessApprovalSettings\"\u003c/li\u003e\n  \u003cli\u003e\"folders/{folder_id}/accessApprovalSettings\"\u003c/li\u003e\n  \u003cli\u003e\"organizations/{organization_id}/accessApprovalSettings\"\u003c/li\u003e\n\u003col\u003e",
  2256  	//       "location": "path",
  2257  	//       "pattern": "^organizations/[^/]+/accessApprovalSettings$",
  2258  	//       "required": true,
  2259  	//       "type": "string"
  2260  	//     },
  2261  	//     "updateMask": {
  2262  	//       "description": "For the `FieldMask` definition, see\nhttps://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask\nIf this field is left unset, only the notification_emails field will be\nupdated.",
  2263  	//       "format": "google-fieldmask",
  2264  	//       "location": "query",
  2265  	//       "type": "string"
  2266  	//     }
  2267  	//   },
  2268  	//   "path": "v1beta1/{+name}",
  2269  	//   "request": {
  2270  	//     "$ref": "AccessApprovalSettings"
  2271  	//   },
  2272  	//   "response": {
  2273  	//     "$ref": "AccessApprovalSettings"
  2274  	//   },
  2275  	//   "scopes": [
  2276  	//     "https://www.googleapis.com/auth/cloud-platform"
  2277  	//   ]
  2278  	// }
  2279  
  2280  }
  2281  
  2282  // method id "accessapproval.organizations.approvalRequests.approve":
  2283  
  2284  type OrganizationsApprovalRequestsApproveCall struct {
  2285  	s                             *Service
  2286  	name                          string
  2287  	approveapprovalrequestmessage *ApproveApprovalRequestMessage
  2288  	urlParams_                    gensupport.URLParams
  2289  	ctx_                          context.Context
  2290  	header_                       http.Header
  2291  }
  2292  
  2293  // Approve: Approves a request and returns the updated
  2294  // ApprovalRequest.
  2295  //
  2296  // Returns NOT_FOUND if the request does not exist.
  2297  // Returns
  2298  // FAILED_PRECONDITION if the request exists but is not in a pending
  2299  // state.
  2300  func (r *OrganizationsApprovalRequestsService) Approve(name string, approveapprovalrequestmessage *ApproveApprovalRequestMessage) *OrganizationsApprovalRequestsApproveCall {
  2301  	c := &OrganizationsApprovalRequestsApproveCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2302  	c.name = name
  2303  	c.approveapprovalrequestmessage = approveapprovalrequestmessage
  2304  	return c
  2305  }
  2306  
  2307  // Fields allows partial responses to be retrieved. See
  2308  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2309  // for more information.
  2310  func (c *OrganizationsApprovalRequestsApproveCall) Fields(s ...googleapi.Field) *OrganizationsApprovalRequestsApproveCall {
  2311  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2312  	return c
  2313  }
  2314  
  2315  // Context sets the context to be used in this call's Do method. Any
  2316  // pending HTTP request will be aborted if the provided context is
  2317  // canceled.
  2318  func (c *OrganizationsApprovalRequestsApproveCall) Context(ctx context.Context) *OrganizationsApprovalRequestsApproveCall {
  2319  	c.ctx_ = ctx
  2320  	return c
  2321  }
  2322  
  2323  // Header returns an http.Header that can be modified by the caller to
  2324  // add HTTP headers to the request.
  2325  func (c *OrganizationsApprovalRequestsApproveCall) Header() http.Header {
  2326  	if c.header_ == nil {
  2327  		c.header_ = make(http.Header)
  2328  	}
  2329  	return c.header_
  2330  }
  2331  
  2332  func (c *OrganizationsApprovalRequestsApproveCall) doRequest(alt string) (*http.Response, error) {
  2333  	reqHeaders := make(http.Header)
  2334  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  2335  	for k, v := range c.header_ {
  2336  		reqHeaders[k] = v
  2337  	}
  2338  	reqHeaders.Set("User-Agent", c.s.userAgent())
  2339  	var body io.Reader = nil
  2340  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.approveapprovalrequestmessage)
  2341  	if err != nil {
  2342  		return nil, err
  2343  	}
  2344  	reqHeaders.Set("Content-Type", "application/json")
  2345  	c.urlParams_.Set("alt", alt)
  2346  	c.urlParams_.Set("prettyPrint", "false")
  2347  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:approve")
  2348  	urls += "?" + c.urlParams_.Encode()
  2349  	req, err := http.NewRequest("POST", urls, body)
  2350  	if err != nil {
  2351  		return nil, err
  2352  	}
  2353  	req.Header = reqHeaders
  2354  	googleapi.Expand(req.URL, map[string]string{
  2355  		"name": c.name,
  2356  	})
  2357  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2358  }
  2359  
  2360  // Do executes the "accessapproval.organizations.approvalRequests.approve" call.
  2361  // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx
  2362  // status code is an error. Response headers are in either
  2363  // *ApprovalRequest.ServerResponse.Header or (if a response was returned
  2364  // at all) in error.(*googleapi.Error).Header. Use
  2365  // googleapi.IsNotModified to check whether the returned error was
  2366  // because http.StatusNotModified was returned.
  2367  func (c *OrganizationsApprovalRequestsApproveCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) {
  2368  	gensupport.SetOptions(c.urlParams_, opts...)
  2369  	res, err := c.doRequest("json")
  2370  	if res != nil && res.StatusCode == http.StatusNotModified {
  2371  		if res.Body != nil {
  2372  			res.Body.Close()
  2373  		}
  2374  		return nil, &googleapi.Error{
  2375  			Code:   res.StatusCode,
  2376  			Header: res.Header,
  2377  		}
  2378  	}
  2379  	if err != nil {
  2380  		return nil, err
  2381  	}
  2382  	defer googleapi.CloseBody(res)
  2383  	if err := googleapi.CheckResponse(res); err != nil {
  2384  		return nil, err
  2385  	}
  2386  	ret := &ApprovalRequest{
  2387  		ServerResponse: googleapi.ServerResponse{
  2388  			Header:         res.Header,
  2389  			HTTPStatusCode: res.StatusCode,
  2390  		},
  2391  	}
  2392  	target := &ret
  2393  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2394  		return nil, err
  2395  	}
  2396  	return ret, nil
  2397  	// {
  2398  	//   "description": "Approves a request and returns the updated ApprovalRequest.\n\nReturns NOT_FOUND if the request does not exist. Returns\nFAILED_PRECONDITION if the request exists but is not in a pending state.",
  2399  	//   "flatPath": "v1beta1/organizations/{organizationsId}/approvalRequests/{approvalRequestsId}:approve",
  2400  	//   "httpMethod": "POST",
  2401  	//   "id": "accessapproval.organizations.approvalRequests.approve",
  2402  	//   "parameterOrder": [
  2403  	//     "name"
  2404  	//   ],
  2405  	//   "parameters": {
  2406  	//     "name": {
  2407  	//       "description": "Name of the approval request to approve.",
  2408  	//       "location": "path",
  2409  	//       "pattern": "^organizations/[^/]+/approvalRequests/[^/]+$",
  2410  	//       "required": true,
  2411  	//       "type": "string"
  2412  	//     }
  2413  	//   },
  2414  	//   "path": "v1beta1/{+name}:approve",
  2415  	//   "request": {
  2416  	//     "$ref": "ApproveApprovalRequestMessage"
  2417  	//   },
  2418  	//   "response": {
  2419  	//     "$ref": "ApprovalRequest"
  2420  	//   },
  2421  	//   "scopes": [
  2422  	//     "https://www.googleapis.com/auth/cloud-platform"
  2423  	//   ]
  2424  	// }
  2425  
  2426  }
  2427  
  2428  // method id "accessapproval.organizations.approvalRequests.dismiss":
  2429  
  2430  type OrganizationsApprovalRequestsDismissCall struct {
  2431  	s                             *Service
  2432  	name                          string
  2433  	dismissapprovalrequestmessage *DismissApprovalRequestMessage
  2434  	urlParams_                    gensupport.URLParams
  2435  	ctx_                          context.Context
  2436  	header_                       http.Header
  2437  }
  2438  
  2439  // Dismiss: Dismisses a request. Returns the updated
  2440  // ApprovalRequest.
  2441  //
  2442  // NOTE: This does not deny access to the resource if another request
  2443  // has been
  2444  // made and approved. It is equivalent in effect to ignoring the
  2445  // request
  2446  // altogether.
  2447  //
  2448  // Returns NOT_FOUND if the request does not exist.
  2449  //
  2450  // Returns FAILED_PRECONDITION if the request exists but is not in a
  2451  // pending
  2452  // state.
  2453  func (r *OrganizationsApprovalRequestsService) Dismiss(name string, dismissapprovalrequestmessage *DismissApprovalRequestMessage) *OrganizationsApprovalRequestsDismissCall {
  2454  	c := &OrganizationsApprovalRequestsDismissCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2455  	c.name = name
  2456  	c.dismissapprovalrequestmessage = dismissapprovalrequestmessage
  2457  	return c
  2458  }
  2459  
  2460  // Fields allows partial responses to be retrieved. See
  2461  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2462  // for more information.
  2463  func (c *OrganizationsApprovalRequestsDismissCall) Fields(s ...googleapi.Field) *OrganizationsApprovalRequestsDismissCall {
  2464  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2465  	return c
  2466  }
  2467  
  2468  // Context sets the context to be used in this call's Do method. Any
  2469  // pending HTTP request will be aborted if the provided context is
  2470  // canceled.
  2471  func (c *OrganizationsApprovalRequestsDismissCall) Context(ctx context.Context) *OrganizationsApprovalRequestsDismissCall {
  2472  	c.ctx_ = ctx
  2473  	return c
  2474  }
  2475  
  2476  // Header returns an http.Header that can be modified by the caller to
  2477  // add HTTP headers to the request.
  2478  func (c *OrganizationsApprovalRequestsDismissCall) Header() http.Header {
  2479  	if c.header_ == nil {
  2480  		c.header_ = make(http.Header)
  2481  	}
  2482  	return c.header_
  2483  }
  2484  
  2485  func (c *OrganizationsApprovalRequestsDismissCall) doRequest(alt string) (*http.Response, error) {
  2486  	reqHeaders := make(http.Header)
  2487  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  2488  	for k, v := range c.header_ {
  2489  		reqHeaders[k] = v
  2490  	}
  2491  	reqHeaders.Set("User-Agent", c.s.userAgent())
  2492  	var body io.Reader = nil
  2493  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.dismissapprovalrequestmessage)
  2494  	if err != nil {
  2495  		return nil, err
  2496  	}
  2497  	reqHeaders.Set("Content-Type", "application/json")
  2498  	c.urlParams_.Set("alt", alt)
  2499  	c.urlParams_.Set("prettyPrint", "false")
  2500  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:dismiss")
  2501  	urls += "?" + c.urlParams_.Encode()
  2502  	req, err := http.NewRequest("POST", urls, body)
  2503  	if err != nil {
  2504  		return nil, err
  2505  	}
  2506  	req.Header = reqHeaders
  2507  	googleapi.Expand(req.URL, map[string]string{
  2508  		"name": c.name,
  2509  	})
  2510  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2511  }
  2512  
  2513  // Do executes the "accessapproval.organizations.approvalRequests.dismiss" call.
  2514  // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx
  2515  // status code is an error. Response headers are in either
  2516  // *ApprovalRequest.ServerResponse.Header or (if a response was returned
  2517  // at all) in error.(*googleapi.Error).Header. Use
  2518  // googleapi.IsNotModified to check whether the returned error was
  2519  // because http.StatusNotModified was returned.
  2520  func (c *OrganizationsApprovalRequestsDismissCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) {
  2521  	gensupport.SetOptions(c.urlParams_, opts...)
  2522  	res, err := c.doRequest("json")
  2523  	if res != nil && res.StatusCode == http.StatusNotModified {
  2524  		if res.Body != nil {
  2525  			res.Body.Close()
  2526  		}
  2527  		return nil, &googleapi.Error{
  2528  			Code:   res.StatusCode,
  2529  			Header: res.Header,
  2530  		}
  2531  	}
  2532  	if err != nil {
  2533  		return nil, err
  2534  	}
  2535  	defer googleapi.CloseBody(res)
  2536  	if err := googleapi.CheckResponse(res); err != nil {
  2537  		return nil, err
  2538  	}
  2539  	ret := &ApprovalRequest{
  2540  		ServerResponse: googleapi.ServerResponse{
  2541  			Header:         res.Header,
  2542  			HTTPStatusCode: res.StatusCode,
  2543  		},
  2544  	}
  2545  	target := &ret
  2546  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2547  		return nil, err
  2548  	}
  2549  	return ret, nil
  2550  	// {
  2551  	//   "description": "Dismisses a request. Returns the updated ApprovalRequest.\n\nNOTE: This does not deny access to the resource if another request has been\nmade and approved. It is equivalent in effect to ignoring the request\naltogether.\n\nReturns NOT_FOUND if the request does not exist.\n\nReturns FAILED_PRECONDITION if the request exists but is not in a pending\nstate.",
  2552  	//   "flatPath": "v1beta1/organizations/{organizationsId}/approvalRequests/{approvalRequestsId}:dismiss",
  2553  	//   "httpMethod": "POST",
  2554  	//   "id": "accessapproval.organizations.approvalRequests.dismiss",
  2555  	//   "parameterOrder": [
  2556  	//     "name"
  2557  	//   ],
  2558  	//   "parameters": {
  2559  	//     "name": {
  2560  	//       "description": "Name of the ApprovalRequest to dismiss.",
  2561  	//       "location": "path",
  2562  	//       "pattern": "^organizations/[^/]+/approvalRequests/[^/]+$",
  2563  	//       "required": true,
  2564  	//       "type": "string"
  2565  	//     }
  2566  	//   },
  2567  	//   "path": "v1beta1/{+name}:dismiss",
  2568  	//   "request": {
  2569  	//     "$ref": "DismissApprovalRequestMessage"
  2570  	//   },
  2571  	//   "response": {
  2572  	//     "$ref": "ApprovalRequest"
  2573  	//   },
  2574  	//   "scopes": [
  2575  	//     "https://www.googleapis.com/auth/cloud-platform"
  2576  	//   ]
  2577  	// }
  2578  
  2579  }
  2580  
  2581  // method id "accessapproval.organizations.approvalRequests.get":
  2582  
  2583  type OrganizationsApprovalRequestsGetCall struct {
  2584  	s            *Service
  2585  	name         string
  2586  	urlParams_   gensupport.URLParams
  2587  	ifNoneMatch_ string
  2588  	ctx_         context.Context
  2589  	header_      http.Header
  2590  }
  2591  
  2592  // Get: Gets an approval request. Returns NOT_FOUND if the request does
  2593  // not exist.
  2594  func (r *OrganizationsApprovalRequestsService) Get(name string) *OrganizationsApprovalRequestsGetCall {
  2595  	c := &OrganizationsApprovalRequestsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2596  	c.name = name
  2597  	return c
  2598  }
  2599  
  2600  // Fields allows partial responses to be retrieved. See
  2601  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2602  // for more information.
  2603  func (c *OrganizationsApprovalRequestsGetCall) Fields(s ...googleapi.Field) *OrganizationsApprovalRequestsGetCall {
  2604  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2605  	return c
  2606  }
  2607  
  2608  // IfNoneMatch sets the optional parameter which makes the operation
  2609  // fail if the object's ETag matches the given value. This is useful for
  2610  // getting updates only after the object has changed since the last
  2611  // request. Use googleapi.IsNotModified to check whether the response
  2612  // error from Do is the result of In-None-Match.
  2613  func (c *OrganizationsApprovalRequestsGetCall) IfNoneMatch(entityTag string) *OrganizationsApprovalRequestsGetCall {
  2614  	c.ifNoneMatch_ = entityTag
  2615  	return c
  2616  }
  2617  
  2618  // Context sets the context to be used in this call's Do method. Any
  2619  // pending HTTP request will be aborted if the provided context is
  2620  // canceled.
  2621  func (c *OrganizationsApprovalRequestsGetCall) Context(ctx context.Context) *OrganizationsApprovalRequestsGetCall {
  2622  	c.ctx_ = ctx
  2623  	return c
  2624  }
  2625  
  2626  // Header returns an http.Header that can be modified by the caller to
  2627  // add HTTP headers to the request.
  2628  func (c *OrganizationsApprovalRequestsGetCall) Header() http.Header {
  2629  	if c.header_ == nil {
  2630  		c.header_ = make(http.Header)
  2631  	}
  2632  	return c.header_
  2633  }
  2634  
  2635  func (c *OrganizationsApprovalRequestsGetCall) doRequest(alt string) (*http.Response, error) {
  2636  	reqHeaders := make(http.Header)
  2637  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  2638  	for k, v := range c.header_ {
  2639  		reqHeaders[k] = v
  2640  	}
  2641  	reqHeaders.Set("User-Agent", c.s.userAgent())
  2642  	if c.ifNoneMatch_ != "" {
  2643  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2644  	}
  2645  	var body io.Reader = nil
  2646  	c.urlParams_.Set("alt", alt)
  2647  	c.urlParams_.Set("prettyPrint", "false")
  2648  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  2649  	urls += "?" + c.urlParams_.Encode()
  2650  	req, err := http.NewRequest("GET", urls, body)
  2651  	if err != nil {
  2652  		return nil, err
  2653  	}
  2654  	req.Header = reqHeaders
  2655  	googleapi.Expand(req.URL, map[string]string{
  2656  		"name": c.name,
  2657  	})
  2658  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2659  }
  2660  
  2661  // Do executes the "accessapproval.organizations.approvalRequests.get" call.
  2662  // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx
  2663  // status code is an error. Response headers are in either
  2664  // *ApprovalRequest.ServerResponse.Header or (if a response was returned
  2665  // at all) in error.(*googleapi.Error).Header. Use
  2666  // googleapi.IsNotModified to check whether the returned error was
  2667  // because http.StatusNotModified was returned.
  2668  func (c *OrganizationsApprovalRequestsGetCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) {
  2669  	gensupport.SetOptions(c.urlParams_, opts...)
  2670  	res, err := c.doRequest("json")
  2671  	if res != nil && res.StatusCode == http.StatusNotModified {
  2672  		if res.Body != nil {
  2673  			res.Body.Close()
  2674  		}
  2675  		return nil, &googleapi.Error{
  2676  			Code:   res.StatusCode,
  2677  			Header: res.Header,
  2678  		}
  2679  	}
  2680  	if err != nil {
  2681  		return nil, err
  2682  	}
  2683  	defer googleapi.CloseBody(res)
  2684  	if err := googleapi.CheckResponse(res); err != nil {
  2685  		return nil, err
  2686  	}
  2687  	ret := &ApprovalRequest{
  2688  		ServerResponse: googleapi.ServerResponse{
  2689  			Header:         res.Header,
  2690  			HTTPStatusCode: res.StatusCode,
  2691  		},
  2692  	}
  2693  	target := &ret
  2694  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2695  		return nil, err
  2696  	}
  2697  	return ret, nil
  2698  	// {
  2699  	//   "description": "Gets an approval request. Returns NOT_FOUND if the request does not exist.",
  2700  	//   "flatPath": "v1beta1/organizations/{organizationsId}/approvalRequests/{approvalRequestsId}",
  2701  	//   "httpMethod": "GET",
  2702  	//   "id": "accessapproval.organizations.approvalRequests.get",
  2703  	//   "parameterOrder": [
  2704  	//     "name"
  2705  	//   ],
  2706  	//   "parameters": {
  2707  	//     "name": {
  2708  	//       "description": "Name of the approval request to retrieve.",
  2709  	//       "location": "path",
  2710  	//       "pattern": "^organizations/[^/]+/approvalRequests/[^/]+$",
  2711  	//       "required": true,
  2712  	//       "type": "string"
  2713  	//     }
  2714  	//   },
  2715  	//   "path": "v1beta1/{+name}",
  2716  	//   "response": {
  2717  	//     "$ref": "ApprovalRequest"
  2718  	//   },
  2719  	//   "scopes": [
  2720  	//     "https://www.googleapis.com/auth/cloud-platform"
  2721  	//   ]
  2722  	// }
  2723  
  2724  }
  2725  
  2726  // method id "accessapproval.organizations.approvalRequests.list":
  2727  
  2728  type OrganizationsApprovalRequestsListCall struct {
  2729  	s            *Service
  2730  	parent       string
  2731  	urlParams_   gensupport.URLParams
  2732  	ifNoneMatch_ string
  2733  	ctx_         context.Context
  2734  	header_      http.Header
  2735  }
  2736  
  2737  // List: Lists approval requests associated with a project, folder, or
  2738  // organization.
  2739  // Approval requests can be filtered by state (pending, active,
  2740  // dismissed).
  2741  // The order is reverse chronological.
  2742  func (r *OrganizationsApprovalRequestsService) List(parent string) *OrganizationsApprovalRequestsListCall {
  2743  	c := &OrganizationsApprovalRequestsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2744  	c.parent = parent
  2745  	return c
  2746  }
  2747  
  2748  // Filter sets the optional parameter "filter": A filter on the type of
  2749  // approval requests to retrieve. Must be one of the
  2750  // following values:
  2751  // <ol>
  2752  //
  2753  //	<li>[not set]: Requests that are pending or have active
  2754  //
  2755  // approvals.</li>
  2756  //
  2757  //	<li>ALL: All requests.</li>
  2758  //	<li>PENDING: Only pending requests.</li>
  2759  //	<li>ACTIVE: Only active (i.e. currently approved) requests.</li>
  2760  //	<li>DISMISSED: Only dismissed (including expired) requests.</li>
  2761  //	<li>HISTORY: Active and dismissed (including expired)
  2762  //
  2763  // requests.</li>
  2764  // </ol>
  2765  func (c *OrganizationsApprovalRequestsListCall) Filter(filter string) *OrganizationsApprovalRequestsListCall {
  2766  	c.urlParams_.Set("filter", filter)
  2767  	return c
  2768  }
  2769  
  2770  // PageSize sets the optional parameter "pageSize": Requested page size.
  2771  func (c *OrganizationsApprovalRequestsListCall) PageSize(pageSize int64) *OrganizationsApprovalRequestsListCall {
  2772  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2773  	return c
  2774  }
  2775  
  2776  // PageToken sets the optional parameter "pageToken": A token
  2777  // identifying the page of results to return.
  2778  func (c *OrganizationsApprovalRequestsListCall) PageToken(pageToken string) *OrganizationsApprovalRequestsListCall {
  2779  	c.urlParams_.Set("pageToken", pageToken)
  2780  	return c
  2781  }
  2782  
  2783  // Fields allows partial responses to be retrieved. See
  2784  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2785  // for more information.
  2786  func (c *OrganizationsApprovalRequestsListCall) Fields(s ...googleapi.Field) *OrganizationsApprovalRequestsListCall {
  2787  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2788  	return c
  2789  }
  2790  
  2791  // IfNoneMatch sets the optional parameter which makes the operation
  2792  // fail if the object's ETag matches the given value. This is useful for
  2793  // getting updates only after the object has changed since the last
  2794  // request. Use googleapi.IsNotModified to check whether the response
  2795  // error from Do is the result of In-None-Match.
  2796  func (c *OrganizationsApprovalRequestsListCall) IfNoneMatch(entityTag string) *OrganizationsApprovalRequestsListCall {
  2797  	c.ifNoneMatch_ = entityTag
  2798  	return c
  2799  }
  2800  
  2801  // Context sets the context to be used in this call's Do method. Any
  2802  // pending HTTP request will be aborted if the provided context is
  2803  // canceled.
  2804  func (c *OrganizationsApprovalRequestsListCall) Context(ctx context.Context) *OrganizationsApprovalRequestsListCall {
  2805  	c.ctx_ = ctx
  2806  	return c
  2807  }
  2808  
  2809  // Header returns an http.Header that can be modified by the caller to
  2810  // add HTTP headers to the request.
  2811  func (c *OrganizationsApprovalRequestsListCall) Header() http.Header {
  2812  	if c.header_ == nil {
  2813  		c.header_ = make(http.Header)
  2814  	}
  2815  	return c.header_
  2816  }
  2817  
  2818  func (c *OrganizationsApprovalRequestsListCall) doRequest(alt string) (*http.Response, error) {
  2819  	reqHeaders := make(http.Header)
  2820  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  2821  	for k, v := range c.header_ {
  2822  		reqHeaders[k] = v
  2823  	}
  2824  	reqHeaders.Set("User-Agent", c.s.userAgent())
  2825  	if c.ifNoneMatch_ != "" {
  2826  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2827  	}
  2828  	var body io.Reader = nil
  2829  	c.urlParams_.Set("alt", alt)
  2830  	c.urlParams_.Set("prettyPrint", "false")
  2831  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/approvalRequests")
  2832  	urls += "?" + c.urlParams_.Encode()
  2833  	req, err := http.NewRequest("GET", urls, body)
  2834  	if err != nil {
  2835  		return nil, err
  2836  	}
  2837  	req.Header = reqHeaders
  2838  	googleapi.Expand(req.URL, map[string]string{
  2839  		"parent": c.parent,
  2840  	})
  2841  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2842  }
  2843  
  2844  // Do executes the "accessapproval.organizations.approvalRequests.list" call.
  2845  // Exactly one of *ListApprovalRequestsResponse or error will be
  2846  // non-nil. Any non-2xx status code is an error. Response headers are in
  2847  // either *ListApprovalRequestsResponse.ServerResponse.Header or (if a
  2848  // response was returned at all) in error.(*googleapi.Error).Header. Use
  2849  // googleapi.IsNotModified to check whether the returned error was
  2850  // because http.StatusNotModified was returned.
  2851  func (c *OrganizationsApprovalRequestsListCall) Do(opts ...googleapi.CallOption) (*ListApprovalRequestsResponse, error) {
  2852  	gensupport.SetOptions(c.urlParams_, opts...)
  2853  	res, err := c.doRequest("json")
  2854  	if res != nil && res.StatusCode == http.StatusNotModified {
  2855  		if res.Body != nil {
  2856  			res.Body.Close()
  2857  		}
  2858  		return nil, &googleapi.Error{
  2859  			Code:   res.StatusCode,
  2860  			Header: res.Header,
  2861  		}
  2862  	}
  2863  	if err != nil {
  2864  		return nil, err
  2865  	}
  2866  	defer googleapi.CloseBody(res)
  2867  	if err := googleapi.CheckResponse(res); err != nil {
  2868  		return nil, err
  2869  	}
  2870  	ret := &ListApprovalRequestsResponse{
  2871  		ServerResponse: googleapi.ServerResponse{
  2872  			Header:         res.Header,
  2873  			HTTPStatusCode: res.StatusCode,
  2874  		},
  2875  	}
  2876  	target := &ret
  2877  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2878  		return nil, err
  2879  	}
  2880  	return ret, nil
  2881  	// {
  2882  	//   "description": "Lists approval requests associated with a project, folder, or organization.\nApproval requests can be filtered by state (pending, active, dismissed).\nThe order is reverse chronological.",
  2883  	//   "flatPath": "v1beta1/organizations/{organizationsId}/approvalRequests",
  2884  	//   "httpMethod": "GET",
  2885  	//   "id": "accessapproval.organizations.approvalRequests.list",
  2886  	//   "parameterOrder": [
  2887  	//     "parent"
  2888  	//   ],
  2889  	//   "parameters": {
  2890  	//     "filter": {
  2891  	//       "description": "A filter on the type of approval requests to retrieve. Must be one of the\nfollowing values:\n\u003col\u003e\n  \u003cli\u003e[not set]: Requests that are pending or have active approvals.\u003c/li\u003e\n  \u003cli\u003eALL: All requests.\u003c/li\u003e\n  \u003cli\u003ePENDING: Only pending requests.\u003c/li\u003e\n  \u003cli\u003eACTIVE: Only active (i.e. currently approved) requests.\u003c/li\u003e\n  \u003cli\u003eDISMISSED: Only dismissed (including expired) requests.\u003c/li\u003e\n  \u003cli\u003eHISTORY: Active and dismissed (including expired) requests.\u003c/li\u003e\n\u003c/ol\u003e",
  2892  	//       "location": "query",
  2893  	//       "type": "string"
  2894  	//     },
  2895  	//     "pageSize": {
  2896  	//       "description": "Requested page size.",
  2897  	//       "format": "int32",
  2898  	//       "location": "query",
  2899  	//       "type": "integer"
  2900  	//     },
  2901  	//     "pageToken": {
  2902  	//       "description": "A token identifying the page of results to return.",
  2903  	//       "location": "query",
  2904  	//       "type": "string"
  2905  	//     },
  2906  	//     "parent": {
  2907  	//       "description": "The parent resource. This may be \"projects/{project_id}\",\n\"folders/{folder_id}\", or \"organizations/{organization_id}\".",
  2908  	//       "location": "path",
  2909  	//       "pattern": "^organizations/[^/]+$",
  2910  	//       "required": true,
  2911  	//       "type": "string"
  2912  	//     }
  2913  	//   },
  2914  	//   "path": "v1beta1/{+parent}/approvalRequests",
  2915  	//   "response": {
  2916  	//     "$ref": "ListApprovalRequestsResponse"
  2917  	//   },
  2918  	//   "scopes": [
  2919  	//     "https://www.googleapis.com/auth/cloud-platform"
  2920  	//   ]
  2921  	// }
  2922  
  2923  }
  2924  
  2925  // Pages invokes f for each page of results.
  2926  // A non-nil error returned from f will halt the iteration.
  2927  // The provided context supersedes any context provided to the Context method.
  2928  func (c *OrganizationsApprovalRequestsListCall) Pages(ctx context.Context, f func(*ListApprovalRequestsResponse) error) error {
  2929  	c.ctx_ = ctx
  2930  	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2931  	for {
  2932  		x, err := c.Do()
  2933  		if err != nil {
  2934  			return err
  2935  		}
  2936  		if err := f(x); err != nil {
  2937  			return err
  2938  		}
  2939  		if x.NextPageToken == "" {
  2940  			return nil
  2941  		}
  2942  		c.PageToken(x.NextPageToken)
  2943  	}
  2944  }
  2945  
  2946  // method id "accessapproval.projects.deleteAccessApprovalSettings":
  2947  
  2948  type ProjectsDeleteAccessApprovalSettingsCall struct {
  2949  	s          *Service
  2950  	name       string
  2951  	urlParams_ gensupport.URLParams
  2952  	ctx_       context.Context
  2953  	header_    http.Header
  2954  }
  2955  
  2956  // DeleteAccessApprovalSettings: Deletes the settings associated with a
  2957  // project, folder, or organization.
  2958  // This will have the effect of disabling Access Approval for the
  2959  // project,
  2960  // folder, or organization, but only if all ancestors also have
  2961  // Access
  2962  // Approval disabled. If Access Approval is enabled at a higher level of
  2963  // the
  2964  // hierarchy, then Access Approval will still be enabled at this level
  2965  // as
  2966  // the settings are inherited.
  2967  func (r *ProjectsService) DeleteAccessApprovalSettings(name string) *ProjectsDeleteAccessApprovalSettingsCall {
  2968  	c := &ProjectsDeleteAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2969  	c.name = name
  2970  	return c
  2971  }
  2972  
  2973  // Fields allows partial responses to be retrieved. See
  2974  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2975  // for more information.
  2976  func (c *ProjectsDeleteAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *ProjectsDeleteAccessApprovalSettingsCall {
  2977  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2978  	return c
  2979  }
  2980  
  2981  // Context sets the context to be used in this call's Do method. Any
  2982  // pending HTTP request will be aborted if the provided context is
  2983  // canceled.
  2984  func (c *ProjectsDeleteAccessApprovalSettingsCall) Context(ctx context.Context) *ProjectsDeleteAccessApprovalSettingsCall {
  2985  	c.ctx_ = ctx
  2986  	return c
  2987  }
  2988  
  2989  // Header returns an http.Header that can be modified by the caller to
  2990  // add HTTP headers to the request.
  2991  func (c *ProjectsDeleteAccessApprovalSettingsCall) Header() http.Header {
  2992  	if c.header_ == nil {
  2993  		c.header_ = make(http.Header)
  2994  	}
  2995  	return c.header_
  2996  }
  2997  
  2998  func (c *ProjectsDeleteAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) {
  2999  	reqHeaders := make(http.Header)
  3000  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  3001  	for k, v := range c.header_ {
  3002  		reqHeaders[k] = v
  3003  	}
  3004  	reqHeaders.Set("User-Agent", c.s.userAgent())
  3005  	var body io.Reader = nil
  3006  	c.urlParams_.Set("alt", alt)
  3007  	c.urlParams_.Set("prettyPrint", "false")
  3008  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  3009  	urls += "?" + c.urlParams_.Encode()
  3010  	req, err := http.NewRequest("DELETE", urls, body)
  3011  	if err != nil {
  3012  		return nil, err
  3013  	}
  3014  	req.Header = reqHeaders
  3015  	googleapi.Expand(req.URL, map[string]string{
  3016  		"name": c.name,
  3017  	})
  3018  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3019  }
  3020  
  3021  // Do executes the "accessapproval.projects.deleteAccessApprovalSettings" call.
  3022  // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3023  // code is an error. Response headers are in either
  3024  // *Empty.ServerResponse.Header or (if a response was returned at all)
  3025  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3026  // check whether the returned error was because http.StatusNotModified
  3027  // was returned.
  3028  func (c *ProjectsDeleteAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3029  	gensupport.SetOptions(c.urlParams_, opts...)
  3030  	res, err := c.doRequest("json")
  3031  	if res != nil && res.StatusCode == http.StatusNotModified {
  3032  		if res.Body != nil {
  3033  			res.Body.Close()
  3034  		}
  3035  		return nil, &googleapi.Error{
  3036  			Code:   res.StatusCode,
  3037  			Header: res.Header,
  3038  		}
  3039  	}
  3040  	if err != nil {
  3041  		return nil, err
  3042  	}
  3043  	defer googleapi.CloseBody(res)
  3044  	if err := googleapi.CheckResponse(res); err != nil {
  3045  		return nil, err
  3046  	}
  3047  	ret := &Empty{
  3048  		ServerResponse: googleapi.ServerResponse{
  3049  			Header:         res.Header,
  3050  			HTTPStatusCode: res.StatusCode,
  3051  		},
  3052  	}
  3053  	target := &ret
  3054  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3055  		return nil, err
  3056  	}
  3057  	return ret, nil
  3058  	// {
  3059  	//   "description": "Deletes the settings associated with a project, folder, or organization.\nThis will have the effect of disabling Access Approval for the project,\nfolder, or organization, but only if all ancestors also have Access\nApproval disabled. If Access Approval is enabled at a higher level of the\nhierarchy, then Access Approval will still be enabled at this level as\nthe settings are inherited.",
  3060  	//   "flatPath": "v1beta1/projects/{projectsId}/accessApprovalSettings",
  3061  	//   "httpMethod": "DELETE",
  3062  	//   "id": "accessapproval.projects.deleteAccessApprovalSettings",
  3063  	//   "parameterOrder": [
  3064  	//     "name"
  3065  	//   ],
  3066  	//   "parameters": {
  3067  	//     "name": {
  3068  	//       "description": "Name of the AccessApprovalSettings to delete.",
  3069  	//       "location": "path",
  3070  	//       "pattern": "^projects/[^/]+/accessApprovalSettings$",
  3071  	//       "required": true,
  3072  	//       "type": "string"
  3073  	//     }
  3074  	//   },
  3075  	//   "path": "v1beta1/{+name}",
  3076  	//   "response": {
  3077  	//     "$ref": "Empty"
  3078  	//   },
  3079  	//   "scopes": [
  3080  	//     "https://www.googleapis.com/auth/cloud-platform"
  3081  	//   ]
  3082  	// }
  3083  
  3084  }
  3085  
  3086  // method id "accessapproval.projects.getAccessApprovalSettings":
  3087  
  3088  type ProjectsGetAccessApprovalSettingsCall struct {
  3089  	s            *Service
  3090  	name         string
  3091  	urlParams_   gensupport.URLParams
  3092  	ifNoneMatch_ string
  3093  	ctx_         context.Context
  3094  	header_      http.Header
  3095  }
  3096  
  3097  // GetAccessApprovalSettings: Gets the settings associated with a
  3098  // project, folder, or organization.
  3099  func (r *ProjectsService) GetAccessApprovalSettings(name string) *ProjectsGetAccessApprovalSettingsCall {
  3100  	c := &ProjectsGetAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3101  	c.name = name
  3102  	return c
  3103  }
  3104  
  3105  // Fields allows partial responses to be retrieved. See
  3106  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3107  // for more information.
  3108  func (c *ProjectsGetAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *ProjectsGetAccessApprovalSettingsCall {
  3109  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3110  	return c
  3111  }
  3112  
  3113  // IfNoneMatch sets the optional parameter which makes the operation
  3114  // fail if the object's ETag matches the given value. This is useful for
  3115  // getting updates only after the object has changed since the last
  3116  // request. Use googleapi.IsNotModified to check whether the response
  3117  // error from Do is the result of In-None-Match.
  3118  func (c *ProjectsGetAccessApprovalSettingsCall) IfNoneMatch(entityTag string) *ProjectsGetAccessApprovalSettingsCall {
  3119  	c.ifNoneMatch_ = entityTag
  3120  	return c
  3121  }
  3122  
  3123  // Context sets the context to be used in this call's Do method. Any
  3124  // pending HTTP request will be aborted if the provided context is
  3125  // canceled.
  3126  func (c *ProjectsGetAccessApprovalSettingsCall) Context(ctx context.Context) *ProjectsGetAccessApprovalSettingsCall {
  3127  	c.ctx_ = ctx
  3128  	return c
  3129  }
  3130  
  3131  // Header returns an http.Header that can be modified by the caller to
  3132  // add HTTP headers to the request.
  3133  func (c *ProjectsGetAccessApprovalSettingsCall) Header() http.Header {
  3134  	if c.header_ == nil {
  3135  		c.header_ = make(http.Header)
  3136  	}
  3137  	return c.header_
  3138  }
  3139  
  3140  func (c *ProjectsGetAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) {
  3141  	reqHeaders := make(http.Header)
  3142  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  3143  	for k, v := range c.header_ {
  3144  		reqHeaders[k] = v
  3145  	}
  3146  	reqHeaders.Set("User-Agent", c.s.userAgent())
  3147  	if c.ifNoneMatch_ != "" {
  3148  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3149  	}
  3150  	var body io.Reader = nil
  3151  	c.urlParams_.Set("alt", alt)
  3152  	c.urlParams_.Set("prettyPrint", "false")
  3153  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  3154  	urls += "?" + c.urlParams_.Encode()
  3155  	req, err := http.NewRequest("GET", urls, body)
  3156  	if err != nil {
  3157  		return nil, err
  3158  	}
  3159  	req.Header = reqHeaders
  3160  	googleapi.Expand(req.URL, map[string]string{
  3161  		"name": c.name,
  3162  	})
  3163  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3164  }
  3165  
  3166  // Do executes the "accessapproval.projects.getAccessApprovalSettings" call.
  3167  // Exactly one of *AccessApprovalSettings or error will be non-nil. Any
  3168  // non-2xx status code is an error. Response headers are in either
  3169  // *AccessApprovalSettings.ServerResponse.Header or (if a response was
  3170  // returned at all) in error.(*googleapi.Error).Header. Use
  3171  // googleapi.IsNotModified to check whether the returned error was
  3172  // because http.StatusNotModified was returned.
  3173  func (c *ProjectsGetAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*AccessApprovalSettings, error) {
  3174  	gensupport.SetOptions(c.urlParams_, opts...)
  3175  	res, err := c.doRequest("json")
  3176  	if res != nil && res.StatusCode == http.StatusNotModified {
  3177  		if res.Body != nil {
  3178  			res.Body.Close()
  3179  		}
  3180  		return nil, &googleapi.Error{
  3181  			Code:   res.StatusCode,
  3182  			Header: res.Header,
  3183  		}
  3184  	}
  3185  	if err != nil {
  3186  		return nil, err
  3187  	}
  3188  	defer googleapi.CloseBody(res)
  3189  	if err := googleapi.CheckResponse(res); err != nil {
  3190  		return nil, err
  3191  	}
  3192  	ret := &AccessApprovalSettings{
  3193  		ServerResponse: googleapi.ServerResponse{
  3194  			Header:         res.Header,
  3195  			HTTPStatusCode: res.StatusCode,
  3196  		},
  3197  	}
  3198  	target := &ret
  3199  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3200  		return nil, err
  3201  	}
  3202  	return ret, nil
  3203  	// {
  3204  	//   "description": "Gets the settings associated with a project, folder, or organization.",
  3205  	//   "flatPath": "v1beta1/projects/{projectsId}/accessApprovalSettings",
  3206  	//   "httpMethod": "GET",
  3207  	//   "id": "accessapproval.projects.getAccessApprovalSettings",
  3208  	//   "parameterOrder": [
  3209  	//     "name"
  3210  	//   ],
  3211  	//   "parameters": {
  3212  	//     "name": {
  3213  	//       "description": "Name of the AccessApprovalSettings to retrieve.",
  3214  	//       "location": "path",
  3215  	//       "pattern": "^projects/[^/]+/accessApprovalSettings$",
  3216  	//       "required": true,
  3217  	//       "type": "string"
  3218  	//     }
  3219  	//   },
  3220  	//   "path": "v1beta1/{+name}",
  3221  	//   "response": {
  3222  	//     "$ref": "AccessApprovalSettings"
  3223  	//   },
  3224  	//   "scopes": [
  3225  	//     "https://www.googleapis.com/auth/cloud-platform"
  3226  	//   ]
  3227  	// }
  3228  
  3229  }
  3230  
  3231  // method id "accessapproval.projects.updateAccessApprovalSettings":
  3232  
  3233  type ProjectsUpdateAccessApprovalSettingsCall struct {
  3234  	s                      *Service
  3235  	name                   string
  3236  	accessapprovalsettings *AccessApprovalSettings
  3237  	urlParams_             gensupport.URLParams
  3238  	ctx_                   context.Context
  3239  	header_                http.Header
  3240  }
  3241  
  3242  // UpdateAccessApprovalSettings: Updates the settings associated with a
  3243  // project, folder, or organization.
  3244  // Settings to update are determined by the value of field_mask.
  3245  func (r *ProjectsService) UpdateAccessApprovalSettings(name string, accessapprovalsettings *AccessApprovalSettings) *ProjectsUpdateAccessApprovalSettingsCall {
  3246  	c := &ProjectsUpdateAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3247  	c.name = name
  3248  	c.accessapprovalsettings = accessapprovalsettings
  3249  	return c
  3250  }
  3251  
  3252  // UpdateMask sets the optional parameter "updateMask": For the
  3253  // `FieldMask` definition,
  3254  // see
  3255  // https://developers.google.com/protocol-buffers/docs/reference/goog
  3256  // le.protobuf#fieldmask
  3257  // If this field is left unset, only the notification_emails field will
  3258  // be
  3259  // updated.
  3260  func (c *ProjectsUpdateAccessApprovalSettingsCall) UpdateMask(updateMask string) *ProjectsUpdateAccessApprovalSettingsCall {
  3261  	c.urlParams_.Set("updateMask", updateMask)
  3262  	return c
  3263  }
  3264  
  3265  // Fields allows partial responses to be retrieved. See
  3266  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3267  // for more information.
  3268  func (c *ProjectsUpdateAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *ProjectsUpdateAccessApprovalSettingsCall {
  3269  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3270  	return c
  3271  }
  3272  
  3273  // Context sets the context to be used in this call's Do method. Any
  3274  // pending HTTP request will be aborted if the provided context is
  3275  // canceled.
  3276  func (c *ProjectsUpdateAccessApprovalSettingsCall) Context(ctx context.Context) *ProjectsUpdateAccessApprovalSettingsCall {
  3277  	c.ctx_ = ctx
  3278  	return c
  3279  }
  3280  
  3281  // Header returns an http.Header that can be modified by the caller to
  3282  // add HTTP headers to the request.
  3283  func (c *ProjectsUpdateAccessApprovalSettingsCall) Header() http.Header {
  3284  	if c.header_ == nil {
  3285  		c.header_ = make(http.Header)
  3286  	}
  3287  	return c.header_
  3288  }
  3289  
  3290  func (c *ProjectsUpdateAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) {
  3291  	reqHeaders := make(http.Header)
  3292  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  3293  	for k, v := range c.header_ {
  3294  		reqHeaders[k] = v
  3295  	}
  3296  	reqHeaders.Set("User-Agent", c.s.userAgent())
  3297  	var body io.Reader = nil
  3298  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.accessapprovalsettings)
  3299  	if err != nil {
  3300  		return nil, err
  3301  	}
  3302  	reqHeaders.Set("Content-Type", "application/json")
  3303  	c.urlParams_.Set("alt", alt)
  3304  	c.urlParams_.Set("prettyPrint", "false")
  3305  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  3306  	urls += "?" + c.urlParams_.Encode()
  3307  	req, err := http.NewRequest("PATCH", urls, body)
  3308  	if err != nil {
  3309  		return nil, err
  3310  	}
  3311  	req.Header = reqHeaders
  3312  	googleapi.Expand(req.URL, map[string]string{
  3313  		"name": c.name,
  3314  	})
  3315  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3316  }
  3317  
  3318  // Do executes the "accessapproval.projects.updateAccessApprovalSettings" call.
  3319  // Exactly one of *AccessApprovalSettings or error will be non-nil. Any
  3320  // non-2xx status code is an error. Response headers are in either
  3321  // *AccessApprovalSettings.ServerResponse.Header or (if a response was
  3322  // returned at all) in error.(*googleapi.Error).Header. Use
  3323  // googleapi.IsNotModified to check whether the returned error was
  3324  // because http.StatusNotModified was returned.
  3325  func (c *ProjectsUpdateAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*AccessApprovalSettings, error) {
  3326  	gensupport.SetOptions(c.urlParams_, opts...)
  3327  	res, err := c.doRequest("json")
  3328  	if res != nil && res.StatusCode == http.StatusNotModified {
  3329  		if res.Body != nil {
  3330  			res.Body.Close()
  3331  		}
  3332  		return nil, &googleapi.Error{
  3333  			Code:   res.StatusCode,
  3334  			Header: res.Header,
  3335  		}
  3336  	}
  3337  	if err != nil {
  3338  		return nil, err
  3339  	}
  3340  	defer googleapi.CloseBody(res)
  3341  	if err := googleapi.CheckResponse(res); err != nil {
  3342  		return nil, err
  3343  	}
  3344  	ret := &AccessApprovalSettings{
  3345  		ServerResponse: googleapi.ServerResponse{
  3346  			Header:         res.Header,
  3347  			HTTPStatusCode: res.StatusCode,
  3348  		},
  3349  	}
  3350  	target := &ret
  3351  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3352  		return nil, err
  3353  	}
  3354  	return ret, nil
  3355  	// {
  3356  	//   "description": "Updates the settings associated with a project, folder, or organization.\nSettings to update are determined by the value of field_mask.",
  3357  	//   "flatPath": "v1beta1/projects/{projectsId}/accessApprovalSettings",
  3358  	//   "httpMethod": "PATCH",
  3359  	//   "id": "accessapproval.projects.updateAccessApprovalSettings",
  3360  	//   "parameterOrder": [
  3361  	//     "name"
  3362  	//   ],
  3363  	//   "parameters": {
  3364  	//     "name": {
  3365  	//       "description": "The resource name of the settings. Format is one of:\n\u003col\u003e\n  \u003cli\u003e\"projects/{project_id}/accessApprovalSettings\"\u003c/li\u003e\n  \u003cli\u003e\"folders/{folder_id}/accessApprovalSettings\"\u003c/li\u003e\n  \u003cli\u003e\"organizations/{organization_id}/accessApprovalSettings\"\u003c/li\u003e\n\u003col\u003e",
  3366  	//       "location": "path",
  3367  	//       "pattern": "^projects/[^/]+/accessApprovalSettings$",
  3368  	//       "required": true,
  3369  	//       "type": "string"
  3370  	//     },
  3371  	//     "updateMask": {
  3372  	//       "description": "For the `FieldMask` definition, see\nhttps://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask\nIf this field is left unset, only the notification_emails field will be\nupdated.",
  3373  	//       "format": "google-fieldmask",
  3374  	//       "location": "query",
  3375  	//       "type": "string"
  3376  	//     }
  3377  	//   },
  3378  	//   "path": "v1beta1/{+name}",
  3379  	//   "request": {
  3380  	//     "$ref": "AccessApprovalSettings"
  3381  	//   },
  3382  	//   "response": {
  3383  	//     "$ref": "AccessApprovalSettings"
  3384  	//   },
  3385  	//   "scopes": [
  3386  	//     "https://www.googleapis.com/auth/cloud-platform"
  3387  	//   ]
  3388  	// }
  3389  
  3390  }
  3391  
  3392  // method id "accessapproval.projects.approvalRequests.approve":
  3393  
  3394  type ProjectsApprovalRequestsApproveCall struct {
  3395  	s                             *Service
  3396  	name                          string
  3397  	approveapprovalrequestmessage *ApproveApprovalRequestMessage
  3398  	urlParams_                    gensupport.URLParams
  3399  	ctx_                          context.Context
  3400  	header_                       http.Header
  3401  }
  3402  
  3403  // Approve: Approves a request and returns the updated
  3404  // ApprovalRequest.
  3405  //
  3406  // Returns NOT_FOUND if the request does not exist.
  3407  // Returns
  3408  // FAILED_PRECONDITION if the request exists but is not in a pending
  3409  // state.
  3410  func (r *ProjectsApprovalRequestsService) Approve(name string, approveapprovalrequestmessage *ApproveApprovalRequestMessage) *ProjectsApprovalRequestsApproveCall {
  3411  	c := &ProjectsApprovalRequestsApproveCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3412  	c.name = name
  3413  	c.approveapprovalrequestmessage = approveapprovalrequestmessage
  3414  	return c
  3415  }
  3416  
  3417  // Fields allows partial responses to be retrieved. See
  3418  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3419  // for more information.
  3420  func (c *ProjectsApprovalRequestsApproveCall) Fields(s ...googleapi.Field) *ProjectsApprovalRequestsApproveCall {
  3421  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3422  	return c
  3423  }
  3424  
  3425  // Context sets the context to be used in this call's Do method. Any
  3426  // pending HTTP request will be aborted if the provided context is
  3427  // canceled.
  3428  func (c *ProjectsApprovalRequestsApproveCall) Context(ctx context.Context) *ProjectsApprovalRequestsApproveCall {
  3429  	c.ctx_ = ctx
  3430  	return c
  3431  }
  3432  
  3433  // Header returns an http.Header that can be modified by the caller to
  3434  // add HTTP headers to the request.
  3435  func (c *ProjectsApprovalRequestsApproveCall) Header() http.Header {
  3436  	if c.header_ == nil {
  3437  		c.header_ = make(http.Header)
  3438  	}
  3439  	return c.header_
  3440  }
  3441  
  3442  func (c *ProjectsApprovalRequestsApproveCall) doRequest(alt string) (*http.Response, error) {
  3443  	reqHeaders := make(http.Header)
  3444  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  3445  	for k, v := range c.header_ {
  3446  		reqHeaders[k] = v
  3447  	}
  3448  	reqHeaders.Set("User-Agent", c.s.userAgent())
  3449  	var body io.Reader = nil
  3450  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.approveapprovalrequestmessage)
  3451  	if err != nil {
  3452  		return nil, err
  3453  	}
  3454  	reqHeaders.Set("Content-Type", "application/json")
  3455  	c.urlParams_.Set("alt", alt)
  3456  	c.urlParams_.Set("prettyPrint", "false")
  3457  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:approve")
  3458  	urls += "?" + c.urlParams_.Encode()
  3459  	req, err := http.NewRequest("POST", urls, body)
  3460  	if err != nil {
  3461  		return nil, err
  3462  	}
  3463  	req.Header = reqHeaders
  3464  	googleapi.Expand(req.URL, map[string]string{
  3465  		"name": c.name,
  3466  	})
  3467  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3468  }
  3469  
  3470  // Do executes the "accessapproval.projects.approvalRequests.approve" call.
  3471  // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx
  3472  // status code is an error. Response headers are in either
  3473  // *ApprovalRequest.ServerResponse.Header or (if a response was returned
  3474  // at all) in error.(*googleapi.Error).Header. Use
  3475  // googleapi.IsNotModified to check whether the returned error was
  3476  // because http.StatusNotModified was returned.
  3477  func (c *ProjectsApprovalRequestsApproveCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) {
  3478  	gensupport.SetOptions(c.urlParams_, opts...)
  3479  	res, err := c.doRequest("json")
  3480  	if res != nil && res.StatusCode == http.StatusNotModified {
  3481  		if res.Body != nil {
  3482  			res.Body.Close()
  3483  		}
  3484  		return nil, &googleapi.Error{
  3485  			Code:   res.StatusCode,
  3486  			Header: res.Header,
  3487  		}
  3488  	}
  3489  	if err != nil {
  3490  		return nil, err
  3491  	}
  3492  	defer googleapi.CloseBody(res)
  3493  	if err := googleapi.CheckResponse(res); err != nil {
  3494  		return nil, err
  3495  	}
  3496  	ret := &ApprovalRequest{
  3497  		ServerResponse: googleapi.ServerResponse{
  3498  			Header:         res.Header,
  3499  			HTTPStatusCode: res.StatusCode,
  3500  		},
  3501  	}
  3502  	target := &ret
  3503  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3504  		return nil, err
  3505  	}
  3506  	return ret, nil
  3507  	// {
  3508  	//   "description": "Approves a request and returns the updated ApprovalRequest.\n\nReturns NOT_FOUND if the request does not exist. Returns\nFAILED_PRECONDITION if the request exists but is not in a pending state.",
  3509  	//   "flatPath": "v1beta1/projects/{projectsId}/approvalRequests/{approvalRequestsId}:approve",
  3510  	//   "httpMethod": "POST",
  3511  	//   "id": "accessapproval.projects.approvalRequests.approve",
  3512  	//   "parameterOrder": [
  3513  	//     "name"
  3514  	//   ],
  3515  	//   "parameters": {
  3516  	//     "name": {
  3517  	//       "description": "Name of the approval request to approve.",
  3518  	//       "location": "path",
  3519  	//       "pattern": "^projects/[^/]+/approvalRequests/[^/]+$",
  3520  	//       "required": true,
  3521  	//       "type": "string"
  3522  	//     }
  3523  	//   },
  3524  	//   "path": "v1beta1/{+name}:approve",
  3525  	//   "request": {
  3526  	//     "$ref": "ApproveApprovalRequestMessage"
  3527  	//   },
  3528  	//   "response": {
  3529  	//     "$ref": "ApprovalRequest"
  3530  	//   },
  3531  	//   "scopes": [
  3532  	//     "https://www.googleapis.com/auth/cloud-platform"
  3533  	//   ]
  3534  	// }
  3535  
  3536  }
  3537  
  3538  // method id "accessapproval.projects.approvalRequests.dismiss":
  3539  
  3540  type ProjectsApprovalRequestsDismissCall struct {
  3541  	s                             *Service
  3542  	name                          string
  3543  	dismissapprovalrequestmessage *DismissApprovalRequestMessage
  3544  	urlParams_                    gensupport.URLParams
  3545  	ctx_                          context.Context
  3546  	header_                       http.Header
  3547  }
  3548  
  3549  // Dismiss: Dismisses a request. Returns the updated
  3550  // ApprovalRequest.
  3551  //
  3552  // NOTE: This does not deny access to the resource if another request
  3553  // has been
  3554  // made and approved. It is equivalent in effect to ignoring the
  3555  // request
  3556  // altogether.
  3557  //
  3558  // Returns NOT_FOUND if the request does not exist.
  3559  //
  3560  // Returns FAILED_PRECONDITION if the request exists but is not in a
  3561  // pending
  3562  // state.
  3563  func (r *ProjectsApprovalRequestsService) Dismiss(name string, dismissapprovalrequestmessage *DismissApprovalRequestMessage) *ProjectsApprovalRequestsDismissCall {
  3564  	c := &ProjectsApprovalRequestsDismissCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3565  	c.name = name
  3566  	c.dismissapprovalrequestmessage = dismissapprovalrequestmessage
  3567  	return c
  3568  }
  3569  
  3570  // Fields allows partial responses to be retrieved. See
  3571  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3572  // for more information.
  3573  func (c *ProjectsApprovalRequestsDismissCall) Fields(s ...googleapi.Field) *ProjectsApprovalRequestsDismissCall {
  3574  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3575  	return c
  3576  }
  3577  
  3578  // Context sets the context to be used in this call's Do method. Any
  3579  // pending HTTP request will be aborted if the provided context is
  3580  // canceled.
  3581  func (c *ProjectsApprovalRequestsDismissCall) Context(ctx context.Context) *ProjectsApprovalRequestsDismissCall {
  3582  	c.ctx_ = ctx
  3583  	return c
  3584  }
  3585  
  3586  // Header returns an http.Header that can be modified by the caller to
  3587  // add HTTP headers to the request.
  3588  func (c *ProjectsApprovalRequestsDismissCall) Header() http.Header {
  3589  	if c.header_ == nil {
  3590  		c.header_ = make(http.Header)
  3591  	}
  3592  	return c.header_
  3593  }
  3594  
  3595  func (c *ProjectsApprovalRequestsDismissCall) doRequest(alt string) (*http.Response, error) {
  3596  	reqHeaders := make(http.Header)
  3597  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  3598  	for k, v := range c.header_ {
  3599  		reqHeaders[k] = v
  3600  	}
  3601  	reqHeaders.Set("User-Agent", c.s.userAgent())
  3602  	var body io.Reader = nil
  3603  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.dismissapprovalrequestmessage)
  3604  	if err != nil {
  3605  		return nil, err
  3606  	}
  3607  	reqHeaders.Set("Content-Type", "application/json")
  3608  	c.urlParams_.Set("alt", alt)
  3609  	c.urlParams_.Set("prettyPrint", "false")
  3610  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:dismiss")
  3611  	urls += "?" + c.urlParams_.Encode()
  3612  	req, err := http.NewRequest("POST", urls, body)
  3613  	if err != nil {
  3614  		return nil, err
  3615  	}
  3616  	req.Header = reqHeaders
  3617  	googleapi.Expand(req.URL, map[string]string{
  3618  		"name": c.name,
  3619  	})
  3620  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3621  }
  3622  
  3623  // Do executes the "accessapproval.projects.approvalRequests.dismiss" call.
  3624  // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx
  3625  // status code is an error. Response headers are in either
  3626  // *ApprovalRequest.ServerResponse.Header or (if a response was returned
  3627  // at all) in error.(*googleapi.Error).Header. Use
  3628  // googleapi.IsNotModified to check whether the returned error was
  3629  // because http.StatusNotModified was returned.
  3630  func (c *ProjectsApprovalRequestsDismissCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) {
  3631  	gensupport.SetOptions(c.urlParams_, opts...)
  3632  	res, err := c.doRequest("json")
  3633  	if res != nil && res.StatusCode == http.StatusNotModified {
  3634  		if res.Body != nil {
  3635  			res.Body.Close()
  3636  		}
  3637  		return nil, &googleapi.Error{
  3638  			Code:   res.StatusCode,
  3639  			Header: res.Header,
  3640  		}
  3641  	}
  3642  	if err != nil {
  3643  		return nil, err
  3644  	}
  3645  	defer googleapi.CloseBody(res)
  3646  	if err := googleapi.CheckResponse(res); err != nil {
  3647  		return nil, err
  3648  	}
  3649  	ret := &ApprovalRequest{
  3650  		ServerResponse: googleapi.ServerResponse{
  3651  			Header:         res.Header,
  3652  			HTTPStatusCode: res.StatusCode,
  3653  		},
  3654  	}
  3655  	target := &ret
  3656  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3657  		return nil, err
  3658  	}
  3659  	return ret, nil
  3660  	// {
  3661  	//   "description": "Dismisses a request. Returns the updated ApprovalRequest.\n\nNOTE: This does not deny access to the resource if another request has been\nmade and approved. It is equivalent in effect to ignoring the request\naltogether.\n\nReturns NOT_FOUND if the request does not exist.\n\nReturns FAILED_PRECONDITION if the request exists but is not in a pending\nstate.",
  3662  	//   "flatPath": "v1beta1/projects/{projectsId}/approvalRequests/{approvalRequestsId}:dismiss",
  3663  	//   "httpMethod": "POST",
  3664  	//   "id": "accessapproval.projects.approvalRequests.dismiss",
  3665  	//   "parameterOrder": [
  3666  	//     "name"
  3667  	//   ],
  3668  	//   "parameters": {
  3669  	//     "name": {
  3670  	//       "description": "Name of the ApprovalRequest to dismiss.",
  3671  	//       "location": "path",
  3672  	//       "pattern": "^projects/[^/]+/approvalRequests/[^/]+$",
  3673  	//       "required": true,
  3674  	//       "type": "string"
  3675  	//     }
  3676  	//   },
  3677  	//   "path": "v1beta1/{+name}:dismiss",
  3678  	//   "request": {
  3679  	//     "$ref": "DismissApprovalRequestMessage"
  3680  	//   },
  3681  	//   "response": {
  3682  	//     "$ref": "ApprovalRequest"
  3683  	//   },
  3684  	//   "scopes": [
  3685  	//     "https://www.googleapis.com/auth/cloud-platform"
  3686  	//   ]
  3687  	// }
  3688  
  3689  }
  3690  
  3691  // method id "accessapproval.projects.approvalRequests.get":
  3692  
  3693  type ProjectsApprovalRequestsGetCall struct {
  3694  	s            *Service
  3695  	name         string
  3696  	urlParams_   gensupport.URLParams
  3697  	ifNoneMatch_ string
  3698  	ctx_         context.Context
  3699  	header_      http.Header
  3700  }
  3701  
  3702  // Get: Gets an approval request. Returns NOT_FOUND if the request does
  3703  // not exist.
  3704  func (r *ProjectsApprovalRequestsService) Get(name string) *ProjectsApprovalRequestsGetCall {
  3705  	c := &ProjectsApprovalRequestsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3706  	c.name = name
  3707  	return c
  3708  }
  3709  
  3710  // Fields allows partial responses to be retrieved. See
  3711  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3712  // for more information.
  3713  func (c *ProjectsApprovalRequestsGetCall) Fields(s ...googleapi.Field) *ProjectsApprovalRequestsGetCall {
  3714  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3715  	return c
  3716  }
  3717  
  3718  // IfNoneMatch sets the optional parameter which makes the operation
  3719  // fail if the object's ETag matches the given value. This is useful for
  3720  // getting updates only after the object has changed since the last
  3721  // request. Use googleapi.IsNotModified to check whether the response
  3722  // error from Do is the result of In-None-Match.
  3723  func (c *ProjectsApprovalRequestsGetCall) IfNoneMatch(entityTag string) *ProjectsApprovalRequestsGetCall {
  3724  	c.ifNoneMatch_ = entityTag
  3725  	return c
  3726  }
  3727  
  3728  // Context sets the context to be used in this call's Do method. Any
  3729  // pending HTTP request will be aborted if the provided context is
  3730  // canceled.
  3731  func (c *ProjectsApprovalRequestsGetCall) Context(ctx context.Context) *ProjectsApprovalRequestsGetCall {
  3732  	c.ctx_ = ctx
  3733  	return c
  3734  }
  3735  
  3736  // Header returns an http.Header that can be modified by the caller to
  3737  // add HTTP headers to the request.
  3738  func (c *ProjectsApprovalRequestsGetCall) Header() http.Header {
  3739  	if c.header_ == nil {
  3740  		c.header_ = make(http.Header)
  3741  	}
  3742  	return c.header_
  3743  }
  3744  
  3745  func (c *ProjectsApprovalRequestsGetCall) doRequest(alt string) (*http.Response, error) {
  3746  	reqHeaders := make(http.Header)
  3747  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  3748  	for k, v := range c.header_ {
  3749  		reqHeaders[k] = v
  3750  	}
  3751  	reqHeaders.Set("User-Agent", c.s.userAgent())
  3752  	if c.ifNoneMatch_ != "" {
  3753  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3754  	}
  3755  	var body io.Reader = nil
  3756  	c.urlParams_.Set("alt", alt)
  3757  	c.urlParams_.Set("prettyPrint", "false")
  3758  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
  3759  	urls += "?" + c.urlParams_.Encode()
  3760  	req, err := http.NewRequest("GET", urls, body)
  3761  	if err != nil {
  3762  		return nil, err
  3763  	}
  3764  	req.Header = reqHeaders
  3765  	googleapi.Expand(req.URL, map[string]string{
  3766  		"name": c.name,
  3767  	})
  3768  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3769  }
  3770  
  3771  // Do executes the "accessapproval.projects.approvalRequests.get" call.
  3772  // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx
  3773  // status code is an error. Response headers are in either
  3774  // *ApprovalRequest.ServerResponse.Header or (if a response was returned
  3775  // at all) in error.(*googleapi.Error).Header. Use
  3776  // googleapi.IsNotModified to check whether the returned error was
  3777  // because http.StatusNotModified was returned.
  3778  func (c *ProjectsApprovalRequestsGetCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) {
  3779  	gensupport.SetOptions(c.urlParams_, opts...)
  3780  	res, err := c.doRequest("json")
  3781  	if res != nil && res.StatusCode == http.StatusNotModified {
  3782  		if res.Body != nil {
  3783  			res.Body.Close()
  3784  		}
  3785  		return nil, &googleapi.Error{
  3786  			Code:   res.StatusCode,
  3787  			Header: res.Header,
  3788  		}
  3789  	}
  3790  	if err != nil {
  3791  		return nil, err
  3792  	}
  3793  	defer googleapi.CloseBody(res)
  3794  	if err := googleapi.CheckResponse(res); err != nil {
  3795  		return nil, err
  3796  	}
  3797  	ret := &ApprovalRequest{
  3798  		ServerResponse: googleapi.ServerResponse{
  3799  			Header:         res.Header,
  3800  			HTTPStatusCode: res.StatusCode,
  3801  		},
  3802  	}
  3803  	target := &ret
  3804  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3805  		return nil, err
  3806  	}
  3807  	return ret, nil
  3808  	// {
  3809  	//   "description": "Gets an approval request. Returns NOT_FOUND if the request does not exist.",
  3810  	//   "flatPath": "v1beta1/projects/{projectsId}/approvalRequests/{approvalRequestsId}",
  3811  	//   "httpMethod": "GET",
  3812  	//   "id": "accessapproval.projects.approvalRequests.get",
  3813  	//   "parameterOrder": [
  3814  	//     "name"
  3815  	//   ],
  3816  	//   "parameters": {
  3817  	//     "name": {
  3818  	//       "description": "Name of the approval request to retrieve.",
  3819  	//       "location": "path",
  3820  	//       "pattern": "^projects/[^/]+/approvalRequests/[^/]+$",
  3821  	//       "required": true,
  3822  	//       "type": "string"
  3823  	//     }
  3824  	//   },
  3825  	//   "path": "v1beta1/{+name}",
  3826  	//   "response": {
  3827  	//     "$ref": "ApprovalRequest"
  3828  	//   },
  3829  	//   "scopes": [
  3830  	//     "https://www.googleapis.com/auth/cloud-platform"
  3831  	//   ]
  3832  	// }
  3833  
  3834  }
  3835  
  3836  // method id "accessapproval.projects.approvalRequests.list":
  3837  
  3838  type ProjectsApprovalRequestsListCall struct {
  3839  	s            *Service
  3840  	parent       string
  3841  	urlParams_   gensupport.URLParams
  3842  	ifNoneMatch_ string
  3843  	ctx_         context.Context
  3844  	header_      http.Header
  3845  }
  3846  
  3847  // List: Lists approval requests associated with a project, folder, or
  3848  // organization.
  3849  // Approval requests can be filtered by state (pending, active,
  3850  // dismissed).
  3851  // The order is reverse chronological.
  3852  func (r *ProjectsApprovalRequestsService) List(parent string) *ProjectsApprovalRequestsListCall {
  3853  	c := &ProjectsApprovalRequestsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3854  	c.parent = parent
  3855  	return c
  3856  }
  3857  
  3858  // Filter sets the optional parameter "filter": A filter on the type of
  3859  // approval requests to retrieve. Must be one of the
  3860  // following values:
  3861  // <ol>
  3862  //
  3863  //	<li>[not set]: Requests that are pending or have active
  3864  //
  3865  // approvals.</li>
  3866  //
  3867  //	<li>ALL: All requests.</li>
  3868  //	<li>PENDING: Only pending requests.</li>
  3869  //	<li>ACTIVE: Only active (i.e. currently approved) requests.</li>
  3870  //	<li>DISMISSED: Only dismissed (including expired) requests.</li>
  3871  //	<li>HISTORY: Active and dismissed (including expired)
  3872  //
  3873  // requests.</li>
  3874  // </ol>
  3875  func (c *ProjectsApprovalRequestsListCall) Filter(filter string) *ProjectsApprovalRequestsListCall {
  3876  	c.urlParams_.Set("filter", filter)
  3877  	return c
  3878  }
  3879  
  3880  // PageSize sets the optional parameter "pageSize": Requested page size.
  3881  func (c *ProjectsApprovalRequestsListCall) PageSize(pageSize int64) *ProjectsApprovalRequestsListCall {
  3882  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3883  	return c
  3884  }
  3885  
  3886  // PageToken sets the optional parameter "pageToken": A token
  3887  // identifying the page of results to return.
  3888  func (c *ProjectsApprovalRequestsListCall) PageToken(pageToken string) *ProjectsApprovalRequestsListCall {
  3889  	c.urlParams_.Set("pageToken", pageToken)
  3890  	return c
  3891  }
  3892  
  3893  // Fields allows partial responses to be retrieved. See
  3894  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3895  // for more information.
  3896  func (c *ProjectsApprovalRequestsListCall) Fields(s ...googleapi.Field) *ProjectsApprovalRequestsListCall {
  3897  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3898  	return c
  3899  }
  3900  
  3901  // IfNoneMatch sets the optional parameter which makes the operation
  3902  // fail if the object's ETag matches the given value. This is useful for
  3903  // getting updates only after the object has changed since the last
  3904  // request. Use googleapi.IsNotModified to check whether the response
  3905  // error from Do is the result of In-None-Match.
  3906  func (c *ProjectsApprovalRequestsListCall) IfNoneMatch(entityTag string) *ProjectsApprovalRequestsListCall {
  3907  	c.ifNoneMatch_ = entityTag
  3908  	return c
  3909  }
  3910  
  3911  // Context sets the context to be used in this call's Do method. Any
  3912  // pending HTTP request will be aborted if the provided context is
  3913  // canceled.
  3914  func (c *ProjectsApprovalRequestsListCall) Context(ctx context.Context) *ProjectsApprovalRequestsListCall {
  3915  	c.ctx_ = ctx
  3916  	return c
  3917  }
  3918  
  3919  // Header returns an http.Header that can be modified by the caller to
  3920  // add HTTP headers to the request.
  3921  func (c *ProjectsApprovalRequestsListCall) Header() http.Header {
  3922  	if c.header_ == nil {
  3923  		c.header_ = make(http.Header)
  3924  	}
  3925  	return c.header_
  3926  }
  3927  
  3928  func (c *ProjectsApprovalRequestsListCall) doRequest(alt string) (*http.Response, error) {
  3929  	reqHeaders := make(http.Header)
  3930  	reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200811")
  3931  	for k, v := range c.header_ {
  3932  		reqHeaders[k] = v
  3933  	}
  3934  	reqHeaders.Set("User-Agent", c.s.userAgent())
  3935  	if c.ifNoneMatch_ != "" {
  3936  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3937  	}
  3938  	var body io.Reader = nil
  3939  	c.urlParams_.Set("alt", alt)
  3940  	c.urlParams_.Set("prettyPrint", "false")
  3941  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/approvalRequests")
  3942  	urls += "?" + c.urlParams_.Encode()
  3943  	req, err := http.NewRequest("GET", urls, body)
  3944  	if err != nil {
  3945  		return nil, err
  3946  	}
  3947  	req.Header = reqHeaders
  3948  	googleapi.Expand(req.URL, map[string]string{
  3949  		"parent": c.parent,
  3950  	})
  3951  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3952  }
  3953  
  3954  // Do executes the "accessapproval.projects.approvalRequests.list" call.
  3955  // Exactly one of *ListApprovalRequestsResponse or error will be
  3956  // non-nil. Any non-2xx status code is an error. Response headers are in
  3957  // either *ListApprovalRequestsResponse.ServerResponse.Header or (if a
  3958  // response was returned at all) in error.(*googleapi.Error).Header. Use
  3959  // googleapi.IsNotModified to check whether the returned error was
  3960  // because http.StatusNotModified was returned.
  3961  func (c *ProjectsApprovalRequestsListCall) Do(opts ...googleapi.CallOption) (*ListApprovalRequestsResponse, error) {
  3962  	gensupport.SetOptions(c.urlParams_, opts...)
  3963  	res, err := c.doRequest("json")
  3964  	if res != nil && res.StatusCode == http.StatusNotModified {
  3965  		if res.Body != nil {
  3966  			res.Body.Close()
  3967  		}
  3968  		return nil, &googleapi.Error{
  3969  			Code:   res.StatusCode,
  3970  			Header: res.Header,
  3971  		}
  3972  	}
  3973  	if err != nil {
  3974  		return nil, err
  3975  	}
  3976  	defer googleapi.CloseBody(res)
  3977  	if err := googleapi.CheckResponse(res); err != nil {
  3978  		return nil, err
  3979  	}
  3980  	ret := &ListApprovalRequestsResponse{
  3981  		ServerResponse: googleapi.ServerResponse{
  3982  			Header:         res.Header,
  3983  			HTTPStatusCode: res.StatusCode,
  3984  		},
  3985  	}
  3986  	target := &ret
  3987  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3988  		return nil, err
  3989  	}
  3990  	return ret, nil
  3991  	// {
  3992  	//   "description": "Lists approval requests associated with a project, folder, or organization.\nApproval requests can be filtered by state (pending, active, dismissed).\nThe order is reverse chronological.",
  3993  	//   "flatPath": "v1beta1/projects/{projectsId}/approvalRequests",
  3994  	//   "httpMethod": "GET",
  3995  	//   "id": "accessapproval.projects.approvalRequests.list",
  3996  	//   "parameterOrder": [
  3997  	//     "parent"
  3998  	//   ],
  3999  	//   "parameters": {
  4000  	//     "filter": {
  4001  	//       "description": "A filter on the type of approval requests to retrieve. Must be one of the\nfollowing values:\n\u003col\u003e\n  \u003cli\u003e[not set]: Requests that are pending or have active approvals.\u003c/li\u003e\n  \u003cli\u003eALL: All requests.\u003c/li\u003e\n  \u003cli\u003ePENDING: Only pending requests.\u003c/li\u003e\n  \u003cli\u003eACTIVE: Only active (i.e. currently approved) requests.\u003c/li\u003e\n  \u003cli\u003eDISMISSED: Only dismissed (including expired) requests.\u003c/li\u003e\n  \u003cli\u003eHISTORY: Active and dismissed (including expired) requests.\u003c/li\u003e\n\u003c/ol\u003e",
  4002  	//       "location": "query",
  4003  	//       "type": "string"
  4004  	//     },
  4005  	//     "pageSize": {
  4006  	//       "description": "Requested page size.",
  4007  	//       "format": "int32",
  4008  	//       "location": "query",
  4009  	//       "type": "integer"
  4010  	//     },
  4011  	//     "pageToken": {
  4012  	//       "description": "A token identifying the page of results to return.",
  4013  	//       "location": "query",
  4014  	//       "type": "string"
  4015  	//     },
  4016  	//     "parent": {
  4017  	//       "description": "The parent resource. This may be \"projects/{project_id}\",\n\"folders/{folder_id}\", or \"organizations/{organization_id}\".",
  4018  	//       "location": "path",
  4019  	//       "pattern": "^projects/[^/]+$",
  4020  	//       "required": true,
  4021  	//       "type": "string"
  4022  	//     }
  4023  	//   },
  4024  	//   "path": "v1beta1/{+parent}/approvalRequests",
  4025  	//   "response": {
  4026  	//     "$ref": "ListApprovalRequestsResponse"
  4027  	//   },
  4028  	//   "scopes": [
  4029  	//     "https://www.googleapis.com/auth/cloud-platform"
  4030  	//   ]
  4031  	// }
  4032  
  4033  }
  4034  
  4035  // Pages invokes f for each page of results.
  4036  // A non-nil error returned from f will halt the iteration.
  4037  // The provided context supersedes any context provided to the Context method.
  4038  func (c *ProjectsApprovalRequestsListCall) Pages(ctx context.Context, f func(*ListApprovalRequestsResponse) error) error {
  4039  	c.ctx_ = ctx
  4040  	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4041  	for {
  4042  		x, err := c.Do()
  4043  		if err != nil {
  4044  			return err
  4045  		}
  4046  		if err := f(x); err != nil {
  4047  			return err
  4048  		}
  4049  		if x.NextPageToken == "" {
  4050  			return nil
  4051  		}
  4052  		c.PageToken(x.NextPageToken)
  4053  	}
  4054  }
  4055  

View as plain text