// Copyright 2020 Google LLC. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Code generated file. DO NOT EDIT. // Package accessapproval provides access to the Access Approval API. // // For product documentation, see: https://cloud.google.com/access-approval/docs // // Creating a client // // Usage example: // // import "google.golang.org/api/accessapproval/v1beta1" // ... // ctx := context.Background() // accessapprovalService, err := accessapproval.NewService(ctx) // // In this example, Google Application Default Credentials are used for authentication. // // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. // // Other authentication options // // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: // // accessapprovalService, err := accessapproval.NewService(ctx, option.WithAPIKey("AIza...")) // // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: // // config := &oauth2.Config{...} // // ... // token, err := config.Exchange(ctx, ...) // accessapprovalService, err := accessapproval.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) // // See https://godoc.org/google.golang.org/api/option/ for details on options. package accessapproval // import "google.golang.org/api/accessapproval/v1beta1" import ( "bytes" "context" "encoding/json" "errors" "fmt" "io" "net/http" "net/url" "strconv" "strings" googleapi "google.golang.org/api/googleapi" gensupport "google.golang.org/api/internal/gensupport" option "google.golang.org/api/option" internaloption "google.golang.org/api/option/internaloption" htransport "google.golang.org/api/transport/http" ) // Always reference these packages, just in case the auto-generated code // below doesn't. var _ = bytes.NewBuffer var _ = strconv.Itoa var _ = fmt.Sprintf var _ = json.NewDecoder var _ = io.Copy var _ = url.Parse var _ = gensupport.MarshalJSON var _ = googleapi.Version var _ = errors.New var _ = strings.Replace var _ = context.Canceled var _ = internaloption.WithDefaultEndpoint const apiId = "accessapproval:v1beta1" const apiName = "accessapproval" const apiVersion = "v1beta1" const basePath = "https://accessapproval.googleapis.com/" // OAuth2 scopes used by this API. const ( // View and manage your data across Google Cloud Platform services CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" ) // NewService creates a new Service. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { scopesOption := option.WithScopes( "https://www.googleapis.com/auth/cloud-platform", ) // NOTE: prepend, so we don't override user-specified scopes. opts = append([]option.ClientOption{scopesOption}, opts...) opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) client, endpoint, err := htransport.NewClient(ctx, opts...) if err != nil { return nil, err } s, err := New(client) if err != nil { return nil, err } if endpoint != "" { s.BasePath = endpoint } return s, nil } // New creates a new Service. It uses the provided http.Client for requests. // // Deprecated: please use NewService instead. // To provide a custom HTTP client, use option.WithHTTPClient. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. func New(client *http.Client) (*Service, error) { if client == nil { return nil, errors.New("client is nil") } s := &Service{client: client, BasePath: basePath} s.Folders = NewFoldersService(s) s.Organizations = NewOrganizationsService(s) s.Projects = NewProjectsService(s) return s, nil } type Service struct { client *http.Client BasePath string // API endpoint base URL UserAgent string // optional additional User-Agent fragment Folders *FoldersService Organizations *OrganizationsService Projects *ProjectsService } func (s *Service) userAgent() string { if s.UserAgent == "" { return googleapi.UserAgent } return googleapi.UserAgent + " " + s.UserAgent } func NewFoldersService(s *Service) *FoldersService { rs := &FoldersService{s: s} rs.ApprovalRequests = NewFoldersApprovalRequestsService(s) return rs } type FoldersService struct { s *Service ApprovalRequests *FoldersApprovalRequestsService } func NewFoldersApprovalRequestsService(s *Service) *FoldersApprovalRequestsService { rs := &FoldersApprovalRequestsService{s: s} return rs } type FoldersApprovalRequestsService struct { s *Service } func NewOrganizationsService(s *Service) *OrganizationsService { rs := &OrganizationsService{s: s} rs.ApprovalRequests = NewOrganizationsApprovalRequestsService(s) return rs } type OrganizationsService struct { s *Service ApprovalRequests *OrganizationsApprovalRequestsService } func NewOrganizationsApprovalRequestsService(s *Service) *OrganizationsApprovalRequestsService { rs := &OrganizationsApprovalRequestsService{s: s} return rs } type OrganizationsApprovalRequestsService struct { s *Service } func NewProjectsService(s *Service) *ProjectsService { rs := &ProjectsService{s: s} rs.ApprovalRequests = NewProjectsApprovalRequestsService(s) return rs } type ProjectsService struct { s *Service ApprovalRequests *ProjectsApprovalRequestsService } func NewProjectsApprovalRequestsService(s *Service) *ProjectsApprovalRequestsService { rs := &ProjectsApprovalRequestsService{s: s} return rs } type ProjectsApprovalRequestsService struct { s *Service } // AccessApprovalSettings: Settings on a Project/Folder/Organization // related to Access Approval. type AccessApprovalSettings struct { // EnrolledAncestor: Output only. This field is read only (not settable // via // UpdateAccessAccessApprovalSettings method). If the field is true, // that // indicates that at least one service is enrolled for Access Approval // in one // or more ancestors of the Project or Folder (this field will always // be // unset for the organization since organizations do not have // ancestors). EnrolledAncestor bool `json:"enrolledAncestor,omitempty"` // EnrolledServices: A list of Google Cloud Services for which the given // resource has Access // Approval enrolled. Access requests for the resource given by name // against // any of these services contained here will be required to have // explicit // approval. If name refers to an organization, enrollment can be done // for // individual services. If name refers to a folder or project, // enrollment can // only be done on an all or nothing basis. // // If a cloud_product is repeated in this list, the first entry will // be // honored and all following entries will be discarded. A maximum of // 10 // enrolled services will be enforced, to be expanded as the set of // supported // services is expanded. EnrolledServices []*EnrolledService `json:"enrolledServices,omitempty"` // Name: The resource name of the settings. Format is one of: //
    //
  1. "projects/{project_id}/accessApprovalSettings"
  2. //
  3. "folders/{folder_id}/accessApprovalSettings"
  4. // //
  5. "organizations/{organization_id}/accessApprovalSettings"
  6. //
      Name string `json:"name,omitempty"` // NotificationEmails: A list of email addresses to which notifications // relating to approval // requests should be sent. Notifications relating to a resource will be // sent // to all emails in the settings of ancestor resources of that resource. // A // maximum of 50 email addresses are allowed. NotificationEmails []string `json:"notificationEmails,omitempty"` // ServerResponse contains the HTTP response code and headers from the // server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "EnrolledAncestor") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "EnrolledAncestor") to // include in API requests with the JSON null value. By default, fields // with empty values are omitted from API requests. However, any field // with an empty value appearing in NullFields will be sent to the // server as null. It is an error if a field in this list has a // non-empty value. This may be used to include null fields in Patch // requests. NullFields []string `json:"-"` } func (s *AccessApprovalSettings) MarshalJSON() ([]byte, error) { type NoMethod AccessApprovalSettings raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // AccessLocations: Home office and physical location of the principal. type AccessLocations struct { // PrincipalOfficeCountry: The "home office" location of the principal. // A two-letter country code // (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or a region code. In // some // limited situations Google systems may refer refer to a region code // instead // of a country code. // Possible Region Codes: //
        //
      1. ASI: Asia
      2. //
      3. EUR: Europe
      4. //
      5. OCE: Oceania
      6. //
      7. AFR: Africa
      8. //
      9. NAM: North America
      10. //
      11. SAM: South America
      12. //
      13. ANT: Antarctica
      14. //
      15. ANY: Any location
      16. //
      PrincipalOfficeCountry string `json:"principalOfficeCountry,omitempty"` // PrincipalPhysicalLocationCountry: Physical location of the principal // at the time of the access. A // two-letter country code (ISO 3166-1 alpha-2), such as "US", "DE" or // "GB" or // a region code. In some limited situations Google systems may refer // refer to // a region code instead of a country code. // Possible Region Codes: //
        //
      1. ASI: Asia
      2. //
      3. EUR: Europe
      4. //
      5. OCE: Oceania
      6. //
      7. AFR: Africa
      8. //
      9. NAM: North America
      10. //
      11. SAM: South America
      12. //
      13. ANT: Antarctica
      14. //
      15. ANY: Any location
      16. //
      PrincipalPhysicalLocationCountry string `json:"principalPhysicalLocationCountry,omitempty"` // ForceSendFields is a list of field names (e.g. // "PrincipalOfficeCountry") to unconditionally include in API requests. // By default, fields with empty values are omitted from API requests. // However, any non-pointer, non-interface field appearing in // ForceSendFields will be sent to the server regardless of whether the // field is empty or not. This may be used to include empty fields in // Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "PrincipalOfficeCountry") // to include in API requests with the JSON null value. By default, // fields with empty values are omitted from API requests. However, any // field with an empty value appearing in NullFields will be sent to the // server as null. It is an error if a field in this list has a // non-empty value. This may be used to include null fields in Patch // requests. NullFields []string `json:"-"` } func (s *AccessLocations) MarshalJSON() ([]byte, error) { type NoMethod AccessLocations raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } type AccessReason struct { // Detail: More detail about certain reason types. See comments for each // type above. Detail string `json:"detail,omitempty"` // Type: Type of access justification. // // Possible values: // "TYPE_UNSPECIFIED" - Default value for proto, shouldn't be used. // "CUSTOMER_INITIATED_SUPPORT" - Customer made a request or raised an // issue that required the principal to // access customer data. `detail` is of the form ("#####" is the issue // ID): //
        //
      1. "Feedback Report: #####"
      2. //
      3. "Case Number: #####"
      4. //
      5. "Case ID: #####"
      6. //
      7. "E-PIN Reference: #####"
      8. //
      9. "Google-#####"
      10. //
      11. "T-#####"
      12. //
      // "GOOGLE_INITIATED_SERVICE" - The principal accessed customer data // in order to diagnose or resolve a // suspected issue in services or a known outage. Often this access is // used // to confirm that customers are not affected by a suspected service // issue // or to remediate a reversible system issue. // "GOOGLE_INITIATED_REVIEW" - Google initiated service for security, // fraud, abuse, or compliance // purposes. Type string `json:"type,omitempty"` // ForceSendFields is a list of field names (e.g. "Detail") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Detail") to include in API // requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *AccessReason) MarshalJSON() ([]byte, error) { type NoMethod AccessReason raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // ApprovalRequest: A request for the customer to approve access to a // resource. type ApprovalRequest struct { // Approve: Access was approved. Approve *ApproveDecision `json:"approve,omitempty"` // Dismiss: The request was dismissed. Dismiss *DismissDecision `json:"dismiss,omitempty"` // Name: The resource name of the request. Format // is // "{projects|folders|organizations}/{id}/approvalRequests/{approval_r // equest_id}". Name string `json:"name,omitempty"` // RequestTime: The time at which approval was requested. RequestTime string `json:"requestTime,omitempty"` // RequestedExpiration: The requested expiration for the approval. If // the request is approved, // access will be granted from the time of approval until the expiration // time. RequestedExpiration string `json:"requestedExpiration,omitempty"` // RequestedLocations: The locations for which approval is being // requested. RequestedLocations *AccessLocations `json:"requestedLocations,omitempty"` // RequestedReason: The justification for which approval is being // requested. RequestedReason *AccessReason `json:"requestedReason,omitempty"` // RequestedResourceName: The resource for which approval is being // requested. The format of the // resource name is defined // at // https://cloud.google.com/apis/design/resource_names. The resource // name here // may either be a "full" resource name // (e.g. // "//library.googleapis.com/shelves/shelf1/books/book2") or a // "relative" // resource name (e.g. "shelves/shelf1/books/book2") as described in // the // resource name specification. RequestedResourceName string `json:"requestedResourceName,omitempty"` // RequestedResourceProperties: Properties related to the resource // represented by requested_resource_name. RequestedResourceProperties *ResourceProperties `json:"requestedResourceProperties,omitempty"` // ServerResponse contains the HTTP response code and headers from the // server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Approve") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Approve") to include in // API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ApprovalRequest) MarshalJSON() ([]byte, error) { type NoMethod ApprovalRequest raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // ApproveApprovalRequestMessage: Request to approve an ApprovalRequest. type ApproveApprovalRequestMessage struct { // ExpireTime: The expiration time of this approval. ExpireTime string `json:"expireTime,omitempty"` // ForceSendFields is a list of field names (e.g. "ExpireTime") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "ExpireTime") to include in // API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ApproveApprovalRequestMessage) MarshalJSON() ([]byte, error) { type NoMethod ApproveApprovalRequestMessage raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // ApproveDecision: A decision that has been made to approve access to a // resource. type ApproveDecision struct { // ApproveTime: The time at which approval was granted. ApproveTime string `json:"approveTime,omitempty"` // ExpireTime: The time at which the approval expires. ExpireTime string `json:"expireTime,omitempty"` // ForceSendFields is a list of field names (e.g. "ApproveTime") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "ApproveTime") to include // in API requests with the JSON null value. By default, fields with // empty values are omitted from API requests. However, any field with // an empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *ApproveDecision) MarshalJSON() ([]byte, error) { type NoMethod ApproveDecision raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // DismissApprovalRequestMessage: Request to dismiss an approval // request. type DismissApprovalRequestMessage struct { } // DismissDecision: A decision that has been made to dismiss an approval // request. type DismissDecision struct { // DismissTime: The time at which the approval request was dismissed. DismissTime string `json:"dismissTime,omitempty"` // ForceSendFields is a list of field names (e.g. "DismissTime") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "DismissTime") to include // in API requests with the JSON null value. By default, fields with // empty values are omitted from API requests. However, any field with // an empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *DismissDecision) MarshalJSON() ([]byte, error) { type NoMethod DismissDecision raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // Empty: A generic empty message that you can re-use to avoid defining // duplicated // empty messages in your APIs. A typical example is to use it as the // request // or the response type of an API method. For instance: // // service Foo { // rpc Bar(google.protobuf.Empty) returns // (google.protobuf.Empty); // } // // The JSON representation for `Empty` is empty JSON object `{}`. type Empty struct { // ServerResponse contains the HTTP response code and headers from the // server. googleapi.ServerResponse `json:"-"` } // EnrolledService: Represents the enrollment of a cloud resource into a // specific service. type EnrolledService struct { // CloudProduct: The product for which Access Approval will be enrolled. // Allowed values are // listed below (case-sensitive): //
        //
      1. all
      2. //
      3. appengine.googleapis.com
      4. //
      5. bigquery.googleapis.com
      6. //
      7. bigtable.googleapis.com
      8. //
      9. cloudkms.googleapis.com
      10. //
      11. compute.googleapis.com
      12. //
      13. dataflow.googleapis.com
      14. //
      15. iam.googleapis.com
      16. //
      17. pubsub.googleapis.com
      18. //
      19. storage.googleapis.com
      20. //
          CloudProduct string `json:"cloudProduct,omitempty"` // EnrollmentLevel: The enrollment level of the service. // // Possible values: // "ENROLLMENT_LEVEL_UNSPECIFIED" - Default value for proto, shouldn't // be used. // "BLOCK_ALL" - Service is enrolled in Access Approval for all // requests EnrollmentLevel string `json:"enrollmentLevel,omitempty"` // ForceSendFields is a list of field names (e.g. "CloudProduct") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "CloudProduct") to include // in API requests with the JSON null value. By default, fields with // empty values are omitted from API requests. However, any field with // an empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` } func (s *EnrolledService) MarshalJSON() ([]byte, error) { type NoMethod EnrolledService raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // ListApprovalRequestsResponse: Response to listing of ApprovalRequest // objects. type ListApprovalRequestsResponse struct { // ApprovalRequests: Approval request details. ApprovalRequests []*ApprovalRequest `json:"approvalRequests,omitempty"` // NextPageToken: Token to retrieve the next page of results, or empty // if there are no more. NextPageToken string `json:"nextPageToken,omitempty"` // ServerResponse contains the HTTP response code and headers from the // server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "ApprovalRequests") to // unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "ApprovalRequests") to // include in API requests with the JSON null value. By default, fields // with empty values are omitted from API requests. However, any field // with an empty value appearing in NullFields will be sent to the // server as null. It is an error if a field in this list has a // non-empty value. This may be used to include null fields in Patch // requests. NullFields []string `json:"-"` } func (s *ListApprovalRequestsResponse) MarshalJSON() ([]byte, error) { type NoMethod ListApprovalRequestsResponse raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // ResourceProperties: The properties associated with the resource of // the request. type ResourceProperties struct { // ExcludesDescendants: Whether an approval will exclude the descendants // of the resource being // requested. ExcludesDescendants bool `json:"excludesDescendants,omitempty"` // ForceSendFields is a list of field names (e.g. "ExcludesDescendants") // to unconditionally include in API requests. By default, fields with // empty values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "ExcludesDescendants") to // include in API requests with the JSON null value. By default, fields // with empty values are omitted from API requests. However, any field // with an empty value appearing in NullFields will be sent to the // server as null. It is an error if a field in this list has a // non-empty value. This may be used to include null fields in Patch // requests. NullFields []string `json:"-"` } func (s *ResourceProperties) MarshalJSON() ([]byte, error) { type NoMethod ResourceProperties raw := NoMethod(*s) return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) } // method id "accessapproval.folders.deleteAccessApprovalSettings": type FoldersDeleteAccessApprovalSettingsCall struct { s *Service name string urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // DeleteAccessApprovalSettings: Deletes the settings associated with a // project, folder, or organization. // This will have the effect of disabling Access Approval for the // project, // folder, or organization, but only if all ancestors also have // Access // Approval disabled. If Access Approval is enabled at a higher level of // the // hierarchy, then Access Approval will still be enabled at this level // as // the settings are inherited. func (r *FoldersService) DeleteAccessApprovalSettings(name string) *FoldersDeleteAccessApprovalSettingsCall { c := &FoldersDeleteAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *FoldersDeleteAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *FoldersDeleteAccessApprovalSettingsCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *FoldersDeleteAccessApprovalSettingsCall) Context(ctx context.Context) *FoldersDeleteAccessApprovalSettingsCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *FoldersDeleteAccessApprovalSettingsCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *FoldersDeleteAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("DELETE", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.folders.deleteAccessApprovalSettings" call. // Exactly one of *Empty or error will be non-nil. Any non-2xx status // code is an error. Response headers are in either // *Empty.ServerResponse.Header or (if a response was returned at all) // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to // check whether the returned error was because http.StatusNotModified // was returned. func (c *FoldersDeleteAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*Empty, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &Empty{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "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.", // "flatPath": "v1beta1/folders/{foldersId}/accessApprovalSettings", // "httpMethod": "DELETE", // "id": "accessapproval.folders.deleteAccessApprovalSettings", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the AccessApprovalSettings to delete.", // "location": "path", // "pattern": "^folders/[^/]+/accessApprovalSettings$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}", // "response": { // "$ref": "Empty" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.folders.getAccessApprovalSettings": type FoldersGetAccessApprovalSettingsCall struct { s *Service name string urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // GetAccessApprovalSettings: Gets the settings associated with a // project, folder, or organization. func (r *FoldersService) GetAccessApprovalSettings(name string) *FoldersGetAccessApprovalSettingsCall { c := &FoldersGetAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *FoldersGetAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *FoldersGetAccessApprovalSettingsCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets the optional parameter which makes the operation // fail if the object's ETag matches the given value. This is useful for // getting updates only after the object has changed since the last // request. Use googleapi.IsNotModified to check whether the response // error from Do is the result of In-None-Match. func (c *FoldersGetAccessApprovalSettingsCall) IfNoneMatch(entityTag string) *FoldersGetAccessApprovalSettingsCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *FoldersGetAccessApprovalSettingsCall) Context(ctx context.Context) *FoldersGetAccessApprovalSettingsCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *FoldersGetAccessApprovalSettingsCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *FoldersGetAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("GET", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.folders.getAccessApprovalSettings" call. // Exactly one of *AccessApprovalSettings or error will be non-nil. Any // non-2xx status code is an error. Response headers are in either // *AccessApprovalSettings.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *FoldersGetAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*AccessApprovalSettings, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &AccessApprovalSettings{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "description": "Gets the settings associated with a project, folder, or organization.", // "flatPath": "v1beta1/folders/{foldersId}/accessApprovalSettings", // "httpMethod": "GET", // "id": "accessapproval.folders.getAccessApprovalSettings", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the AccessApprovalSettings to retrieve.", // "location": "path", // "pattern": "^folders/[^/]+/accessApprovalSettings$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}", // "response": { // "$ref": "AccessApprovalSettings" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.folders.updateAccessApprovalSettings": type FoldersUpdateAccessApprovalSettingsCall struct { s *Service name string accessapprovalsettings *AccessApprovalSettings urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // UpdateAccessApprovalSettings: Updates the settings associated with a // project, folder, or organization. // Settings to update are determined by the value of field_mask. func (r *FoldersService) UpdateAccessApprovalSettings(name string, accessapprovalsettings *AccessApprovalSettings) *FoldersUpdateAccessApprovalSettingsCall { c := &FoldersUpdateAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.accessapprovalsettings = accessapprovalsettings return c } // UpdateMask sets the optional parameter "updateMask": For the // `FieldMask` definition, // see // https://developers.google.com/protocol-buffers/docs/reference/goog // le.protobuf#fieldmask // If this field is left unset, only the notification_emails field will // be // updated. func (c *FoldersUpdateAccessApprovalSettingsCall) UpdateMask(updateMask string) *FoldersUpdateAccessApprovalSettingsCall { c.urlParams_.Set("updateMask", updateMask) return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *FoldersUpdateAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *FoldersUpdateAccessApprovalSettingsCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *FoldersUpdateAccessApprovalSettingsCall) Context(ctx context.Context) *FoldersUpdateAccessApprovalSettingsCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *FoldersUpdateAccessApprovalSettingsCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *FoldersUpdateAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) var body io.Reader = nil body, err := googleapi.WithoutDataWrapper.JSONReader(c.accessapprovalsettings) if err != nil { return nil, err } reqHeaders.Set("Content-Type", "application/json") c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("PATCH", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.folders.updateAccessApprovalSettings" call. // Exactly one of *AccessApprovalSettings or error will be non-nil. Any // non-2xx status code is an error. Response headers are in either // *AccessApprovalSettings.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *FoldersUpdateAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*AccessApprovalSettings, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &AccessApprovalSettings{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "description": "Updates the settings associated with a project, folder, or organization.\nSettings to update are determined by the value of field_mask.", // "flatPath": "v1beta1/folders/{foldersId}/accessApprovalSettings", // "httpMethod": "PATCH", // "id": "accessapproval.folders.updateAccessApprovalSettings", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "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", // "location": "path", // "pattern": "^folders/[^/]+/accessApprovalSettings$", // "required": true, // "type": "string" // }, // "updateMask": { // "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.", // "format": "google-fieldmask", // "location": "query", // "type": "string" // } // }, // "path": "v1beta1/{+name}", // "request": { // "$ref": "AccessApprovalSettings" // }, // "response": { // "$ref": "AccessApprovalSettings" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.folders.approvalRequests.approve": type FoldersApprovalRequestsApproveCall struct { s *Service name string approveapprovalrequestmessage *ApproveApprovalRequestMessage urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Approve: Approves a request and returns the updated // ApprovalRequest. // // Returns NOT_FOUND if the request does not exist. // Returns // FAILED_PRECONDITION if the request exists but is not in a pending // state. func (r *FoldersApprovalRequestsService) Approve(name string, approveapprovalrequestmessage *ApproveApprovalRequestMessage) *FoldersApprovalRequestsApproveCall { c := &FoldersApprovalRequestsApproveCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.approveapprovalrequestmessage = approveapprovalrequestmessage return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *FoldersApprovalRequestsApproveCall) Fields(s ...googleapi.Field) *FoldersApprovalRequestsApproveCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *FoldersApprovalRequestsApproveCall) Context(ctx context.Context) *FoldersApprovalRequestsApproveCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *FoldersApprovalRequestsApproveCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *FoldersApprovalRequestsApproveCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) var body io.Reader = nil body, err := googleapi.WithoutDataWrapper.JSONReader(c.approveapprovalrequestmessage) if err != nil { return nil, err } reqHeaders.Set("Content-Type", "application/json") c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:approve") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.folders.approvalRequests.approve" call. // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx // status code is an error. Response headers are in either // *ApprovalRequest.ServerResponse.Header or (if a response was returned // at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *FoldersApprovalRequestsApproveCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &ApprovalRequest{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "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.", // "flatPath": "v1beta1/folders/{foldersId}/approvalRequests/{approvalRequestsId}:approve", // "httpMethod": "POST", // "id": "accessapproval.folders.approvalRequests.approve", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the approval request to approve.", // "location": "path", // "pattern": "^folders/[^/]+/approvalRequests/[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}:approve", // "request": { // "$ref": "ApproveApprovalRequestMessage" // }, // "response": { // "$ref": "ApprovalRequest" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.folders.approvalRequests.dismiss": type FoldersApprovalRequestsDismissCall struct { s *Service name string dismissapprovalrequestmessage *DismissApprovalRequestMessage urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Dismiss: Dismisses a request. Returns the updated // ApprovalRequest. // // NOTE: This does not deny access to the resource if another request // has been // made and approved. It is equivalent in effect to ignoring the // request // altogether. // // Returns NOT_FOUND if the request does not exist. // // Returns FAILED_PRECONDITION if the request exists but is not in a // pending // state. func (r *FoldersApprovalRequestsService) Dismiss(name string, dismissapprovalrequestmessage *DismissApprovalRequestMessage) *FoldersApprovalRequestsDismissCall { c := &FoldersApprovalRequestsDismissCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.dismissapprovalrequestmessage = dismissapprovalrequestmessage return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *FoldersApprovalRequestsDismissCall) Fields(s ...googleapi.Field) *FoldersApprovalRequestsDismissCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *FoldersApprovalRequestsDismissCall) Context(ctx context.Context) *FoldersApprovalRequestsDismissCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *FoldersApprovalRequestsDismissCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *FoldersApprovalRequestsDismissCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) var body io.Reader = nil body, err := googleapi.WithoutDataWrapper.JSONReader(c.dismissapprovalrequestmessage) if err != nil { return nil, err } reqHeaders.Set("Content-Type", "application/json") c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:dismiss") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.folders.approvalRequests.dismiss" call. // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx // status code is an error. Response headers are in either // *ApprovalRequest.ServerResponse.Header or (if a response was returned // at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *FoldersApprovalRequestsDismissCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &ApprovalRequest{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "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.", // "flatPath": "v1beta1/folders/{foldersId}/approvalRequests/{approvalRequestsId}:dismiss", // "httpMethod": "POST", // "id": "accessapproval.folders.approvalRequests.dismiss", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the ApprovalRequest to dismiss.", // "location": "path", // "pattern": "^folders/[^/]+/approvalRequests/[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}:dismiss", // "request": { // "$ref": "DismissApprovalRequestMessage" // }, // "response": { // "$ref": "ApprovalRequest" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.folders.approvalRequests.get": type FoldersApprovalRequestsGetCall struct { s *Service name string urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // Get: Gets an approval request. Returns NOT_FOUND if the request does // not exist. func (r *FoldersApprovalRequestsService) Get(name string) *FoldersApprovalRequestsGetCall { c := &FoldersApprovalRequestsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *FoldersApprovalRequestsGetCall) Fields(s ...googleapi.Field) *FoldersApprovalRequestsGetCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets the optional parameter which makes the operation // fail if the object's ETag matches the given value. This is useful for // getting updates only after the object has changed since the last // request. Use googleapi.IsNotModified to check whether the response // error from Do is the result of In-None-Match. func (c *FoldersApprovalRequestsGetCall) IfNoneMatch(entityTag string) *FoldersApprovalRequestsGetCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *FoldersApprovalRequestsGetCall) Context(ctx context.Context) *FoldersApprovalRequestsGetCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *FoldersApprovalRequestsGetCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *FoldersApprovalRequestsGetCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("GET", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.folders.approvalRequests.get" call. // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx // status code is an error. Response headers are in either // *ApprovalRequest.ServerResponse.Header or (if a response was returned // at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *FoldersApprovalRequestsGetCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &ApprovalRequest{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "description": "Gets an approval request. Returns NOT_FOUND if the request does not exist.", // "flatPath": "v1beta1/folders/{foldersId}/approvalRequests/{approvalRequestsId}", // "httpMethod": "GET", // "id": "accessapproval.folders.approvalRequests.get", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the approval request to retrieve.", // "location": "path", // "pattern": "^folders/[^/]+/approvalRequests/[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}", // "response": { // "$ref": "ApprovalRequest" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.folders.approvalRequests.list": type FoldersApprovalRequestsListCall struct { s *Service parent string urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // List: Lists approval requests associated with a project, folder, or // organization. // Approval requests can be filtered by state (pending, active, // dismissed). // The order is reverse chronological. func (r *FoldersApprovalRequestsService) List(parent string) *FoldersApprovalRequestsListCall { c := &FoldersApprovalRequestsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.parent = parent return c } // Filter sets the optional parameter "filter": A filter on the type of // approval requests to retrieve. Must be one of the // following values: //
            //
          1. [not set]: Requests that are pending or have active // approvals.
          2. //
          3. ALL: All requests.
          4. //
          5. PENDING: Only pending requests.
          6. //
          7. ACTIVE: Only active (i.e. currently approved) requests.
          8. //
          9. DISMISSED: Only dismissed (including expired) // requests.
          10. //
          func (c *FoldersApprovalRequestsListCall) Filter(filter string) *FoldersApprovalRequestsListCall { c.urlParams_.Set("filter", filter) return c } // PageSize sets the optional parameter "pageSize": Requested page size. func (c *FoldersApprovalRequestsListCall) PageSize(pageSize int64) *FoldersApprovalRequestsListCall { c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) return c } // PageToken sets the optional parameter "pageToken": A token // identifying the page of results to return. func (c *FoldersApprovalRequestsListCall) PageToken(pageToken string) *FoldersApprovalRequestsListCall { c.urlParams_.Set("pageToken", pageToken) return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *FoldersApprovalRequestsListCall) Fields(s ...googleapi.Field) *FoldersApprovalRequestsListCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets the optional parameter which makes the operation // fail if the object's ETag matches the given value. This is useful for // getting updates only after the object has changed since the last // request. Use googleapi.IsNotModified to check whether the response // error from Do is the result of In-None-Match. func (c *FoldersApprovalRequestsListCall) IfNoneMatch(entityTag string) *FoldersApprovalRequestsListCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *FoldersApprovalRequestsListCall) Context(ctx context.Context) *FoldersApprovalRequestsListCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *FoldersApprovalRequestsListCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *FoldersApprovalRequestsListCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/approvalRequests") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("GET", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "parent": c.parent, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.folders.approvalRequests.list" call. // Exactly one of *ListApprovalRequestsResponse or error will be // non-nil. Any non-2xx status code is an error. Response headers are in // either *ListApprovalRequestsResponse.ServerResponse.Header or (if a // response was returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *FoldersApprovalRequestsListCall) Do(opts ...googleapi.CallOption) (*ListApprovalRequestsResponse, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &ListApprovalRequestsResponse{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "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.", // "flatPath": "v1beta1/folders/{foldersId}/approvalRequests", // "httpMethod": "GET", // "id": "accessapproval.folders.approvalRequests.list", // "parameterOrder": [ // "parent" // ], // "parameters": { // "filter": { // "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\u003c/ol\u003e", // "location": "query", // "type": "string" // }, // "pageSize": { // "description": "Requested page size.", // "format": "int32", // "location": "query", // "type": "integer" // }, // "pageToken": { // "description": "A token identifying the page of results to return.", // "location": "query", // "type": "string" // }, // "parent": { // "description": "The parent resource. This may be \"projects/{project_id}\",\n\"folders/{folder_id}\", or \"organizations/{organization_id}\".", // "location": "path", // "pattern": "^folders/[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+parent}/approvalRequests", // "response": { // "$ref": "ListApprovalRequestsResponse" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // Pages invokes f for each page of results. // A non-nil error returned from f will halt the iteration. // The provided context supersedes any context provided to the Context method. func (c *FoldersApprovalRequestsListCall) Pages(ctx context.Context, f func(*ListApprovalRequestsResponse) error) error { c.ctx_ = ctx defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point for { x, err := c.Do() if err != nil { return err } if err := f(x); err != nil { return err } if x.NextPageToken == "" { return nil } c.PageToken(x.NextPageToken) } } // method id "accessapproval.organizations.deleteAccessApprovalSettings": type OrganizationsDeleteAccessApprovalSettingsCall struct { s *Service name string urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // DeleteAccessApprovalSettings: Deletes the settings associated with a // project, folder, or organization. // This will have the effect of disabling Access Approval for the // project, // folder, or organization, but only if all ancestors also have // Access // Approval disabled. If Access Approval is enabled at a higher level of // the // hierarchy, then Access Approval will still be enabled at this level // as // the settings are inherited. func (r *OrganizationsService) DeleteAccessApprovalSettings(name string) *OrganizationsDeleteAccessApprovalSettingsCall { c := &OrganizationsDeleteAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *OrganizationsDeleteAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *OrganizationsDeleteAccessApprovalSettingsCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *OrganizationsDeleteAccessApprovalSettingsCall) Context(ctx context.Context) *OrganizationsDeleteAccessApprovalSettingsCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *OrganizationsDeleteAccessApprovalSettingsCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *OrganizationsDeleteAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("DELETE", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.organizations.deleteAccessApprovalSettings" call. // Exactly one of *Empty or error will be non-nil. Any non-2xx status // code is an error. Response headers are in either // *Empty.ServerResponse.Header or (if a response was returned at all) // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to // check whether the returned error was because http.StatusNotModified // was returned. func (c *OrganizationsDeleteAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*Empty, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &Empty{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "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.", // "flatPath": "v1beta1/organizations/{organizationsId}/accessApprovalSettings", // "httpMethod": "DELETE", // "id": "accessapproval.organizations.deleteAccessApprovalSettings", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the AccessApprovalSettings to delete.", // "location": "path", // "pattern": "^organizations/[^/]+/accessApprovalSettings$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}", // "response": { // "$ref": "Empty" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.organizations.getAccessApprovalSettings": type OrganizationsGetAccessApprovalSettingsCall struct { s *Service name string urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // GetAccessApprovalSettings: Gets the settings associated with a // project, folder, or organization. func (r *OrganizationsService) GetAccessApprovalSettings(name string) *OrganizationsGetAccessApprovalSettingsCall { c := &OrganizationsGetAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *OrganizationsGetAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *OrganizationsGetAccessApprovalSettingsCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets the optional parameter which makes the operation // fail if the object's ETag matches the given value. This is useful for // getting updates only after the object has changed since the last // request. Use googleapi.IsNotModified to check whether the response // error from Do is the result of In-None-Match. func (c *OrganizationsGetAccessApprovalSettingsCall) IfNoneMatch(entityTag string) *OrganizationsGetAccessApprovalSettingsCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *OrganizationsGetAccessApprovalSettingsCall) Context(ctx context.Context) *OrganizationsGetAccessApprovalSettingsCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *OrganizationsGetAccessApprovalSettingsCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *OrganizationsGetAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("GET", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.organizations.getAccessApprovalSettings" call. // Exactly one of *AccessApprovalSettings or error will be non-nil. Any // non-2xx status code is an error. Response headers are in either // *AccessApprovalSettings.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *OrganizationsGetAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*AccessApprovalSettings, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &AccessApprovalSettings{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "description": "Gets the settings associated with a project, folder, or organization.", // "flatPath": "v1beta1/organizations/{organizationsId}/accessApprovalSettings", // "httpMethod": "GET", // "id": "accessapproval.organizations.getAccessApprovalSettings", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the AccessApprovalSettings to retrieve.", // "location": "path", // "pattern": "^organizations/[^/]+/accessApprovalSettings$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}", // "response": { // "$ref": "AccessApprovalSettings" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.organizations.updateAccessApprovalSettings": type OrganizationsUpdateAccessApprovalSettingsCall struct { s *Service name string accessapprovalsettings *AccessApprovalSettings urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // UpdateAccessApprovalSettings: Updates the settings associated with a // project, folder, or organization. // Settings to update are determined by the value of field_mask. func (r *OrganizationsService) UpdateAccessApprovalSettings(name string, accessapprovalsettings *AccessApprovalSettings) *OrganizationsUpdateAccessApprovalSettingsCall { c := &OrganizationsUpdateAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.accessapprovalsettings = accessapprovalsettings return c } // UpdateMask sets the optional parameter "updateMask": For the // `FieldMask` definition, // see // https://developers.google.com/protocol-buffers/docs/reference/goog // le.protobuf#fieldmask // If this field is left unset, only the notification_emails field will // be // updated. func (c *OrganizationsUpdateAccessApprovalSettingsCall) UpdateMask(updateMask string) *OrganizationsUpdateAccessApprovalSettingsCall { c.urlParams_.Set("updateMask", updateMask) return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *OrganizationsUpdateAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *OrganizationsUpdateAccessApprovalSettingsCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *OrganizationsUpdateAccessApprovalSettingsCall) Context(ctx context.Context) *OrganizationsUpdateAccessApprovalSettingsCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *OrganizationsUpdateAccessApprovalSettingsCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *OrganizationsUpdateAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) var body io.Reader = nil body, err := googleapi.WithoutDataWrapper.JSONReader(c.accessapprovalsettings) if err != nil { return nil, err } reqHeaders.Set("Content-Type", "application/json") c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("PATCH", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.organizations.updateAccessApprovalSettings" call. // Exactly one of *AccessApprovalSettings or error will be non-nil. Any // non-2xx status code is an error. Response headers are in either // *AccessApprovalSettings.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *OrganizationsUpdateAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*AccessApprovalSettings, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &AccessApprovalSettings{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "description": "Updates the settings associated with a project, folder, or organization.\nSettings to update are determined by the value of field_mask.", // "flatPath": "v1beta1/organizations/{organizationsId}/accessApprovalSettings", // "httpMethod": "PATCH", // "id": "accessapproval.organizations.updateAccessApprovalSettings", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "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", // "location": "path", // "pattern": "^organizations/[^/]+/accessApprovalSettings$", // "required": true, // "type": "string" // }, // "updateMask": { // "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.", // "format": "google-fieldmask", // "location": "query", // "type": "string" // } // }, // "path": "v1beta1/{+name}", // "request": { // "$ref": "AccessApprovalSettings" // }, // "response": { // "$ref": "AccessApprovalSettings" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.organizations.approvalRequests.approve": type OrganizationsApprovalRequestsApproveCall struct { s *Service name string approveapprovalrequestmessage *ApproveApprovalRequestMessage urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Approve: Approves a request and returns the updated // ApprovalRequest. // // Returns NOT_FOUND if the request does not exist. // Returns // FAILED_PRECONDITION if the request exists but is not in a pending // state. func (r *OrganizationsApprovalRequestsService) Approve(name string, approveapprovalrequestmessage *ApproveApprovalRequestMessage) *OrganizationsApprovalRequestsApproveCall { c := &OrganizationsApprovalRequestsApproveCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.approveapprovalrequestmessage = approveapprovalrequestmessage return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *OrganizationsApprovalRequestsApproveCall) Fields(s ...googleapi.Field) *OrganizationsApprovalRequestsApproveCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *OrganizationsApprovalRequestsApproveCall) Context(ctx context.Context) *OrganizationsApprovalRequestsApproveCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *OrganizationsApprovalRequestsApproveCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *OrganizationsApprovalRequestsApproveCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) var body io.Reader = nil body, err := googleapi.WithoutDataWrapper.JSONReader(c.approveapprovalrequestmessage) if err != nil { return nil, err } reqHeaders.Set("Content-Type", "application/json") c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:approve") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.organizations.approvalRequests.approve" call. // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx // status code is an error. Response headers are in either // *ApprovalRequest.ServerResponse.Header or (if a response was returned // at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *OrganizationsApprovalRequestsApproveCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &ApprovalRequest{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "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.", // "flatPath": "v1beta1/organizations/{organizationsId}/approvalRequests/{approvalRequestsId}:approve", // "httpMethod": "POST", // "id": "accessapproval.organizations.approvalRequests.approve", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the approval request to approve.", // "location": "path", // "pattern": "^organizations/[^/]+/approvalRequests/[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}:approve", // "request": { // "$ref": "ApproveApprovalRequestMessage" // }, // "response": { // "$ref": "ApprovalRequest" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.organizations.approvalRequests.dismiss": type OrganizationsApprovalRequestsDismissCall struct { s *Service name string dismissapprovalrequestmessage *DismissApprovalRequestMessage urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Dismiss: Dismisses a request. Returns the updated // ApprovalRequest. // // NOTE: This does not deny access to the resource if another request // has been // made and approved. It is equivalent in effect to ignoring the // request // altogether. // // Returns NOT_FOUND if the request does not exist. // // Returns FAILED_PRECONDITION if the request exists but is not in a // pending // state. func (r *OrganizationsApprovalRequestsService) Dismiss(name string, dismissapprovalrequestmessage *DismissApprovalRequestMessage) *OrganizationsApprovalRequestsDismissCall { c := &OrganizationsApprovalRequestsDismissCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.dismissapprovalrequestmessage = dismissapprovalrequestmessage return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *OrganizationsApprovalRequestsDismissCall) Fields(s ...googleapi.Field) *OrganizationsApprovalRequestsDismissCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *OrganizationsApprovalRequestsDismissCall) Context(ctx context.Context) *OrganizationsApprovalRequestsDismissCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *OrganizationsApprovalRequestsDismissCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *OrganizationsApprovalRequestsDismissCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) var body io.Reader = nil body, err := googleapi.WithoutDataWrapper.JSONReader(c.dismissapprovalrequestmessage) if err != nil { return nil, err } reqHeaders.Set("Content-Type", "application/json") c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:dismiss") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.organizations.approvalRequests.dismiss" call. // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx // status code is an error. Response headers are in either // *ApprovalRequest.ServerResponse.Header or (if a response was returned // at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *OrganizationsApprovalRequestsDismissCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &ApprovalRequest{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "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.", // "flatPath": "v1beta1/organizations/{organizationsId}/approvalRequests/{approvalRequestsId}:dismiss", // "httpMethod": "POST", // "id": "accessapproval.organizations.approvalRequests.dismiss", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the ApprovalRequest to dismiss.", // "location": "path", // "pattern": "^organizations/[^/]+/approvalRequests/[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}:dismiss", // "request": { // "$ref": "DismissApprovalRequestMessage" // }, // "response": { // "$ref": "ApprovalRequest" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.organizations.approvalRequests.get": type OrganizationsApprovalRequestsGetCall struct { s *Service name string urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // Get: Gets an approval request. Returns NOT_FOUND if the request does // not exist. func (r *OrganizationsApprovalRequestsService) Get(name string) *OrganizationsApprovalRequestsGetCall { c := &OrganizationsApprovalRequestsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *OrganizationsApprovalRequestsGetCall) Fields(s ...googleapi.Field) *OrganizationsApprovalRequestsGetCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets the optional parameter which makes the operation // fail if the object's ETag matches the given value. This is useful for // getting updates only after the object has changed since the last // request. Use googleapi.IsNotModified to check whether the response // error from Do is the result of In-None-Match. func (c *OrganizationsApprovalRequestsGetCall) IfNoneMatch(entityTag string) *OrganizationsApprovalRequestsGetCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *OrganizationsApprovalRequestsGetCall) Context(ctx context.Context) *OrganizationsApprovalRequestsGetCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *OrganizationsApprovalRequestsGetCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *OrganizationsApprovalRequestsGetCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("GET", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.organizations.approvalRequests.get" call. // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx // status code is an error. Response headers are in either // *ApprovalRequest.ServerResponse.Header or (if a response was returned // at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *OrganizationsApprovalRequestsGetCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &ApprovalRequest{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "description": "Gets an approval request. Returns NOT_FOUND if the request does not exist.", // "flatPath": "v1beta1/organizations/{organizationsId}/approvalRequests/{approvalRequestsId}", // "httpMethod": "GET", // "id": "accessapproval.organizations.approvalRequests.get", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the approval request to retrieve.", // "location": "path", // "pattern": "^organizations/[^/]+/approvalRequests/[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}", // "response": { // "$ref": "ApprovalRequest" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.organizations.approvalRequests.list": type OrganizationsApprovalRequestsListCall struct { s *Service parent string urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // List: Lists approval requests associated with a project, folder, or // organization. // Approval requests can be filtered by state (pending, active, // dismissed). // The order is reverse chronological. func (r *OrganizationsApprovalRequestsService) List(parent string) *OrganizationsApprovalRequestsListCall { c := &OrganizationsApprovalRequestsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.parent = parent return c } // Filter sets the optional parameter "filter": A filter on the type of // approval requests to retrieve. Must be one of the // following values: //
            //
          1. [not set]: Requests that are pending or have active // approvals.
          2. //
          3. ALL: All requests.
          4. //
          5. PENDING: Only pending requests.
          6. //
          7. ACTIVE: Only active (i.e. currently approved) requests.
          8. //
          9. DISMISSED: Only dismissed (including expired) // requests.
          10. //
          func (c *OrganizationsApprovalRequestsListCall) Filter(filter string) *OrganizationsApprovalRequestsListCall { c.urlParams_.Set("filter", filter) return c } // PageSize sets the optional parameter "pageSize": Requested page size. func (c *OrganizationsApprovalRequestsListCall) PageSize(pageSize int64) *OrganizationsApprovalRequestsListCall { c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) return c } // PageToken sets the optional parameter "pageToken": A token // identifying the page of results to return. func (c *OrganizationsApprovalRequestsListCall) PageToken(pageToken string) *OrganizationsApprovalRequestsListCall { c.urlParams_.Set("pageToken", pageToken) return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *OrganizationsApprovalRequestsListCall) Fields(s ...googleapi.Field) *OrganizationsApprovalRequestsListCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets the optional parameter which makes the operation // fail if the object's ETag matches the given value. This is useful for // getting updates only after the object has changed since the last // request. Use googleapi.IsNotModified to check whether the response // error from Do is the result of In-None-Match. func (c *OrganizationsApprovalRequestsListCall) IfNoneMatch(entityTag string) *OrganizationsApprovalRequestsListCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *OrganizationsApprovalRequestsListCall) Context(ctx context.Context) *OrganizationsApprovalRequestsListCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *OrganizationsApprovalRequestsListCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *OrganizationsApprovalRequestsListCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/approvalRequests") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("GET", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "parent": c.parent, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.organizations.approvalRequests.list" call. // Exactly one of *ListApprovalRequestsResponse or error will be // non-nil. Any non-2xx status code is an error. Response headers are in // either *ListApprovalRequestsResponse.ServerResponse.Header or (if a // response was returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *OrganizationsApprovalRequestsListCall) Do(opts ...googleapi.CallOption) (*ListApprovalRequestsResponse, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &ListApprovalRequestsResponse{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "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.", // "flatPath": "v1beta1/organizations/{organizationsId}/approvalRequests", // "httpMethod": "GET", // "id": "accessapproval.organizations.approvalRequests.list", // "parameterOrder": [ // "parent" // ], // "parameters": { // "filter": { // "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\u003c/ol\u003e", // "location": "query", // "type": "string" // }, // "pageSize": { // "description": "Requested page size.", // "format": "int32", // "location": "query", // "type": "integer" // }, // "pageToken": { // "description": "A token identifying the page of results to return.", // "location": "query", // "type": "string" // }, // "parent": { // "description": "The parent resource. This may be \"projects/{project_id}\",\n\"folders/{folder_id}\", or \"organizations/{organization_id}\".", // "location": "path", // "pattern": "^organizations/[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+parent}/approvalRequests", // "response": { // "$ref": "ListApprovalRequestsResponse" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // Pages invokes f for each page of results. // A non-nil error returned from f will halt the iteration. // The provided context supersedes any context provided to the Context method. func (c *OrganizationsApprovalRequestsListCall) Pages(ctx context.Context, f func(*ListApprovalRequestsResponse) error) error { c.ctx_ = ctx defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point for { x, err := c.Do() if err != nil { return err } if err := f(x); err != nil { return err } if x.NextPageToken == "" { return nil } c.PageToken(x.NextPageToken) } } // method id "accessapproval.projects.deleteAccessApprovalSettings": type ProjectsDeleteAccessApprovalSettingsCall struct { s *Service name string urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // DeleteAccessApprovalSettings: Deletes the settings associated with a // project, folder, or organization. // This will have the effect of disabling Access Approval for the // project, // folder, or organization, but only if all ancestors also have // Access // Approval disabled. If Access Approval is enabled at a higher level of // the // hierarchy, then Access Approval will still be enabled at this level // as // the settings are inherited. func (r *ProjectsService) DeleteAccessApprovalSettings(name string) *ProjectsDeleteAccessApprovalSettingsCall { c := &ProjectsDeleteAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *ProjectsDeleteAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *ProjectsDeleteAccessApprovalSettingsCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *ProjectsDeleteAccessApprovalSettingsCall) Context(ctx context.Context) *ProjectsDeleteAccessApprovalSettingsCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *ProjectsDeleteAccessApprovalSettingsCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *ProjectsDeleteAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("DELETE", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.projects.deleteAccessApprovalSettings" call. // Exactly one of *Empty or error will be non-nil. Any non-2xx status // code is an error. Response headers are in either // *Empty.ServerResponse.Header or (if a response was returned at all) // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to // check whether the returned error was because http.StatusNotModified // was returned. func (c *ProjectsDeleteAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*Empty, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &Empty{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "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.", // "flatPath": "v1beta1/projects/{projectsId}/accessApprovalSettings", // "httpMethod": "DELETE", // "id": "accessapproval.projects.deleteAccessApprovalSettings", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the AccessApprovalSettings to delete.", // "location": "path", // "pattern": "^projects/[^/]+/accessApprovalSettings$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}", // "response": { // "$ref": "Empty" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.projects.getAccessApprovalSettings": type ProjectsGetAccessApprovalSettingsCall struct { s *Service name string urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // GetAccessApprovalSettings: Gets the settings associated with a // project, folder, or organization. func (r *ProjectsService) GetAccessApprovalSettings(name string) *ProjectsGetAccessApprovalSettingsCall { c := &ProjectsGetAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *ProjectsGetAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *ProjectsGetAccessApprovalSettingsCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets the optional parameter which makes the operation // fail if the object's ETag matches the given value. This is useful for // getting updates only after the object has changed since the last // request. Use googleapi.IsNotModified to check whether the response // error from Do is the result of In-None-Match. func (c *ProjectsGetAccessApprovalSettingsCall) IfNoneMatch(entityTag string) *ProjectsGetAccessApprovalSettingsCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *ProjectsGetAccessApprovalSettingsCall) Context(ctx context.Context) *ProjectsGetAccessApprovalSettingsCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *ProjectsGetAccessApprovalSettingsCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *ProjectsGetAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("GET", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.projects.getAccessApprovalSettings" call. // Exactly one of *AccessApprovalSettings or error will be non-nil. Any // non-2xx status code is an error. Response headers are in either // *AccessApprovalSettings.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *ProjectsGetAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*AccessApprovalSettings, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &AccessApprovalSettings{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "description": "Gets the settings associated with a project, folder, or organization.", // "flatPath": "v1beta1/projects/{projectsId}/accessApprovalSettings", // "httpMethod": "GET", // "id": "accessapproval.projects.getAccessApprovalSettings", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the AccessApprovalSettings to retrieve.", // "location": "path", // "pattern": "^projects/[^/]+/accessApprovalSettings$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}", // "response": { // "$ref": "AccessApprovalSettings" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.projects.updateAccessApprovalSettings": type ProjectsUpdateAccessApprovalSettingsCall struct { s *Service name string accessapprovalsettings *AccessApprovalSettings urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // UpdateAccessApprovalSettings: Updates the settings associated with a // project, folder, or organization. // Settings to update are determined by the value of field_mask. func (r *ProjectsService) UpdateAccessApprovalSettings(name string, accessapprovalsettings *AccessApprovalSettings) *ProjectsUpdateAccessApprovalSettingsCall { c := &ProjectsUpdateAccessApprovalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.accessapprovalsettings = accessapprovalsettings return c } // UpdateMask sets the optional parameter "updateMask": For the // `FieldMask` definition, // see // https://developers.google.com/protocol-buffers/docs/reference/goog // le.protobuf#fieldmask // If this field is left unset, only the notification_emails field will // be // updated. func (c *ProjectsUpdateAccessApprovalSettingsCall) UpdateMask(updateMask string) *ProjectsUpdateAccessApprovalSettingsCall { c.urlParams_.Set("updateMask", updateMask) return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *ProjectsUpdateAccessApprovalSettingsCall) Fields(s ...googleapi.Field) *ProjectsUpdateAccessApprovalSettingsCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *ProjectsUpdateAccessApprovalSettingsCall) Context(ctx context.Context) *ProjectsUpdateAccessApprovalSettingsCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *ProjectsUpdateAccessApprovalSettingsCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *ProjectsUpdateAccessApprovalSettingsCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) var body io.Reader = nil body, err := googleapi.WithoutDataWrapper.JSONReader(c.accessapprovalsettings) if err != nil { return nil, err } reqHeaders.Set("Content-Type", "application/json") c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("PATCH", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.projects.updateAccessApprovalSettings" call. // Exactly one of *AccessApprovalSettings or error will be non-nil. Any // non-2xx status code is an error. Response headers are in either // *AccessApprovalSettings.ServerResponse.Header or (if a response was // returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *ProjectsUpdateAccessApprovalSettingsCall) Do(opts ...googleapi.CallOption) (*AccessApprovalSettings, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &AccessApprovalSettings{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "description": "Updates the settings associated with a project, folder, or organization.\nSettings to update are determined by the value of field_mask.", // "flatPath": "v1beta1/projects/{projectsId}/accessApprovalSettings", // "httpMethod": "PATCH", // "id": "accessapproval.projects.updateAccessApprovalSettings", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "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", // "location": "path", // "pattern": "^projects/[^/]+/accessApprovalSettings$", // "required": true, // "type": "string" // }, // "updateMask": { // "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.", // "format": "google-fieldmask", // "location": "query", // "type": "string" // } // }, // "path": "v1beta1/{+name}", // "request": { // "$ref": "AccessApprovalSettings" // }, // "response": { // "$ref": "AccessApprovalSettings" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.projects.approvalRequests.approve": type ProjectsApprovalRequestsApproveCall struct { s *Service name string approveapprovalrequestmessage *ApproveApprovalRequestMessage urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Approve: Approves a request and returns the updated // ApprovalRequest. // // Returns NOT_FOUND if the request does not exist. // Returns // FAILED_PRECONDITION if the request exists but is not in a pending // state. func (r *ProjectsApprovalRequestsService) Approve(name string, approveapprovalrequestmessage *ApproveApprovalRequestMessage) *ProjectsApprovalRequestsApproveCall { c := &ProjectsApprovalRequestsApproveCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.approveapprovalrequestmessage = approveapprovalrequestmessage return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *ProjectsApprovalRequestsApproveCall) Fields(s ...googleapi.Field) *ProjectsApprovalRequestsApproveCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *ProjectsApprovalRequestsApproveCall) Context(ctx context.Context) *ProjectsApprovalRequestsApproveCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *ProjectsApprovalRequestsApproveCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *ProjectsApprovalRequestsApproveCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) var body io.Reader = nil body, err := googleapi.WithoutDataWrapper.JSONReader(c.approveapprovalrequestmessage) if err != nil { return nil, err } reqHeaders.Set("Content-Type", "application/json") c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:approve") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.projects.approvalRequests.approve" call. // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx // status code is an error. Response headers are in either // *ApprovalRequest.ServerResponse.Header or (if a response was returned // at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *ProjectsApprovalRequestsApproveCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &ApprovalRequest{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "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.", // "flatPath": "v1beta1/projects/{projectsId}/approvalRequests/{approvalRequestsId}:approve", // "httpMethod": "POST", // "id": "accessapproval.projects.approvalRequests.approve", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the approval request to approve.", // "location": "path", // "pattern": "^projects/[^/]+/approvalRequests/[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}:approve", // "request": { // "$ref": "ApproveApprovalRequestMessage" // }, // "response": { // "$ref": "ApprovalRequest" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.projects.approvalRequests.dismiss": type ProjectsApprovalRequestsDismissCall struct { s *Service name string dismissapprovalrequestmessage *DismissApprovalRequestMessage urlParams_ gensupport.URLParams ctx_ context.Context header_ http.Header } // Dismiss: Dismisses a request. Returns the updated // ApprovalRequest. // // NOTE: This does not deny access to the resource if another request // has been // made and approved. It is equivalent in effect to ignoring the // request // altogether. // // Returns NOT_FOUND if the request does not exist. // // Returns FAILED_PRECONDITION if the request exists but is not in a // pending // state. func (r *ProjectsApprovalRequestsService) Dismiss(name string, dismissapprovalrequestmessage *DismissApprovalRequestMessage) *ProjectsApprovalRequestsDismissCall { c := &ProjectsApprovalRequestsDismissCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name c.dismissapprovalrequestmessage = dismissapprovalrequestmessage return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *ProjectsApprovalRequestsDismissCall) Fields(s ...googleapi.Field) *ProjectsApprovalRequestsDismissCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *ProjectsApprovalRequestsDismissCall) Context(ctx context.Context) *ProjectsApprovalRequestsDismissCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *ProjectsApprovalRequestsDismissCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *ProjectsApprovalRequestsDismissCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) var body io.Reader = nil body, err := googleapi.WithoutDataWrapper.JSONReader(c.dismissapprovalrequestmessage) if err != nil { return nil, err } reqHeaders.Set("Content-Type", "application/json") c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:dismiss") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("POST", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.projects.approvalRequests.dismiss" call. // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx // status code is an error. Response headers are in either // *ApprovalRequest.ServerResponse.Header or (if a response was returned // at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *ProjectsApprovalRequestsDismissCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &ApprovalRequest{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "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.", // "flatPath": "v1beta1/projects/{projectsId}/approvalRequests/{approvalRequestsId}:dismiss", // "httpMethod": "POST", // "id": "accessapproval.projects.approvalRequests.dismiss", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the ApprovalRequest to dismiss.", // "location": "path", // "pattern": "^projects/[^/]+/approvalRequests/[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}:dismiss", // "request": { // "$ref": "DismissApprovalRequestMessage" // }, // "response": { // "$ref": "ApprovalRequest" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.projects.approvalRequests.get": type ProjectsApprovalRequestsGetCall struct { s *Service name string urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // Get: Gets an approval request. Returns NOT_FOUND if the request does // not exist. func (r *ProjectsApprovalRequestsService) Get(name string) *ProjectsApprovalRequestsGetCall { c := &ProjectsApprovalRequestsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.name = name return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *ProjectsApprovalRequestsGetCall) Fields(s ...googleapi.Field) *ProjectsApprovalRequestsGetCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets the optional parameter which makes the operation // fail if the object's ETag matches the given value. This is useful for // getting updates only after the object has changed since the last // request. Use googleapi.IsNotModified to check whether the response // error from Do is the result of In-None-Match. func (c *ProjectsApprovalRequestsGetCall) IfNoneMatch(entityTag string) *ProjectsApprovalRequestsGetCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *ProjectsApprovalRequestsGetCall) Context(ctx context.Context) *ProjectsApprovalRequestsGetCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *ProjectsApprovalRequestsGetCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *ProjectsApprovalRequestsGetCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("GET", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "name": c.name, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.projects.approvalRequests.get" call. // Exactly one of *ApprovalRequest or error will be non-nil. Any non-2xx // status code is an error. Response headers are in either // *ApprovalRequest.ServerResponse.Header or (if a response was returned // at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *ProjectsApprovalRequestsGetCall) Do(opts ...googleapi.CallOption) (*ApprovalRequest, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &ApprovalRequest{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "description": "Gets an approval request. Returns NOT_FOUND if the request does not exist.", // "flatPath": "v1beta1/projects/{projectsId}/approvalRequests/{approvalRequestsId}", // "httpMethod": "GET", // "id": "accessapproval.projects.approvalRequests.get", // "parameterOrder": [ // "name" // ], // "parameters": { // "name": { // "description": "Name of the approval request to retrieve.", // "location": "path", // "pattern": "^projects/[^/]+/approvalRequests/[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+name}", // "response": { // "$ref": "ApprovalRequest" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // method id "accessapproval.projects.approvalRequests.list": type ProjectsApprovalRequestsListCall struct { s *Service parent string urlParams_ gensupport.URLParams ifNoneMatch_ string ctx_ context.Context header_ http.Header } // List: Lists approval requests associated with a project, folder, or // organization. // Approval requests can be filtered by state (pending, active, // dismissed). // The order is reverse chronological. func (r *ProjectsApprovalRequestsService) List(parent string) *ProjectsApprovalRequestsListCall { c := &ProjectsApprovalRequestsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} c.parent = parent return c } // Filter sets the optional parameter "filter": A filter on the type of // approval requests to retrieve. Must be one of the // following values: //
            //
          1. [not set]: Requests that are pending or have active // approvals.
          2. //
          3. ALL: All requests.
          4. //
          5. PENDING: Only pending requests.
          6. //
          7. ACTIVE: Only active (i.e. currently approved) requests.
          8. //
          9. DISMISSED: Only dismissed (including expired) // requests.
          10. //
          func (c *ProjectsApprovalRequestsListCall) Filter(filter string) *ProjectsApprovalRequestsListCall { c.urlParams_.Set("filter", filter) return c } // PageSize sets the optional parameter "pageSize": Requested page size. func (c *ProjectsApprovalRequestsListCall) PageSize(pageSize int64) *ProjectsApprovalRequestsListCall { c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) return c } // PageToken sets the optional parameter "pageToken": A token // identifying the page of results to return. func (c *ProjectsApprovalRequestsListCall) PageToken(pageToken string) *ProjectsApprovalRequestsListCall { c.urlParams_.Set("pageToken", pageToken) return c } // Fields allows partial responses to be retrieved. See // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse // for more information. func (c *ProjectsApprovalRequestsListCall) Fields(s ...googleapi.Field) *ProjectsApprovalRequestsListCall { c.urlParams_.Set("fields", googleapi.CombineFields(s)) return c } // IfNoneMatch sets the optional parameter which makes the operation // fail if the object's ETag matches the given value. This is useful for // getting updates only after the object has changed since the last // request. Use googleapi.IsNotModified to check whether the response // error from Do is the result of In-None-Match. func (c *ProjectsApprovalRequestsListCall) IfNoneMatch(entityTag string) *ProjectsApprovalRequestsListCall { c.ifNoneMatch_ = entityTag return c } // Context sets the context to be used in this call's Do method. Any // pending HTTP request will be aborted if the provided context is // canceled. func (c *ProjectsApprovalRequestsListCall) Context(ctx context.Context) *ProjectsApprovalRequestsListCall { c.ctx_ = ctx return c } // Header returns an http.Header that can be modified by the caller to // add HTTP headers to the request. func (c *ProjectsApprovalRequestsListCall) Header() http.Header { if c.header_ == nil { c.header_ = make(http.Header) } return c.header_ } func (c *ProjectsApprovalRequestsListCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200518") for k, v := range c.header_ { reqHeaders[k] = v } reqHeaders.Set("User-Agent", c.s.userAgent()) if c.ifNoneMatch_ != "" { reqHeaders.Set("If-None-Match", c.ifNoneMatch_) } var body io.Reader = nil c.urlParams_.Set("alt", alt) c.urlParams_.Set("prettyPrint", "false") urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/approvalRequests") urls += "?" + c.urlParams_.Encode() req, err := http.NewRequest("GET", urls, body) if err != nil { return nil, err } req.Header = reqHeaders googleapi.Expand(req.URL, map[string]string{ "parent": c.parent, }) return gensupport.SendRequest(c.ctx_, c.s.client, req) } // Do executes the "accessapproval.projects.approvalRequests.list" call. // Exactly one of *ListApprovalRequestsResponse or error will be // non-nil. Any non-2xx status code is an error. Response headers are in // either *ListApprovalRequestsResponse.ServerResponse.Header or (if a // response was returned at all) in error.(*googleapi.Error).Header. Use // googleapi.IsNotModified to check whether the returned error was // because http.StatusNotModified was returned. func (c *ProjectsApprovalRequestsListCall) Do(opts ...googleapi.CallOption) (*ListApprovalRequestsResponse, error) { gensupport.SetOptions(c.urlParams_, opts...) res, err := c.doRequest("json") if res != nil && res.StatusCode == http.StatusNotModified { if res.Body != nil { res.Body.Close() } return nil, &googleapi.Error{ Code: res.StatusCode, Header: res.Header, } } if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } ret := &ListApprovalRequestsResponse{ ServerResponse: googleapi.ServerResponse{ Header: res.Header, HTTPStatusCode: res.StatusCode, }, } target := &ret if err := gensupport.DecodeResponse(target, res); err != nil { return nil, err } return ret, nil // { // "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.", // "flatPath": "v1beta1/projects/{projectsId}/approvalRequests", // "httpMethod": "GET", // "id": "accessapproval.projects.approvalRequests.list", // "parameterOrder": [ // "parent" // ], // "parameters": { // "filter": { // "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\u003c/ol\u003e", // "location": "query", // "type": "string" // }, // "pageSize": { // "description": "Requested page size.", // "format": "int32", // "location": "query", // "type": "integer" // }, // "pageToken": { // "description": "A token identifying the page of results to return.", // "location": "query", // "type": "string" // }, // "parent": { // "description": "The parent resource. This may be \"projects/{project_id}\",\n\"folders/{folder_id}\", or \"organizations/{organization_id}\".", // "location": "path", // "pattern": "^projects/[^/]+$", // "required": true, // "type": "string" // } // }, // "path": "v1beta1/{+parent}/approvalRequests", // "response": { // "$ref": "ListApprovalRequestsResponse" // }, // "scopes": [ // "https://www.googleapis.com/auth/cloud-platform" // ] // } } // Pages invokes f for each page of results. // A non-nil error returned from f will halt the iteration. // The provided context supersedes any context provided to the Context method. func (c *ProjectsApprovalRequestsListCall) Pages(ctx context.Context, f func(*ListApprovalRequestsResponse) error) error { c.ctx_ = ctx defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point for { x, err := c.Do() if err != nil { return err } if err := f(x); err != nil { return err } if x.NextPageToken == "" { return nil } c.PageToken(x.NextPageToken) } }