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\GoogleCloudApigeeV1AsyncQueryResultView;
23use Google\Service\Apigee\GoogleCloudApigeeV1ListAsyncQueriesResponse;
24use Google\Service\Apigee\GoogleCloudApigeeV1Query;
25
26/**
27 * The "hostQueries" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $apigeeService = new Google\Service\Apigee(...);
31 *   $hostQueries = $apigeeService->hostQueries;
32 *  </code>
33 */
34class OrganizationsHostQueries extends \Google\Service\Resource
35{
36  /**
37   * Submit a query at host level to be processed in the background. If the
38   * submission of the query succeeds, the API returns a 201 status and an ID that
39   * refer to the query. In addition to the HTTP status 201, the `state` of
40   * "enqueued" means that the request succeeded. (hostQueries.create)
41   *
42   * @param string $parent Required. The parent resource name. Must be of the form
43   * `organizations/{org}`.
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 status of a query submitted at host level. If the query is still in
56   * progress, the `state` is set to "running" After the query has completed
57   * successfully, `state` is set to "completed" (hostQueries.get)
58   *
59   * @param string $name Required. Name of the asynchronous query to get. Must be
60   * of the form `organizations/{org}/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` (hostQueries.getResult)
76   *
77   * @param string $name Required. Name of the asynchronous query result to get.
78   * Must be of the form `organizations/{org}/queries/{queryId}/result`.
79   * @param array $optParams Optional parameters.
80   * @return GoogleApiHttpBody
81   */
82  public function getResult($name, $optParams = [])
83  {
84    $params = ['name' => $name];
85    $params = array_merge($params, $optParams);
86    return $this->call('getResult', [$params], GoogleApiHttpBody::class);
87  }
88  /**
89   * (hostQueries.getResultView)
90   *
91   * @param string $name Required. Name of the asynchronous query result view to
92   * get. Must be of the form `organizations/{org}/queries/{queryId}/resultView`.
93   * @param array $optParams Optional parameters.
94   * @return GoogleCloudApigeeV1AsyncQueryResultView
95   */
96  public function getResultView($name, $optParams = [])
97  {
98    $params = ['name' => $name];
99    $params = array_merge($params, $optParams);
100    return $this->call('getResultView', [$params], GoogleCloudApigeeV1AsyncQueryResultView::class);
101  }
102  /**
103   * Return a list of Asynchronous Queries at host level.
104   * (hostQueries.listOrganizationsHostQueries)
105   *
106   * @param string $parent Required. The parent resource name. Must be of the form
107   * `organizations/{org}`.
108   * @param array $optParams Optional parameters.
109   *
110   * @opt_param string dataset Filter response list by dataset. Example: `api`,
111   * `mint`
112   * @opt_param string envgroupHostname Required. Filter response list by
113   * hostname.
114   * @opt_param string from Filter response list by returning asynchronous queries
115   * that created after this date time. Time must be in ISO date-time format like
116   * '2011-12-03T10:15:30Z'.
117   * @opt_param string inclQueriesWithoutReport Flag to include asynchronous
118   * queries that don't have a report denifition.
119   * @opt_param string status Filter response list by asynchronous query status.
120   * @opt_param string submittedBy Filter response list by user who submitted
121   * queries.
122   * @opt_param string to Filter response list by returning asynchronous queries
123   * that created before this date time. Time must be in ISO date-time format like
124   * '2011-12-03T10:16:30Z'.
125   * @return GoogleCloudApigeeV1ListAsyncQueriesResponse
126   */
127  public function listOrganizationsHostQueries($parent, $optParams = [])
128  {
129    $params = ['parent' => $parent];
130    $params = array_merge($params, $optParams);
131    return $this->call('list', [$params], GoogleCloudApigeeV1ListAsyncQueriesResponse::class);
132  }
133}
134
135// Adding a class alias for backwards compatibility with the previous class name.
136class_alias(OrganizationsHostQueries::class, 'Google_Service_Apigee_Resource_OrganizationsHostQueries');
137