You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2706 lines
88 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package cloudidentity provides access to the Cloud Identity API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/identity/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/cloudidentity/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // cloudidentityService, err := cloudidentity.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // cloudidentityService, err := cloudidentity.NewService(ctx, option.WithScopes(cloudidentity.CloudIdentityGroupsReadonlyScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // cloudidentityService, err := cloudidentity.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // cloudidentityService, err := cloudidentity.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package cloudidentity // import "google.golang.org/api/cloudidentity/v1"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "cloudidentity:v1"
  71. const apiName = "cloudidentity"
  72. const apiVersion = "v1"
  73. const basePath = "https://cloudidentity.googleapis.com/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // See, change, create, and delete any of the Cloud Identity Groups that
  77. // you can access, including the members of each group
  78. CloudIdentityGroupsScope = "https://www.googleapis.com/auth/cloud-identity.groups"
  79. // See any Cloud Identity Groups that you can access, including group
  80. // members and their emails
  81. CloudIdentityGroupsReadonlyScope = "https://www.googleapis.com/auth/cloud-identity.groups.readonly"
  82. )
  83. // NewService creates a new Service.
  84. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  85. scopesOption := option.WithScopes(
  86. "https://www.googleapis.com/auth/cloud-identity.groups",
  87. "https://www.googleapis.com/auth/cloud-identity.groups.readonly",
  88. )
  89. // NOTE: prepend, so we don't override user-specified scopes.
  90. opts = append([]option.ClientOption{scopesOption}, opts...)
  91. client, endpoint, err := htransport.NewClient(ctx, opts...)
  92. if err != nil {
  93. return nil, err
  94. }
  95. s, err := New(client)
  96. if err != nil {
  97. return nil, err
  98. }
  99. if endpoint != "" {
  100. s.BasePath = endpoint
  101. }
  102. return s, nil
  103. }
  104. // New creates a new Service. It uses the provided http.Client for requests.
  105. //
  106. // Deprecated: please use NewService instead.
  107. // To provide a custom HTTP client, use option.WithHTTPClient.
  108. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  109. func New(client *http.Client) (*Service, error) {
  110. if client == nil {
  111. return nil, errors.New("client is nil")
  112. }
  113. s := &Service{client: client, BasePath: basePath}
  114. s.Groups = NewGroupsService(s)
  115. return s, nil
  116. }
  117. type Service struct {
  118. client *http.Client
  119. BasePath string // API endpoint base URL
  120. UserAgent string // optional additional User-Agent fragment
  121. Groups *GroupsService
  122. }
  123. func (s *Service) userAgent() string {
  124. if s.UserAgent == "" {
  125. return googleapi.UserAgent
  126. }
  127. return googleapi.UserAgent + " " + s.UserAgent
  128. }
  129. func NewGroupsService(s *Service) *GroupsService {
  130. rs := &GroupsService{s: s}
  131. rs.Memberships = NewGroupsMembershipsService(s)
  132. return rs
  133. }
  134. type GroupsService struct {
  135. s *Service
  136. Memberships *GroupsMembershipsService
  137. }
  138. func NewGroupsMembershipsService(s *Service) *GroupsMembershipsService {
  139. rs := &GroupsMembershipsService{s: s}
  140. return rs
  141. }
  142. type GroupsMembershipsService struct {
  143. s *Service
  144. }
  145. // EntityKey: An EntityKey uniquely identifies an Entity. Namespaces are
  146. // used to provide
  147. // isolation for IDs. A single ID can be reused across namespaces but
  148. // the
  149. // combination of a namespace and an ID must be unique.
  150. type EntityKey struct {
  151. // Id: The ID of the entity within the given namespace. The ID must be
  152. // unique
  153. // within its namespace.
  154. Id string `json:"id,omitempty"`
  155. // Namespace: Namespaces provide isolation for IDs, so an ID only needs
  156. // to be unique
  157. // within its namespace.
  158. //
  159. // Namespaces are currently only created as part of IdentitySource
  160. // creation
  161. // from Admin Console. A namespace
  162. // "identitysources/{identity_source_id}" is
  163. // created corresponding to every Identity Source `identity_source_id`.
  164. Namespace string `json:"namespace,omitempty"`
  165. // ForceSendFields is a list of field names (e.g. "Id") to
  166. // unconditionally include in API requests. By default, fields with
  167. // empty values are omitted from API requests. However, any non-pointer,
  168. // non-interface field appearing in ForceSendFields will be sent to the
  169. // server regardless of whether the field is empty or not. This may be
  170. // used to include empty fields in Patch requests.
  171. ForceSendFields []string `json:"-"`
  172. // NullFields is a list of field names (e.g. "Id") to include in API
  173. // requests with the JSON null value. By default, fields with empty
  174. // values are omitted from API requests. However, any field with an
  175. // empty value appearing in NullFields will be sent to the server as
  176. // null. It is an error if a field in this list has a non-empty value.
  177. // This may be used to include null fields in Patch requests.
  178. NullFields []string `json:"-"`
  179. }
  180. func (s *EntityKey) MarshalJSON() ([]byte, error) {
  181. type NoMethod EntityKey
  182. raw := NoMethod(*s)
  183. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  184. }
  185. // Group: Resource representing a Group.
  186. type Group struct {
  187. // CreateTime: The time when the Group was created.
  188. // Output only.
  189. CreateTime string `json:"createTime,omitempty"`
  190. // Description: An extended description to help users determine the
  191. // purpose of a Group. For
  192. // example, you can include information about who should join the Group,
  193. // the
  194. // types of messages to send to the Group, links to FAQs about the
  195. // Group, or
  196. // related Groups. Maximum length is 4,096 characters.
  197. Description string `json:"description,omitempty"`
  198. // DisplayName: The Group's display name.
  199. DisplayName string `json:"displayName,omitempty"`
  200. // GroupKey: EntityKey of the Group.
  201. //
  202. // Must be set when creating a Group, read-only afterwards.
  203. GroupKey *EntityKey `json:"groupKey,omitempty"`
  204. // Labels: `Required`. Labels for Group resource.
  205. // For creating Groups under a namespace, set label key
  206. // to
  207. // 'labels/system/groups/external' and label value as empty.
  208. Labels map[string]string `json:"labels,omitempty"`
  209. // Name: [Resource
  210. // name](https://cloud.google.com/apis/design/resource_names) of
  211. // the
  212. // Group in the format: `groups/{group_id}`, where group_id is the
  213. // unique ID
  214. // assigned to the Group.
  215. //
  216. // Must be left blank while creating a Group.
  217. Name string `json:"name,omitempty"`
  218. // Parent: The entity under which this Group resides in Cloud Identity
  219. // resource
  220. // hierarchy. Must be set when creating a Group, read-only
  221. // afterwards.
  222. //
  223. // Currently allowed types: `identitysources`.
  224. Parent string `json:"parent,omitempty"`
  225. // UpdateTime: The time when the Group was last updated.
  226. // Output only.
  227. UpdateTime string `json:"updateTime,omitempty"`
  228. // ServerResponse contains the HTTP response code and headers from the
  229. // server.
  230. googleapi.ServerResponse `json:"-"`
  231. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  232. // unconditionally include in API requests. By default, fields with
  233. // empty values are omitted from API requests. However, any non-pointer,
  234. // non-interface field appearing in ForceSendFields will be sent to the
  235. // server regardless of whether the field is empty or not. This may be
  236. // used to include empty fields in Patch requests.
  237. ForceSendFields []string `json:"-"`
  238. // NullFields is a list of field names (e.g. "CreateTime") to include in
  239. // API requests with the JSON null value. By default, fields with empty
  240. // values are omitted from API requests. However, any field with an
  241. // empty value appearing in NullFields will be sent to the server as
  242. // null. It is an error if a field in this list has a non-empty value.
  243. // This may be used to include null fields in Patch requests.
  244. NullFields []string `json:"-"`
  245. }
  246. func (s *Group) MarshalJSON() ([]byte, error) {
  247. type NoMethod Group
  248. raw := NoMethod(*s)
  249. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  250. }
  251. // ListGroupsResponse: Response message for ListGroups operation.
  252. type ListGroupsResponse struct {
  253. // Groups: Groups returned in response to list request.
  254. // The results are not sorted.
  255. Groups []*Group `json:"groups,omitempty"`
  256. // NextPageToken: Token to retrieve the next page of results, or empty
  257. // if there are no
  258. // more results available for listing.
  259. NextPageToken string `json:"nextPageToken,omitempty"`
  260. // ServerResponse contains the HTTP response code and headers from the
  261. // server.
  262. googleapi.ServerResponse `json:"-"`
  263. // ForceSendFields is a list of field names (e.g. "Groups") to
  264. // unconditionally include in API requests. By default, fields with
  265. // empty values are omitted from API requests. However, any non-pointer,
  266. // non-interface field appearing in ForceSendFields will be sent to the
  267. // server regardless of whether the field is empty or not. This may be
  268. // used to include empty fields in Patch requests.
  269. ForceSendFields []string `json:"-"`
  270. // NullFields is a list of field names (e.g. "Groups") to include in API
  271. // requests with the JSON null value. By default, fields with empty
  272. // values are omitted from API requests. However, any field with an
  273. // empty value appearing in NullFields will be sent to the server as
  274. // null. It is an error if a field in this list has a non-empty value.
  275. // This may be used to include null fields in Patch requests.
  276. NullFields []string `json:"-"`
  277. }
  278. func (s *ListGroupsResponse) MarshalJSON() ([]byte, error) {
  279. type NoMethod ListGroupsResponse
  280. raw := NoMethod(*s)
  281. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  282. }
  283. type ListMembershipsResponse struct {
  284. // Memberships: List of Memberships.
  285. Memberships []*Membership `json:"memberships,omitempty"`
  286. // NextPageToken: Token to retrieve the next page of results, or empty
  287. // if there are no
  288. // more results available for listing.
  289. NextPageToken string `json:"nextPageToken,omitempty"`
  290. // ServerResponse contains the HTTP response code and headers from the
  291. // server.
  292. googleapi.ServerResponse `json:"-"`
  293. // ForceSendFields is a list of field names (e.g. "Memberships") to
  294. // unconditionally include in API requests. By default, fields with
  295. // empty values are omitted from API requests. However, any non-pointer,
  296. // non-interface field appearing in ForceSendFields will be sent to the
  297. // server regardless of whether the field is empty or not. This may be
  298. // used to include empty fields in Patch requests.
  299. ForceSendFields []string `json:"-"`
  300. // NullFields is a list of field names (e.g. "Memberships") to include
  301. // in API requests with the JSON null value. By default, fields with
  302. // empty values are omitted from API requests. However, any field with
  303. // an empty value appearing in NullFields will be sent to the server as
  304. // null. It is an error if a field in this list has a non-empty value.
  305. // This may be used to include null fields in Patch requests.
  306. NullFields []string `json:"-"`
  307. }
  308. func (s *ListMembershipsResponse) MarshalJSON() ([]byte, error) {
  309. type NoMethod ListMembershipsResponse
  310. raw := NoMethod(*s)
  311. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  312. }
  313. type LookupGroupNameResponse struct {
  314. // Name: [Resource
  315. // name](https://cloud.google.com/apis/design/resource_names) of
  316. // the
  317. // Group in the format: `groups/{group_id}`, where `group_id` is the
  318. // unique ID
  319. // assigned to the Group.
  320. Name string `json:"name,omitempty"`
  321. // ServerResponse contains the HTTP response code and headers from the
  322. // server.
  323. googleapi.ServerResponse `json:"-"`
  324. // ForceSendFields is a list of field names (e.g. "Name") to
  325. // unconditionally include in API requests. By default, fields with
  326. // empty values are omitted from API requests. However, any non-pointer,
  327. // non-interface field appearing in ForceSendFields will be sent to the
  328. // server regardless of whether the field is empty or not. This may be
  329. // used to include empty fields in Patch requests.
  330. ForceSendFields []string `json:"-"`
  331. // NullFields is a list of field names (e.g. "Name") to include in API
  332. // requests with the JSON null value. By default, fields with empty
  333. // values are omitted from API requests. However, any field with an
  334. // empty value appearing in NullFields will be sent to the server as
  335. // null. It is an error if a field in this list has a non-empty value.
  336. // This may be used to include null fields in Patch requests.
  337. NullFields []string `json:"-"`
  338. }
  339. func (s *LookupGroupNameResponse) MarshalJSON() ([]byte, error) {
  340. type NoMethod LookupGroupNameResponse
  341. raw := NoMethod(*s)
  342. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  343. }
  344. type LookupMembershipNameResponse struct {
  345. // Name: [Resource
  346. // name](https://cloud.google.com/apis/design/resource_names) of
  347. // the
  348. // Membership being looked up.
  349. //
  350. // Format: `groups/{group_id}/memberships/{member_id}`, where `group_id`
  351. // is
  352. // the unique ID assigned to the Group to which Membership belongs to,
  353. // and
  354. // `member_id` is the unique ID assigned to the member.
  355. Name string `json:"name,omitempty"`
  356. // ServerResponse contains the HTTP response code and headers from the
  357. // server.
  358. googleapi.ServerResponse `json:"-"`
  359. // ForceSendFields is a list of field names (e.g. "Name") to
  360. // unconditionally include in API requests. By default, fields with
  361. // empty values are omitted from API requests. However, any non-pointer,
  362. // non-interface field appearing in ForceSendFields will be sent to the
  363. // server regardless of whether the field is empty or not. This may be
  364. // used to include empty fields in Patch requests.
  365. ForceSendFields []string `json:"-"`
  366. // NullFields is a list of field names (e.g. "Name") to include in API
  367. // requests with the JSON null value. By default, fields with empty
  368. // values are omitted from API requests. However, any field with an
  369. // empty value appearing in NullFields will be sent to the server as
  370. // null. It is an error if a field in this list has a non-empty value.
  371. // This may be used to include null fields in Patch requests.
  372. NullFields []string `json:"-"`
  373. }
  374. func (s *LookupMembershipNameResponse) MarshalJSON() ([]byte, error) {
  375. type NoMethod LookupMembershipNameResponse
  376. raw := NoMethod(*s)
  377. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  378. }
  379. // Membership: Resource representing a Membership within a Group
  380. type Membership struct {
  381. // CreateTime: Creation timestamp of the Membership. Output only.
  382. CreateTime string `json:"createTime,omitempty"`
  383. // Name: [Resource
  384. // name](https://cloud.google.com/apis/design/resource_names) of
  385. // the
  386. // Membership in the format:
  387. // `groups/{group_id}/memberships/{member_id}`,
  388. // where group_id is the unique ID assigned to the Group to which
  389. // Membership
  390. // belongs to, and member_id is the unique ID assigned to the
  391. // member
  392. //
  393. // Must be left blank while creating a Membership.
  394. Name string `json:"name,omitempty"`
  395. // PreferredMemberKey: EntityKey of the entity to be added as the
  396. // member. Must be set while
  397. // creating a Membership, read-only afterwards.
  398. //
  399. // Currently allowed entity types: `Users`, `Groups`.
  400. PreferredMemberKey *EntityKey `json:"preferredMemberKey,omitempty"`
  401. // Roles: Roles for a member within the Group.
  402. //
  403. // Currently supported MembershipRoles: "MEMBER".
  404. Roles []*MembershipRole `json:"roles,omitempty"`
  405. // UpdateTime: Last updated timestamp of the Membership. Output only.
  406. UpdateTime string `json:"updateTime,omitempty"`
  407. // ServerResponse contains the HTTP response code and headers from the
  408. // server.
  409. googleapi.ServerResponse `json:"-"`
  410. // ForceSendFields is a list of field names (e.g. "CreateTime") to
  411. // unconditionally include in API requests. By default, fields with
  412. // empty values are omitted from API requests. However, any non-pointer,
  413. // non-interface field appearing in ForceSendFields will be sent to the
  414. // server regardless of whether the field is empty or not. This may be
  415. // used to include empty fields in Patch requests.
  416. ForceSendFields []string `json:"-"`
  417. // NullFields is a list of field names (e.g. "CreateTime") to include in
  418. // API requests with the JSON null value. By default, fields with empty
  419. // values are omitted from API requests. However, any field with an
  420. // empty value appearing in NullFields will be sent to the server as
  421. // null. It is an error if a field in this list has a non-empty value.
  422. // This may be used to include null fields in Patch requests.
  423. NullFields []string `json:"-"`
  424. }
  425. func (s *Membership) MarshalJSON() ([]byte, error) {
  426. type NoMethod Membership
  427. raw := NoMethod(*s)
  428. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  429. }
  430. // MembershipRole: Resource representing a role within a Membership.
  431. type MembershipRole struct {
  432. // Name: MembershipRole in string format.
  433. //
  434. // Currently supported MembershipRoles: "MEMBER".
  435. Name string `json:"name,omitempty"`
  436. // ForceSendFields is a list of field names (e.g. "Name") to
  437. // unconditionally include in API requests. By default, fields with
  438. // empty values are omitted from API requests. However, any non-pointer,
  439. // non-interface field appearing in ForceSendFields will be sent to the
  440. // server regardless of whether the field is empty or not. This may be
  441. // used to include empty fields in Patch requests.
  442. ForceSendFields []string `json:"-"`
  443. // NullFields is a list of field names (e.g. "Name") to include in API
  444. // requests with the JSON null value. By default, fields with empty
  445. // values are omitted from API requests. However, any field with an
  446. // empty value appearing in NullFields will be sent to the server as
  447. // null. It is an error if a field in this list has a non-empty value.
  448. // This may be used to include null fields in Patch requests.
  449. NullFields []string `json:"-"`
  450. }
  451. func (s *MembershipRole) MarshalJSON() ([]byte, error) {
  452. type NoMethod MembershipRole
  453. raw := NoMethod(*s)
  454. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  455. }
  456. // Operation: This resource represents a long-running operation that is
  457. // the result of a
  458. // network API call.
  459. type Operation struct {
  460. // Done: If the value is `false`, it means the operation is still in
  461. // progress.
  462. // If `true`, the operation is completed, and either `error` or
  463. // `response` is
  464. // available.
  465. Done bool `json:"done,omitempty"`
  466. // Error: The error result of the operation in case of failure or
  467. // cancellation.
  468. Error *Status `json:"error,omitempty"`
  469. // Metadata: Service-specific metadata associated with the operation.
  470. // It typically
  471. // contains progress information and common metadata such as create
  472. // time.
  473. // Some services might not provide such metadata. Any method that
  474. // returns a
  475. // long-running operation should document the metadata type, if any.
  476. Metadata googleapi.RawMessage `json:"metadata,omitempty"`
  477. // Name: The server-assigned name, which is only unique within the same
  478. // service that
  479. // originally returns it. If you use the default HTTP mapping,
  480. // the
  481. // `name` should have the format of `operations/some/unique/name`.
  482. Name string `json:"name,omitempty"`
  483. // Response: The normal response of the operation in case of success.
  484. // If the original
  485. // method returns no data on success, such as `Delete`, the response
  486. // is
  487. // `google.protobuf.Empty`. If the original method is
  488. // standard
  489. // `Get`/`Create`/`Update`, the response should be the resource. For
  490. // other
  491. // methods, the response should have the type `XxxResponse`, where
  492. // `Xxx`
  493. // is the original method name. For example, if the original method
  494. // name
  495. // is `TakeSnapshot()`, the inferred response type
  496. // is
  497. // `TakeSnapshotResponse`.
  498. Response googleapi.RawMessage `json:"response,omitempty"`
  499. // ServerResponse contains the HTTP response code and headers from the
  500. // server.
  501. googleapi.ServerResponse `json:"-"`
  502. // ForceSendFields is a list of field names (e.g. "Done") to
  503. // unconditionally include in API requests. By default, fields with
  504. // empty values are omitted from API requests. However, any non-pointer,
  505. // non-interface field appearing in ForceSendFields will be sent to the
  506. // server regardless of whether the field is empty or not. This may be
  507. // used to include empty fields in Patch requests.
  508. ForceSendFields []string `json:"-"`
  509. // NullFields is a list of field names (e.g. "Done") to include in API
  510. // requests with the JSON null value. By default, fields with empty
  511. // values are omitted from API requests. However, any field with an
  512. // empty value appearing in NullFields will be sent to the server as
  513. // null. It is an error if a field in this list has a non-empty value.
  514. // This may be used to include null fields in Patch requests.
  515. NullFields []string `json:"-"`
  516. }
  517. func (s *Operation) MarshalJSON() ([]byte, error) {
  518. type NoMethod Operation
  519. raw := NoMethod(*s)
  520. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  521. }
  522. type SearchGroupsResponse struct {
  523. // Groups: List of Groups satisfying the search query.
  524. Groups []*Group `json:"groups,omitempty"`
  525. // NextPageToken: Token to retrieve the next page of results, or empty
  526. // if there are no
  527. // more results available for specified query.
  528. NextPageToken string `json:"nextPageToken,omitempty"`
  529. // ServerResponse contains the HTTP response code and headers from the
  530. // server.
  531. googleapi.ServerResponse `json:"-"`
  532. // ForceSendFields is a list of field names (e.g. "Groups") to
  533. // unconditionally include in API requests. By default, fields with
  534. // empty values are omitted from API requests. However, any non-pointer,
  535. // non-interface field appearing in ForceSendFields will be sent to the
  536. // server regardless of whether the field is empty or not. This may be
  537. // used to include empty fields in Patch requests.
  538. ForceSendFields []string `json:"-"`
  539. // NullFields is a list of field names (e.g. "Groups") to include in API
  540. // requests with the JSON null value. By default, fields with empty
  541. // values are omitted from API requests. However, any field with an
  542. // empty value appearing in NullFields will be sent to the server as
  543. // null. It is an error if a field in this list has a non-empty value.
  544. // This may be used to include null fields in Patch requests.
  545. NullFields []string `json:"-"`
  546. }
  547. func (s *SearchGroupsResponse) MarshalJSON() ([]byte, error) {
  548. type NoMethod SearchGroupsResponse
  549. raw := NoMethod(*s)
  550. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  551. }
  552. // Status: The `Status` type defines a logical error model that is
  553. // suitable for
  554. // different programming environments, including REST APIs and RPC APIs.
  555. // It is
  556. // used by [gRPC](https://github.com/grpc). The error model is designed
  557. // to be:
  558. //
  559. // - Simple to use and understand for most users
  560. // - Flexible enough to meet unexpected needs
  561. //
  562. // # Overview
  563. //
  564. // The `Status` message contains three pieces of data: error code,
  565. // error
  566. // message, and error details. The error code should be an enum value
  567. // of
  568. // google.rpc.Code, but it may accept additional error codes if needed.
  569. // The
  570. // error message should be a developer-facing English message that
  571. // helps
  572. // developers *understand* and *resolve* the error. If a localized
  573. // user-facing
  574. // error message is needed, put the localized message in the error
  575. // details or
  576. // localize it in the client. The optional error details may contain
  577. // arbitrary
  578. // information about the error. There is a predefined set of error
  579. // detail types
  580. // in the package `google.rpc` that can be used for common error
  581. // conditions.
  582. //
  583. // # Language mapping
  584. //
  585. // The `Status` message is the logical representation of the error
  586. // model, but it
  587. // is not necessarily the actual wire format. When the `Status` message
  588. // is
  589. // exposed in different client libraries and different wire protocols,
  590. // it can be
  591. // mapped differently. For example, it will likely be mapped to some
  592. // exceptions
  593. // in Java, but more likely mapped to some error codes in C.
  594. //
  595. // # Other uses
  596. //
  597. // The error model and the `Status` message can be used in a variety
  598. // of
  599. // environments, either with or without APIs, to provide a
  600. // consistent developer experience across different
  601. // environments.
  602. //
  603. // Example uses of this error model include:
  604. //
  605. // - Partial errors. If a service needs to return partial errors to the
  606. // client,
  607. // it may embed the `Status` in the normal response to indicate the
  608. // partial
  609. // errors.
  610. //
  611. // - Workflow errors. A typical workflow has multiple steps. Each step
  612. // may
  613. // have a `Status` message for error reporting.
  614. //
  615. // - Batch operations. If a client uses batch request and batch
  616. // response, the
  617. // `Status` message should be used directly inside batch response,
  618. // one for
  619. // each error sub-response.
  620. //
  621. // - Asynchronous operations. If an API call embeds asynchronous
  622. // operation
  623. // results in its response, the status of those operations should
  624. // be
  625. // represented directly using the `Status` message.
  626. //
  627. // - Logging. If some API errors are stored in logs, the message
  628. // `Status` could
  629. // be used directly after any stripping needed for security/privacy
  630. // reasons.
  631. type Status struct {
  632. // Code: The status code, which should be an enum value of
  633. // google.rpc.Code.
  634. Code int64 `json:"code,omitempty"`
  635. // Details: A list of messages that carry the error details. There is a
  636. // common set of
  637. // message types for APIs to use.
  638. Details []googleapi.RawMessage `json:"details,omitempty"`
  639. // Message: A developer-facing error message, which should be in
  640. // English. Any
  641. // user-facing error message should be localized and sent in
  642. // the
  643. // google.rpc.Status.details field, or localized by the client.
  644. Message string `json:"message,omitempty"`
  645. // ForceSendFields is a list of field names (e.g. "Code") to
  646. // unconditionally include in API requests. By default, fields with
  647. // empty values are omitted from API requests. However, any non-pointer,
  648. // non-interface field appearing in ForceSendFields will be sent to the
  649. // server regardless of whether the field is empty or not. This may be
  650. // used to include empty fields in Patch requests.
  651. ForceSendFields []string `json:"-"`
  652. // NullFields is a list of field names (e.g. "Code") to include in API
  653. // requests with the JSON null value. By default, fields with empty
  654. // values are omitted from API requests. However, any field with an
  655. // empty value appearing in NullFields will be sent to the server as
  656. // null. It is an error if a field in this list has a non-empty value.
  657. // This may be used to include null fields in Patch requests.
  658. NullFields []string `json:"-"`
  659. }
  660. func (s *Status) MarshalJSON() ([]byte, error) {
  661. type NoMethod Status
  662. raw := NoMethod(*s)
  663. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  664. }
  665. // method id "cloudidentity.groups.create":
  666. type GroupsCreateCall struct {
  667. s *Service
  668. group *Group
  669. urlParams_ gensupport.URLParams
  670. ctx_ context.Context
  671. header_ http.Header
  672. }
  673. // Create: Creates a Group.
  674. func (r *GroupsService) Create(group *Group) *GroupsCreateCall {
  675. c := &GroupsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  676. c.group = group
  677. return c
  678. }
  679. // Fields allows partial responses to be retrieved. See
  680. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  681. // for more information.
  682. func (c *GroupsCreateCall) Fields(s ...googleapi.Field) *GroupsCreateCall {
  683. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  684. return c
  685. }
  686. // Context sets the context to be used in this call's Do method. Any
  687. // pending HTTP request will be aborted if the provided context is
  688. // canceled.
  689. func (c *GroupsCreateCall) Context(ctx context.Context) *GroupsCreateCall {
  690. c.ctx_ = ctx
  691. return c
  692. }
  693. // Header returns an http.Header that can be modified by the caller to
  694. // add HTTP headers to the request.
  695. func (c *GroupsCreateCall) Header() http.Header {
  696. if c.header_ == nil {
  697. c.header_ = make(http.Header)
  698. }
  699. return c.header_
  700. }
  701. func (c *GroupsCreateCall) doRequest(alt string) (*http.Response, error) {
  702. reqHeaders := make(http.Header)
  703. for k, v := range c.header_ {
  704. reqHeaders[k] = v
  705. }
  706. reqHeaders.Set("User-Agent", c.s.userAgent())
  707. var body io.Reader = nil
  708. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  709. if err != nil {
  710. return nil, err
  711. }
  712. reqHeaders.Set("Content-Type", "application/json")
  713. c.urlParams_.Set("alt", alt)
  714. c.urlParams_.Set("prettyPrint", "false")
  715. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/groups")
  716. urls += "?" + c.urlParams_.Encode()
  717. req, err := http.NewRequest("POST", urls, body)
  718. if err != nil {
  719. return nil, err
  720. }
  721. req.Header = reqHeaders
  722. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  723. }
  724. // Do executes the "cloudidentity.groups.create" call.
  725. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  726. // status code is an error. Response headers are in either
  727. // *Operation.ServerResponse.Header or (if a response was returned at
  728. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  729. // to check whether the returned error was because
  730. // http.StatusNotModified was returned.
  731. func (c *GroupsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  732. gensupport.SetOptions(c.urlParams_, opts...)
  733. res, err := c.doRequest("json")
  734. if res != nil && res.StatusCode == http.StatusNotModified {
  735. if res.Body != nil {
  736. res.Body.Close()
  737. }
  738. return nil, &googleapi.Error{
  739. Code: res.StatusCode,
  740. Header: res.Header,
  741. }
  742. }
  743. if err != nil {
  744. return nil, err
  745. }
  746. defer googleapi.CloseBody(res)
  747. if err := googleapi.CheckResponse(res); err != nil {
  748. return nil, err
  749. }
  750. ret := &Operation{
  751. ServerResponse: googleapi.ServerResponse{
  752. Header: res.Header,
  753. HTTPStatusCode: res.StatusCode,
  754. },
  755. }
  756. target := &ret
  757. if err := gensupport.DecodeResponse(target, res); err != nil {
  758. return nil, err
  759. }
  760. return ret, nil
  761. // {
  762. // "description": "Creates a Group.",
  763. // "flatPath": "v1/groups",
  764. // "httpMethod": "POST",
  765. // "id": "cloudidentity.groups.create",
  766. // "parameterOrder": [],
  767. // "parameters": {},
  768. // "path": "v1/groups",
  769. // "request": {
  770. // "$ref": "Group"
  771. // },
  772. // "response": {
  773. // "$ref": "Operation"
  774. // },
  775. // "scopes": [
  776. // "https://www.googleapis.com/auth/cloud-identity.groups"
  777. // ]
  778. // }
  779. }
  780. // method id "cloudidentity.groups.delete":
  781. type GroupsDeleteCall struct {
  782. s *Service
  783. name string
  784. urlParams_ gensupport.URLParams
  785. ctx_ context.Context
  786. header_ http.Header
  787. }
  788. // Delete: Deletes a Group.
  789. func (r *GroupsService) Delete(name string) *GroupsDeleteCall {
  790. c := &GroupsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  791. c.name = name
  792. return c
  793. }
  794. // Fields allows partial responses to be retrieved. See
  795. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  796. // for more information.
  797. func (c *GroupsDeleteCall) Fields(s ...googleapi.Field) *GroupsDeleteCall {
  798. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  799. return c
  800. }
  801. // Context sets the context to be used in this call's Do method. Any
  802. // pending HTTP request will be aborted if the provided context is
  803. // canceled.
  804. func (c *GroupsDeleteCall) Context(ctx context.Context) *GroupsDeleteCall {
  805. c.ctx_ = ctx
  806. return c
  807. }
  808. // Header returns an http.Header that can be modified by the caller to
  809. // add HTTP headers to the request.
  810. func (c *GroupsDeleteCall) Header() http.Header {
  811. if c.header_ == nil {
  812. c.header_ = make(http.Header)
  813. }
  814. return c.header_
  815. }
  816. func (c *GroupsDeleteCall) doRequest(alt string) (*http.Response, error) {
  817. reqHeaders := make(http.Header)
  818. for k, v := range c.header_ {
  819. reqHeaders[k] = v
  820. }
  821. reqHeaders.Set("User-Agent", c.s.userAgent())
  822. var body io.Reader = nil
  823. c.urlParams_.Set("alt", alt)
  824. c.urlParams_.Set("prettyPrint", "false")
  825. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  826. urls += "?" + c.urlParams_.Encode()
  827. req, err := http.NewRequest("DELETE", urls, body)
  828. if err != nil {
  829. return nil, err
  830. }
  831. req.Header = reqHeaders
  832. googleapi.Expand(req.URL, map[string]string{
  833. "name": c.name,
  834. })
  835. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  836. }
  837. // Do executes the "cloudidentity.groups.delete" call.
  838. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  839. // status code is an error. Response headers are in either
  840. // *Operation.ServerResponse.Header or (if a response was returned at
  841. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  842. // to check whether the returned error was because
  843. // http.StatusNotModified was returned.
  844. func (c *GroupsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  845. gensupport.SetOptions(c.urlParams_, opts...)
  846. res, err := c.doRequest("json")
  847. if res != nil && res.StatusCode == http.StatusNotModified {
  848. if res.Body != nil {
  849. res.Body.Close()
  850. }
  851. return nil, &googleapi.Error{
  852. Code: res.StatusCode,
  853. Header: res.Header,
  854. }
  855. }
  856. if err != nil {
  857. return nil, err
  858. }
  859. defer googleapi.CloseBody(res)
  860. if err := googleapi.CheckResponse(res); err != nil {
  861. return nil, err
  862. }
  863. ret := &Operation{
  864. ServerResponse: googleapi.ServerResponse{
  865. Header: res.Header,
  866. HTTPStatusCode: res.StatusCode,
  867. },
  868. }
  869. target := &ret
  870. if err := gensupport.DecodeResponse(target, res); err != nil {
  871. return nil, err
  872. }
  873. return ret, nil
  874. // {
  875. // "description": "Deletes a Group.",
  876. // "flatPath": "v1/groups/{groupsId}",
  877. // "httpMethod": "DELETE",
  878. // "id": "cloudidentity.groups.delete",
  879. // "parameterOrder": [
  880. // "name"
  881. // ],
  882. // "parameters": {
  883. // "name": {
  884. // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nGroup in the format: `groups/{group_id}`, where `group_id` is the unique ID\nassigned to the Group.",
  885. // "location": "path",
  886. // "pattern": "^groups/[^/]+$",
  887. // "required": true,
  888. // "type": "string"
  889. // }
  890. // },
  891. // "path": "v1/{+name}",
  892. // "response": {
  893. // "$ref": "Operation"
  894. // },
  895. // "scopes": [
  896. // "https://www.googleapis.com/auth/cloud-identity.groups"
  897. // ]
  898. // }
  899. }
  900. // method id "cloudidentity.groups.get":
  901. type GroupsGetCall struct {
  902. s *Service
  903. name string
  904. urlParams_ gensupport.URLParams
  905. ifNoneMatch_ string
  906. ctx_ context.Context
  907. header_ http.Header
  908. }
  909. // Get: Retrieves a Group.
  910. func (r *GroupsService) Get(name string) *GroupsGetCall {
  911. c := &GroupsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  912. c.name = name
  913. return c
  914. }
  915. // Fields allows partial responses to be retrieved. See
  916. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  917. // for more information.
  918. func (c *GroupsGetCall) Fields(s ...googleapi.Field) *GroupsGetCall {
  919. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  920. return c
  921. }
  922. // IfNoneMatch sets the optional parameter which makes the operation
  923. // fail if the object's ETag matches the given value. This is useful for
  924. // getting updates only after the object has changed since the last
  925. // request. Use googleapi.IsNotModified to check whether the response
  926. // error from Do is the result of In-None-Match.
  927. func (c *GroupsGetCall) IfNoneMatch(entityTag string) *GroupsGetCall {
  928. c.ifNoneMatch_ = entityTag
  929. return c
  930. }
  931. // Context sets the context to be used in this call's Do method. Any
  932. // pending HTTP request will be aborted if the provided context is
  933. // canceled.
  934. func (c *GroupsGetCall) Context(ctx context.Context) *GroupsGetCall {
  935. c.ctx_ = ctx
  936. return c
  937. }
  938. // Header returns an http.Header that can be modified by the caller to
  939. // add HTTP headers to the request.
  940. func (c *GroupsGetCall) Header() http.Header {
  941. if c.header_ == nil {
  942. c.header_ = make(http.Header)
  943. }
  944. return c.header_
  945. }
  946. func (c *GroupsGetCall) doRequest(alt string) (*http.Response, error) {
  947. reqHeaders := make(http.Header)
  948. for k, v := range c.header_ {
  949. reqHeaders[k] = v
  950. }
  951. reqHeaders.Set("User-Agent", c.s.userAgent())
  952. if c.ifNoneMatch_ != "" {
  953. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  954. }
  955. var body io.Reader = nil
  956. c.urlParams_.Set("alt", alt)
  957. c.urlParams_.Set("prettyPrint", "false")
  958. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  959. urls += "?" + c.urlParams_.Encode()
  960. req, err := http.NewRequest("GET", urls, body)
  961. if err != nil {
  962. return nil, err
  963. }
  964. req.Header = reqHeaders
  965. googleapi.Expand(req.URL, map[string]string{
  966. "name": c.name,
  967. })
  968. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  969. }
  970. // Do executes the "cloudidentity.groups.get" call.
  971. // Exactly one of *Group or error will be non-nil. Any non-2xx status
  972. // code is an error. Response headers are in either
  973. // *Group.ServerResponse.Header or (if a response was returned at all)
  974. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  975. // check whether the returned error was because http.StatusNotModified
  976. // was returned.
  977. func (c *GroupsGetCall) Do(opts ...googleapi.CallOption) (*Group, error) {
  978. gensupport.SetOptions(c.urlParams_, opts...)
  979. res, err := c.doRequest("json")
  980. if res != nil && res.StatusCode == http.StatusNotModified {
  981. if res.Body != nil {
  982. res.Body.Close()
  983. }
  984. return nil, &googleapi.Error{
  985. Code: res.StatusCode,
  986. Header: res.Header,
  987. }
  988. }
  989. if err != nil {
  990. return nil, err
  991. }
  992. defer googleapi.CloseBody(res)
  993. if err := googleapi.CheckResponse(res); err != nil {
  994. return nil, err
  995. }
  996. ret := &Group{
  997. ServerResponse: googleapi.ServerResponse{
  998. Header: res.Header,
  999. HTTPStatusCode: res.StatusCode,
  1000. },
  1001. }
  1002. target := &ret
  1003. if err := gensupport.DecodeResponse(target, res); err != nil {
  1004. return nil, err
  1005. }
  1006. return ret, nil
  1007. // {
  1008. // "description": "Retrieves a Group.",
  1009. // "flatPath": "v1/groups/{groupsId}",
  1010. // "httpMethod": "GET",
  1011. // "id": "cloudidentity.groups.get",
  1012. // "parameterOrder": [
  1013. // "name"
  1014. // ],
  1015. // "parameters": {
  1016. // "name": {
  1017. // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nGroup in the format: `groups/{group_id}`, where `group_id` is the unique ID\nassigned to the Group.",
  1018. // "location": "path",
  1019. // "pattern": "^groups/[^/]+$",
  1020. // "required": true,
  1021. // "type": "string"
  1022. // }
  1023. // },
  1024. // "path": "v1/{+name}",
  1025. // "response": {
  1026. // "$ref": "Group"
  1027. // },
  1028. // "scopes": [
  1029. // "https://www.googleapis.com/auth/cloud-identity.groups",
  1030. // "https://www.googleapis.com/auth/cloud-identity.groups.readonly"
  1031. // ]
  1032. // }
  1033. }
  1034. // method id "cloudidentity.groups.list":
  1035. type GroupsListCall struct {
  1036. s *Service
  1037. urlParams_ gensupport.URLParams
  1038. ifNoneMatch_ string
  1039. ctx_ context.Context
  1040. header_ http.Header
  1041. }
  1042. // List: List groups within a customer or a domain.
  1043. func (r *GroupsService) List() *GroupsListCall {
  1044. c := &GroupsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1045. return c
  1046. }
  1047. // PageSize sets the optional parameter "pageSize": The default page
  1048. // size is 200 (max 1000) for the BASIC view, and 50
  1049. // (max 500) for the FULL view.
  1050. func (c *GroupsListCall) PageSize(pageSize int64) *GroupsListCall {
  1051. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1052. return c
  1053. }
  1054. // PageToken sets the optional parameter "pageToken": The
  1055. // next_page_token value returned from a previous list request, if any.
  1056. func (c *GroupsListCall) PageToken(pageToken string) *GroupsListCall {
  1057. c.urlParams_.Set("pageToken", pageToken)
  1058. return c
  1059. }
  1060. // Parent sets the optional parameter "parent": `Required`. May be made
  1061. // Optional in the future.
  1062. // Customer ID to list all groups from.
  1063. func (c *GroupsListCall) Parent(parent string) *GroupsListCall {
  1064. c.urlParams_.Set("parent", parent)
  1065. return c
  1066. }
  1067. // View sets the optional parameter "view": Group resource view to be
  1068. // returned. Defaults to [View.BASIC]().
  1069. //
  1070. // Possible values:
  1071. // "VIEW_UNSPECIFIED"
  1072. // "BASIC"
  1073. // "FULL"
  1074. func (c *GroupsListCall) View(view string) *GroupsListCall {
  1075. c.urlParams_.Set("view", view)
  1076. return c
  1077. }
  1078. // Fields allows partial responses to be retrieved. See
  1079. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1080. // for more information.
  1081. func (c *GroupsListCall) Fields(s ...googleapi.Field) *GroupsListCall {
  1082. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1083. return c
  1084. }
  1085. // IfNoneMatch sets the optional parameter which makes the operation
  1086. // fail if the object's ETag matches the given value. This is useful for
  1087. // getting updates only after the object has changed since the last
  1088. // request. Use googleapi.IsNotModified to check whether the response
  1089. // error from Do is the result of In-None-Match.
  1090. func (c *GroupsListCall) IfNoneMatch(entityTag string) *GroupsListCall {
  1091. c.ifNoneMatch_ = entityTag
  1092. return c
  1093. }
  1094. // Context sets the context to be used in this call's Do method. Any
  1095. // pending HTTP request will be aborted if the provided context is
  1096. // canceled.
  1097. func (c *GroupsListCall) Context(ctx context.Context) *GroupsListCall {
  1098. c.ctx_ = ctx
  1099. return c
  1100. }
  1101. // Header returns an http.Header that can be modified by the caller to
  1102. // add HTTP headers to the request.
  1103. func (c *GroupsListCall) Header() http.Header {
  1104. if c.header_ == nil {
  1105. c.header_ = make(http.Header)
  1106. }
  1107. return c.header_
  1108. }
  1109. func (c *GroupsListCall) doRequest(alt string) (*http.Response, error) {
  1110. reqHeaders := make(http.Header)
  1111. for k, v := range c.header_ {
  1112. reqHeaders[k] = v
  1113. }
  1114. reqHeaders.Set("User-Agent", c.s.userAgent())
  1115. if c.ifNoneMatch_ != "" {
  1116. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1117. }
  1118. var body io.Reader = nil
  1119. c.urlParams_.Set("alt", alt)
  1120. c.urlParams_.Set("prettyPrint", "false")
  1121. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/groups")
  1122. urls += "?" + c.urlParams_.Encode()
  1123. req, err := http.NewRequest("GET", urls, body)
  1124. if err != nil {
  1125. return nil, err
  1126. }
  1127. req.Header = reqHeaders
  1128. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1129. }
  1130. // Do executes the "cloudidentity.groups.list" call.
  1131. // Exactly one of *ListGroupsResponse or error will be non-nil. Any
  1132. // non-2xx status code is an error. Response headers are in either
  1133. // *ListGroupsResponse.ServerResponse.Header or (if a response was
  1134. // returned at all) in error.(*googleapi.Error).Header. Use
  1135. // googleapi.IsNotModified to check whether the returned error was
  1136. // because http.StatusNotModified was returned.
  1137. func (c *GroupsListCall) Do(opts ...googleapi.CallOption) (*ListGroupsResponse, error) {
  1138. gensupport.SetOptions(c.urlParams_, opts...)
  1139. res, err := c.doRequest("json")
  1140. if res != nil && res.StatusCode == http.StatusNotModified {
  1141. if res.Body != nil {
  1142. res.Body.Close()
  1143. }
  1144. return nil, &googleapi.Error{
  1145. Code: res.StatusCode,
  1146. Header: res.Header,
  1147. }
  1148. }
  1149. if err != nil {
  1150. return nil, err
  1151. }
  1152. defer googleapi.CloseBody(res)
  1153. if err := googleapi.CheckResponse(res); err != nil {
  1154. return nil, err
  1155. }
  1156. ret := &ListGroupsResponse{
  1157. ServerResponse: googleapi.ServerResponse{
  1158. Header: res.Header,
  1159. HTTPStatusCode: res.StatusCode,
  1160. },
  1161. }
  1162. target := &ret
  1163. if err := gensupport.DecodeResponse(target, res); err != nil {
  1164. return nil, err
  1165. }
  1166. return ret, nil
  1167. // {
  1168. // "description": "List groups within a customer or a domain.",
  1169. // "flatPath": "v1/groups",
  1170. // "httpMethod": "GET",
  1171. // "id": "cloudidentity.groups.list",
  1172. // "parameterOrder": [],
  1173. // "parameters": {
  1174. // "pageSize": {
  1175. // "description": "The default page size is 200 (max 1000) for the BASIC view, and 50\n(max 500) for the FULL view.",
  1176. // "format": "int32",
  1177. // "location": "query",
  1178. // "type": "integer"
  1179. // },
  1180. // "pageToken": {
  1181. // "description": "The next_page_token value returned from a previous list request, if any.",
  1182. // "location": "query",
  1183. // "type": "string"
  1184. // },
  1185. // "parent": {
  1186. // "description": "`Required`. May be made Optional in the future.\nCustomer ID to list all groups from.",
  1187. // "location": "query",
  1188. // "type": "string"
  1189. // },
  1190. // "view": {
  1191. // "description": "Group resource view to be returned. Defaults to [View.BASIC]().",
  1192. // "enum": [
  1193. // "VIEW_UNSPECIFIED",
  1194. // "BASIC",
  1195. // "FULL"
  1196. // ],
  1197. // "location": "query",
  1198. // "type": "string"
  1199. // }
  1200. // },
  1201. // "path": "v1/groups",
  1202. // "response": {
  1203. // "$ref": "ListGroupsResponse"
  1204. // },
  1205. // "scopes": [
  1206. // "https://www.googleapis.com/auth/cloud-identity.groups",
  1207. // "https://www.googleapis.com/auth/cloud-identity.groups.readonly"
  1208. // ]
  1209. // }
  1210. }
  1211. // Pages invokes f for each page of results.
  1212. // A non-nil error returned from f will halt the iteration.
  1213. // The provided context supersedes any context provided to the Context method.
  1214. func (c *GroupsListCall) Pages(ctx context.Context, f func(*ListGroupsResponse) error) error {
  1215. c.ctx_ = ctx
  1216. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1217. for {
  1218. x, err := c.Do()
  1219. if err != nil {
  1220. return err
  1221. }
  1222. if err := f(x); err != nil {
  1223. return err
  1224. }
  1225. if x.NextPageToken == "" {
  1226. return nil
  1227. }
  1228. c.PageToken(x.NextPageToken)
  1229. }
  1230. }
  1231. // method id "cloudidentity.groups.lookup":
  1232. type GroupsLookupCall struct {
  1233. s *Service
  1234. urlParams_ gensupport.URLParams
  1235. ifNoneMatch_ string
  1236. ctx_ context.Context
  1237. header_ http.Header
  1238. }
  1239. // Lookup: Looks up
  1240. // [resource
  1241. // name](https://cloud.google.com/apis/design/resource_names) of a Group
  1242. // by
  1243. // its EntityKey.
  1244. func (r *GroupsService) Lookup() *GroupsLookupCall {
  1245. c := &GroupsLookupCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1246. return c
  1247. }
  1248. // GroupKeyId sets the optional parameter "groupKey.id": The ID of the
  1249. // entity within the given namespace. The ID must be unique
  1250. // within its namespace.
  1251. func (c *GroupsLookupCall) GroupKeyId(groupKeyId string) *GroupsLookupCall {
  1252. c.urlParams_.Set("groupKey.id", groupKeyId)
  1253. return c
  1254. }
  1255. // GroupKeyNamespace sets the optional parameter "groupKey.namespace":
  1256. // Namespaces provide isolation for IDs, so an ID only needs to be
  1257. // unique
  1258. // within its namespace.
  1259. //
  1260. // Namespaces are currently only created as part of IdentitySource
  1261. // creation
  1262. // from Admin Console. A namespace
  1263. // "identitysources/{identity_source_id}" is
  1264. // created corresponding to every Identity Source `identity_source_id`.
  1265. func (c *GroupsLookupCall) GroupKeyNamespace(groupKeyNamespace string) *GroupsLookupCall {
  1266. c.urlParams_.Set("groupKey.namespace", groupKeyNamespace)
  1267. return c
  1268. }
  1269. // Fields allows partial responses to be retrieved. See
  1270. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1271. // for more information.
  1272. func (c *GroupsLookupCall) Fields(s ...googleapi.Field) *GroupsLookupCall {
  1273. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1274. return c
  1275. }
  1276. // IfNoneMatch sets the optional parameter which makes the operation
  1277. // fail if the object's ETag matches the given value. This is useful for
  1278. // getting updates only after the object has changed since the last
  1279. // request. Use googleapi.IsNotModified to check whether the response
  1280. // error from Do is the result of In-None-Match.
  1281. func (c *GroupsLookupCall) IfNoneMatch(entityTag string) *GroupsLookupCall {
  1282. c.ifNoneMatch_ = entityTag
  1283. return c
  1284. }
  1285. // Context sets the context to be used in this call's Do method. Any
  1286. // pending HTTP request will be aborted if the provided context is
  1287. // canceled.
  1288. func (c *GroupsLookupCall) Context(ctx context.Context) *GroupsLookupCall {
  1289. c.ctx_ = ctx
  1290. return c
  1291. }
  1292. // Header returns an http.Header that can be modified by the caller to
  1293. // add HTTP headers to the request.
  1294. func (c *GroupsLookupCall) Header() http.Header {
  1295. if c.header_ == nil {
  1296. c.header_ = make(http.Header)
  1297. }
  1298. return c.header_
  1299. }
  1300. func (c *GroupsLookupCall) doRequest(alt string) (*http.Response, error) {
  1301. reqHeaders := make(http.Header)
  1302. for k, v := range c.header_ {
  1303. reqHeaders[k] = v
  1304. }
  1305. reqHeaders.Set("User-Agent", c.s.userAgent())
  1306. if c.ifNoneMatch_ != "" {
  1307. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1308. }
  1309. var body io.Reader = nil
  1310. c.urlParams_.Set("alt", alt)
  1311. c.urlParams_.Set("prettyPrint", "false")
  1312. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/groups:lookup")
  1313. urls += "?" + c.urlParams_.Encode()
  1314. req, err := http.NewRequest("GET", urls, body)
  1315. if err != nil {
  1316. return nil, err
  1317. }
  1318. req.Header = reqHeaders
  1319. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1320. }
  1321. // Do executes the "cloudidentity.groups.lookup" call.
  1322. // Exactly one of *LookupGroupNameResponse or error will be non-nil. Any
  1323. // non-2xx status code is an error. Response headers are in either
  1324. // *LookupGroupNameResponse.ServerResponse.Header or (if a response was
  1325. // returned at all) in error.(*googleapi.Error).Header. Use
  1326. // googleapi.IsNotModified to check whether the returned error was
  1327. // because http.StatusNotModified was returned.
  1328. func (c *GroupsLookupCall) Do(opts ...googleapi.CallOption) (*LookupGroupNameResponse, error) {
  1329. gensupport.SetOptions(c.urlParams_, opts...)
  1330. res, err := c.doRequest("json")
  1331. if res != nil && res.StatusCode == http.StatusNotModified {
  1332. if res.Body != nil {
  1333. res.Body.Close()
  1334. }
  1335. return nil, &googleapi.Error{
  1336. Code: res.StatusCode,
  1337. Header: res.Header,
  1338. }
  1339. }
  1340. if err != nil {
  1341. return nil, err
  1342. }
  1343. defer googleapi.CloseBody(res)
  1344. if err := googleapi.CheckResponse(res); err != nil {
  1345. return nil, err
  1346. }
  1347. ret := &LookupGroupNameResponse{
  1348. ServerResponse: googleapi.ServerResponse{
  1349. Header: res.Header,
  1350. HTTPStatusCode: res.StatusCode,
  1351. },
  1352. }
  1353. target := &ret
  1354. if err := gensupport.DecodeResponse(target, res); err != nil {
  1355. return nil, err
  1356. }
  1357. return ret, nil
  1358. // {
  1359. // "description": "Looks up [resource\nname](https://cloud.google.com/apis/design/resource_names) of a Group by\nits EntityKey.",
  1360. // "flatPath": "v1/groups:lookup",
  1361. // "httpMethod": "GET",
  1362. // "id": "cloudidentity.groups.lookup",
  1363. // "parameterOrder": [],
  1364. // "parameters": {
  1365. // "groupKey.id": {
  1366. // "description": "The ID of the entity within the given namespace. The ID must be unique\nwithin its namespace.",
  1367. // "location": "query",
  1368. // "type": "string"
  1369. // },
  1370. // "groupKey.namespace": {
  1371. // "description": "Namespaces provide isolation for IDs, so an ID only needs to be unique\nwithin its namespace.\n\nNamespaces are currently only created as part of IdentitySource creation\nfrom Admin Console. A namespace `\"identitysources/{identity_source_id}\"` is\ncreated corresponding to every Identity Source `identity_source_id`.",
  1372. // "location": "query",
  1373. // "type": "string"
  1374. // }
  1375. // },
  1376. // "path": "v1/groups:lookup",
  1377. // "response": {
  1378. // "$ref": "LookupGroupNameResponse"
  1379. // },
  1380. // "scopes": [
  1381. // "https://www.googleapis.com/auth/cloud-identity.groups",
  1382. // "https://www.googleapis.com/auth/cloud-identity.groups.readonly"
  1383. // ]
  1384. // }
  1385. }
  1386. // method id "cloudidentity.groups.patch":
  1387. type GroupsPatchCall struct {
  1388. s *Service
  1389. name string
  1390. group *Group
  1391. urlParams_ gensupport.URLParams
  1392. ctx_ context.Context
  1393. header_ http.Header
  1394. }
  1395. // Patch: Updates a Group.
  1396. func (r *GroupsService) Patch(name string, group *Group) *GroupsPatchCall {
  1397. c := &GroupsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1398. c.name = name
  1399. c.group = group
  1400. return c
  1401. }
  1402. // UpdateMask sets the optional parameter "updateMask": Editable fields:
  1403. // `display_name`, `description`
  1404. func (c *GroupsPatchCall) UpdateMask(updateMask string) *GroupsPatchCall {
  1405. c.urlParams_.Set("updateMask", updateMask)
  1406. return c
  1407. }
  1408. // Fields allows partial responses to be retrieved. See
  1409. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1410. // for more information.
  1411. func (c *GroupsPatchCall) Fields(s ...googleapi.Field) *GroupsPatchCall {
  1412. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1413. return c
  1414. }
  1415. // Context sets the context to be used in this call's Do method. Any
  1416. // pending HTTP request will be aborted if the provided context is
  1417. // canceled.
  1418. func (c *GroupsPatchCall) Context(ctx context.Context) *GroupsPatchCall {
  1419. c.ctx_ = ctx
  1420. return c
  1421. }
  1422. // Header returns an http.Header that can be modified by the caller to
  1423. // add HTTP headers to the request.
  1424. func (c *GroupsPatchCall) Header() http.Header {
  1425. if c.header_ == nil {
  1426. c.header_ = make(http.Header)
  1427. }
  1428. return c.header_
  1429. }
  1430. func (c *GroupsPatchCall) doRequest(alt string) (*http.Response, error) {
  1431. reqHeaders := make(http.Header)
  1432. for k, v := range c.header_ {
  1433. reqHeaders[k] = v
  1434. }
  1435. reqHeaders.Set("User-Agent", c.s.userAgent())
  1436. var body io.Reader = nil
  1437. body, err := googleapi.WithoutDataWrapper.JSONReader(c.group)
  1438. if err != nil {
  1439. return nil, err
  1440. }
  1441. reqHeaders.Set("Content-Type", "application/json")
  1442. c.urlParams_.Set("alt", alt)
  1443. c.urlParams_.Set("prettyPrint", "false")
  1444. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1445. urls += "?" + c.urlParams_.Encode()
  1446. req, err := http.NewRequest("PATCH", urls, body)
  1447. if err != nil {
  1448. return nil, err
  1449. }
  1450. req.Header = reqHeaders
  1451. googleapi.Expand(req.URL, map[string]string{
  1452. "name": c.name,
  1453. })
  1454. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1455. }
  1456. // Do executes the "cloudidentity.groups.patch" call.
  1457. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1458. // status code is an error. Response headers are in either
  1459. // *Operation.ServerResponse.Header or (if a response was returned at
  1460. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1461. // to check whether the returned error was because
  1462. // http.StatusNotModified was returned.
  1463. func (c *GroupsPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1464. gensupport.SetOptions(c.urlParams_, opts...)
  1465. res, err := c.doRequest("json")
  1466. if res != nil && res.StatusCode == http.StatusNotModified {
  1467. if res.Body != nil {
  1468. res.Body.Close()
  1469. }
  1470. return nil, &googleapi.Error{
  1471. Code: res.StatusCode,
  1472. Header: res.Header,
  1473. }
  1474. }
  1475. if err != nil {
  1476. return nil, err
  1477. }
  1478. defer googleapi.CloseBody(res)
  1479. if err := googleapi.CheckResponse(res); err != nil {
  1480. return nil, err
  1481. }
  1482. ret := &Operation{
  1483. ServerResponse: googleapi.ServerResponse{
  1484. Header: res.Header,
  1485. HTTPStatusCode: res.StatusCode,
  1486. },
  1487. }
  1488. target := &ret
  1489. if err := gensupport.DecodeResponse(target, res); err != nil {
  1490. return nil, err
  1491. }
  1492. return ret, nil
  1493. // {
  1494. // "description": "Updates a Group.",
  1495. // "flatPath": "v1/groups/{groupsId}",
  1496. // "httpMethod": "PATCH",
  1497. // "id": "cloudidentity.groups.patch",
  1498. // "parameterOrder": [
  1499. // "name"
  1500. // ],
  1501. // "parameters": {
  1502. // "name": {
  1503. // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nGroup in the format: `groups/{group_id}`, where group_id is the unique ID\nassigned to the Group.\n\nMust be left blank while creating a Group.",
  1504. // "location": "path",
  1505. // "pattern": "^groups/[^/]+$",
  1506. // "required": true,
  1507. // "type": "string"
  1508. // },
  1509. // "updateMask": {
  1510. // "description": "Editable fields: `display_name`, `description`",
  1511. // "format": "google-fieldmask",
  1512. // "location": "query",
  1513. // "type": "string"
  1514. // }
  1515. // },
  1516. // "path": "v1/{+name}",
  1517. // "request": {
  1518. // "$ref": "Group"
  1519. // },
  1520. // "response": {
  1521. // "$ref": "Operation"
  1522. // },
  1523. // "scopes": [
  1524. // "https://www.googleapis.com/auth/cloud-identity.groups"
  1525. // ]
  1526. // }
  1527. }
  1528. // method id "cloudidentity.groups.search":
  1529. type GroupsSearchCall struct {
  1530. s *Service
  1531. urlParams_ gensupport.URLParams
  1532. ifNoneMatch_ string
  1533. ctx_ context.Context
  1534. header_ http.Header
  1535. }
  1536. // Search: Searches for Groups.
  1537. func (r *GroupsService) Search() *GroupsSearchCall {
  1538. c := &GroupsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1539. return c
  1540. }
  1541. // PageSize sets the optional parameter "pageSize": The default page
  1542. // size is 200 (max 1000) for the BASIC view, and 50
  1543. // (max 500) for the FULL view.
  1544. func (c *GroupsSearchCall) PageSize(pageSize int64) *GroupsSearchCall {
  1545. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1546. return c
  1547. }
  1548. // PageToken sets the optional parameter "pageToken": The
  1549. // next_page_token value returned from a previous search request, if
  1550. // any.
  1551. func (c *GroupsSearchCall) PageToken(pageToken string) *GroupsSearchCall {
  1552. c.urlParams_.Set("pageToken", pageToken)
  1553. return c
  1554. }
  1555. // Query sets the optional parameter "query": `Required`. Query string
  1556. // for performing search on groups. Users can search
  1557. // on parent and label attributes of groups.
  1558. // EXACT match ('==') is supported on parent, and CONTAINS match ('in')
  1559. // is
  1560. // supported on labels.
  1561. func (c *GroupsSearchCall) Query(query string) *GroupsSearchCall {
  1562. c.urlParams_.Set("query", query)
  1563. return c
  1564. }
  1565. // View sets the optional parameter "view": Group resource view to be
  1566. // returned. Defaults to [View.BASIC]().
  1567. //
  1568. // Possible values:
  1569. // "VIEW_UNSPECIFIED"
  1570. // "BASIC"
  1571. // "FULL"
  1572. func (c *GroupsSearchCall) View(view string) *GroupsSearchCall {
  1573. c.urlParams_.Set("view", view)
  1574. return c
  1575. }
  1576. // Fields allows partial responses to be retrieved. See
  1577. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1578. // for more information.
  1579. func (c *GroupsSearchCall) Fields(s ...googleapi.Field) *GroupsSearchCall {
  1580. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1581. return c
  1582. }
  1583. // IfNoneMatch sets the optional parameter which makes the operation
  1584. // fail if the object's ETag matches the given value. This is useful for
  1585. // getting updates only after the object has changed since the last
  1586. // request. Use googleapi.IsNotModified to check whether the response
  1587. // error from Do is the result of In-None-Match.
  1588. func (c *GroupsSearchCall) IfNoneMatch(entityTag string) *GroupsSearchCall {
  1589. c.ifNoneMatch_ = entityTag
  1590. return c
  1591. }
  1592. // Context sets the context to be used in this call's Do method. Any
  1593. // pending HTTP request will be aborted if the provided context is
  1594. // canceled.
  1595. func (c *GroupsSearchCall) Context(ctx context.Context) *GroupsSearchCall {
  1596. c.ctx_ = ctx
  1597. return c
  1598. }
  1599. // Header returns an http.Header that can be modified by the caller to
  1600. // add HTTP headers to the request.
  1601. func (c *GroupsSearchCall) Header() http.Header {
  1602. if c.header_ == nil {
  1603. c.header_ = make(http.Header)
  1604. }
  1605. return c.header_
  1606. }
  1607. func (c *GroupsSearchCall) doRequest(alt string) (*http.Response, error) {
  1608. reqHeaders := make(http.Header)
  1609. for k, v := range c.header_ {
  1610. reqHeaders[k] = v
  1611. }
  1612. reqHeaders.Set("User-Agent", c.s.userAgent())
  1613. if c.ifNoneMatch_ != "" {
  1614. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1615. }
  1616. var body io.Reader = nil
  1617. c.urlParams_.Set("alt", alt)
  1618. c.urlParams_.Set("prettyPrint", "false")
  1619. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/groups:search")
  1620. urls += "?" + c.urlParams_.Encode()
  1621. req, err := http.NewRequest("GET", urls, body)
  1622. if err != nil {
  1623. return nil, err
  1624. }
  1625. req.Header = reqHeaders
  1626. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1627. }
  1628. // Do executes the "cloudidentity.groups.search" call.
  1629. // Exactly one of *SearchGroupsResponse or error will be non-nil. Any
  1630. // non-2xx status code is an error. Response headers are in either
  1631. // *SearchGroupsResponse.ServerResponse.Header or (if a response was
  1632. // returned at all) in error.(*googleapi.Error).Header. Use
  1633. // googleapi.IsNotModified to check whether the returned error was
  1634. // because http.StatusNotModified was returned.
  1635. func (c *GroupsSearchCall) Do(opts ...googleapi.CallOption) (*SearchGroupsResponse, error) {
  1636. gensupport.SetOptions(c.urlParams_, opts...)
  1637. res, err := c.doRequest("json")
  1638. if res != nil && res.StatusCode == http.StatusNotModified {
  1639. if res.Body != nil {
  1640. res.Body.Close()
  1641. }
  1642. return nil, &googleapi.Error{
  1643. Code: res.StatusCode,
  1644. Header: res.Header,
  1645. }
  1646. }
  1647. if err != nil {
  1648. return nil, err
  1649. }
  1650. defer googleapi.CloseBody(res)
  1651. if err := googleapi.CheckResponse(res); err != nil {
  1652. return nil, err
  1653. }
  1654. ret := &SearchGroupsResponse{
  1655. ServerResponse: googleapi.ServerResponse{
  1656. Header: res.Header,
  1657. HTTPStatusCode: res.StatusCode,
  1658. },
  1659. }
  1660. target := &ret
  1661. if err := gensupport.DecodeResponse(target, res); err != nil {
  1662. return nil, err
  1663. }
  1664. return ret, nil
  1665. // {
  1666. // "description": "Searches for Groups.",
  1667. // "flatPath": "v1/groups:search",
  1668. // "httpMethod": "GET",
  1669. // "id": "cloudidentity.groups.search",
  1670. // "parameterOrder": [],
  1671. // "parameters": {
  1672. // "pageSize": {
  1673. // "description": "The default page size is 200 (max 1000) for the BASIC view, and 50\n(max 500) for the FULL view.",
  1674. // "format": "int32",
  1675. // "location": "query",
  1676. // "type": "integer"
  1677. // },
  1678. // "pageToken": {
  1679. // "description": "The next_page_token value returned from a previous search request, if any.",
  1680. // "location": "query",
  1681. // "type": "string"
  1682. // },
  1683. // "query": {
  1684. // "description": "`Required`. Query string for performing search on groups. Users can search\non parent and label attributes of groups.\nEXACT match ('==') is supported on parent, and CONTAINS match ('in') is\nsupported on labels.",
  1685. // "location": "query",
  1686. // "type": "string"
  1687. // },
  1688. // "view": {
  1689. // "description": "Group resource view to be returned. Defaults to [View.BASIC]().",
  1690. // "enum": [
  1691. // "VIEW_UNSPECIFIED",
  1692. // "BASIC",
  1693. // "FULL"
  1694. // ],
  1695. // "location": "query",
  1696. // "type": "string"
  1697. // }
  1698. // },
  1699. // "path": "v1/groups:search",
  1700. // "response": {
  1701. // "$ref": "SearchGroupsResponse"
  1702. // },
  1703. // "scopes": [
  1704. // "https://www.googleapis.com/auth/cloud-identity.groups",
  1705. // "https://www.googleapis.com/auth/cloud-identity.groups.readonly"
  1706. // ]
  1707. // }
  1708. }
  1709. // Pages invokes f for each page of results.
  1710. // A non-nil error returned from f will halt the iteration.
  1711. // The provided context supersedes any context provided to the Context method.
  1712. func (c *GroupsSearchCall) Pages(ctx context.Context, f func(*SearchGroupsResponse) error) error {
  1713. c.ctx_ = ctx
  1714. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1715. for {
  1716. x, err := c.Do()
  1717. if err != nil {
  1718. return err
  1719. }
  1720. if err := f(x); err != nil {
  1721. return err
  1722. }
  1723. if x.NextPageToken == "" {
  1724. return nil
  1725. }
  1726. c.PageToken(x.NextPageToken)
  1727. }
  1728. }
  1729. // method id "cloudidentity.groups.memberships.create":
  1730. type GroupsMembershipsCreateCall struct {
  1731. s *Service
  1732. parent string
  1733. membership *Membership
  1734. urlParams_ gensupport.URLParams
  1735. ctx_ context.Context
  1736. header_ http.Header
  1737. }
  1738. // Create: Creates a Membership.
  1739. func (r *GroupsMembershipsService) Create(parent string, membership *Membership) *GroupsMembershipsCreateCall {
  1740. c := &GroupsMembershipsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1741. c.parent = parent
  1742. c.membership = membership
  1743. return c
  1744. }
  1745. // Fields allows partial responses to be retrieved. See
  1746. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1747. // for more information.
  1748. func (c *GroupsMembershipsCreateCall) Fields(s ...googleapi.Field) *GroupsMembershipsCreateCall {
  1749. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1750. return c
  1751. }
  1752. // Context sets the context to be used in this call's Do method. Any
  1753. // pending HTTP request will be aborted if the provided context is
  1754. // canceled.
  1755. func (c *GroupsMembershipsCreateCall) Context(ctx context.Context) *GroupsMembershipsCreateCall {
  1756. c.ctx_ = ctx
  1757. return c
  1758. }
  1759. // Header returns an http.Header that can be modified by the caller to
  1760. // add HTTP headers to the request.
  1761. func (c *GroupsMembershipsCreateCall) Header() http.Header {
  1762. if c.header_ == nil {
  1763. c.header_ = make(http.Header)
  1764. }
  1765. return c.header_
  1766. }
  1767. func (c *GroupsMembershipsCreateCall) doRequest(alt string) (*http.Response, error) {
  1768. reqHeaders := make(http.Header)
  1769. for k, v := range c.header_ {
  1770. reqHeaders[k] = v
  1771. }
  1772. reqHeaders.Set("User-Agent", c.s.userAgent())
  1773. var body io.Reader = nil
  1774. body, err := googleapi.WithoutDataWrapper.JSONReader(c.membership)
  1775. if err != nil {
  1776. return nil, err
  1777. }
  1778. reqHeaders.Set("Content-Type", "application/json")
  1779. c.urlParams_.Set("alt", alt)
  1780. c.urlParams_.Set("prettyPrint", "false")
  1781. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/memberships")
  1782. urls += "?" + c.urlParams_.Encode()
  1783. req, err := http.NewRequest("POST", urls, body)
  1784. if err != nil {
  1785. return nil, err
  1786. }
  1787. req.Header = reqHeaders
  1788. googleapi.Expand(req.URL, map[string]string{
  1789. "parent": c.parent,
  1790. })
  1791. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1792. }
  1793. // Do executes the "cloudidentity.groups.memberships.create" call.
  1794. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1795. // status code is an error. Response headers are in either
  1796. // *Operation.ServerResponse.Header or (if a response was returned at
  1797. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1798. // to check whether the returned error was because
  1799. // http.StatusNotModified was returned.
  1800. func (c *GroupsMembershipsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1801. gensupport.SetOptions(c.urlParams_, opts...)
  1802. res, err := c.doRequest("json")
  1803. if res != nil && res.StatusCode == http.StatusNotModified {
  1804. if res.Body != nil {
  1805. res.Body.Close()
  1806. }
  1807. return nil, &googleapi.Error{
  1808. Code: res.StatusCode,
  1809. Header: res.Header,
  1810. }
  1811. }
  1812. if err != nil {
  1813. return nil, err
  1814. }
  1815. defer googleapi.CloseBody(res)
  1816. if err := googleapi.CheckResponse(res); err != nil {
  1817. return nil, err
  1818. }
  1819. ret := &Operation{
  1820. ServerResponse: googleapi.ServerResponse{
  1821. Header: res.Header,
  1822. HTTPStatusCode: res.StatusCode,
  1823. },
  1824. }
  1825. target := &ret
  1826. if err := gensupport.DecodeResponse(target, res); err != nil {
  1827. return nil, err
  1828. }
  1829. return ret, nil
  1830. // {
  1831. // "description": "Creates a Membership.",
  1832. // "flatPath": "v1/groups/{groupsId}/memberships",
  1833. // "httpMethod": "POST",
  1834. // "id": "cloudidentity.groups.memberships.create",
  1835. // "parameterOrder": [
  1836. // "parent"
  1837. // ],
  1838. // "parameters": {
  1839. // "parent": {
  1840. // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nGroup to create Membership within. Format: `groups/{group_id}`, where\n`group_id` is the unique ID assigned to the Group.",
  1841. // "location": "path",
  1842. // "pattern": "^groups/[^/]+$",
  1843. // "required": true,
  1844. // "type": "string"
  1845. // }
  1846. // },
  1847. // "path": "v1/{+parent}/memberships",
  1848. // "request": {
  1849. // "$ref": "Membership"
  1850. // },
  1851. // "response": {
  1852. // "$ref": "Operation"
  1853. // },
  1854. // "scopes": [
  1855. // "https://www.googleapis.com/auth/cloud-identity.groups"
  1856. // ]
  1857. // }
  1858. }
  1859. // method id "cloudidentity.groups.memberships.delete":
  1860. type GroupsMembershipsDeleteCall struct {
  1861. s *Service
  1862. name string
  1863. urlParams_ gensupport.URLParams
  1864. ctx_ context.Context
  1865. header_ http.Header
  1866. }
  1867. // Delete: Deletes a Membership.
  1868. func (r *GroupsMembershipsService) Delete(name string) *GroupsMembershipsDeleteCall {
  1869. c := &GroupsMembershipsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1870. c.name = name
  1871. return c
  1872. }
  1873. // Fields allows partial responses to be retrieved. See
  1874. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1875. // for more information.
  1876. func (c *GroupsMembershipsDeleteCall) Fields(s ...googleapi.Field) *GroupsMembershipsDeleteCall {
  1877. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1878. return c
  1879. }
  1880. // Context sets the context to be used in this call's Do method. Any
  1881. // pending HTTP request will be aborted if the provided context is
  1882. // canceled.
  1883. func (c *GroupsMembershipsDeleteCall) Context(ctx context.Context) *GroupsMembershipsDeleteCall {
  1884. c.ctx_ = ctx
  1885. return c
  1886. }
  1887. // Header returns an http.Header that can be modified by the caller to
  1888. // add HTTP headers to the request.
  1889. func (c *GroupsMembershipsDeleteCall) Header() http.Header {
  1890. if c.header_ == nil {
  1891. c.header_ = make(http.Header)
  1892. }
  1893. return c.header_
  1894. }
  1895. func (c *GroupsMembershipsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1896. reqHeaders := make(http.Header)
  1897. for k, v := range c.header_ {
  1898. reqHeaders[k] = v
  1899. }
  1900. reqHeaders.Set("User-Agent", c.s.userAgent())
  1901. var body io.Reader = nil
  1902. c.urlParams_.Set("alt", alt)
  1903. c.urlParams_.Set("prettyPrint", "false")
  1904. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1905. urls += "?" + c.urlParams_.Encode()
  1906. req, err := http.NewRequest("DELETE", urls, body)
  1907. if err != nil {
  1908. return nil, err
  1909. }
  1910. req.Header = reqHeaders
  1911. googleapi.Expand(req.URL, map[string]string{
  1912. "name": c.name,
  1913. })
  1914. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1915. }
  1916. // Do executes the "cloudidentity.groups.memberships.delete" call.
  1917. // Exactly one of *Operation or error will be non-nil. Any non-2xx
  1918. // status code is an error. Response headers are in either
  1919. // *Operation.ServerResponse.Header or (if a response was returned at
  1920. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1921. // to check whether the returned error was because
  1922. // http.StatusNotModified was returned.
  1923. func (c *GroupsMembershipsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
  1924. gensupport.SetOptions(c.urlParams_, opts...)
  1925. res, err := c.doRequest("json")
  1926. if res != nil && res.StatusCode == http.StatusNotModified {
  1927. if res.Body != nil {
  1928. res.Body.Close()
  1929. }
  1930. return nil, &googleapi.Error{
  1931. Code: res.StatusCode,
  1932. Header: res.Header,
  1933. }
  1934. }
  1935. if err != nil {
  1936. return nil, err
  1937. }
  1938. defer googleapi.CloseBody(res)
  1939. if err := googleapi.CheckResponse(res); err != nil {
  1940. return nil, err
  1941. }
  1942. ret := &Operation{
  1943. ServerResponse: googleapi.ServerResponse{
  1944. Header: res.Header,
  1945. HTTPStatusCode: res.StatusCode,
  1946. },
  1947. }
  1948. target := &ret
  1949. if err := gensupport.DecodeResponse(target, res); err != nil {
  1950. return nil, err
  1951. }
  1952. return ret, nil
  1953. // {
  1954. // "description": "Deletes a Membership.",
  1955. // "flatPath": "v1/groups/{groupsId}/memberships/{membershipsId}",
  1956. // "httpMethod": "DELETE",
  1957. // "id": "cloudidentity.groups.memberships.delete",
  1958. // "parameterOrder": [
  1959. // "name"
  1960. // ],
  1961. // "parameters": {
  1962. // "name": {
  1963. // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nMembership to be deleted.\n\nFormat: `groups/{group_id}/memberships/{member_id}`, where `group_id` is\nthe unique ID assigned to the Group to which Membership belongs to, and\nmember_id is the unique ID assigned to the member.",
  1964. // "location": "path",
  1965. // "pattern": "^groups/[^/]+/memberships/[^/]+$",
  1966. // "required": true,
  1967. // "type": "string"
  1968. // }
  1969. // },
  1970. // "path": "v1/{+name}",
  1971. // "response": {
  1972. // "$ref": "Operation"
  1973. // },
  1974. // "scopes": [
  1975. // "https://www.googleapis.com/auth/cloud-identity.groups"
  1976. // ]
  1977. // }
  1978. }
  1979. // method id "cloudidentity.groups.memberships.get":
  1980. type GroupsMembershipsGetCall struct {
  1981. s *Service
  1982. name string
  1983. urlParams_ gensupport.URLParams
  1984. ifNoneMatch_ string
  1985. ctx_ context.Context
  1986. header_ http.Header
  1987. }
  1988. // Get: Retrieves a Membership.
  1989. func (r *GroupsMembershipsService) Get(name string) *GroupsMembershipsGetCall {
  1990. c := &GroupsMembershipsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1991. c.name = name
  1992. return c
  1993. }
  1994. // Fields allows partial responses to be retrieved. See
  1995. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1996. // for more information.
  1997. func (c *GroupsMembershipsGetCall) Fields(s ...googleapi.Field) *GroupsMembershipsGetCall {
  1998. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1999. return c
  2000. }
  2001. // IfNoneMatch sets the optional parameter which makes the operation
  2002. // fail if the object's ETag matches the given value. This is useful for
  2003. // getting updates only after the object has changed since the last
  2004. // request. Use googleapi.IsNotModified to check whether the response
  2005. // error from Do is the result of In-None-Match.
  2006. func (c *GroupsMembershipsGetCall) IfNoneMatch(entityTag string) *GroupsMembershipsGetCall {
  2007. c.ifNoneMatch_ = entityTag
  2008. return c
  2009. }
  2010. // Context sets the context to be used in this call's Do method. Any
  2011. // pending HTTP request will be aborted if the provided context is
  2012. // canceled.
  2013. func (c *GroupsMembershipsGetCall) Context(ctx context.Context) *GroupsMembershipsGetCall {
  2014. c.ctx_ = ctx
  2015. return c
  2016. }
  2017. // Header returns an http.Header that can be modified by the caller to
  2018. // add HTTP headers to the request.
  2019. func (c *GroupsMembershipsGetCall) Header() http.Header {
  2020. if c.header_ == nil {
  2021. c.header_ = make(http.Header)
  2022. }
  2023. return c.header_
  2024. }
  2025. func (c *GroupsMembershipsGetCall) doRequest(alt string) (*http.Response, error) {
  2026. reqHeaders := make(http.Header)
  2027. for k, v := range c.header_ {
  2028. reqHeaders[k] = v
  2029. }
  2030. reqHeaders.Set("User-Agent", c.s.userAgent())
  2031. if c.ifNoneMatch_ != "" {
  2032. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2033. }
  2034. var body io.Reader = nil
  2035. c.urlParams_.Set("alt", alt)
  2036. c.urlParams_.Set("prettyPrint", "false")
  2037. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2038. urls += "?" + c.urlParams_.Encode()
  2039. req, err := http.NewRequest("GET", urls, body)
  2040. if err != nil {
  2041. return nil, err
  2042. }
  2043. req.Header = reqHeaders
  2044. googleapi.Expand(req.URL, map[string]string{
  2045. "name": c.name,
  2046. })
  2047. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2048. }
  2049. // Do executes the "cloudidentity.groups.memberships.get" call.
  2050. // Exactly one of *Membership or error will be non-nil. Any non-2xx
  2051. // status code is an error. Response headers are in either
  2052. // *Membership.ServerResponse.Header or (if a response was returned at
  2053. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2054. // to check whether the returned error was because
  2055. // http.StatusNotModified was returned.
  2056. func (c *GroupsMembershipsGetCall) Do(opts ...googleapi.CallOption) (*Membership, error) {
  2057. gensupport.SetOptions(c.urlParams_, opts...)
  2058. res, err := c.doRequest("json")
  2059. if res != nil && res.StatusCode == http.StatusNotModified {
  2060. if res.Body != nil {
  2061. res.Body.Close()
  2062. }
  2063. return nil, &googleapi.Error{
  2064. Code: res.StatusCode,
  2065. Header: res.Header,
  2066. }
  2067. }
  2068. if err != nil {
  2069. return nil, err
  2070. }
  2071. defer googleapi.CloseBody(res)
  2072. if err := googleapi.CheckResponse(res); err != nil {
  2073. return nil, err
  2074. }
  2075. ret := &Membership{
  2076. ServerResponse: googleapi.ServerResponse{
  2077. Header: res.Header,
  2078. HTTPStatusCode: res.StatusCode,
  2079. },
  2080. }
  2081. target := &ret
  2082. if err := gensupport.DecodeResponse(target, res); err != nil {
  2083. return nil, err
  2084. }
  2085. return ret, nil
  2086. // {
  2087. // "description": "Retrieves a Membership.",
  2088. // "flatPath": "v1/groups/{groupsId}/memberships/{membershipsId}",
  2089. // "httpMethod": "GET",
  2090. // "id": "cloudidentity.groups.memberships.get",
  2091. // "parameterOrder": [
  2092. // "name"
  2093. // ],
  2094. // "parameters": {
  2095. // "name": {
  2096. // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nMembership to be retrieved.\n\nFormat: `groups/{group_id}/memberships/{member_id}`, where `group_id` is\nthe unique id assigned to the Group to which Membership belongs to, and\n`member_id` is the unique ID assigned to the member.",
  2097. // "location": "path",
  2098. // "pattern": "^groups/[^/]+/memberships/[^/]+$",
  2099. // "required": true,
  2100. // "type": "string"
  2101. // }
  2102. // },
  2103. // "path": "v1/{+name}",
  2104. // "response": {
  2105. // "$ref": "Membership"
  2106. // },
  2107. // "scopes": [
  2108. // "https://www.googleapis.com/auth/cloud-identity.groups",
  2109. // "https://www.googleapis.com/auth/cloud-identity.groups.readonly"
  2110. // ]
  2111. // }
  2112. }
  2113. // method id "cloudidentity.groups.memberships.list":
  2114. type GroupsMembershipsListCall struct {
  2115. s *Service
  2116. parent string
  2117. urlParams_ gensupport.URLParams
  2118. ifNoneMatch_ string
  2119. ctx_ context.Context
  2120. header_ http.Header
  2121. }
  2122. // List: List Memberships within a Group.
  2123. func (r *GroupsMembershipsService) List(parent string) *GroupsMembershipsListCall {
  2124. c := &GroupsMembershipsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2125. c.parent = parent
  2126. return c
  2127. }
  2128. // PageSize sets the optional parameter "pageSize": The default page
  2129. // size is 200 (max 1000) for the BASIC view, and 50
  2130. // (max 500) for the FULL view.
  2131. func (c *GroupsMembershipsListCall) PageSize(pageSize int64) *GroupsMembershipsListCall {
  2132. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2133. return c
  2134. }
  2135. // PageToken sets the optional parameter "pageToken": The
  2136. // next_page_token value returned from a previous list request, if any.
  2137. func (c *GroupsMembershipsListCall) PageToken(pageToken string) *GroupsMembershipsListCall {
  2138. c.urlParams_.Set("pageToken", pageToken)
  2139. return c
  2140. }
  2141. // View sets the optional parameter "view": Membership resource view to
  2142. // be returned. Defaults to View.BASIC.
  2143. //
  2144. // Possible values:
  2145. // "VIEW_UNSPECIFIED"
  2146. // "BASIC"
  2147. // "FULL"
  2148. func (c *GroupsMembershipsListCall) View(view string) *GroupsMembershipsListCall {
  2149. c.urlParams_.Set("view", view)
  2150. return c
  2151. }
  2152. // Fields allows partial responses to be retrieved. See
  2153. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2154. // for more information.
  2155. func (c *GroupsMembershipsListCall) Fields(s ...googleapi.Field) *GroupsMembershipsListCall {
  2156. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2157. return c
  2158. }
  2159. // IfNoneMatch sets the optional parameter which makes the operation
  2160. // fail if the object's ETag matches the given value. This is useful for
  2161. // getting updates only after the object has changed since the last
  2162. // request. Use googleapi.IsNotModified to check whether the response
  2163. // error from Do is the result of In-None-Match.
  2164. func (c *GroupsMembershipsListCall) IfNoneMatch(entityTag string) *GroupsMembershipsListCall {
  2165. c.ifNoneMatch_ = entityTag
  2166. return c
  2167. }
  2168. // Context sets the context to be used in this call's Do method. Any
  2169. // pending HTTP request will be aborted if the provided context is
  2170. // canceled.
  2171. func (c *GroupsMembershipsListCall) Context(ctx context.Context) *GroupsMembershipsListCall {
  2172. c.ctx_ = ctx
  2173. return c
  2174. }
  2175. // Header returns an http.Header that can be modified by the caller to
  2176. // add HTTP headers to the request.
  2177. func (c *GroupsMembershipsListCall) Header() http.Header {
  2178. if c.header_ == nil {
  2179. c.header_ = make(http.Header)
  2180. }
  2181. return c.header_
  2182. }
  2183. func (c *GroupsMembershipsListCall) doRequest(alt string) (*http.Response, error) {
  2184. reqHeaders := make(http.Header)
  2185. for k, v := range c.header_ {
  2186. reqHeaders[k] = v
  2187. }
  2188. reqHeaders.Set("User-Agent", c.s.userAgent())
  2189. if c.ifNoneMatch_ != "" {
  2190. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2191. }
  2192. var body io.Reader = nil
  2193. c.urlParams_.Set("alt", alt)
  2194. c.urlParams_.Set("prettyPrint", "false")
  2195. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/memberships")
  2196. urls += "?" + c.urlParams_.Encode()
  2197. req, err := http.NewRequest("GET", urls, body)
  2198. if err != nil {
  2199. return nil, err
  2200. }
  2201. req.Header = reqHeaders
  2202. googleapi.Expand(req.URL, map[string]string{
  2203. "parent": c.parent,
  2204. })
  2205. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2206. }
  2207. // Do executes the "cloudidentity.groups.memberships.list" call.
  2208. // Exactly one of *ListMembershipsResponse or error will be non-nil. Any
  2209. // non-2xx status code is an error. Response headers are in either
  2210. // *ListMembershipsResponse.ServerResponse.Header or (if a response was
  2211. // returned at all) in error.(*googleapi.Error).Header. Use
  2212. // googleapi.IsNotModified to check whether the returned error was
  2213. // because http.StatusNotModified was returned.
  2214. func (c *GroupsMembershipsListCall) Do(opts ...googleapi.CallOption) (*ListMembershipsResponse, error) {
  2215. gensupport.SetOptions(c.urlParams_, opts...)
  2216. res, err := c.doRequest("json")
  2217. if res != nil && res.StatusCode == http.StatusNotModified {
  2218. if res.Body != nil {
  2219. res.Body.Close()
  2220. }
  2221. return nil, &googleapi.Error{
  2222. Code: res.StatusCode,
  2223. Header: res.Header,
  2224. }
  2225. }
  2226. if err != nil {
  2227. return nil, err
  2228. }
  2229. defer googleapi.CloseBody(res)
  2230. if err := googleapi.CheckResponse(res); err != nil {
  2231. return nil, err
  2232. }
  2233. ret := &ListMembershipsResponse{
  2234. ServerResponse: googleapi.ServerResponse{
  2235. Header: res.Header,
  2236. HTTPStatusCode: res.StatusCode,
  2237. },
  2238. }
  2239. target := &ret
  2240. if err := gensupport.DecodeResponse(target, res); err != nil {
  2241. return nil, err
  2242. }
  2243. return ret, nil
  2244. // {
  2245. // "description": "List Memberships within a Group.",
  2246. // "flatPath": "v1/groups/{groupsId}/memberships",
  2247. // "httpMethod": "GET",
  2248. // "id": "cloudidentity.groups.memberships.list",
  2249. // "parameterOrder": [
  2250. // "parent"
  2251. // ],
  2252. // "parameters": {
  2253. // "pageSize": {
  2254. // "description": "The default page size is 200 (max 1000) for the BASIC view, and 50\n(max 500) for the FULL view.",
  2255. // "format": "int32",
  2256. // "location": "query",
  2257. // "type": "integer"
  2258. // },
  2259. // "pageToken": {
  2260. // "description": "The next_page_token value returned from a previous list request, if any.",
  2261. // "location": "query",
  2262. // "type": "string"
  2263. // },
  2264. // "parent": {
  2265. // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nGroup to list Memberships within.\n\nFormat: `groups/{group_id}`, where `group_id` is the unique ID assigned to\nthe Group.",
  2266. // "location": "path",
  2267. // "pattern": "^groups/[^/]+$",
  2268. // "required": true,
  2269. // "type": "string"
  2270. // },
  2271. // "view": {
  2272. // "description": "Membership resource view to be returned. Defaults to View.BASIC.",
  2273. // "enum": [
  2274. // "VIEW_UNSPECIFIED",
  2275. // "BASIC",
  2276. // "FULL"
  2277. // ],
  2278. // "location": "query",
  2279. // "type": "string"
  2280. // }
  2281. // },
  2282. // "path": "v1/{+parent}/memberships",
  2283. // "response": {
  2284. // "$ref": "ListMembershipsResponse"
  2285. // },
  2286. // "scopes": [
  2287. // "https://www.googleapis.com/auth/cloud-identity.groups",
  2288. // "https://www.googleapis.com/auth/cloud-identity.groups.readonly"
  2289. // ]
  2290. // }
  2291. }
  2292. // Pages invokes f for each page of results.
  2293. // A non-nil error returned from f will halt the iteration.
  2294. // The provided context supersedes any context provided to the Context method.
  2295. func (c *GroupsMembershipsListCall) Pages(ctx context.Context, f func(*ListMembershipsResponse) error) error {
  2296. c.ctx_ = ctx
  2297. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2298. for {
  2299. x, err := c.Do()
  2300. if err != nil {
  2301. return err
  2302. }
  2303. if err := f(x); err != nil {
  2304. return err
  2305. }
  2306. if x.NextPageToken == "" {
  2307. return nil
  2308. }
  2309. c.PageToken(x.NextPageToken)
  2310. }
  2311. }
  2312. // method id "cloudidentity.groups.memberships.lookup":
  2313. type GroupsMembershipsLookupCall struct {
  2314. s *Service
  2315. parent string
  2316. urlParams_ gensupport.URLParams
  2317. ifNoneMatch_ string
  2318. ctx_ context.Context
  2319. header_ http.Header
  2320. }
  2321. // Lookup: Looks up
  2322. // [resource
  2323. // name](https://cloud.google.com/apis/design/resource_names) of a
  2324. // Membership
  2325. // within a Group by member's EntityKey.
  2326. func (r *GroupsMembershipsService) Lookup(parent string) *GroupsMembershipsLookupCall {
  2327. c := &GroupsMembershipsLookupCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2328. c.parent = parent
  2329. return c
  2330. }
  2331. // MemberKeyId sets the optional parameter "memberKey.id": The ID of the
  2332. // entity within the given namespace. The ID must be unique
  2333. // within its namespace.
  2334. func (c *GroupsMembershipsLookupCall) MemberKeyId(memberKeyId string) *GroupsMembershipsLookupCall {
  2335. c.urlParams_.Set("memberKey.id", memberKeyId)
  2336. return c
  2337. }
  2338. // MemberKeyNamespace sets the optional parameter "memberKey.namespace":
  2339. // Namespaces provide isolation for IDs, so an ID only needs to be
  2340. // unique
  2341. // within its namespace.
  2342. //
  2343. // Namespaces are currently only created as part of IdentitySource
  2344. // creation
  2345. // from Admin Console. A namespace
  2346. // "identitysources/{identity_source_id}" is
  2347. // created corresponding to every Identity Source `identity_source_id`.
  2348. func (c *GroupsMembershipsLookupCall) MemberKeyNamespace(memberKeyNamespace string) *GroupsMembershipsLookupCall {
  2349. c.urlParams_.Set("memberKey.namespace", memberKeyNamespace)
  2350. return c
  2351. }
  2352. // Fields allows partial responses to be retrieved. See
  2353. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2354. // for more information.
  2355. func (c *GroupsMembershipsLookupCall) Fields(s ...googleapi.Field) *GroupsMembershipsLookupCall {
  2356. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2357. return c
  2358. }
  2359. // IfNoneMatch sets the optional parameter which makes the operation
  2360. // fail if the object's ETag matches the given value. This is useful for
  2361. // getting updates only after the object has changed since the last
  2362. // request. Use googleapi.IsNotModified to check whether the response
  2363. // error from Do is the result of In-None-Match.
  2364. func (c *GroupsMembershipsLookupCall) IfNoneMatch(entityTag string) *GroupsMembershipsLookupCall {
  2365. c.ifNoneMatch_ = entityTag
  2366. return c
  2367. }
  2368. // Context sets the context to be used in this call's Do method. Any
  2369. // pending HTTP request will be aborted if the provided context is
  2370. // canceled.
  2371. func (c *GroupsMembershipsLookupCall) Context(ctx context.Context) *GroupsMembershipsLookupCall {
  2372. c.ctx_ = ctx
  2373. return c
  2374. }
  2375. // Header returns an http.Header that can be modified by the caller to
  2376. // add HTTP headers to the request.
  2377. func (c *GroupsMembershipsLookupCall) Header() http.Header {
  2378. if c.header_ == nil {
  2379. c.header_ = make(http.Header)
  2380. }
  2381. return c.header_
  2382. }
  2383. func (c *GroupsMembershipsLookupCall) doRequest(alt string) (*http.Response, error) {
  2384. reqHeaders := make(http.Header)
  2385. for k, v := range c.header_ {
  2386. reqHeaders[k] = v
  2387. }
  2388. reqHeaders.Set("User-Agent", c.s.userAgent())
  2389. if c.ifNoneMatch_ != "" {
  2390. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2391. }
  2392. var body io.Reader = nil
  2393. c.urlParams_.Set("alt", alt)
  2394. c.urlParams_.Set("prettyPrint", "false")
  2395. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/memberships:lookup")
  2396. urls += "?" + c.urlParams_.Encode()
  2397. req, err := http.NewRequest("GET", urls, body)
  2398. if err != nil {
  2399. return nil, err
  2400. }
  2401. req.Header = reqHeaders
  2402. googleapi.Expand(req.URL, map[string]string{
  2403. "parent": c.parent,
  2404. })
  2405. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2406. }
  2407. // Do executes the "cloudidentity.groups.memberships.lookup" call.
  2408. // Exactly one of *LookupMembershipNameResponse or error will be
  2409. // non-nil. Any non-2xx status code is an error. Response headers are in
  2410. // either *LookupMembershipNameResponse.ServerResponse.Header or (if a
  2411. // response was returned at all) in error.(*googleapi.Error).Header. Use
  2412. // googleapi.IsNotModified to check whether the returned error was
  2413. // because http.StatusNotModified was returned.
  2414. func (c *GroupsMembershipsLookupCall) Do(opts ...googleapi.CallOption) (*LookupMembershipNameResponse, error) {
  2415. gensupport.SetOptions(c.urlParams_, opts...)
  2416. res, err := c.doRequest("json")
  2417. if res != nil && res.StatusCode == http.StatusNotModified {
  2418. if res.Body != nil {
  2419. res.Body.Close()
  2420. }
  2421. return nil, &googleapi.Error{
  2422. Code: res.StatusCode,
  2423. Header: res.Header,
  2424. }
  2425. }
  2426. if err != nil {
  2427. return nil, err
  2428. }
  2429. defer googleapi.CloseBody(res)
  2430. if err := googleapi.CheckResponse(res); err != nil {
  2431. return nil, err
  2432. }
  2433. ret := &LookupMembershipNameResponse{
  2434. ServerResponse: googleapi.ServerResponse{
  2435. Header: res.Header,
  2436. HTTPStatusCode: res.StatusCode,
  2437. },
  2438. }
  2439. target := &ret
  2440. if err := gensupport.DecodeResponse(target, res); err != nil {
  2441. return nil, err
  2442. }
  2443. return ret, nil
  2444. // {
  2445. // "description": "Looks up [resource\nname](https://cloud.google.com/apis/design/resource_names) of a Membership\nwithin a Group by member's EntityKey.",
  2446. // "flatPath": "v1/groups/{groupsId}/memberships:lookup",
  2447. // "httpMethod": "GET",
  2448. // "id": "cloudidentity.groups.memberships.lookup",
  2449. // "parameterOrder": [
  2450. // "parent"
  2451. // ],
  2452. // "parameters": {
  2453. // "memberKey.id": {
  2454. // "description": "The ID of the entity within the given namespace. The ID must be unique\nwithin its namespace.",
  2455. // "location": "query",
  2456. // "type": "string"
  2457. // },
  2458. // "memberKey.namespace": {
  2459. // "description": "Namespaces provide isolation for IDs, so an ID only needs to be unique\nwithin its namespace.\n\nNamespaces are currently only created as part of IdentitySource creation\nfrom Admin Console. A namespace `\"identitysources/{identity_source_id}\"` is\ncreated corresponding to every Identity Source `identity_source_id`.",
  2460. // "location": "query",
  2461. // "type": "string"
  2462. // },
  2463. // "parent": {
  2464. // "description": "[Resource name](https://cloud.google.com/apis/design/resource_names) of the\nGroup to lookup Membership within.\n\nFormat: `groups/{group_id}`, where `group_id` is the unique ID assigned to\nthe Group.",
  2465. // "location": "path",
  2466. // "pattern": "^groups/[^/]+$",
  2467. // "required": true,
  2468. // "type": "string"
  2469. // }
  2470. // },
  2471. // "path": "v1/{+parent}/memberships:lookup",
  2472. // "response": {
  2473. // "$ref": "LookupMembershipNameResponse"
  2474. // },
  2475. // "scopes": [
  2476. // "https://www.googleapis.com/auth/cloud-identity.groups",
  2477. // "https://www.googleapis.com/auth/cloud-identity.groups.readonly"
  2478. // ]
  2479. // }
  2480. }