Skip to content

Commit fc7835b

Browse files
feat: analytics engine v3 feature changes
feat: analytics engine v3 feature changes
1 parent c9e4286 commit fc7835b

13 files changed

+1639
-627
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ deploy:
3939
script: npx semantic-release
4040
skip_cleanup: true
4141
on:
42-
python: '3.5'
42+
python: '3.6'
4343
branch: master
4444
- provider: pypi
4545
user: __token__
@@ -48,5 +48,5 @@ deploy:
4848
repository: https://upload.pypi.org/legacy
4949
skip_cleanup: true
5050
on:
51-
python: '3.5'
51+
python: '3.6'
5252
tags: true
Lines changed: 340 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,340 @@
1+
# -*- coding: utf-8 -*-
2+
# (C) Copyright IBM Corp. 2021.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
"""
17+
Examples for IbmAnalyticsEngineApiV2
18+
"""
19+
20+
from ibm_cloud_sdk_core import ApiException, read_external_sources
21+
import os
22+
import pytest
23+
from iaesdk.ibm_analytics_engine_api_v2 import *
24+
25+
#
26+
# This file provides an example of how to use the IBM Analytics Engine API service.
27+
#
28+
# The following configuration properties are assumed to be defined:
29+
# IBM_ANALYTICS_ENGINE_API_URL=<service base url>
30+
# IBM_ANALYTICS_ENGINE_API_AUTH_TYPE=iam
31+
# IBM_ANALYTICS_ENGINE_API_APIKEY=<IAM apikey>
32+
# IBM_ANALYTICS_ENGINE_API_AUTH_URL=<IAM token service base URL - omit this if using the production environment>
33+
#
34+
# These configuration properties can be exported as environment variables, or stored
35+
# in a configuration file and then:
36+
# export IBM_CREDENTIALS_FILE=<name of configuration file>
37+
#
38+
config_file = 'ibm_analytics_engine_api_v2.env'
39+
40+
ibm_analytics_engine_api_service = None
41+
42+
config = None
43+
44+
45+
##############################################################################
46+
# Start of Examples for Service: IbmAnalyticsEngineApiV2
47+
##############################################################################
48+
# region
49+
class TestIbmAnalyticsEngineApiV2Examples():
50+
"""
51+
Example Test Class for IbmAnalyticsEngineApiV2
52+
"""
53+
54+
@classmethod
55+
def setup_class(cls):
56+
global ibm_analytics_engine_api_service
57+
if os.path.exists(config_file):
58+
os.environ['IBM_CREDENTIALS_FILE'] = config_file
59+
60+
# begin-common
61+
62+
ibm_analytics_engine_api_service = IbmAnalyticsEngineApiV2.new_instance(
63+
)
64+
65+
# end-common
66+
assert ibm_analytics_engine_api_service is not None
67+
68+
# Load the configuration
69+
global config
70+
config = read_external_sources(IbmAnalyticsEngineApiV2.DEFAULT_SERVICE_NAME)
71+
72+
print('Setup complete.')
73+
74+
needscredentials = pytest.mark.skipif(
75+
not os.path.exists(config_file), reason="External configuration not available, skipping..."
76+
)
77+
78+
@needscredentials
79+
def test_get_all_analytics_engines_example(self):
80+
"""
81+
get_all_analytics_engines request example
82+
"""
83+
try:
84+
# begin-getAllAnalyticsEngines
85+
86+
response = ibm_analytics_engine_api_service.get_all_analytics_engines()
87+
88+
# end-getAllAnalyticsEngines
89+
print('\nget_all_analytics_engines() response status code: ', response.get_status_code())
90+
91+
except ApiException as e:
92+
pytest.fail(str(e))
93+
94+
@needscredentials
95+
def test_get_analytics_engine_by_id_example(self):
96+
"""
97+
get_analytics_engine_by_id request example
98+
"""
99+
try:
100+
print('\nget_analytics_engine_by_id() result:')
101+
# begin-getAnalyticsEngineById
102+
103+
analytics_engine = ibm_analytics_engine_api_service.get_analytics_engine_by_id(
104+
instance_guid='testString'
105+
).get_result()
106+
107+
print(json.dumps(analytics_engine, indent=2))
108+
109+
# end-getAnalyticsEngineById
110+
111+
except ApiException as e:
112+
pytest.fail(str(e))
113+
114+
@needscredentials
115+
def test_get_analytics_engine_state_by_id_example(self):
116+
"""
117+
get_analytics_engine_state_by_id request example
118+
"""
119+
try:
120+
print('\nget_analytics_engine_state_by_id() result:')
121+
# begin-getAnalyticsEngineStateById
122+
123+
analytics_engine_state = ibm_analytics_engine_api_service.get_analytics_engine_state_by_id(
124+
instance_guid='testString'
125+
).get_result()
126+
127+
print(json.dumps(analytics_engine_state, indent=2))
128+
129+
# end-getAnalyticsEngineStateById
130+
131+
except ApiException as e:
132+
pytest.fail(str(e))
133+
134+
@needscredentials
135+
def test_create_customization_request_example(self):
136+
"""
137+
create_customization_request request example
138+
"""
139+
try:
140+
print('\ncreate_customization_request() result:')
141+
# begin-createCustomizationRequest
142+
143+
analytics_engine_custom_action_model = {
144+
'name': 'testString',
145+
}
146+
147+
analytics_engine_create_customization_response = ibm_analytics_engine_api_service.create_customization_request(
148+
instance_guid='testString',
149+
target='all',
150+
custom_actions=[analytics_engine_custom_action_model]
151+
).get_result()
152+
153+
print(json.dumps(analytics_engine_create_customization_response, indent=2))
154+
155+
# end-createCustomizationRequest
156+
157+
except ApiException as e:
158+
pytest.fail(str(e))
159+
160+
@needscredentials
161+
def test_get_all_customization_requests_example(self):
162+
"""
163+
get_all_customization_requests request example
164+
"""
165+
try:
166+
print('\nget_all_customization_requests() result:')
167+
# begin-getAllCustomizationRequests
168+
169+
list_analytics_engine_customization_request_collection_item = ibm_analytics_engine_api_service.get_all_customization_requests(
170+
instance_guid='testString'
171+
).get_result()
172+
173+
print(json.dumps(list_analytics_engine_customization_request_collection_item, indent=2))
174+
175+
# end-getAllCustomizationRequests
176+
177+
except ApiException as e:
178+
pytest.fail(str(e))
179+
180+
@needscredentials
181+
def test_get_customization_request_by_id_example(self):
182+
"""
183+
get_customization_request_by_id request example
184+
"""
185+
try:
186+
print('\nget_customization_request_by_id() result:')
187+
# begin-getCustomizationRequestById
188+
189+
analytics_engine_customization_run_details = ibm_analytics_engine_api_service.get_customization_request_by_id(
190+
instance_guid='testString',
191+
request_id='testString'
192+
).get_result()
193+
194+
print(json.dumps(analytics_engine_customization_run_details, indent=2))
195+
196+
# end-getCustomizationRequestById
197+
198+
except ApiException as e:
199+
pytest.fail(str(e))
200+
201+
@needscredentials
202+
def test_resize_cluster_example(self):
203+
"""
204+
resize_cluster request example
205+
"""
206+
try:
207+
print('\nresize_cluster() result:')
208+
# begin-resizeCluster
209+
210+
resize_cluster_request_model = {
211+
}
212+
213+
analytics_engine_resize_cluster_response = ibm_analytics_engine_api_service.resize_cluster(
214+
instance_guid='testString',
215+
body=resize_cluster_request_model
216+
).get_result()
217+
218+
print(json.dumps(analytics_engine_resize_cluster_response, indent=2))
219+
220+
# end-resizeCluster
221+
222+
except ApiException as e:
223+
pytest.fail(str(e))
224+
225+
@needscredentials
226+
def test_reset_cluster_password_example(self):
227+
"""
228+
reset_cluster_password request example
229+
"""
230+
try:
231+
print('\nreset_cluster_password() result:')
232+
# begin-resetClusterPassword
233+
234+
analytics_engine_reset_cluster_password_response = ibm_analytics_engine_api_service.reset_cluster_password(
235+
instance_guid='testString'
236+
).get_result()
237+
238+
print(json.dumps(analytics_engine_reset_cluster_password_response, indent=2))
239+
240+
# end-resetClusterPassword
241+
242+
except ApiException as e:
243+
pytest.fail(str(e))
244+
245+
@needscredentials
246+
def test_configure_logging_example(self):
247+
"""
248+
configure_logging request example
249+
"""
250+
try:
251+
# begin-configureLogging
252+
253+
analytics_engine_logging_node_spec_model = {
254+
'node_type': 'management',
255+
'components': ['ambari-server'],
256+
}
257+
258+
analytics_engine_logging_server_model = {
259+
'type': 'logdna',
260+
'credential': 'testString',
261+
'api_host': 'testString',
262+
'log_host': 'testString',
263+
}
264+
265+
response = ibm_analytics_engine_api_service.configure_logging(
266+
instance_guid='testString',
267+
log_specs=[analytics_engine_logging_node_spec_model],
268+
log_server=analytics_engine_logging_server_model
269+
)
270+
271+
# end-configureLogging
272+
print('\nconfigure_logging() response status code: ', response.get_status_code())
273+
274+
except ApiException as e:
275+
pytest.fail(str(e))
276+
277+
@needscredentials
278+
def test_get_logging_config_example(self):
279+
"""
280+
get_logging_config request example
281+
"""
282+
try:
283+
print('\nget_logging_config() result:')
284+
# begin-getLoggingConfig
285+
286+
analytics_engine_logging_config_details = ibm_analytics_engine_api_service.get_logging_config(
287+
instance_guid='testString'
288+
).get_result()
289+
290+
print(json.dumps(analytics_engine_logging_config_details, indent=2))
291+
292+
# end-getLoggingConfig
293+
294+
except ApiException as e:
295+
pytest.fail(str(e))
296+
297+
@needscredentials
298+
def test_update_private_endpoint_whitelist_example(self):
299+
"""
300+
update_private_endpoint_whitelist request example
301+
"""
302+
try:
303+
print('\nupdate_private_endpoint_whitelist() result:')
304+
# begin-updatePrivateEndpointWhitelist
305+
306+
analytics_engine_whitelist_response = ibm_analytics_engine_api_service.update_private_endpoint_whitelist(
307+
instance_guid='testString',
308+
ip_ranges=['testString'],
309+
action='add'
310+
).get_result()
311+
312+
print(json.dumps(analytics_engine_whitelist_response, indent=2))
313+
314+
# end-updatePrivateEndpointWhitelist
315+
316+
except ApiException as e:
317+
pytest.fail(str(e))
318+
319+
@needscredentials
320+
def test_delete_logging_config_example(self):
321+
"""
322+
delete_logging_config request example
323+
"""
324+
try:
325+
# begin-deleteLoggingConfig
326+
327+
response = ibm_analytics_engine_api_service.delete_logging_config(
328+
instance_guid='testString'
329+
)
330+
331+
# end-deleteLoggingConfig
332+
print('\ndelete_logging_config() response status code: ', response.get_status_code())
333+
334+
except ApiException as e:
335+
pytest.fail(str(e))
336+
337+
# endregion
338+
##############################################################################
339+
# End of Examples for Service: IbmAnalyticsEngineApiV2
340+
##############################################################################

0 commit comments

Comments
 (0)