cdpcurl 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cdpcurl/__init__.py +13 -0
- cdpcurl/__main__.py +25 -0
- cdpcurl/_version.py +17 -0
- cdpcurl/cdpconfig.py +63 -0
- cdpcurl/cdpcurl.py +279 -0
- cdpcurl/cdpv1sign.py +217 -0
- cdpcurl-1.0.0.dist-info/METADATA +302 -0
- cdpcurl-1.0.0.dist-info/RECORD +12 -0
- cdpcurl-1.0.0.dist-info/WHEEL +4 -0
- cdpcurl-1.0.0.dist-info/entry_points.txt +3 -0
- cdpcurl-1.0.0.dist-info/licenses/LICENSE +176 -0
- cdpcurl-1.0.0.dist-info/licenses/NOTICE.txt +42 -0
cdpcurl/__init__.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Copyright 2025 Cloudera, Inc. All rights reserved.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
cdpcurl/__main__.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
# Copyright 2025 Cloudera, Inc. All rights reserved.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
|
|
18
|
+
"""The main entry point. Invoke as `cdpcurl' or `python -m cdpcurl'."""
|
|
19
|
+
|
|
20
|
+
import sys
|
|
21
|
+
from cdpcurl.cdpcurl import main
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
if __name__ == "__main__":
|
|
25
|
+
sys.exit(main())
|
cdpcurl/_version.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# Copyright 2025 Cloudera, Inc. All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# https://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,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
__version__ = "1.0.0"
|
cdpcurl/cdpconfig.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# Copyright 2025 Cloudera, Inc. All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# https://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,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
"""
|
|
18
|
+
cdp profile support
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
import configparser
|
|
22
|
+
import os
|
|
23
|
+
|
|
24
|
+
from typing import Tuple
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def load_cdp_config(
|
|
28
|
+
access_key,
|
|
29
|
+
private_key,
|
|
30
|
+
credentials_path,
|
|
31
|
+
profile,
|
|
32
|
+
) -> Tuple[str, str]:
|
|
33
|
+
"""
|
|
34
|
+
Load CDP credential configuration, by parsing credential file, by checking
|
|
35
|
+
(access_key,private_key) are not (None,None)
|
|
36
|
+
"""
|
|
37
|
+
if access_key is None or private_key is None:
|
|
38
|
+
exists = os.path.exists(credentials_path)
|
|
39
|
+
if not exists:
|
|
40
|
+
msg = "Credentials file '{0}' does not exist"
|
|
41
|
+
raise Exception(msg.format(credentials_path))
|
|
42
|
+
|
|
43
|
+
config = configparser.ConfigParser()
|
|
44
|
+
config.read(credentials_path)
|
|
45
|
+
|
|
46
|
+
if not config.has_section(profile):
|
|
47
|
+
raise Exception("CDP profile '{0}' not found".format(profile))
|
|
48
|
+
|
|
49
|
+
if access_key is None:
|
|
50
|
+
if config.has_option(profile, "cdp_access_key_id"):
|
|
51
|
+
access_key = config.get(profile, "cdp_access_key_id")
|
|
52
|
+
else:
|
|
53
|
+
msg = "CDP profile '{0}' is missing 'cdp_access_key_id'"
|
|
54
|
+
raise Exception(msg.format(profile))
|
|
55
|
+
|
|
56
|
+
if private_key is None:
|
|
57
|
+
if config.has_option(profile, "cdp_private_key"):
|
|
58
|
+
private_key = config.get(profile, "cdp_private_key")
|
|
59
|
+
else:
|
|
60
|
+
msg = "CDP profile '{0}' is missing 'cdp_private_key'"
|
|
61
|
+
raise Exception(msg.format(profile))
|
|
62
|
+
|
|
63
|
+
return access_key, private_key
|
cdpcurl/cdpcurl.py
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
# Copyright 2025 Cloudera, Inc. All rights reserved.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
cdpcurl implementation
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
import datetime
|
|
23
|
+
import http.client
|
|
24
|
+
import io
|
|
25
|
+
import os
|
|
26
|
+
import re
|
|
27
|
+
import sys
|
|
28
|
+
|
|
29
|
+
import configargparse
|
|
30
|
+
import requests
|
|
31
|
+
|
|
32
|
+
from contextlib import redirect_stdout, redirect_stderr
|
|
33
|
+
from email.utils import formatdate
|
|
34
|
+
|
|
35
|
+
from cdpcurl.cdpv1sign import make_signature_header
|
|
36
|
+
from cdpcurl.cdpconfig import load_cdp_config
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def __format_logs(data):
|
|
40
|
+
formatted_output = ""
|
|
41
|
+
lines = data.strip().split("\n")
|
|
42
|
+
|
|
43
|
+
send_re = r"^(send: b'|send: )(.*?)'(\r\n)?$"
|
|
44
|
+
reply_re = r"^reply: '(.*?)'$"
|
|
45
|
+
header_re = r"^header: (.*?)[:]\s(.*)$"
|
|
46
|
+
|
|
47
|
+
for line in lines:
|
|
48
|
+
if not line:
|
|
49
|
+
continue
|
|
50
|
+
|
|
51
|
+
match = re.match(send_re, line)
|
|
52
|
+
if match:
|
|
53
|
+
decoded_bytes = match.group(2).encode("latin-1").decode("unicode_escape")
|
|
54
|
+
for subline in decoded_bytes.splitlines():
|
|
55
|
+
formatted_output += f"> {subline}\n"
|
|
56
|
+
continue
|
|
57
|
+
|
|
58
|
+
match = re.match(reply_re, line)
|
|
59
|
+
if match:
|
|
60
|
+
decoded_bytes = match.group(1).encode("latin-1").decode("unicode_escape")
|
|
61
|
+
for subline in decoded_bytes.splitlines():
|
|
62
|
+
formatted_output += f"< {subline}\n"
|
|
63
|
+
continue
|
|
64
|
+
|
|
65
|
+
match = re.match(header_re, line)
|
|
66
|
+
if match:
|
|
67
|
+
formatted_output += f"< {match.group(1)}: {match.group(2)}\n"
|
|
68
|
+
continue
|
|
69
|
+
|
|
70
|
+
formatted_output += f"* {line}\n"
|
|
71
|
+
|
|
72
|
+
return formatted_output.strip()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def __send_request(uri, data, headers, method, verify, verbose):
|
|
76
|
+
|
|
77
|
+
if verbose:
|
|
78
|
+
http.client.HTTPConnection.debuglevel = 1
|
|
79
|
+
|
|
80
|
+
output_buffer = io.StringIO()
|
|
81
|
+
|
|
82
|
+
with redirect_stdout(output_buffer), redirect_stderr(output_buffer):
|
|
83
|
+
response = requests.request(
|
|
84
|
+
method,
|
|
85
|
+
uri,
|
|
86
|
+
headers=headers,
|
|
87
|
+
data=data,
|
|
88
|
+
verify=verify,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
print(__format_logs(output_buffer.getvalue()))
|
|
92
|
+
|
|
93
|
+
return response
|
|
94
|
+
else:
|
|
95
|
+
return requests.request(
|
|
96
|
+
method,
|
|
97
|
+
uri,
|
|
98
|
+
headers=headers,
|
|
99
|
+
data=data,
|
|
100
|
+
verify=verify,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def __now():
|
|
105
|
+
return datetime.datetime.now(datetime.timezone.utc)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def make_request(
|
|
109
|
+
method,
|
|
110
|
+
uri,
|
|
111
|
+
headers,
|
|
112
|
+
data,
|
|
113
|
+
access_key,
|
|
114
|
+
private_key,
|
|
115
|
+
data_binary,
|
|
116
|
+
verify=True,
|
|
117
|
+
verbose=False,
|
|
118
|
+
):
|
|
119
|
+
"""
|
|
120
|
+
Make HTTP request with CDP request signing
|
|
121
|
+
|
|
122
|
+
:return: http request object
|
|
123
|
+
:param method: str
|
|
124
|
+
:param uri: str
|
|
125
|
+
:param headers: dict
|
|
126
|
+
:param data: str
|
|
127
|
+
:param profile: str
|
|
128
|
+
:param access_key: str
|
|
129
|
+
:param private_key: str
|
|
130
|
+
:param data_binary: bool
|
|
131
|
+
:param verify: bool
|
|
132
|
+
:param verbose: bool
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
if "x-altus-auth" in headers:
|
|
136
|
+
raise Exception("Malformed request: x-altus-auth found in headers")
|
|
137
|
+
|
|
138
|
+
if "x-altus-date" in headers:
|
|
139
|
+
raise Exception("Malformed request: x-altus-date found in headers")
|
|
140
|
+
|
|
141
|
+
headers["x-altus-date"] = formatdate(
|
|
142
|
+
timeval=__now().timestamp(),
|
|
143
|
+
usegmt=True,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
headers["x-altus-auth"] = make_signature_header(
|
|
147
|
+
method,
|
|
148
|
+
uri,
|
|
149
|
+
headers,
|
|
150
|
+
access_key,
|
|
151
|
+
private_key,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
if data_binary:
|
|
155
|
+
return __send_request(uri, data, headers, method, verify, verbose)
|
|
156
|
+
|
|
157
|
+
return __send_request(uri, data.encode("utf-8"), headers, method, verify, verbose)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def inner_main(argv):
|
|
161
|
+
"""
|
|
162
|
+
cdpcurl CLI main entry point
|
|
163
|
+
"""
|
|
164
|
+
default_headers = ["Content-Type: application/json"]
|
|
165
|
+
|
|
166
|
+
parser = configargparse.ArgumentParser(
|
|
167
|
+
description="CURL with CDP request signing",
|
|
168
|
+
formatter_class=configargparse.ArgumentDefaultsHelpFormatter,
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
parser.add_argument(
|
|
172
|
+
"-v",
|
|
173
|
+
"--verbose",
|
|
174
|
+
action="store_true",
|
|
175
|
+
help="log request and response headers",
|
|
176
|
+
default=False,
|
|
177
|
+
)
|
|
178
|
+
parser.add_argument(
|
|
179
|
+
"-f",
|
|
180
|
+
"--output-format",
|
|
181
|
+
help="output format",
|
|
182
|
+
choices=["string", "bytes-literal"],
|
|
183
|
+
default="string",
|
|
184
|
+
)
|
|
185
|
+
parser.add_argument(
|
|
186
|
+
"-X",
|
|
187
|
+
"--request",
|
|
188
|
+
help="Specify request command to use",
|
|
189
|
+
default="GET",
|
|
190
|
+
)
|
|
191
|
+
parser.add_argument("-d", "--data", help="HTTP POST data", default="")
|
|
192
|
+
parser.add_argument("-H", "--header", help="HTTP header", action="append")
|
|
193
|
+
parser.add_argument(
|
|
194
|
+
"-k",
|
|
195
|
+
"--insecure",
|
|
196
|
+
action="store_false",
|
|
197
|
+
help="This option allows cdpcurl to proceed and "
|
|
198
|
+
"operate even for server connections otherwise "
|
|
199
|
+
"considered insecure",
|
|
200
|
+
)
|
|
201
|
+
parser.add_argument(
|
|
202
|
+
"--data-binary",
|
|
203
|
+
action="store_true",
|
|
204
|
+
help="Process HTTP POST data exactly as specified "
|
|
205
|
+
"with no extra processing whatsoever.",
|
|
206
|
+
default=False,
|
|
207
|
+
)
|
|
208
|
+
parser.add_argument(
|
|
209
|
+
"--profile",
|
|
210
|
+
help="CDP profile",
|
|
211
|
+
default="default",
|
|
212
|
+
env_var="CDP_PROFILE",
|
|
213
|
+
)
|
|
214
|
+
parser.add_argument("--access_key", env_var="CDP_ACCESS_KEY_ID")
|
|
215
|
+
parser.add_argument("--private_key", env_var="CDP_PRIVATE_KEY")
|
|
216
|
+
|
|
217
|
+
parser.add_argument("uri")
|
|
218
|
+
|
|
219
|
+
args = parser.parse_args(argv)
|
|
220
|
+
|
|
221
|
+
data = args.data
|
|
222
|
+
|
|
223
|
+
if data is not None and data.startswith("@"):
|
|
224
|
+
filename = data[1:]
|
|
225
|
+
with open(filename, "r") as post_data_file:
|
|
226
|
+
data = post_data_file.read()
|
|
227
|
+
|
|
228
|
+
if args.header is None:
|
|
229
|
+
args.header = default_headers
|
|
230
|
+
|
|
231
|
+
# pylint: disable=unnecessary-comprehension
|
|
232
|
+
headers = {k: v for (k, v) in map(lambda s: s.split(": "), args.header)}
|
|
233
|
+
|
|
234
|
+
# TODO Enable credential path per argument
|
|
235
|
+
credentials_path = os.path.expanduser("~") + "/.cdp/credentials"
|
|
236
|
+
args.access_key, args.private_key = load_cdp_config(
|
|
237
|
+
args.access_key,
|
|
238
|
+
args.private_key,
|
|
239
|
+
credentials_path,
|
|
240
|
+
args.profile,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
if args.access_key is None:
|
|
244
|
+
raise ValueError("No access key is available")
|
|
245
|
+
|
|
246
|
+
if args.private_key is None:
|
|
247
|
+
raise ValueError("No private key is available")
|
|
248
|
+
|
|
249
|
+
response = make_request(
|
|
250
|
+
args.request,
|
|
251
|
+
args.uri,
|
|
252
|
+
headers,
|
|
253
|
+
data,
|
|
254
|
+
args.access_key,
|
|
255
|
+
args.private_key,
|
|
256
|
+
args.data_binary,
|
|
257
|
+
args.insecure,
|
|
258
|
+
args.verbose,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
if args.output_format == "bytes-literal":
|
|
262
|
+
print(response.text.encode("utf-8"))
|
|
263
|
+
else:
|
|
264
|
+
print(response.text)
|
|
265
|
+
|
|
266
|
+
response.raise_for_status()
|
|
267
|
+
|
|
268
|
+
return 0
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
def main():
|
|
272
|
+
"""
|
|
273
|
+
main method
|
|
274
|
+
"""
|
|
275
|
+
inner_main(sys.argv[1:])
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
if __name__ == "__main__":
|
|
279
|
+
sys.exit(main())
|
cdpcurl/cdpv1sign.py
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
# Copyright 2025 Cloudera, Inc. All rights reserved.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
Implementation of the CDP API signature specification, V1
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
import json
|
|
23
|
+
import os
|
|
24
|
+
import sys
|
|
25
|
+
|
|
26
|
+
import configargparse
|
|
27
|
+
|
|
28
|
+
from base64 import b64decode, urlsafe_b64encode
|
|
29
|
+
from collections import OrderedDict
|
|
30
|
+
from cryptography.hazmat.primitives.asymmetric import ed25519
|
|
31
|
+
from email.utils import formatdate
|
|
32
|
+
from urllib.parse import urlparse
|
|
33
|
+
|
|
34
|
+
from cdpcurl.cdpconfig import load_cdp_config
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def create_canonical_request_string(
|
|
38
|
+
method,
|
|
39
|
+
uri,
|
|
40
|
+
headers,
|
|
41
|
+
auth_method,
|
|
42
|
+
):
|
|
43
|
+
"""
|
|
44
|
+
Create a canonical request string from aspects of the request.
|
|
45
|
+
"""
|
|
46
|
+
headers_of_interest = []
|
|
47
|
+
for header_name in ["content-type", "x-altus-date"]:
|
|
48
|
+
found = False
|
|
49
|
+
for key in headers:
|
|
50
|
+
key_lc = key.lower()
|
|
51
|
+
if headers[key] is not None and key_lc == header_name:
|
|
52
|
+
headers_of_interest.append(headers[key].strip())
|
|
53
|
+
found = True
|
|
54
|
+
if not found:
|
|
55
|
+
headers_of_interest.append("")
|
|
56
|
+
|
|
57
|
+
# Our signature verification with treat a query with no = as part of the
|
|
58
|
+
# path, so we do as well. It appears to be a behavior left to the server
|
|
59
|
+
# implementation, and python and our java servlet implementation disagree.
|
|
60
|
+
uri_components = urlparse(uri)
|
|
61
|
+
path = uri_components.path
|
|
62
|
+
if not path:
|
|
63
|
+
path = "/"
|
|
64
|
+
if uri_components.query:
|
|
65
|
+
path += "?" + uri_components.query
|
|
66
|
+
|
|
67
|
+
canonical_string = method.upper() + "\n"
|
|
68
|
+
canonical_string += "\n".join(headers_of_interest) + "\n"
|
|
69
|
+
canonical_string += path + "\n"
|
|
70
|
+
canonical_string += auth_method
|
|
71
|
+
|
|
72
|
+
return canonical_string
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def create_signature_string(
|
|
76
|
+
canonical_string,
|
|
77
|
+
private_key,
|
|
78
|
+
):
|
|
79
|
+
"""
|
|
80
|
+
Create the string form of the digital signature of the canonical request
|
|
81
|
+
string.
|
|
82
|
+
"""
|
|
83
|
+
seed = b64decode(private_key)
|
|
84
|
+
if len(seed) != 32:
|
|
85
|
+
raise Exception("Not an Ed25519 private key!")
|
|
86
|
+
parsed_private_key = ed25519.Ed25519PrivateKey.from_private_bytes(seed)
|
|
87
|
+
|
|
88
|
+
signature = parsed_private_key.sign(
|
|
89
|
+
canonical_string.encode("utf-8"),
|
|
90
|
+
)
|
|
91
|
+
return urlsafe_b64encode(signature).strip().decode("utf-8")
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def create_encoded_authn_params_string(
|
|
95
|
+
access_key,
|
|
96
|
+
auth_method,
|
|
97
|
+
):
|
|
98
|
+
"""
|
|
99
|
+
Create the base 64 encoded string of authentication parameters.
|
|
100
|
+
"""
|
|
101
|
+
auth_params = OrderedDict()
|
|
102
|
+
auth_params["access_key_id"] = access_key
|
|
103
|
+
auth_params["auth_method"] = auth_method
|
|
104
|
+
encoded_json = json.dumps(auth_params).encode("utf-8")
|
|
105
|
+
return urlsafe_b64encode(encoded_json).strip()
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def create_signature_header(
|
|
109
|
+
encoded_authn_params,
|
|
110
|
+
signature,
|
|
111
|
+
):
|
|
112
|
+
"""
|
|
113
|
+
Combine the encoded authentication parameters string and signature string
|
|
114
|
+
into the signature header value.
|
|
115
|
+
"""
|
|
116
|
+
return "%s.%s" % (encoded_authn_params.decode("utf-8"), signature)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def make_signature_header(
|
|
120
|
+
method,
|
|
121
|
+
uri,
|
|
122
|
+
headers,
|
|
123
|
+
access_key,
|
|
124
|
+
private_key,
|
|
125
|
+
):
|
|
126
|
+
"""
|
|
127
|
+
Generates the value to be used for the x-altus-auth header in the service
|
|
128
|
+
call.
|
|
129
|
+
"""
|
|
130
|
+
if len(private_key) != 44:
|
|
131
|
+
raise Exception("Only ed25519v1 keys are supported!")
|
|
132
|
+
|
|
133
|
+
auth_method = "ed25519v1"
|
|
134
|
+
|
|
135
|
+
canonical_string = create_canonical_request_string(
|
|
136
|
+
method,
|
|
137
|
+
uri,
|
|
138
|
+
headers,
|
|
139
|
+
auth_method,
|
|
140
|
+
)
|
|
141
|
+
signature = create_signature_string(canonical_string, private_key)
|
|
142
|
+
encoded_authn_params = create_encoded_authn_params_string(
|
|
143
|
+
access_key,
|
|
144
|
+
auth_method,
|
|
145
|
+
)
|
|
146
|
+
signature_header = create_signature_header(encoded_authn_params, signature)
|
|
147
|
+
return signature_header
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def inner_main(argv):
|
|
151
|
+
"""
|
|
152
|
+
cdpv1sign main entry point
|
|
153
|
+
"""
|
|
154
|
+
parser = configargparse.ArgumentParser(
|
|
155
|
+
description="Curl with CDP request signing",
|
|
156
|
+
formatter_class=configargparse.ArgumentDefaultsHelpFormatter,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
parser.add_argument(
|
|
160
|
+
"-X",
|
|
161
|
+
"--request",
|
|
162
|
+
help="Specify request command to use",
|
|
163
|
+
default="GET",
|
|
164
|
+
)
|
|
165
|
+
parser.add_argument(
|
|
166
|
+
"--profile",
|
|
167
|
+
help="CDP profile",
|
|
168
|
+
default="default",
|
|
169
|
+
env_var="CDP_PROFILE",
|
|
170
|
+
)
|
|
171
|
+
parser.add_argument("--access_key", env_var="CDP_ACCESS_KEY_ID")
|
|
172
|
+
parser.add_argument("--private_key", env_var="CDP_PRIVATE_KEY")
|
|
173
|
+
# date???
|
|
174
|
+
|
|
175
|
+
parser.add_argument("uri")
|
|
176
|
+
|
|
177
|
+
args = parser.parse_args(argv)
|
|
178
|
+
|
|
179
|
+
credentials_path = os.path.expanduser("~") + "/.cdp/credentials"
|
|
180
|
+
args.access_key, args.private_key = load_cdp_config(
|
|
181
|
+
args.access_key,
|
|
182
|
+
args.private_key,
|
|
183
|
+
credentials_path,
|
|
184
|
+
args.profile,
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
if args.access_key is None:
|
|
188
|
+
raise ValueError("No access key is available")
|
|
189
|
+
|
|
190
|
+
if args.private_key is None:
|
|
191
|
+
raise ValueError("No private key is available")
|
|
192
|
+
|
|
193
|
+
headers = {"Content-Type": "application/json"}
|
|
194
|
+
headers["x-altus-date"] = formatdate(usegmt=True)
|
|
195
|
+
headers["x-altus-auth"] = make_signature_header(
|
|
196
|
+
args.request,
|
|
197
|
+
args.uri,
|
|
198
|
+
headers,
|
|
199
|
+
args.access_key,
|
|
200
|
+
args.private_key,
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
for header_key, header_value in headers.items():
|
|
204
|
+
print("{}: {}".format(header_key, header_value))
|
|
205
|
+
|
|
206
|
+
return 0
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def main():
|
|
210
|
+
"""
|
|
211
|
+
main method
|
|
212
|
+
"""
|
|
213
|
+
inner_main(sys.argv[1:])
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
if __name__ == "__main__":
|
|
217
|
+
sys.exit(main())
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cdpcurl
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A curl-like tool for Cloudera on Cloud (CDP) API requests
|
|
5
|
+
Author: Cloudera, Inc.
|
|
6
|
+
License: Apache License
|
|
7
|
+
Version 2.0, January 2004
|
|
8
|
+
http://www.apache.org/licenses/
|
|
9
|
+
|
|
10
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
+
|
|
12
|
+
1. Definitions.
|
|
13
|
+
|
|
14
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
15
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
16
|
+
|
|
17
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
18
|
+
the copyright owner that is granting the License.
|
|
19
|
+
|
|
20
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
21
|
+
other entities that control, are controlled by, or are under common
|
|
22
|
+
control with that entity. For the purposes of this definition,
|
|
23
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
24
|
+
direction or management of such entity, whether by contract or
|
|
25
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
26
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
27
|
+
|
|
28
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
29
|
+
exercising permissions granted by this License.
|
|
30
|
+
|
|
31
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
32
|
+
including but not limited to software source code, documentation
|
|
33
|
+
source, and configuration files.
|
|
34
|
+
|
|
35
|
+
"Object" form shall mean any form resulting from mechanical
|
|
36
|
+
transformation or translation of a Source form, including but
|
|
37
|
+
not limited to compiled object code, generated documentation,
|
|
38
|
+
and conversions to other media types.
|
|
39
|
+
|
|
40
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
41
|
+
Object form, made available under the License, as indicated by a
|
|
42
|
+
copyright notice that is included in or attached to the work
|
|
43
|
+
(an example is provided in the Appendix below).
|
|
44
|
+
|
|
45
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
46
|
+
form, that is based on (or derived from) the Work and for which the
|
|
47
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
48
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
49
|
+
of this License, Derivative Works shall not include works that remain
|
|
50
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
51
|
+
the Work and Derivative Works thereof.
|
|
52
|
+
|
|
53
|
+
"Contribution" shall mean any work of authorship, including
|
|
54
|
+
the original version of the Work and any modifications or additions
|
|
55
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
56
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
57
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
58
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
59
|
+
means any form of electronic, verbal, or written communication sent
|
|
60
|
+
to the Licensor or its representatives, including but not limited to
|
|
61
|
+
communication on electronic mailing lists, source code control systems,
|
|
62
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
63
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
64
|
+
excluding communication that is conspicuously marked or otherwise
|
|
65
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
66
|
+
|
|
67
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
68
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
69
|
+
subsequently incorporated within the Work.
|
|
70
|
+
|
|
71
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
72
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
73
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
74
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
75
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
76
|
+
Work and such Derivative Works in Source or Object form.
|
|
77
|
+
|
|
78
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
79
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
80
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
81
|
+
(except as stated in this section) patent license to make, have made,
|
|
82
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
83
|
+
where such license applies only to those patent claims licensable
|
|
84
|
+
by such Contributor that are necessarily infringed by their
|
|
85
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
86
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
87
|
+
institute patent litigation against any entity (including a
|
|
88
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
89
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
90
|
+
or contributory patent infringement, then any patent licenses
|
|
91
|
+
granted to You under this License for that Work shall terminate
|
|
92
|
+
as of the date such litigation is filed.
|
|
93
|
+
|
|
94
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
95
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
96
|
+
modifications, and in Source or Object form, provided that You
|
|
97
|
+
meet the following conditions:
|
|
98
|
+
|
|
99
|
+
(a) You must give any other recipients of the Work or
|
|
100
|
+
Derivative Works a copy of this License; and
|
|
101
|
+
|
|
102
|
+
(b) You must cause any modified files to carry prominent notices
|
|
103
|
+
stating that You changed the files; and
|
|
104
|
+
|
|
105
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
106
|
+
that You distribute, all copyright, patent, trademark, and
|
|
107
|
+
attribution notices from the Source form of the Work,
|
|
108
|
+
excluding those notices that do not pertain to any part of
|
|
109
|
+
the Derivative Works; and
|
|
110
|
+
|
|
111
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
112
|
+
distribution, then any Derivative Works that You distribute must
|
|
113
|
+
include a readable copy of the attribution notices contained
|
|
114
|
+
within such NOTICE file, excluding those notices that do not
|
|
115
|
+
pertain to any part of the Derivative Works, in at least one
|
|
116
|
+
of the following places: within a NOTICE text file distributed
|
|
117
|
+
as part of the Derivative Works; within the Source form or
|
|
118
|
+
documentation, if provided along with the Derivative Works; or,
|
|
119
|
+
within a display generated by the Derivative Works, if and
|
|
120
|
+
wherever such third-party notices normally appear. The contents
|
|
121
|
+
of the NOTICE file are for informational purposes only and
|
|
122
|
+
do not modify the License. You may add Your own attribution
|
|
123
|
+
notices within Derivative Works that You distribute, alongside
|
|
124
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
125
|
+
that such additional attribution notices cannot be construed
|
|
126
|
+
as modifying the License.
|
|
127
|
+
|
|
128
|
+
You may add Your own copyright statement to Your modifications and
|
|
129
|
+
may provide additional or different license terms and conditions
|
|
130
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
131
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
132
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
133
|
+
the conditions stated in this License.
|
|
134
|
+
|
|
135
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
136
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
137
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
138
|
+
this License, without any additional terms or conditions.
|
|
139
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
140
|
+
the terms of any separate license agreement you may have executed
|
|
141
|
+
with Licensor regarding such Contributions.
|
|
142
|
+
|
|
143
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
144
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
145
|
+
except as required for reasonable and customary use in describing the
|
|
146
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
147
|
+
|
|
148
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
149
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
150
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
151
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
152
|
+
implied, including, without limitation, any warranties or conditions
|
|
153
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
154
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
155
|
+
appropriateness of using or redistributing the Work and assume any
|
|
156
|
+
risks associated with Your exercise of permissions under this License.
|
|
157
|
+
|
|
158
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
159
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
160
|
+
unless required by applicable law (such as deliberate and grossly
|
|
161
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
162
|
+
liable to You for damages, including any direct, indirect, special,
|
|
163
|
+
incidental, or consequential damages of any character arising as a
|
|
164
|
+
result of this License or out of the use or inability to use the
|
|
165
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
166
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
167
|
+
other commercial damages or losses), even if such Contributor
|
|
168
|
+
has been advised of the possibility of such damages.
|
|
169
|
+
|
|
170
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
171
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
172
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
173
|
+
or other liability obligations and/or rights consistent with this
|
|
174
|
+
License. However, in accepting such obligations, You may act only
|
|
175
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
176
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
177
|
+
defend, and hold each Contributor harmless for any liability
|
|
178
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
179
|
+
of your accepting any such warranty or additional liability.
|
|
180
|
+
|
|
181
|
+
END OF TERMS AND CONDITIONS
|
|
182
|
+
License-File: LICENSE
|
|
183
|
+
License-File: NOTICE.txt
|
|
184
|
+
Keywords: authentication,cdp,cloudera,curl,public_cloud
|
|
185
|
+
Classifier: Development Status :: 3 - Alpha
|
|
186
|
+
Classifier: Intended Audience :: Developers
|
|
187
|
+
Classifier: Intended Audience :: System Administrators
|
|
188
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
189
|
+
Classifier: Natural Language :: English
|
|
190
|
+
Classifier: Operating System :: OS Independent
|
|
191
|
+
Classifier: Programming Language :: Python
|
|
192
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
193
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
194
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
195
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
196
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
197
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
198
|
+
Requires-Python: >=3.7
|
|
199
|
+
Requires-Dist: configargparse
|
|
200
|
+
Requires-Dist: configparser
|
|
201
|
+
Requires-Dist: cryptography>=2.8
|
|
202
|
+
Requires-Dist: requests>=2.20.0
|
|
203
|
+
Requires-Dist: urllib3>=1.25.3
|
|
204
|
+
Description-Content-Type: text/markdown
|
|
205
|
+
|
|
206
|
+
# cdpcurl
|
|
207
|
+
|
|
208
|
+
`curl`-like tool with CDP request signing. Inspired by and built from [awscurl](https://github.com/okigan/awscurl). See that repository's [README](https://github.com/okigan/awscurl/tree/master/README.md) for installation and usage instructions beyond what is provided here.
|
|
209
|
+
|
|
210
|
+
## Building
|
|
211
|
+
|
|
212
|
+
Create a virtualenv if desired.
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# For typical virtualenv
|
|
216
|
+
virtualenv cdpcurlenv
|
|
217
|
+
cdpcurlenv/bin/activate
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# For pyenv
|
|
222
|
+
pyenv virtualenv cdpcurlenv
|
|
223
|
+
pyenv activate cdpcurlenv
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Then, in this directory:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
pip install .
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Usage
|
|
233
|
+
|
|
234
|
+
Run `cdpcurl --help` for a complete list of options.
|
|
235
|
+
|
|
236
|
+
Before using `cdpcurl`, generate an access key / private key pair for your CDP user account using the CDP management console. You have two options for passing those keys to `cdpcurl`:
|
|
237
|
+
|
|
238
|
+
* Pass the keys to `cdpcurl` using the `--access-key` and `--private-key` options
|
|
239
|
+
* (Recommended) Create a profile in `$HOME/.cdp/credentials` containing the keys and then use the `--profile` option in `cdpcurl` calls
|
|
240
|
+
|
|
241
|
+
For example:
|
|
242
|
+
|
|
243
|
+
```ini
|
|
244
|
+
[myuserprofile]
|
|
245
|
+
cdp_access_key_id = 6744f22e-c46a-406d-ad28-987584f45351
|
|
246
|
+
cdp_private_key = abcdefgh...................................=
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Most CDP API calls are `POST` requests, so be sure to specify `-X POST`, and provide the request content using the `-d` option. If the `-d` option value begins with "`@`", the remainder of the value is the path to a file containing the content; otherwise, the value is the content itself.
|
|
250
|
+
|
|
251
|
+
To form the URI, start by determining the hostname based on the service being called:
|
|
252
|
+
|
|
253
|
+
* iam: `iamapi.us-west-1.altus.cloudera.com`
|
|
254
|
+
* all other services: `api.us-west-1.cdp.cloudera.com`
|
|
255
|
+
|
|
256
|
+
The correct URI is an HTTPS URL at the chosen host, with a path indicated for your desired endpoint in the [API documentation](https://cloudera.github.io/cdp-dev-docs/api-docs/).
|
|
257
|
+
|
|
258
|
+
## Examples
|
|
259
|
+
|
|
260
|
+
Get your own account information, using a profile named `demo`:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
$ cdpcurl --profile demo -X POST -d '{}' https://iamapi.us-west-1.altus.cloudera.com/iam/getAccount
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
List all environments with the `sandbox` profile:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
$ cdpcurl --profile sandbox -X POST -d '{}' https://api.us-west-1.cdp.cloudera.com/api/v1/environments2/listEnvironments
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Request Signing
|
|
273
|
+
|
|
274
|
+
A CDP API call requires a request signature to be passed in the `x-altus-auth` header, along with a corresponding timestamp in the `x-altus-date" header`. `cdpcurl` constructs the headers automatically. However, if you would rather use a different HTTP client, such as ordinary `curl`, then you may directly use the `cdpsign` script within `cdpcurl` to generate these required headers. You may then parse the header values from the script output and feed them to your preferred client.
|
|
275
|
+
|
|
276
|
+
> [!warning]
|
|
277
|
+
> CDP API services will reject calls with timestamps too far in the past, so generate new headers for each call.
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
$ cdpsign -X POST https://api.us-west-1.cdp.cloudera.com/api/v1/environments2/listEnvironments
|
|
281
|
+
Content-Type: application/json
|
|
282
|
+
x-altus-date: Fri, 28 Aug 2020 20:38:38 GMT
|
|
283
|
+
x-altus-auth: (very long string value)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
The signature algorithm specification is available from the [API documentation](https://cloudera.github.io/cdp-dev-docs/api-docs/).
|
|
287
|
+
|
|
288
|
+
## License
|
|
289
|
+
|
|
290
|
+
Copyright 2025 Cloudera, Inc. All rights reserved.
|
|
291
|
+
|
|
292
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
293
|
+
you may not use this file except in compliance with the License.
|
|
294
|
+
You may obtain a copy of the License at
|
|
295
|
+
|
|
296
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
297
|
+
|
|
298
|
+
Unless required by applicable law or agreed to in writing, software
|
|
299
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
300
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
301
|
+
See the License for the specific language governing permissions and
|
|
302
|
+
limitations under the License.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
cdpcurl/__init__.py,sha256=nTq0OSx_D9r01RbtneBnu9JJC7U3UwBNYwXnOunguhY,601
|
|
2
|
+
cdpcurl/__main__.py,sha256=hMetFqbxFSaTfef0PgRCqXecT-_7HqvwU5wtuE8Vwik,816
|
|
3
|
+
cdpcurl/_version.py,sha256=fJYcBwXXfbpEGXBSghsmR5r7sriiROvdCi32e5a98UE,649
|
|
4
|
+
cdpcurl/cdpconfig.py,sha256=cSDYMcbTIAqNCgHDiyl_og2PIPcsDF4d_kgTXZc-dhQ,2064
|
|
5
|
+
cdpcurl/cdpcurl.py,sha256=EUkTr6pI_91ZPCR0oyVSDDgm3B0a884gBTuKX2rNke8,7090
|
|
6
|
+
cdpcurl/cdpv1sign.py,sha256=mwhz3pp5PplvWlLIjttGrt0iL_aEL3z0BPxwJMGklsA,5833
|
|
7
|
+
cdpcurl-1.0.0.dist-info/METADATA,sha256=XGbHNgo84_tN68rPMLRa6DRqzE8DiSSqF7irXzUu7lo,16475
|
|
8
|
+
cdpcurl-1.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
9
|
+
cdpcurl-1.0.0.dist-info/entry_points.txt,sha256=tZhOuzd9RNNVgluLe66aAaPJdjLNlwLyiQlI3NMYobA,82
|
|
10
|
+
cdpcurl-1.0.0.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
|
11
|
+
cdpcurl-1.0.0.dist-info/licenses/NOTICE.txt,sha256=drnPopboBG1-NjX9VU8JZJD5IfmV_AcqaKLOQsHuzn0,1930
|
|
12
|
+
cdpcurl-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Copyright 2025 Cloudera, Inc. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
14
|
+
|
|
15
|
+
===============================================================================
|
|
16
|
+
|
|
17
|
+
This software is a modification of awscurl (https://github.com/okigan/awscurl),
|
|
18
|
+
whose license is below.
|
|
19
|
+
|
|
20
|
+
MIT License
|
|
21
|
+
|
|
22
|
+
Copyright 2015 by the contributors to awscurl
|
|
23
|
+
|
|
24
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
25
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
26
|
+
in the Software without restriction, including without limitation the rights
|
|
27
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
28
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
29
|
+
furnished to do so, subject to the following conditions:
|
|
30
|
+
|
|
31
|
+
The above copyright notice and this permission notice shall be included in all
|
|
32
|
+
copies or substantial portions of the Software.
|
|
33
|
+
|
|
34
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
35
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
36
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
37
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
38
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
39
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
40
|
+
SOFTWARE.
|
|
41
|
+
|
|
42
|
+
===============================================================================
|