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 |
|
---|
18 | namespace Google\Service\Digitalassetlinks\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Digitalassetlinks\CheckResponse;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * The "assetlinks" collection of methods.
|
---|
24 | * Typical usage is:
|
---|
25 | * <code>
|
---|
26 | * $digitalassetlinksService = new Google\Service\Digitalassetlinks(...);
|
---|
27 | * $assetlinks = $digitalassetlinksService->assetlinks;
|
---|
28 | * </code>
|
---|
29 | */
|
---|
30 | class Assetlinks extends \Google\Service\Resource
|
---|
31 | {
|
---|
32 | /**
|
---|
33 | * Determines whether the specified (directional) relationship exists between
|
---|
34 | * the specified source and target assets. The relation describes the intent of
|
---|
35 | * the link between the two assets as claimed by the source asset. An example
|
---|
36 | * for such relationships is the delegation of privileges or permissions. This
|
---|
37 | * command is most often used by infrastructure systems to check preconditions
|
---|
38 | * for an action. For example, a client may want to know if it is OK to send a
|
---|
39 | * web URL to a particular mobile app instead. The client can check for the
|
---|
40 | * relevant asset link from the website to the mobile app to decide if the
|
---|
41 | * operation should be allowed. A note about security: if you specify a secure
|
---|
42 | * asset as the source, such as an HTTPS website or an Android app, the API will
|
---|
43 | * ensure that any statements used to generate the response have been made in a
|
---|
44 | * secure way by the owner of that asset. Conversely, if the source asset is an
|
---|
45 | * insecure HTTP website (that is, the URL starts with `http://` instead of
|
---|
46 | * `https://`), the API cannot verify its statements securely, and it is not
|
---|
47 | * possible to ensure that the website's statements have not been altered by a
|
---|
48 | * third party. For more information, see the [Digital Asset Links technical
|
---|
49 | * design
|
---|
50 | * specification](https://github.com/google/digitalassetlinks/blob/master/well-
|
---|
51 | * known/details.md). (assetlinks.check)
|
---|
52 | *
|
---|
53 | * @param array $optParams Optional parameters.
|
---|
54 | *
|
---|
55 | * @opt_param string relation Query string for the relation. We identify
|
---|
56 | * relations with strings of the format `/`, where `` must be one of a set of
|
---|
57 | * pre-defined purpose categories, and `` is a free-form lowercase alphanumeric
|
---|
58 | * string that describes the specific use case of the statement. Refer to [our
|
---|
59 | * API documentation](/digital-asset-links/v1/relation-strings) for the current
|
---|
60 | * list of supported relations. For a query to match an asset link, both the
|
---|
61 | * query's and the asset link's relation strings must match exactly. Example: A
|
---|
62 | * query with relation `delegate_permission/common.handle_all_urls` matches an
|
---|
63 | * asset link with relation `delegate_permission/common.handle_all_urls`.
|
---|
64 | * @opt_param string source.androidApp.certificate.sha256Fingerprint The
|
---|
65 | * uppercase SHA-265 fingerprint of the certificate. From the PEM certificate,
|
---|
66 | * it can be acquired like this: $ keytool -printcert -file $CERTFILE | grep
|
---|
67 | * SHA256: SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \
|
---|
68 | * 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 or like this: $ openssl x509 -in
|
---|
69 | * $CERTFILE -noout -fingerprint -sha256 SHA256
|
---|
70 | * Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \
|
---|
71 | * 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 In this example, the contents
|
---|
72 | * of this field would be `14:6D:E9:83:C5:73:
|
---|
73 | * 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:
|
---|
74 | * 44:E5`. If these tools are not available to you, you can convert the PEM
|
---|
75 | * certificate into the DER format, compute the SHA-256 hash of that string and
|
---|
76 | * represent the result as a hexstring (that is, uppercase hexadecimal
|
---|
77 | * representations of each octet, separated by colons).
|
---|
78 | * @opt_param string source.androidApp.packageName Android App assets are
|
---|
79 | * naturally identified by their Java package name. For example, the Google Maps
|
---|
80 | * app uses the package name `com.google.android.apps.maps`. REQUIRED
|
---|
81 | * @opt_param string source.web.site Web assets are identified by a URL that
|
---|
82 | * contains only the scheme, hostname and port parts. The format is
|
---|
83 | * http[s]://[:] Hostnames must be fully qualified: they must end in a single
|
---|
84 | * period ("`.`"). Only the schemes "http" and "https" are currently allowed.
|
---|
85 | * Port numbers are given as a decimal number, and they must be omitted if the
|
---|
86 | * standard port numbers are used: 80 for http and 443 for https. We call this
|
---|
87 | * limited URL the "site". All URLs that share the same scheme, hostname and
|
---|
88 | * port are considered to be a part of the site and thus belong to the web
|
---|
89 | * asset. Example: the asset with the site `https://www.google.com` contains all
|
---|
90 | * these URLs: * `https://www.google.com/` * `https://www.google.com:443/` *
|
---|
91 | * `https://www.google.com/foo` * `https://www.google.com/foo?bar` *
|
---|
92 | * `https://www.google.com/foo#bar` * `https://user@password:www.google.com/`
|
---|
93 | * But it does not contain these URLs: * `http://www.google.com/` (wrong scheme)
|
---|
94 | * * `https://google.com/` (hostname does not match) *
|
---|
95 | * `https://www.google.com:444/` (port does not match) REQUIRED
|
---|
96 | * @opt_param string target.androidApp.certificate.sha256Fingerprint The
|
---|
97 | * uppercase SHA-265 fingerprint of the certificate. From the PEM certificate,
|
---|
98 | * it can be acquired like this: $ keytool -printcert -file $CERTFILE | grep
|
---|
99 | * SHA256: SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \
|
---|
100 | * 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 or like this: $ openssl x509 -in
|
---|
101 | * $CERTFILE -noout -fingerprint -sha256 SHA256
|
---|
102 | * Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \
|
---|
103 | * 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 In this example, the contents
|
---|
104 | * of this field would be `14:6D:E9:83:C5:73:
|
---|
105 | * 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:
|
---|
106 | * 44:E5`. If these tools are not available to you, you can convert the PEM
|
---|
107 | * certificate into the DER format, compute the SHA-256 hash of that string and
|
---|
108 | * represent the result as a hexstring (that is, uppercase hexadecimal
|
---|
109 | * representations of each octet, separated by colons).
|
---|
110 | * @opt_param string target.androidApp.packageName Android App assets are
|
---|
111 | * naturally identified by their Java package name. For example, the Google Maps
|
---|
112 | * app uses the package name `com.google.android.apps.maps`. REQUIRED
|
---|
113 | * @opt_param string target.web.site Web assets are identified by a URL that
|
---|
114 | * contains only the scheme, hostname and port parts. The format is
|
---|
115 | * http[s]://[:] Hostnames must be fully qualified: they must end in a single
|
---|
116 | * period ("`.`"). Only the schemes "http" and "https" are currently allowed.
|
---|
117 | * Port numbers are given as a decimal number, and they must be omitted if the
|
---|
118 | * standard port numbers are used: 80 for http and 443 for https. We call this
|
---|
119 | * limited URL the "site". All URLs that share the same scheme, hostname and
|
---|
120 | * port are considered to be a part of the site and thus belong to the web
|
---|
121 | * asset. Example: the asset with the site `https://www.google.com` contains all
|
---|
122 | * these URLs: * `https://www.google.com/` * `https://www.google.com:443/` *
|
---|
123 | * `https://www.google.com/foo` * `https://www.google.com/foo?bar` *
|
---|
124 | * `https://www.google.com/foo#bar` * `https://user@password:www.google.com/`
|
---|
125 | * But it does not contain these URLs: * `http://www.google.com/` (wrong scheme)
|
---|
126 | * * `https://google.com/` (hostname does not match) *
|
---|
127 | * `https://www.google.com:444/` (port does not match) REQUIRED
|
---|
128 | * @return CheckResponse
|
---|
129 | * @throws \Google\Service\Exception
|
---|
130 | */
|
---|
131 | public function check($optParams = [])
|
---|
132 | {
|
---|
133 | $params = [];
|
---|
134 | $params = array_merge($params, $optParams);
|
---|
135 | return $this->call('check', [$params], CheckResponse::class);
|
---|
136 | }
|
---|
137 | }
|
---|
138 |
|
---|
139 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
140 | class_alias(Assetlinks::class, 'Google_Service_Digitalassetlinks_Resource_Assetlinks');
|
---|