16
16
import com .ibm .cloud .iaesdk .ibm_analytics_engine_api .v3 .model .ApplicationCollection ;
17
17
import com .ibm .cloud .iaesdk .ibm_analytics_engine_api .v3 .model .ApplicationGetResponse ;
18
18
import com .ibm .cloud .iaesdk .ibm_analytics_engine_api .v3 .model .ApplicationGetStateResponse ;
19
+ import com .ibm .cloud .iaesdk .ibm_analytics_engine_api .v3 .model .ApplicationRequestApplicationDetails ;
19
20
import com .ibm .cloud .iaesdk .ibm_analytics_engine_api .v3 .model .ApplicationResponse ;
20
21
import com .ibm .cloud .iaesdk .ibm_analytics_engine_api .v3 .model .ConfigurePlatformLoggingOptions ;
21
22
import com .ibm .cloud .iaesdk .ibm_analytics_engine_api .v3 .model .CreateApplicationOptions ;
@@ -78,7 +79,7 @@ public static void main(String[] args) throws Exception {
78
79
System .out .println ("getInstance() result:" );
79
80
// begin-get_instance
80
81
GetInstanceOptions getInstanceOptions = new GetInstanceOptions .Builder ()
81
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09 " )
82
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546 " )
82
83
.build ();
83
84
84
85
Response <Instance > response = ibmAnalyticsEngineApiService .getInstance (getInstanceOptions ).execute ();
@@ -95,7 +96,7 @@ public static void main(String[] args) throws Exception {
95
96
System .out .println ("getInstanceState() result:" );
96
97
// begin-get_instance_state
97
98
GetInstanceStateOptions getInstanceStateOptions = new GetInstanceStateOptions .Builder ()
98
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09 " )
99
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546 " )
99
100
.build ();
100
101
101
102
Response <InstanceGetStateResponse > response = ibmAnalyticsEngineApiService .getInstanceState (getInstanceStateOptions ).execute ();
@@ -112,7 +113,9 @@ public static void main(String[] args) throws Exception {
112
113
System .out .println ("setInstanceHome() result:" );
113
114
// begin-set_instance_home
114
115
SetInstanceHomeOptions setInstanceHomeOptions = new SetInstanceHomeOptions .Builder ()
115
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09" )
116
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546" )
117
+ .newHmacAccessKey ("b9****************************4b" )
118
+ .newHmacSecretKey ("fa********************************************8a" )
116
119
.build ();
117
120
118
121
Response <InstanceHomeResponse > response = ibmAnalyticsEngineApiService .setInstanceHome (setInstanceHomeOptions ).execute ();
@@ -129,7 +132,7 @@ public static void main(String[] args) throws Exception {
129
132
System .out .println ("getInstanceDefaultConfigs() result:" );
130
133
// begin-get_instance_default_configs
131
134
GetInstanceDefaultConfigsOptions getInstanceDefaultConfigsOptions = new GetInstanceDefaultConfigsOptions .Builder ()
132
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09 " )
135
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546 " )
133
136
.build ();
134
137
135
138
Response <Map <String , String >> response = ibmAnalyticsEngineApiService .getInstanceDefaultConfigs (getInstanceDefaultConfigsOptions ).execute ();
@@ -145,9 +148,14 @@ public static void main(String[] args) throws Exception {
145
148
try {
146
149
System .out .println ("replaceInstanceDefaultConfigs() result:" );
147
150
// begin-replace_instance_default_configs
151
+
152
+ Map <String , String > newDefaultConfigs = new java .util .HashMap <String , String >();
153
+ newDefaultConfigs .put ("spark.driver.memory" , "8G" );
154
+ newDefaultConfigs .put ("spark.driver.cores" , "2" );
155
+
148
156
ReplaceInstanceDefaultConfigsOptions replaceInstanceDefaultConfigsOptions = new ReplaceInstanceDefaultConfigsOptions .Builder ()
149
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09 " )
150
- .body (new java . util . HashMap < String , String >() { { put ( "foo" , "testString" ); } } )
157
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546 " )
158
+ .body (newDefaultConfigs )
151
159
.build ();
152
160
153
161
Response <Map <String , String >> response = ibmAnalyticsEngineApiService .replaceInstanceDefaultConfigs (replaceInstanceDefaultConfigsOptions ).execute ();
@@ -163,9 +171,14 @@ public static void main(String[] args) throws Exception {
163
171
try {
164
172
System .out .println ("updateInstanceDefaultConfigs() result:" );
165
173
// begin-update_instance_default_configs
174
+
175
+ Map <String , Object > defaultConfigsUpdate = new java .util .HashMap <String , Object >();
176
+ defaultConfigsUpdate .put ("ae.spark.history-server.cores" , "1" );
177
+ defaultConfigsUpdate .put ("ae.spark.history-server.memory" , "4G" );
178
+
166
179
UpdateInstanceDefaultConfigsOptions updateInstanceDefaultConfigsOptions = new UpdateInstanceDefaultConfigsOptions .Builder ()
167
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09 " )
168
- .body (new java . util . HashMap < String , Object >() { { put ( "foo" , "bar" ); } } )
180
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546 " )
181
+ .body (defaultConfigsUpdate )
169
182
.build ();
170
183
171
184
Response <Map <String , String >> response = ibmAnalyticsEngineApiService .updateInstanceDefaultConfigs (updateInstanceDefaultConfigsOptions ).execute ();
@@ -182,7 +195,11 @@ public static void main(String[] args) throws Exception {
182
195
System .out .println ("createApplication() result:" );
183
196
// begin-create_application
184
197
CreateApplicationOptions createApplicationOptions = new CreateApplicationOptions .Builder ()
185
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09" )
198
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546" )
199
+ .applicationDetails (new ApplicationRequestApplicationDetails .Builder ()
200
+ .application ("/opt/ibm/spark/examples/src/main/python/wordcount.py" )
201
+ .addArguments ("/opt/ibm/spark/examples/src/main/resources/people.txt" )
202
+ .build ())
186
203
.build ();
187
204
188
205
Response <ApplicationResponse > response = ibmAnalyticsEngineApiService .createApplication (createApplicationOptions ).execute ();
@@ -199,7 +216,7 @@ public static void main(String[] args) throws Exception {
199
216
System .out .println ("listApplications() result:" );
200
217
// begin-list_applications
201
218
ListApplicationsOptions listApplicationsOptions = new ListApplicationsOptions .Builder ()
202
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09 " )
219
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546 " )
203
220
.build ();
204
221
205
222
Response <ApplicationCollection > response = ibmAnalyticsEngineApiService .listApplications (listApplicationsOptions ).execute ();
@@ -216,8 +233,8 @@ public static void main(String[] args) throws Exception {
216
233
System .out .println ("getApplication() result:" );
217
234
// begin-get_application
218
235
GetApplicationOptions getApplicationOptions = new GetApplicationOptions .Builder ()
219
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09 " )
220
- .applicationId ("ff48cc19-0e7e-4627-aac6-0b4ad080397b " )
236
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546 " )
237
+ .applicationId ("db933645-0b68-4dcb-80d8-7b71a6c8e542 " )
221
238
.build ();
222
239
223
240
Response <ApplicationGetResponse > response = ibmAnalyticsEngineApiService .getApplication (getApplicationOptions ).execute ();
@@ -234,8 +251,8 @@ public static void main(String[] args) throws Exception {
234
251
System .out .println ("getApplicationState() result:" );
235
252
// begin-get_application_state
236
253
GetApplicationStateOptions getApplicationStateOptions = new GetApplicationStateOptions .Builder ()
237
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09 " )
238
- .applicationId ("ff48cc19-0e7e-4627-aac6-0b4ad080397b " )
254
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546 " )
255
+ .applicationId ("db933645-0b68-4dcb-80d8-7b71a6c8e542 " )
239
256
.build ();
240
257
241
258
Response <ApplicationGetStateResponse > response = ibmAnalyticsEngineApiService .getApplicationState (getApplicationStateOptions ).execute ();
@@ -252,7 +269,7 @@ public static void main(String[] args) throws Exception {
252
269
System .out .println ("getCurrentResourceConsumption() result:" );
253
270
// begin-get_current_resource_consumption
254
271
GetCurrentResourceConsumptionOptions getCurrentResourceConsumptionOptions = new GetCurrentResourceConsumptionOptions .Builder ()
255
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09 " )
272
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546 " )
256
273
.build ();
257
274
258
275
Response <CurrentResourceConsumptionResponse > response = ibmAnalyticsEngineApiService .getCurrentResourceConsumption (getCurrentResourceConsumptionOptions ).execute ();
@@ -269,7 +286,8 @@ public static void main(String[] args) throws Exception {
269
286
System .out .println ("replaceLogForwardingConfig() result:" );
270
287
// begin-replace_log_forwarding_config
271
288
ReplaceLogForwardingConfigOptions replaceLogForwardingConfigOptions = new ReplaceLogForwardingConfigOptions .Builder ()
272
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09" )
289
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546" )
290
+ .enabled (true )
273
291
.build ();
274
292
275
293
Response <LogForwardingConfigResponse > response = ibmAnalyticsEngineApiService .replaceLogForwardingConfig (replaceLogForwardingConfigOptions ).execute ();
@@ -286,7 +304,7 @@ public static void main(String[] args) throws Exception {
286
304
System .out .println ("getLogForwardingConfig() result:" );
287
305
// begin-get_log_forwarding_config
288
306
GetLogForwardingConfigOptions getLogForwardingConfigOptions = new GetLogForwardingConfigOptions .Builder ()
289
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09 " )
307
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546 " )
290
308
.build ();
291
309
292
310
Response <LogForwardingConfigResponse > response = ibmAnalyticsEngineApiService .getLogForwardingConfig (getLogForwardingConfigOptions ).execute ();
@@ -303,7 +321,8 @@ public static void main(String[] args) throws Exception {
303
321
System .out .println ("configurePlatformLogging() result:" );
304
322
// begin-configure_platform_logging
305
323
ConfigurePlatformLoggingOptions configurePlatformLoggingOptions = new ConfigurePlatformLoggingOptions .Builder ()
306
- .instanceGuid ("e64c907a-e82f-46fd-addc-ccfafbd28b09" )
324
+ .instanceGuid ("dc0e9889-eab2-4t9e-9441-566209499546" )
325
+ .enable (true )
307
326
.build ();
308
327
309
328
Response <LoggingConfigurationResponse > response = ibmAnalyticsEngineApiService .configurePlatformLogging (configurePlatformLoggingOptions ).execute ();
@@ -320,7 +339,7 @@ public static void main(String[] args) throws Exception {
320
339
System .out .println ("getLoggingConfiguration() result:" );
321
340
// begin-get_logging_configuration
322
341
GetLoggingConfigurationOptions getLoggingConfigurationOptions = new GetLoggingConfigurationOptions .Builder ()
323
- .instanceGuid ("e64c907a-e82f-46fd-addc-ccfafbd28b09 " )
342
+ .instanceGuid ("dc0e9889-eab2-4t9e-9441-566209499546 " )
324
343
.build ();
325
344
326
345
Response <LoggingConfigurationResponse > response = ibmAnalyticsEngineApiService .getLoggingConfiguration (getLoggingConfigurationOptions ).execute ();
@@ -336,8 +355,8 @@ public static void main(String[] args) throws Exception {
336
355
try {
337
356
// begin-delete_application
338
357
DeleteApplicationOptions deleteApplicationOptions = new DeleteApplicationOptions .Builder ()
339
- .instanceId ("e64c907a-e82f-46fd-addc-ccfafbd28b09 " )
340
- .applicationId ("ff48cc19-0e7e-4627-aac6-0b4ad080397b " )
358
+ .instanceId ("dc0e9889-eab2-4t9e-9441-566209499546 " )
359
+ .applicationId ("db933645-0b68-4dcb-80d8-7b71a6c8e542 " )
341
360
.build ();
342
361
343
362
Response <Void > response = ibmAnalyticsEngineApiService .deleteApplication (deleteApplicationOptions ).execute ();
0 commit comments