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.
 
 
 

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