Skip to content

Commit 33e656f

Browse files
authored
Merge pull request #214 from RachelTucker/4-1-api
Updating to 4.1.1 API
2 parents b90215c + 10fdc04 commit 33e656f

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed

src/ds3.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ typedef enum {
286286
DS3_QUIESCED_PENDING,
287287
DS3_QUIESCED_YES
288288
}ds3_quiesced;
289+
typedef enum {
290+
DS3_RESERVED_TASK_TYPE_ANY,
291+
DS3_RESERVED_TASK_TYPE_READ,
292+
DS3_RESERVED_TASK_TYPE_WRITE
293+
}ds3_reserved_task_type;
289294
typedef enum {
290295
DS3_SEVERITY_CRITICAL,
291296
DS3_SEVERITY_WARNING,
@@ -390,6 +395,7 @@ typedef enum {
390395
DS3_TAPE_TYPE_LTO5,
391396
DS3_TAPE_TYPE_LTO6,
392397
DS3_TAPE_TYPE_LTO7,
398+
DS3_TAPE_TYPE_LTOM8,
393399
DS3_TAPE_TYPE_LTO8,
394400
DS3_TAPE_TYPE_LTO_CLEANING_TAPE,
395401
DS3_TAPE_TYPE_TS_JC,
@@ -694,8 +700,10 @@ typedef struct {
694700
}ds3_completed_job_response;
695701
typedef struct {
696702
ds3_bool activated;
703+
ds3_bool allow_new_job_requests;
697704
int auto_activate_timeout_in_mins;
698705
ds3_auto_inspect_mode auto_inspect;
706+
int cache_available_retry_after_in_seconds;
699707
ds3_import_conflict_resolution_mode default_import_conflict_resolution_mode;
700708
ds3_priority default_verify_data_after_import;
701709
ds3_bool default_verify_data_prior_to_import;
@@ -1195,6 +1203,7 @@ typedef struct {
11951203
ds3_str* mfg_serial_number;
11961204
ds3_str* partition_id;
11971205
ds3_quiesced quiesced;
1206+
ds3_reserved_task_type reserved_task_type;
11981207
ds3_str* serial_number;
11991208
ds3_tape_drive_state state;
12001209
ds3_str* tape_id;
@@ -1220,6 +1229,8 @@ typedef struct {
12201229
ds3_str* id;
12211230
ds3_import_export_configuration import_export_configuration;
12221231
ds3_str* library_id;
1232+
int minimum_read_reserved_drives;
1233+
int minimum_write_reserved_drives;
12231234
ds3_str* name;
12241235
ds3_quiesced quiesced;
12251236
ds3_str* serial_id;
@@ -1494,6 +1505,8 @@ typedef struct {
14941505
ds3_str* id;
14951506
ds3_import_export_configuration import_export_configuration;
14961507
ds3_str* library_id;
1508+
int minimum_read_reserved_drives;
1509+
int minimum_write_reserved_drives;
14971510
ds3_str* name;
14981511
ds3_quiesced quiesced;
14991512
ds3_str* serial_id;
@@ -1552,6 +1565,8 @@ typedef struct {
15521565
ds3_str* id;
15531566
ds3_import_export_configuration import_export_configuration;
15541567
ds3_str* library_id;
1568+
int minimum_read_reserved_drives;
1569+
int minimum_write_reserved_drives;
15551570
ds3_str* name;
15561571
ds3_quiesced quiesced;
15571572
ds3_str* serial_id;
@@ -1578,6 +1593,7 @@ typedef struct {
15781593
int number_of_type;
15791594
}ds3_type_response;
15801595
typedef struct {
1596+
int elapsed_hours;
15811597
uint64_t elapsed_millis;
15821598
int elapsed_minutes;
15831599
uint64_t elapsed_nanos;
@@ -2364,6 +2380,7 @@ LIBRARY_API void ds3_request_set_activated(const ds3_request* request, ds3_bool
23642380
LIBRARY_API void ds3_request_set_admin_auth_id(const ds3_request* request, const char * const value);
23652381
LIBRARY_API void ds3_request_set_admin_secret_key(const ds3_request* request, const char * const value);
23662382
LIBRARY_API void ds3_request_set_aggregating(const ds3_request* request, ds3_bool value);
2383+
LIBRARY_API void ds3_request_set_allow_new_job_requests(const ds3_request* request, ds3_bool value);
23672384
LIBRARY_API void ds3_request_set_always_force_put_job_creation(const ds3_request* request, ds3_bool value);
23682385
LIBRARY_API void ds3_request_set_always_minimize_spanning_across_media(const ds3_request* request, ds3_bool value);
23692386
LIBRARY_API void ds3_request_set_assigned_to_storage_domain(const ds3_request* request, ds3_bool value);
@@ -2385,6 +2402,7 @@ LIBRARY_API void ds3_request_set_blobbing_enabled(const ds3_request* request, ds
23852402
LIBRARY_API void ds3_request_set_bucket_id(const ds3_request* request, const char * const value);
23862403
LIBRARY_API void ds3_request_set_built_in(const ds3_request* request, ds3_bool value);
23872404
LIBRARY_API void ds3_request_set_burst_threshold(const ds3_request* request, const float value);
2405+
LIBRARY_API void ds3_request_set_cache_available_retry_after_in_seconds(const ds3_request* request, const int value);
23882406
LIBRARY_API void ds3_request_set_canceled_due_to_timeout(const ds3_request* request, ds3_bool value);
23892407
LIBRARY_API void ds3_request_set_checksum_type_ds3_checksum_type(const ds3_request* request, const ds3_checksum_type value);
23902408
LIBRARY_API void ds3_request_set_chunk_client_processing_order_guarantee_ds3_job_chunk_client_processing_order_guarantee(const ds3_request* request, const ds3_job_chunk_client_processing_order_guarantee value);
@@ -2457,6 +2475,8 @@ LIBRARY_API void ds3_request_set_member_group_id(const ds3_request* request, con
24572475
LIBRARY_API void ds3_request_set_member_user_id(const ds3_request* request, const char * const value);
24582476
LIBRARY_API void ds3_request_set_minimize_spanning_across_media(const ds3_request* request, ds3_bool value);
24592477
LIBRARY_API void ds3_request_set_minimum_days_to_retain(const ds3_request* request, const int value);
2478+
LIBRARY_API void ds3_request_set_minimum_read_reserved_drives(const ds3_request* request, const int value);
2479+
LIBRARY_API void ds3_request_set_minimum_write_reserved_drives(const ds3_request* request, const int value);
24602480
LIBRARY_API void ds3_request_set_name(const ds3_request* request, const char * const value);
24612481
LIBRARY_API void ds3_request_set_naming_convention_ds3_naming_convention_type(const ds3_request* request, const ds3_naming_convention_type value);
24622482
LIBRARY_API void ds3_request_set_node_id(const ds3_request* request, const char * const value);
@@ -2496,6 +2516,7 @@ LIBRARY_API void ds3_request_set_region_ds3_s3_region(const ds3_request* request
24962516
LIBRARY_API void ds3_request_set_replicate_deletes(const ds3_request* request, ds3_bool value);
24972517
LIBRARY_API void ds3_request_set_replicated_user_default_data_policy(const ds3_request* request, const char * const value);
24982518
LIBRARY_API void ds3_request_set_request_type_ds3_job_request_type(const ds3_request* request, const ds3_job_request_type value);
2519+
LIBRARY_API void ds3_request_set_reserved_task_type_ds3_reserved_task_type(const ds3_request* request, const ds3_reserved_task_type value);
24992520
LIBRARY_API void ds3_request_set_roll_back(const ds3_request* request, ds3_bool value);
25002521
LIBRARY_API void ds3_request_set_secret_key(const ds3_request* request, const char * const value);
25012522
LIBRARY_API void ds3_request_set_secure_media_allocation(const ds3_request* request, ds3_bool value);
@@ -2806,8 +2827,10 @@ LIBRARY_API ds3_error* ds3_get_data_planner_blob_store_tasks_spectra_s3_request(
28062827
* Optional Request Modifiers for ds3_init_modify_data_path_backend_spectra_s3_request
28072828
*
28082829
* void ds3_request_set_activated(const ds3_request* request, ds3_bool value)
2830+
* void ds3_request_set_allow_new_job_requests(const ds3_request* request, ds3_bool value)
28092831
* void ds3_request_set_auto_activate_timeout_in_mins(const ds3_request* request, const int value)
28102832
* void ds3_request_set_auto_inspect_ds3_auto_inspect_mode(const ds3_request* request, const ds3_auto_inspect_mode value)
2833+
* void ds3_request_set_cache_available_retry_after_in_seconds(const ds3_request* request, const int value)
28112834
* void ds3_request_set_default_import_conflict_resolution_mode_ds3_import_conflict_resolution_mode(const ds3_request* request, const ds3_import_conflict_resolution_mode value)
28122835
* void ds3_request_set_default_verify_data_after_import_ds3_priority(const ds3_request* request, const ds3_priority value)
28132836
* void ds3_request_set_default_verify_data_prior_to_import(const ds3_request* request, ds3_bool value)
@@ -4353,6 +4376,7 @@ LIBRARY_API ds3_error* ds3_get_tape_drive_spectra_s3_request(const ds3_client* c
43534376
* void ds3_request_set_page_offset(const ds3_request* request, const int value)
43544377
* void ds3_request_set_page_start_marker(const ds3_request* request, const char * const value)
43554378
* void ds3_request_set_partition_id(const ds3_request* request, const char * const value)
4379+
* void ds3_request_set_reserved_task_type_ds3_reserved_task_type(const ds3_request* request, const ds3_reserved_task_type value)
43564380
* void ds3_request_set_serial_number(const ds3_request* request, const char * const value)
43574381
* void ds3_request_set_state_ds3_tape_drive_state(const ds3_request* request, const ds3_tape_drive_state value)
43584382
* void ds3_request_set_type_ds3_tape_drive_type(const ds3_request* request, const ds3_tape_drive_type value)
@@ -4513,12 +4537,15 @@ LIBRARY_API ds3_error* ds3_modify_all_tape_partitions_spectra_s3_request(const d
45134537
* Optional Request Modifiers for ds3_init_modify_tape_drive_spectra_s3_request
45144538
*
45154539
* void ds3_request_set_quiesced_ds3_quiesced(const ds3_request* request, const ds3_quiesced value)
4540+
* void ds3_request_set_reserved_task_type_ds3_reserved_task_type(const ds3_request* request, const ds3_reserved_task_type value)
45164541
*/
45174542
LIBRARY_API ds3_request* ds3_init_modify_tape_drive_spectra_s3_request(const char *const resource_id);
45184543
LIBRARY_API ds3_error* ds3_modify_tape_drive_spectra_s3_request(const ds3_client* client, const ds3_request* request, ds3_tape_drive_response** response);
45194544
/**
45204545
* Optional Request Modifiers for ds3_init_modify_tape_partition_spectra_s3_request
45214546
*
4547+
* void ds3_request_set_minimum_read_reserved_drives(const ds3_request* request, const int value)
4548+
* void ds3_request_set_minimum_write_reserved_drives(const ds3_request* request, const int value)
45224549
* void ds3_request_set_quiesced_ds3_quiesced(const ds3_request* request, const ds3_quiesced value)
45234550
*/
45244551
LIBRARY_API ds3_request* ds3_init_modify_tape_partition_spectra_s3_request(const char *const resource_id);

src/ds3_init_requests.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,18 @@ static char* _get_ds3_tape_drive_type_str(ds3_tape_drive_type input) {
514514
return "";
515515
}
516516

517+
}
518+
static char* _get_ds3_reserved_task_type_str(ds3_reserved_task_type input) {
519+
if (input == DS3_RESERVED_TASK_TYPE_ANY) {
520+
return "ANY";
521+
} else if (input == DS3_RESERVED_TASK_TYPE_READ) {
522+
return "READ";
523+
} else if (input == DS3_RESERVED_TASK_TYPE_WRITE) {
524+
return "WRITE";
525+
} else {
526+
return "";
527+
}
528+
517529
}
518530
static char* _get_ds3_tape_drive_state_str(ds3_tape_drive_state input) {
519531
if (input == DS3_TAPE_DRIVE_STATE_OFFLINE) {
@@ -882,6 +894,10 @@ void ds3_request_set_admin_secret_key(const ds3_request* request, const char * c
882894
void ds3_request_set_aggregating(const ds3_request* request, ds3_bool value) {
883895
_set_query_param_flag(request, "aggregating", value);
884896

897+
}
898+
void ds3_request_set_allow_new_job_requests(const ds3_request* request, ds3_bool value) {
899+
_set_query_param_flag(request, "allow_new_job_requests", value);
900+
885901
}
886902
void ds3_request_set_always_force_put_job_creation(const ds3_request* request, ds3_bool value) {
887903
_set_query_param_flag(request, "always_force_put_job_creation", value);
@@ -966,6 +982,10 @@ void ds3_request_set_built_in(const ds3_request* request, ds3_bool value) {
966982
void ds3_request_set_burst_threshold(const ds3_request* request, const float value) {
967983
_set_query_param_float(request, "burst_threshold", value);
968984

985+
}
986+
void ds3_request_set_cache_available_retry_after_in_seconds(const ds3_request* request, const int value) {
987+
_set_query_param_int(request, "cache_available_retry_after_in_seconds", value);
988+
969989
}
970990
void ds3_request_set_canceled_due_to_timeout(const ds3_request* request, ds3_bool value) {
971991
_set_query_param_flag(request, "canceled_due_to_timeout", value);
@@ -1254,6 +1274,14 @@ void ds3_request_set_minimize_spanning_across_media(const ds3_request* request,
12541274
void ds3_request_set_minimum_days_to_retain(const ds3_request* request, const int value) {
12551275
_set_query_param_int(request, "minimum_days_to_retain", value);
12561276

1277+
}
1278+
void ds3_request_set_minimum_read_reserved_drives(const ds3_request* request, const int value) {
1279+
_set_query_param_int(request, "minimum_read_reserved_drives", value);
1280+
1281+
}
1282+
void ds3_request_set_minimum_write_reserved_drives(const ds3_request* request, const int value) {
1283+
_set_query_param_int(request, "minimum_write_reserved_drives", value);
1284+
12571285
}
12581286
void ds3_request_set_name(const ds3_request* request, const char * const value) {
12591287
_set_query_param(request, "name", value);
@@ -1410,6 +1438,10 @@ void ds3_request_set_replicated_user_default_data_policy(const ds3_request* requ
14101438
void ds3_request_set_request_type_ds3_job_request_type(const ds3_request* request, const ds3_job_request_type value) {
14111439
_set_query_param(request, "request_type", (const char*)_get_ds3_job_request_type_str(value));
14121440

1441+
}
1442+
void ds3_request_set_reserved_task_type_ds3_reserved_task_type(const ds3_request* request, const ds3_reserved_task_type value) {
1443+
_set_query_param(request, "reserved_task_type", (const char*)_get_ds3_reserved_task_type_str(value));
1444+
14131445
}
14141446
void ds3_request_set_roll_back(const ds3_request* request, ds3_bool value) {
14151447
_set_query_param_flag(request, "roll_back", value);

src/ds3_requests.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,18 @@ static ds3_quiesced _match_ds3_quiesced(const ds3_log* log, const xmlChar* text)
931931
return DS3_QUIESCED_NO;
932932
}
933933
}
934+
static ds3_reserved_task_type _match_ds3_reserved_task_type(const ds3_log* log, const xmlChar* text) {
935+
if (xmlStrcmp(text, (const xmlChar*) "ANY") == 0) {
936+
return DS3_RESERVED_TASK_TYPE_ANY;
937+
} else if (xmlStrcmp(text, (const xmlChar*) "READ") == 0) {
938+
return DS3_RESERVED_TASK_TYPE_READ;
939+
} else if (xmlStrcmp(text, (const xmlChar*) "WRITE") == 0) {
940+
return DS3_RESERVED_TASK_TYPE_WRITE;
941+
} else {
942+
ds3_log_message(log, DS3_ERROR, "ERROR: Unknown value of '%s'. Returning DS3_RESERVED_TASK_TYPE_ANY for safety.", text);
943+
return DS3_RESERVED_TASK_TYPE_ANY;
944+
}
945+
}
934946
static ds3_import_export_configuration _match_ds3_import_export_configuration(const ds3_log* log, const xmlChar* text) {
935947
if (xmlStrcmp(text, (const xmlChar*) "SUPPORTED") == 0) {
936948
return DS3_IMPORT_EXPORT_CONFIGURATION_SUPPORTED;
@@ -1138,6 +1150,8 @@ static ds3_tape_type _match_ds3_tape_type(const ds3_log* log, const xmlChar* tex
11381150
return DS3_TAPE_TYPE_LTO6;
11391151
} else if (xmlStrcmp(text, (const xmlChar*) "LTO7") == 0) {
11401152
return DS3_TAPE_TYPE_LTO7;
1153+
} else if (xmlStrcmp(text, (const xmlChar*) "LTOM8") == 0) {
1154+
return DS3_TAPE_TYPE_LTOM8;
11411155
} else if (xmlStrcmp(text, (const xmlChar*) "LTO8") == 0) {
11421156
return DS3_TAPE_TYPE_LTO8;
11431157
} else if (xmlStrcmp(text, (const xmlChar*) "LTO_CLEANING_TAPE") == 0) {
@@ -3857,6 +3871,13 @@ static ds3_error* _parse_ds3_tape_drive_response(const ds3_client* client, const
38573871
}
38583872
response->quiesced = _match_ds3_quiesced(client->log, text);
38593873
xmlFree(text);
3874+
} else if (element_equal(child_node, "ReservedTaskType")) {
3875+
xmlChar* text = xmlNodeListGetString(doc, child_node, 1);
3876+
if (text == NULL) {
3877+
continue;
3878+
}
3879+
response->reserved_task_type = _match_ds3_reserved_task_type(client->log, text);
3880+
xmlFree(text);
38603881
} else if (element_equal(child_node, "SerialNumber")) {
38613882
response->serial_number = xml_get_string(doc, child_node);
38623883
} else if (element_equal(child_node, "State")) {
@@ -3995,6 +4016,10 @@ static ds3_error* _parse_ds3_tape_partition_response(const ds3_client* client, c
39954016
xmlFree(text);
39964017
} else if (element_equal(child_node, "LibraryId")) {
39974018
response->library_id = xml_get_string(doc, child_node);
4019+
} else if (element_equal(child_node, "MinimumReadReservedDrives")) {
4020+
response->minimum_read_reserved_drives = xml_get_uint16(doc, child_node);
4021+
} else if (element_equal(child_node, "MinimumWriteReservedDrives")) {
4022+
response->minimum_write_reserved_drives = xml_get_uint16(doc, child_node);
39984023
} else if (element_equal(child_node, "Name")) {
39994024
response->name = xml_get_string(doc, child_node);
40004025
} else if (element_equal(child_node, "Quiesced")) {
@@ -5271,6 +5296,10 @@ static ds3_error* _parse_ds3_named_detailed_tape_partition_response(const ds3_cl
52715296
xmlFree(text);
52725297
} else if (element_equal(child_node, "LibraryId")) {
52735298
response->library_id = xml_get_string(doc, child_node);
5299+
} else if (element_equal(child_node, "MinimumReadReservedDrives")) {
5300+
response->minimum_read_reserved_drives = xml_get_uint16(doc, child_node);
5301+
} else if (element_equal(child_node, "MinimumWriteReservedDrives")) {
5302+
response->minimum_write_reserved_drives = xml_get_uint16(doc, child_node);
52745303
} else if (element_equal(child_node, "Name")) {
52755304
response->name = xml_get_string(doc, child_node);
52765305
} else if (element_equal(child_node, "Quiesced")) {
@@ -6227,6 +6256,8 @@ static ds3_error* _parse_top_level_ds3_data_path_backend_response(const ds3_clie
62276256
for (child_node = root->xmlChildrenNode; child_node != NULL; child_node = child_node->next) {
62286257
if (element_equal(child_node, "Activated")) {
62296258
response->activated = xml_get_bool(client->log, doc, child_node);
6259+
} else if (element_equal(child_node, "AllowNewJobRequests")) {
6260+
response->allow_new_job_requests = xml_get_bool(client->log, doc, child_node);
62306261
} else if (element_equal(child_node, "AutoActivateTimeoutInMins")) {
62316262
response->auto_activate_timeout_in_mins = xml_get_uint16(doc, child_node);
62326263
} else if (element_equal(child_node, "AutoInspect")) {
@@ -6236,6 +6267,8 @@ static ds3_error* _parse_top_level_ds3_data_path_backend_response(const ds3_clie
62366267
}
62376268
response->auto_inspect = _match_ds3_auto_inspect_mode(client->log, text);
62386269
xmlFree(text);
6270+
} else if (element_equal(child_node, "CacheAvailableRetryAfterInSeconds")) {
6271+
response->cache_available_retry_after_in_seconds = xml_get_uint16(doc, child_node);
62396272
} else if (element_equal(child_node, "DefaultImportConflictResolutionMode")) {
62406273
xmlChar* text = xmlNodeListGetString(doc, child_node, 1);
62416274
if (text == NULL) {
@@ -8577,6 +8610,13 @@ static ds3_error* _parse_top_level_ds3_tape_drive_response(const ds3_client* cli
85778610
}
85788611
response->quiesced = _match_ds3_quiesced(client->log, text);
85798612
xmlFree(text);
8613+
} else if (element_equal(child_node, "ReservedTaskType")) {
8614+
xmlChar* text = xmlNodeListGetString(doc, child_node, 1);
8615+
if (text == NULL) {
8616+
continue;
8617+
}
8618+
response->reserved_task_type = _match_ds3_reserved_task_type(client->log, text);
8619+
xmlFree(text);
85808620
} else if (element_equal(child_node, "SerialNumber")) {
85818621
response->serial_number = xml_get_string(doc, child_node);
85828622
} else if (element_equal(child_node, "State")) {
@@ -8695,6 +8735,10 @@ static ds3_error* _parse_top_level_ds3_tape_partition_response(const ds3_client*
86958735
xmlFree(text);
86968736
} else if (element_equal(child_node, "LibraryId")) {
86978737
response->library_id = xml_get_string(doc, child_node);
8738+
} else if (element_equal(child_node, "MinimumReadReservedDrives")) {
8739+
response->minimum_read_reserved_drives = xml_get_uint16(doc, child_node);
8740+
} else if (element_equal(child_node, "MinimumWriteReservedDrives")) {
8741+
response->minimum_write_reserved_drives = xml_get_uint16(doc, child_node);
86988742
} else if (element_equal(child_node, "Name")) {
86998743
response->name = xml_get_string(doc, child_node);
87008744
} else if (element_equal(child_node, "Quiesced")) {
@@ -9420,6 +9464,10 @@ static ds3_error* _parse_top_level_ds3_detailed_tape_partition_response(const ds
94209464
xmlFree(text);
94219465
} else if (element_equal(child_node, "LibraryId")) {
94229466
response->library_id = xml_get_string(doc, child_node);
9467+
} else if (element_equal(child_node, "MinimumReadReservedDrives")) {
9468+
response->minimum_read_reserved_drives = xml_get_uint16(doc, child_node);
9469+
} else if (element_equal(child_node, "MinimumWriteReservedDrives")) {
9470+
response->minimum_write_reserved_drives = xml_get_uint16(doc, child_node);
94239471
} else if (element_equal(child_node, "Name")) {
94249472
response->name = xml_get_string(doc, child_node);
94259473
} else if (element_equal(child_node, "Quiesced")) {

0 commit comments

Comments
 (0)