1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\Apigee\Resource;
19
20use Google\Service\Apigee\GoogleApiHttpBody;
21use Google\Service\Apigee\GoogleCloudApigeeV1AsyncQuery;
22use Google\Service\Apigee\GoogleCloudApigeeV1GetAsyncQueryResultUrlResponse;
23use Google\Service\Apigee\GoogleCloudApigeeV1ListAsyncQueriesResponse;
24use Google\Service\Apigee\GoogleCloudApigeeV1Query;
25
26/**
27 * The "queries" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $apigeeService = new Google\Service\Apigee(...);
31 *   $queries = $apigeeService->queries;
32 *  </code>
33 */
34class OrganizationsEnvironmentsQueries extends \Google\Service\Resource
35{
36  /**
37   * Submit a query to be processed in the background. If the submission of the
38   * query succeeds, the API returns a 201 status and an ID that refer to the
39   * query. In addition to the HTTP status 201, the `state` of "enqueued" means
40   * that the request succeeded. (queries.create)
41   *
42   * @param string $parent Required. The parent resource name. Must be of the form
43   * `organizations/{org}/environments/{env}`.
44   * @param GoogleCloudApigeeV1Query $postBody
45   * @param array $optParams Optional parameters.
46   * @return GoogleCloudApigeeV1AsyncQuery
47   */
48  public function create($parent, GoogleCloudApigeeV1Query $postBody, $optParams = [])
49  {
50    $params = ['parent' => $parent, 'postBody' => $postBody];
51    $params = array_merge($params, $optParams);
52    return $this->call('create', [$params], GoogleCloudApigeeV1AsyncQuery::class);
53  }
54  /**
55   * Get query status If the query is still in progress, the `state` is set to
56   * "running" After the query has completed successfully, `state` is set to
57   * "completed" (queries.get)
58   *
59   * @param string $name Required. Name of the asynchronous query to get. Must be
60   * of the form `organizations/{org}/environments/{env}/queries/{queryId}`.
61   * @param array $optParams Optional parameters.
62   * @return GoogleCloudApigeeV1AsyncQuery
63   */
64  public function get($name, $optParams = [])
65  {
66    $params = ['name' => $name];
67    $params = array_merge($params, $optParams);
68    return $this->call('get', [$params], GoogleCloudApigeeV1AsyncQuery::class);
69  }
70  /**
71   * After the query is completed, use this API to retrieve the results. If the
72   * request succeeds, and there is a non-zero result set, the result is
73   * downloaded to the client as a zipped JSON file. The name of the downloaded
74   * file will be: OfflineQueryResult-.zip Example: `OfflineQueryResult-
75   * 9cfc0d85-0f30-46d6-ae6f-318d0cb961bd.zip` (queries.getResult)
76   *
77   * @param string $name Required. Name of the asynchronous query result to get.
78   * Must be of the form
79   * `organizations/{org}/environments/{env}/queries/{queryId}/result`.
80   * @param array $optParams Optional parameters.
81   * @return GoogleApiHttpBody
82   */
83  public function getResult($name, $optParams = [])
84  {
85    $params = ['name' => $name];
86    $params = array_merge($params, $optParams);
87    return $this->call('getResult', [$params], GoogleApiHttpBody::class);
88  }
89  /**
90   * After the query is completed, use this API to retrieve the results. If the
91   * request succeeds, and there is a non-zero result set, the result is sent to
92   * the client as a list of urls to JSON files. (queries.getResulturl)
93   *
94   * @param string $name Required. Name of the asynchronous query result to get.
95   * Must be of the form
96   * `organizations/{org}/environments/{env}/queries/{queryId}/resulturl`.
97   * @param array $optParams Optional parameters.
98   * @return GoogleCloudApigeeV1GetAsyncQueryResultUrlResponse
99   */
100  public function getResulturl($name, $optParams = [])
101  {
102    $params = ['name' => $name];
103    $params = array_merge($params, $optParams);
104    return $this->call('getResulturl', [$params], GoogleCloudApigeeV1GetAsyncQueryResultUrlResponse::class);
105  }
106  /**
107   * Return a list of Asynchronous Queries
108   * (queries.listOrganizationsEnvironmentsQueries)
109   *
110   * @param string $parent Required. The parent resource name. Must be of the form
111   * `organizations/{org}/environments/{env}`.
112   * @param array $optParams Optional parameters.
113   *
114   * @opt_param string dataset Filter response list by dataset. Example: `api`,
115   * `mint`
116   * @opt_param string from Filter response list by returning asynchronous queries
117   * that created after this date time. Time must be in ISO date-time format like
118   * '2011-12-03T10:15:30Z'.
119   * @opt_param string inclQueriesWithoutReport Flag to include asynchronous
120   * queries that don't have a report denifition.
121   * @opt_param string status Filter response list by asynchronous query status.
122   * @opt_param string submittedBy Filter response list by user who submitted
123   * queries.
124   * @opt_param string to Filter response list by returning asynchronous queries
125   * that created before this date time. Time must be in ISO date-time format like
126   * '2011-12-03T10:16:30Z'.
127   * @return GoogleCloudApigeeV1ListAsyncQueriesResponse
128   */
129  public function listOrganizationsEnvironmentsQueries($parent, $optParams = [])
130  {
131    $params = ['parent' => $parent];
132    $params = array_merge($params, $optParams);
133    return $this->call('list', [$params], GoogleCloudApigeeV1ListAsyncQueriesResponse::class);
134  }
135}
136
137// Adding a class alias for backwards compatibility with the previous class name.
138class_alias(OrganizationsEnvironmentsQueries::class, 'Google_Service_Apigee_Resource_OrganizationsEnvironmentsQueries');
139