From 4b30eaed859edc21d2f70413dabc5122c3c9451b Mon Sep 17 00:00:00 2001 From: Matthias Gatto Date: Thu, 24 Oct 2024 11:47:03 +0200 Subject: [PATCH] update COGNAC Signed-off-by: Matthias Gatto --- oapi-cli.AppDir/AppRun => AppRun | 8 +- COGNAC | 2 +- Makefile | 3 +- .../appimage-logo.png => appimage-logo.png | Bin .../oapi-cli.desktop => cli.desktop | 4 +- main-helper.h | 3 + main.c | 18973 ++++++++-------- oapi-cli-completion.bash | 890 +- 8 files changed, 9942 insertions(+), 9941 deletions(-) rename oapi-cli.AppDir/AppRun => AppRun (56%) rename oapi-cli.AppDir/appimage-logo.png => appimage-logo.png (100%) rename oapi-cli.AppDir/oapi-cli.desktop => cli.desktop (77%) diff --git a/oapi-cli.AppDir/AppRun b/AppRun similarity index 56% rename from oapi-cli.AppDir/AppRun rename to AppRun index fb9e2bf..627150a 100755 --- a/oapi-cli.AppDir/AppRun +++ b/AppRun @@ -2,15 +2,11 @@ for opt in "$@"; do if [ "${opt}" == "--bash-completion" ]; then - cat "${APPDIR}/usr/bin/oapi-cli-completion.bash" + cat "${APPDIR}/usr/bin/____cli_name____-completion.bash" exit 0 fi done -if [ -z "$CURL_CA_BUNDLE" ]; then - source ${APPDIR}/import-ssl.sh -fi - export COGNAC_HELP_APPEND="$(echo -en '\t--bash-completion\tprint bash completion(appimage only)\n\t--appimage-help\t\tappimage helps')" -LD_LIBRARY_PATH=${APPDIR}/usr/lib/ "${APPDIR}/usr/bin/oapi-cli" "$@" +LD_LIBRARY_PATH=${APPDIR}/usr/lib/ "${APPDIR}/usr/bin/____cli_name____" "$@" diff --git a/COGNAC b/COGNAC index b2b946d..a9bcfd4 160000 --- a/COGNAC +++ b/COGNAC @@ -1 +1 @@ -Subproject commit b2b946d8643c8fe2162c68af05bcfbd08ba5a362 +Subproject commit a9bcfd44ef233989064bb6ef4ba02d4a803ad5b2 diff --git a/Makefile b/Makefile index 1750898..6d9355b 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ JSON_C_RULE=./json-c-build/libjson-c.a API_RULE_DEPEDENCIES= OAPI_APPIMAGE_RULE_DEPEDENCIES= APPIMAGETOOL_OPTION= +CLI_NAME=oapi-cli include config.mk include COGNAC/oapi-cli.mk @@ -33,7 +34,7 @@ osc_sdk.h: osc-sdk-C/osc_sdk.h osc_sdk.c: osc-sdk-C/osc_sdk.c cp osc-sdk-C/osc_sdk.c . -oapi-cli-completion.bash: COGNAC/main.c +$(CLI_NAME)-completion.bash: cp COGNAC/oapi-cli-completion.bash . gen: main.c osc_sdk.h osc_sdk.c oapi-cli-completion.bash main-helper.h diff --git a/oapi-cli.AppDir/appimage-logo.png b/appimage-logo.png similarity index 100% rename from oapi-cli.AppDir/appimage-logo.png rename to appimage-logo.png diff --git a/oapi-cli.AppDir/oapi-cli.desktop b/cli.desktop similarity index 77% rename from oapi-cli.AppDir/oapi-cli.desktop rename to cli.desktop index 73b5e5d..06d3b1a 100644 --- a/oapi-cli.AppDir/oapi-cli.desktop +++ b/cli.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Type=Application -Name=oapi-cli -Exec=oapi-cli +Name=____cli_name____ +Exec=____cli_name____ Comment=CLI-of Outscale Granting Net Accessible Calls Categories=Development;Network; Terminal=true diff --git a/main-helper.h b/main-helper.h index 52662a1..c98608b 100644 --- a/main-helper.h +++ b/main-helper.h @@ -42,6 +42,9 @@ struct ptr_array { */ #define OBJ_SIZE 8 +/* a is an array with a flexible size, v is the value to push, + * and pa is used to store the pointer so that we can easily free everything later. + */ #define SET_NEXT(a,v,pa) do { \ int cnt; \ if (!a) { \ diff --git a/main.c b/main.c index edb7d19..816a51a 100644 --- a/main.c +++ b/main.c @@ -18255,9 +18255,10 @@ int main(int ac, char **av) } else if (!strcmp("--insecure", av[i])) { flag |= OSC_INSECURE_MODE; } else if (!strcmp("--version", av[i])) { - printf("oapi-cli version: %s\n" + printf("%s version: %s\n" "osc-sdk-c version: %s\n" "based on osc-api: %s\n", + program_name, OAPI_CLI_VERSION, osc_sdk_version_str(), OSC_API_VERSION); @@ -18365,7 +18366,7 @@ int main(int ac, char **av) "\t --jsonstr-file PATH same as --file, except the content is surrounded by \"\n" "\t\t\t\tand \" inside the file are escape with a \\, this option is useful for CreatePolicy\n" "\t --set-var ID=VARIABLE_PATH Create an oapi-cli variable, that can be use with --var\n" - "\t\t\t\tExamples: ./oapi-cli ReadVms --Filters.TagValues[] VM_NAME --set-var id=Vms.0.VmId ReadVms --Filters.VmIds[] --var id\n" + "\t\t\t\tExamples: oapi-cli ReadVms --Filters.TagValues[] VM_NAME --set-var id=Vms.0.VmId ReadVms --Filters.VmIds[] --var id\n" "\t\t\t\twill find the vm with VM_NAME as it's tag, and read it again, but using it's VmId as filter this time\n" "\t --var use variabble content created by --set-var\n" "\t-h, --help [CallName] this, can be used with call name, example:\n\t\t\t\t%s --help ReadVms\n" @@ -18444,19 +18445,19 @@ int main(int ac, char **av) } else if (!strcmp("--color", av[i])) { color_flag |= JSON_C_TO_STRING_COLOR; } else - if (!strcmp("UpdateVpnConnection", av[i])) { + if (!strcmp("AcceptNetPeering", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_vpn_connection_arg a = {0}; - struct osc_update_vpn_connection_arg *s = &a; + struct osc_accept_net_peering_arg a = {0}; + struct osc_accept_net_peering_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_vpn_connection_arg: + accept_net_peering_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -18475,7 +18476,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_vpn_connection_arg; + goto accept_net_peering_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -18489,17 +18490,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "ClientGatewayId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ClientGatewayId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ClientGatewayId argument missing\n"); - s->client_gateway_id = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -18516,59 +18506,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VirtualGatewayId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "VirtualGatewayId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "VirtualGatewayId argument missing\n"); - s->virtual_gateway_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "VpnConnectionId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "VpnConnectionId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "VpnConnectionId argument missing\n"); - s->vpn_connection_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "VpnOptions")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NetPeeringId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VpnOptions argument missing\n"); + TRY((!*eq_ptr), "NetPeeringId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "NetPeeringId argument missing\n"); + s->net_peering_id = aa; // string string - TRY(!aa, "VpnOptions argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->vpn_options; - cascade_parser = vpn_options_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(vpn_options_parser(&s->vpn_options, dot_pos, aa, pa)); - s->is_set_vpn_options = 1; - } else { - s->vpn_options_str = aa; - } } else { - BAD_RET("'%s' is not a valide argument for 'UpdateVpnConnection'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'AcceptNetPeering'\n", next_a); } i += incr; - goto update_vpn_connection_arg; + goto accept_net_peering_arg; } - cret = osc_update_vpn_connection(&e, &r, &a); - TRY(cret, "fail to call UpdateVpnConnection: %s\n", curl_easy_strerror(cret)); + cret = osc_accept_net_peering(&e, &r, &a); + TRY(cret, "fail to call AcceptNetPeering: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -18595,19 +18551,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateVolume", av[i])) { + if (!strcmp("AddUserToUserGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_volume_arg a = {0}; - struct osc_update_volume_arg *s = &a; + struct osc_add_user_to_user_group_arg a = {0}; + struct osc_add_user_to_user_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_volume_arg: + add_user_to_user_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -18626,7 +18582,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_volume_arg; + goto add_user_to_user_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -18656,58 +18612,58 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Iops")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Iops argument missing\n"); + TRY((!*eq_ptr), "UserGroupName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Iops argument missing\n"); - s->is_set_iops = 1; - s->iops = atoll(aa); + TRY(!aa, "UserGroupName argument missing\n"); + s->user_group_name = aa; // string string + } else - if ((aret = argcmp(next_a, "Size")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserGroupPath")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Size argument missing\n"); + TRY((!*eq_ptr), "UserGroupPath argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Size argument missing\n"); - s->is_set_size = 1; - s->size = atoll(aa); + TRY(!aa, "UserGroupPath argument missing\n"); + s->user_group_path = aa; // string string + } else - if ((aret = argcmp(next_a, "VolumeId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VolumeId argument missing\n"); + TRY((!*eq_ptr), "UserName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VolumeId argument missing\n"); - s->volume_id = aa; // string string + TRY(!aa, "UserName argument missing\n"); + s->user_name = aa; // string string } else - if ((aret = argcmp(next_a, "VolumeType")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserPath")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VolumeType argument missing\n"); + TRY((!*eq_ptr), "UserPath argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VolumeType argument missing\n"); - s->volume_type = aa; // string string + TRY(!aa, "UserPath argument missing\n"); + s->user_path = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UpdateVolume'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'AddUserToUserGroup'\n", next_a); } i += incr; - goto update_volume_arg; + goto add_user_to_user_group_arg; } - cret = osc_update_volume(&e, &r, &a); - TRY(cret, "fail to call UpdateVolume: %s\n", curl_easy_strerror(cret)); + cret = osc_add_user_to_user_group(&e, &r, &a); + TRY(cret, "fail to call AddUserToUserGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -18734,19 +18690,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateVmTemplate", av[i])) { + if (!strcmp("CheckAuthentication", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_vm_template_arg a = {0}; - struct osc_update_vm_template_arg *s = &a; + struct osc_check_authentication_arg a = {0}; + struct osc_check_authentication_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_vm_template_arg: + check_authentication_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -18765,7 +18721,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_vm_template_arg; + goto check_authentication_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -18779,17 +18735,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -18806,67 +18751,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Tags argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; - - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); - else if (*endptr != '.') - BAD_RET("'Tags' require a .\n"); - TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); - cascade_struct = &s->tags[pos]; - cascade_parser = resource_tag_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); - } else { - TRY(!aa, "Tags argument missing\n"); - s->tags_str = aa; // array ref ResourceTag ref - } - } else - if ((aret = argcmp(next_a, "VmTemplateId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Login")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmTemplateId argument missing\n"); + TRY((!*eq_ptr), "Login argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmTemplateId argument missing\n"); - s->vm_template_id = aa; // string string + TRY(!aa, "Login argument missing\n"); + s->login = aa; // string string } else - if ((aret = argcmp(next_a, "VmTemplateName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Password")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmTemplateName argument missing\n"); + TRY((!*eq_ptr), "Password argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmTemplateName argument missing\n"); - s->vm_template_name = aa; // string string + TRY(!aa, "Password argument missing\n"); + s->password = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UpdateVmTemplate'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CheckAuthentication'\n", next_a); } i += incr; - goto update_vm_template_arg; + goto check_authentication_arg; } - cret = osc_update_vm_template(&e, &r, &a); - TRY(cret, "fail to call UpdateVmTemplate: %s\n", curl_easy_strerror(cret)); + cret = osc_check_authentication(&e, &r, &a); + TRY(cret, "fail to call CheckAuthentication: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -18893,19 +18807,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateVmGroup", av[i])) { + if (!strcmp("CreateAccessKey", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_vm_group_arg a = {0}; - struct osc_update_vm_group_arg *s = &a; + struct osc_create_access_key_arg a = {0}; + struct osc_create_access_key_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_vm_group_arg: + create_access_key_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -18924,7 +18838,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_vm_group_arg; + goto create_access_key_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -18938,17 +18852,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -18965,78 +18868,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ExpirationDate")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Tags argument missing\n"); + TRY((!*eq_ptr), "ExpirationDate argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; + TRY(!aa, "ExpirationDate argument missing\n"); + s->expiration_date = aa; // string string - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); - else if (*endptr != '.') - BAD_RET("'Tags' require a .\n"); - TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); - cascade_struct = &s->tags[pos]; - cascade_parser = resource_tag_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); - } else { - TRY(!aa, "Tags argument missing\n"); - s->tags_str = aa; // array ref ResourceTag ref - } } else - if ((aret = argcmp(next_a, "VmGroupId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmGroupId argument missing\n"); + TRY((!*eq_ptr), "UserName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmGroupId argument missing\n"); - s->vm_group_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "VmGroupName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "VmGroupName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "VmGroupName argument missing\n"); - s->vm_group_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "VmTemplateId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "VmTemplateId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "VmTemplateId argument missing\n"); - s->vm_template_id = aa; // string string + TRY(!aa, "UserName argument missing\n"); + s->user_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UpdateVmGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateAccessKey'\n", next_a); } i += incr; - goto update_vm_group_arg; + goto create_access_key_arg; } - cret = osc_update_vm_group(&e, &r, &a); - TRY(cret, "fail to call UpdateVmGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_create_access_key(&e, &r, &a); + TRY(cret, "fail to call CreateAccessKey: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -19063,19 +18924,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateVm", av[i])) { + if (!strcmp("CreateAccount", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_vm_arg a = {0}; - struct osc_update_vm_arg *s = &a; + struct osc_create_account_arg a = {0}; + struct osc_create_account_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_vm_arg: + create_account_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -19094,7 +18955,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_vm_arg; + goto create_account_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -19108,69 +18969,84 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "BlockDeviceMappings")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "AdditionalEmails")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "BlockDeviceMappings argument missing\n"); + TRY((!*eq_ptr), "AdditionalEmails argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos = strchr(str, '.'); + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); - if (dot_pos) { - int pos; - char *endptr; + TRY(!(dot_pos++), "AdditionalEmails argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "AdditionalEmails require an index\n"); + if (s->additional_emails) { + for (; s->additional_emails[last]; ++last); + } + if (pos < last) { + s->additional_emails[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->additional_emails, "", pa); + SET_NEXT(s->additional_emails, (aa), pa); + } + } else { + TRY(!aa, "AdditionalEmails argument missing\n"); + s->additional_emails_str = aa; + } + } else if (!(aret = argcmp(str, "AdditionalEmails[]")) || aret == '=') { + TRY(!aa, "AdditionalEmails[] argument missing\n"); + SET_NEXT(s->additional_emails, (aa), pa); + } else + if ((aret = argcmp(next_a, "City")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "City argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "City argument missing\n"); + s->city = aa; // string string - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'BlockDeviceMappings' require an index (example array ref BlockDeviceMappingVmUpdate.BlockDeviceMappings.0)\n"); - else if (*endptr != '.') - BAD_RET("'BlockDeviceMappings' require a .\n"); - TRY_ALLOC_AT(s,block_device_mappings, pa, pos, sizeof(*s->block_device_mappings)); - cascade_struct = &s->block_device_mappings[pos]; - cascade_parser = block_device_mapping_vm_update_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(block_device_mapping_vm_update_parser(&s->block_device_mappings[pos], endptr + 1, aa, pa)); - } else { - TRY(!aa, "BlockDeviceMappings argument missing\n"); - s->block_device_mappings_str = aa; // array ref BlockDeviceMappingVmUpdate ref - } } else - if ((aret = argcmp(next_a, "BsuOptimized")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "CompanyName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "BsuOptimized argument missing\n"); + TRY((!*eq_ptr), "CompanyName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_bsu_optimized = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->bsu_optimized = 1; - } else if (!strcasecmp(aa, "false")) { - s->bsu_optimized = 0; - } else { - BAD_RET("BsuOptimized require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "DeletionProtection")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "CompanyName argument missing\n"); + s->company_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "Country")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DeletionProtection argument missing\n"); + TRY((!*eq_ptr), "Country argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_deletion_protection = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->deletion_protection = 1; - } else if (!strcasecmp(aa, "false")) { - s->deletion_protection = 0; - } else { - BAD_RET("DeletionProtection require true/false\n"); - } - } else + TRY(!aa, "Country argument missing\n"); + s->country = aa; // string string + + } else + if ((aret = argcmp(next_a, "CustomerId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "CustomerId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "CustomerId argument missing\n"); + s->customer_id = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -19187,146 +19063,113 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "IsSourceDestChecked")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Email")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "IsSourceDestChecked argument missing\n"); + TRY((!*eq_ptr), "Email argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_is_source_dest_checked = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->is_source_dest_checked = 1; - } else if (!strcasecmp(aa, "false")) { - s->is_source_dest_checked = 0; - } else { - BAD_RET("IsSourceDestChecked require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "KeypairName")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "Email argument missing\n"); + s->email = aa; // string string + + } else + if ((aret = argcmp(next_a, "FirstName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "KeypairName argument missing\n"); + TRY((!*eq_ptr), "FirstName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "KeypairName argument missing\n"); - s->keypair_name = aa; // string string + TRY(!aa, "FirstName argument missing\n"); + s->first_name = aa; // string string } else - if ((aret = argcmp(next_a, "NestedVirtualization")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "JobTitle")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NestedVirtualization argument missing\n"); + TRY((!*eq_ptr), "JobTitle argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_nested_virtualization = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->nested_virtualization = 1; - } else if (!strcasecmp(aa, "false")) { - s->nested_virtualization = 0; - } else { - BAD_RET("NestedVirtualization require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "Performance")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "JobTitle argument missing\n"); + s->job_title = aa; // string string + + } else + if ((aret = argcmp(next_a, "LastName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Performance argument missing\n"); + TRY((!*eq_ptr), "LastName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Performance argument missing\n"); - s->performance = aa; // string string + TRY(!aa, "LastName argument missing\n"); + s->last_name = aa; // string string } else - if ((aret = argcmp(next_a, "SecurityGroupIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "MobileNumber")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupIds argument missing\n"); + TRY((!*eq_ptr), "MobileNumber argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "MobileNumber argument missing\n"); + s->mobile_number = aa; // string string - TRY(!(dot_pos++), "SecurityGroupIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "SecurityGroupIds require an index\n"); - if (s->security_group_ids) { - for (; s->security_group_ids[last]; ++last); - } - if (pos < last) { - s->security_group_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->security_group_ids, "", pa); - SET_NEXT(s->security_group_ids, (aa), pa); - } - } else { - TRY(!aa, "SecurityGroupIds argument missing\n"); - s->security_group_ids_str = aa; - } - } else if (!(aret = argcmp(str, "SecurityGroupIds[]")) || aret == '=') { - TRY(!aa, "SecurityGroupIds[] argument missing\n"); - SET_NEXT(s->security_group_ids, (aa), pa); } else - if ((aret = argcmp(next_a, "UserData")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PhoneNumber")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserData argument missing\n"); + TRY((!*eq_ptr), "PhoneNumber argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserData argument missing\n"); - s->user_data = aa; // string string + TRY(!aa, "PhoneNumber argument missing\n"); + s->phone_number = aa; // string string } else - if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "StateProvince")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmId argument missing\n"); + TRY((!*eq_ptr), "StateProvince argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmId argument missing\n"); - s->vm_id = aa; // string string + TRY(!aa, "StateProvince argument missing\n"); + s->state_province = aa; // string string } else - if ((aret = argcmp(next_a, "VmInitiatedShutdownBehavior")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VatNumber")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmInitiatedShutdownBehavior argument missing\n"); + TRY((!*eq_ptr), "VatNumber argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmInitiatedShutdownBehavior argument missing\n"); - s->vm_initiated_shutdown_behavior = aa; // string string + TRY(!aa, "VatNumber argument missing\n"); + s->vat_number = aa; // string string } else - if ((aret = argcmp(next_a, "VmType")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ZipCode")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmType argument missing\n"); + TRY((!*eq_ptr), "ZipCode argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmType argument missing\n"); - s->vm_type = aa; // string string + TRY(!aa, "ZipCode argument missing\n"); + s->zip_code = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UpdateVm'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateAccount'\n", next_a); } i += incr; - goto update_vm_arg; + goto create_account_arg; } - cret = osc_update_vm(&e, &r, &a); - TRY(cret, "fail to call UpdateVm: %s\n", curl_easy_strerror(cret)); + cret = osc_create_account(&e, &r, &a); + TRY(cret, "fail to call CreateAccount: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -19353,19 +19196,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateUserGroup", av[i])) { + if (!strcmp("CreateApiAccessRule", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_user_group_arg a = {0}; - struct osc_update_user_group_arg *s = &a; + struct osc_create_api_access_rule_arg a = {0}; + struct osc_create_api_access_rule_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_user_group_arg: + create_api_access_rule_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -19384,7 +19227,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_user_group_arg; + goto create_api_access_rule_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -19398,74 +19241,143 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "CaIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "CaIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "NewPath")) == 0 || aret == '=' || aret == '.') { + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "CaIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "CaIds require an index\n"); + if (s->ca_ids) { + for (; s->ca_ids[last]; ++last); + } + if (pos < last) { + s->ca_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->ca_ids, "", pa); + SET_NEXT(s->ca_ids, (aa), pa); + } + } else { + TRY(!aa, "CaIds argument missing\n"); + s->ca_ids_str = aa; + } + } else if (!(aret = argcmp(str, "CaIds[]")) || aret == '=') { + TRY(!aa, "CaIds[] argument missing\n"); + SET_NEXT(s->ca_ids, (aa), pa); + } else + if ((aret = argcmp(next_a, "Cns")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NewPath argument missing\n"); + TRY((!*eq_ptr), "Cns argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NewPath argument missing\n"); - s->new_path = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "Cns argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "Cns require an index\n"); + if (s->cns) { + for (; s->cns[last]; ++last); + } + if (pos < last) { + s->cns[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->cns, "", pa); + SET_NEXT(s->cns, (aa), pa); + } + } else { + TRY(!aa, "Cns argument missing\n"); + s->cns_str = aa; + } + } else if (!(aret = argcmp(str, "Cns[]")) || aret == '=') { + TRY(!aa, "Cns[] argument missing\n"); + SET_NEXT(s->cns, (aa), pa); } else - if ((aret = argcmp(next_a, "NewUserGroupName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NewUserGroupName argument missing\n"); + TRY((!*eq_ptr), "Description argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NewUserGroupName argument missing\n"); - s->new_user_group_name = aa; // string string + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string } else - if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Path argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Path argument missing\n"); - s->path = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "IpRanges")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupName argument missing\n"); + TRY((!*eq_ptr), "IpRanges argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserGroupName argument missing\n"); - s->user_group_name = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "IpRanges argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "IpRanges require an index\n"); + if (s->ip_ranges) { + for (; s->ip_ranges[last]; ++last); + } + if (pos < last) { + s->ip_ranges[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->ip_ranges, "", pa); + SET_NEXT(s->ip_ranges, (aa), pa); + } + } else { + TRY(!aa, "IpRanges argument missing\n"); + s->ip_ranges_str = aa; + } + } else if (!(aret = argcmp(str, "IpRanges[]")) || aret == '=') { + TRY(!aa, "IpRanges[] argument missing\n"); + SET_NEXT(s->ip_ranges, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'UpdateUserGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateApiAccessRule'\n", next_a); } i += incr; - goto update_user_group_arg; + goto create_api_access_rule_arg; } - cret = osc_update_user_group(&e, &r, &a); - TRY(cret, "fail to call UpdateUserGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_create_api_access_rule(&e, &r, &a); + TRY(cret, "fail to call CreateApiAccessRule: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -19492,19 +19404,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateUser", av[i])) { + if (!strcmp("CreateCa", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_user_arg a = {0}; - struct osc_update_user_arg *s = &a; + struct osc_create_ca_arg a = {0}; + struct osc_create_ca_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_user_arg: + create_ca_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -19523,7 +19435,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_user_arg; + goto create_ca_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -19537,74 +19449,52 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "NewPath")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NewPath argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NewPath argument missing\n"); - s->new_path = aa; // string string - - } else - if ((aret = argcmp(next_a, "NewUserEmail")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "CaPem")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NewUserEmail argument missing\n"); + TRY((!*eq_ptr), "CaPem argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NewUserEmail argument missing\n"); - s->new_user_email = aa; // string string + TRY(!aa, "CaPem argument missing\n"); + s->ca_pem = aa; // string string } else - if ((aret = argcmp(next_a, "NewUserName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NewUserName argument missing\n"); + TRY((!*eq_ptr), "Description argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NewUserName argument missing\n"); - s->new_user_name = aa; // string string + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string } else - if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserName argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserName argument missing\n"); - s->user_name = aa; // string string - - } else + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else { - BAD_RET("'%s' is not a valide argument for 'UpdateUser'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateCa'\n", next_a); } i += incr; - goto update_user_arg; + goto create_ca_arg; } - cret = osc_update_user(&e, &r, &a); - TRY(cret, "fail to call UpdateUser: %s\n", curl_easy_strerror(cret)); + cret = osc_create_ca(&e, &r, &a); + TRY(cret, "fail to call CreateCa: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -19631,19 +19521,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateSubnet", av[i])) { + if (!strcmp("CreateClientGateway", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_subnet_arg a = {0}; - struct osc_update_subnet_arg *s = &a; + struct osc_create_client_gateway_arg a = {0}; + struct osc_create_client_gateway_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_subnet_arg: + create_client_gateway_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -19662,7 +19552,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_subnet_arg; + goto create_client_gateway_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -19676,57 +19566,63 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "BgpAsn")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "BgpAsn argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "MapPublicIpOnLaunch")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "BgpAsn argument missing\n"); + s->is_set_bgp_asn = 1; + s->bgp_asn = atoll(aa); + } else + if ((aret = argcmp(next_a, "ConnectionType")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "MapPublicIpOnLaunch argument missing\n"); + TRY((!*eq_ptr), "ConnectionType argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_map_public_ip_on_launch = 1; + TRY(!aa, "ConnectionType argument missing\n"); + s->connection_type = aa; // string string + + } else + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DryRun argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_dry_run = 1; if (!aa || !strcasecmp(aa, "true")) { - s->map_public_ip_on_launch = 1; + s->dry_run = 1; } else if (!strcasecmp(aa, "false")) { - s->map_public_ip_on_launch = 0; + s->dry_run = 0; } else { - BAD_RET("MapPublicIpOnLaunch require true/false\n"); + BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PublicIp")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SubnetId argument missing\n"); + TRY((!*eq_ptr), "PublicIp argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SubnetId argument missing\n"); - s->subnet_id = aa; // string string + TRY(!aa, "PublicIp argument missing\n"); + s->public_ip = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UpdateSubnet'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateClientGateway'\n", next_a); } i += incr; - goto update_subnet_arg; + goto create_client_gateway_arg; } - cret = osc_update_subnet(&e, &r, &a); - TRY(cret, "fail to call UpdateSubnet: %s\n", curl_easy_strerror(cret)); + cret = osc_create_client_gateway(&e, &r, &a); + TRY(cret, "fail to call CreateClientGateway: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -19753,19 +19649,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateSnapshot", av[i])) { + if (!strcmp("CreateDedicatedGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_snapshot_arg a = {0}; - struct osc_update_snapshot_arg *s = &a; + struct osc_create_dedicated_group_arg a = {0}; + struct osc_create_dedicated_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_snapshot_arg: + create_dedicated_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -19784,7 +19680,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_snapshot_arg; + goto create_dedicated_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -19798,6 +19694,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "CpuGeneration")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "CpuGeneration argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "CpuGeneration argument missing\n"); + s->is_set_cpu_generation = 1; + s->cpu_generation = atoll(aa); + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -19814,48 +19721,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "PermissionsToCreateVolume")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Name")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PermissionsToCreateVolume argument missing\n"); + TRY((!*eq_ptr), "Name argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "Name argument missing\n"); + s->name = aa; // string string - TRY(!aa, "PermissionsToCreateVolume argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->permissions_to_create_volume; - cascade_parser = permissions_on_resource_creation_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(permissions_on_resource_creation_parser(&s->permissions_to_create_volume, dot_pos, aa, pa)); - s->is_set_permissions_to_create_volume = 1; - } else { - s->permissions_to_create_volume_str = aa; - } } else - if ((aret = argcmp(next_a, "SnapshotId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SubregionName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SnapshotId argument missing\n"); + TRY((!*eq_ptr), "SubregionName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SnapshotId argument missing\n"); - s->snapshot_id = aa; // string string + TRY(!aa, "SubregionName argument missing\n"); + s->subregion_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UpdateSnapshot'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateDedicatedGroup'\n", next_a); } i += incr; - goto update_snapshot_arg; + goto create_dedicated_group_arg; } - cret = osc_update_snapshot(&e, &r, &a); - TRY(cret, "fail to call UpdateSnapshot: %s\n", curl_easy_strerror(cret)); + cret = osc_create_dedicated_group(&e, &r, &a); + TRY(cret, "fail to call CreateDedicatedGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -19882,19 +19777,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateServerCertificate", av[i])) { + if (!strcmp("CreateDhcpOptions", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_server_certificate_arg a = {0}; - struct osc_update_server_certificate_arg *s = &a; + struct osc_create_dhcp_options_arg a = {0}; + struct osc_create_dhcp_options_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_server_certificate_arg: + create_dhcp_options_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -19913,7 +19808,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_server_certificate_arg; + goto create_dhcp_options_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -19927,6 +19822,51 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "DomainName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DomainName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "DomainName argument missing\n"); + s->domain_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "DomainNameServers")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DomainNameServers argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "DomainNameServers argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "DomainNameServers require an index\n"); + if (s->domain_name_servers) { + for (; s->domain_name_servers[last]; ++last); + } + if (pos < last) { + s->domain_name_servers[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->domain_name_servers, "", pa); + SET_NEXT(s->domain_name_servers, (aa), pa); + } + } else { + TRY(!aa, "DomainNameServers argument missing\n"); + s->domain_name_servers_str = aa; + } + } else if (!(aret = argcmp(str, "DomainNameServers[]")) || aret == '=') { + TRY(!aa, "DomainNameServers[] argument missing\n"); + SET_NEXT(s->domain_name_servers, (aa), pa); + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -19943,47 +19883,82 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Name")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Name argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Name argument missing\n"); - s->name = aa; // string string - - } else - if ((aret = argcmp(next_a, "NewName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LogServers")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NewName argument missing\n"); + TRY((!*eq_ptr), "LogServers argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NewName argument missing\n"); - s->new_name = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "LogServers argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "LogServers require an index\n"); + if (s->log_servers) { + for (; s->log_servers[last]; ++last); + } + if (pos < last) { + s->log_servers[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->log_servers, "", pa); + SET_NEXT(s->log_servers, (aa), pa); + } + } else { + TRY(!aa, "LogServers argument missing\n"); + s->log_servers_str = aa; + } + } else if (!(aret = argcmp(str, "LogServers[]")) || aret == '=') { + TRY(!aa, "LogServers[] argument missing\n"); + SET_NEXT(s->log_servers, (aa), pa); } else - if ((aret = argcmp(next_a, "NewPath")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NtpServers")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NewPath argument missing\n"); + TRY((!*eq_ptr), "NtpServers argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NewPath argument missing\n"); - s->new_path = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "NtpServers argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "NtpServers require an index\n"); + if (s->ntp_servers) { + for (; s->ntp_servers[last]; ++last); + } + if (pos < last) { + s->ntp_servers[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->ntp_servers, "", pa); + SET_NEXT(s->ntp_servers, (aa), pa); + } + } else { + TRY(!aa, "NtpServers argument missing\n"); + s->ntp_servers_str = aa; + } + } else if (!(aret = argcmp(str, "NtpServers[]")) || aret == '=') { + TRY(!aa, "NtpServers[] argument missing\n"); + SET_NEXT(s->ntp_servers, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'UpdateServerCertificate'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateDhcpOptions'\n", next_a); } i += incr; - goto update_server_certificate_arg; + goto create_dhcp_options_arg; } - cret = osc_update_server_certificate(&e, &r, &a); - TRY(cret, "fail to call UpdateServerCertificate: %s\n", curl_easy_strerror(cret)); + cret = osc_create_dhcp_options(&e, &r, &a); + TRY(cret, "fail to call CreateDhcpOptions: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -20010,19 +19985,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateRouteTableLink", av[i])) { + if (!strcmp("CreateDirectLinkInterface", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_route_table_link_arg a = {0}; - struct osc_update_route_table_link_arg *s = &a; + struct osc_create_direct_link_interface_arg a = {0}; + struct osc_create_direct_link_interface_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_route_table_link_arg: + create_direct_link_interface_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -20041,7 +20016,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_route_table_link_arg; + goto create_direct_link_interface_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -20055,52 +20030,64 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DirectLinkId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "DirectLinkId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "LinkRouteTableId")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "DirectLinkId argument missing\n"); + s->direct_link_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "DirectLinkInterface")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LinkRouteTableId argument missing\n"); + TRY((!*eq_ptr), "DirectLinkInterface argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "LinkRouteTableId argument missing\n"); - s->link_route_table_id = aa; // string string + char *dot_pos; + TRY(!aa, "DirectLinkInterface argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->direct_link_interface; + cascade_parser = direct_link_interface_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(direct_link_interface_parser(&s->direct_link_interface, dot_pos, aa, pa)); + s->is_set_direct_link_interface = 1; + } else { + s->direct_link_interface_str = aa; + } } else - if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "RouteTableId argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "RouteTableId argument missing\n"); - s->route_table_id = aa; // string string - - } else + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else { - BAD_RET("'%s' is not a valide argument for 'UpdateRouteTableLink'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateDirectLinkInterface'\n", next_a); } i += incr; - goto update_route_table_link_arg; + goto create_direct_link_interface_arg; } - cret = osc_update_route_table_link(&e, &r, &a); - TRY(cret, "fail to call UpdateRouteTableLink: %s\n", curl_easy_strerror(cret)); + cret = osc_create_direct_link_interface(&e, &r, &a); + TRY(cret, "fail to call CreateDirectLinkInterface: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -20127,19 +20114,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateRoutePropagation", av[i])) { + if (!strcmp("CreateDirectLink", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_route_propagation_arg a = {0}; - struct osc_update_route_propagation_arg *s = &a; + struct osc_create_direct_link_arg a = {0}; + struct osc_create_direct_link_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_route_propagation_arg: + create_direct_link_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -20158,7 +20145,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_route_propagation_arg; + goto create_direct_link_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -20172,6 +20159,28 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "Bandwidth")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Bandwidth argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Bandwidth argument missing\n"); + s->bandwidth = aa; // string string + + } else + if ((aret = argcmp(next_a, "DirectLinkName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DirectLinkName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "DirectLinkName argument missing\n"); + s->direct_link_name = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -20188,52 +20197,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Enable")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Enable argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_enable = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->enable = 1; - } else if (!strcasecmp(aa, "false")) { - s->enable = 0; - } else { - BAD_RET("Enable require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "RouteTableId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "RouteTableId argument missing\n"); - s->route_table_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "VirtualGatewayId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Location")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VirtualGatewayId argument missing\n"); + TRY((!*eq_ptr), "Location argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VirtualGatewayId argument missing\n"); - s->virtual_gateway_id = aa; // string string + TRY(!aa, "Location argument missing\n"); + s->location = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UpdateRoutePropagation'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateDirectLink'\n", next_a); } i += incr; - goto update_route_propagation_arg; + goto create_direct_link_arg; } - cret = osc_update_route_propagation(&e, &r, &a); - TRY(cret, "fail to call UpdateRoutePropagation: %s\n", curl_easy_strerror(cret)); + cret = osc_create_direct_link(&e, &r, &a); + TRY(cret, "fail to call CreateDirectLink: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -20260,19 +20242,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateRoute", av[i])) { + if (!strcmp("CreateFlexibleGpu", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_route_arg a = {0}; - struct osc_update_route_arg *s = &a; + struct osc_create_flexible_gpu_arg a = {0}; + struct osc_create_flexible_gpu_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_route_arg: + create_flexible_gpu_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -20291,7 +20273,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_route_arg; + goto create_flexible_gpu_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -20305,17 +20287,22 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DestinationIpRange")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DeleteOnVmDeletion")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DestinationIpRange argument missing\n"); + TRY((!*eq_ptr), "DeleteOnVmDeletion argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "DestinationIpRange argument missing\n"); - s->destination_ip_range = aa; // string string - - } else + s->is_set_delete_on_vm_deletion = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->delete_on_vm_deletion = 1; + } else if (!strcasecmp(aa, "false")) { + s->delete_on_vm_deletion = 0; + } else { + BAD_RET("DeleteOnVmDeletion require true/false\n"); + } + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -20332,80 +20319,47 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "GatewayId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "GatewayId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "GatewayId argument missing\n"); - s->gateway_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "NatServiceId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NatServiceId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NatServiceId argument missing\n"); - s->nat_service_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "NetPeeringId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NetPeeringId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NetPeeringId argument missing\n"); - s->net_peering_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Generation")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NicId argument missing\n"); + TRY((!*eq_ptr), "Generation argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NicId argument missing\n"); - s->nic_id = aa; // string string + TRY(!aa, "Generation argument missing\n"); + s->generation = aa; // string string } else - if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ModelName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "RouteTableId argument missing\n"); + TRY((!*eq_ptr), "ModelName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "RouteTableId argument missing\n"); - s->route_table_id = aa; // string string + TRY(!aa, "ModelName argument missing\n"); + s->model_name = aa; // string string } else - if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SubregionName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmId argument missing\n"); + TRY((!*eq_ptr), "SubregionName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmId argument missing\n"); - s->vm_id = aa; // string string + TRY(!aa, "SubregionName argument missing\n"); + s->subregion_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UpdateRoute'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateFlexibleGpu'\n", next_a); } i += incr; - goto update_route_arg; + goto create_flexible_gpu_arg; } - cret = osc_update_route(&e, &r, &a); - TRY(cret, "fail to call UpdateRoute: %s\n", curl_easy_strerror(cret)); + cret = osc_create_flexible_gpu(&e, &r, &a); + TRY(cret, "fail to call CreateFlexibleGpu: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -20432,19 +20386,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateNic", av[i])) { + if (!strcmp("CreateImageExportTask", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_nic_arg a = {0}; - struct osc_update_nic_arg *s = &a; + struct osc_create_image_export_task_arg a = {0}; + struct osc_create_image_export_task_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_nic_arg: + create_image_export_task_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -20463,7 +20417,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_nic_arg; + goto create_image_export_task_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -20477,17 +20431,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -20504,82 +20447,48 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "LinkNic")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ImageId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LinkNic argument missing\n"); + TRY((!*eq_ptr), "ImageId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; - - TRY(!aa, "LinkNic argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->link_nic; - cascade_parser = link_nic_to_update_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(link_nic_to_update_parser(&s->link_nic, dot_pos, aa, pa)); - s->is_set_link_nic = 1; - } else { - s->link_nic_str = aa; - } - } else - if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NicId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NicId argument missing\n"); - s->nic_id = aa; // string string + TRY(!aa, "ImageId argument missing\n"); + s->image_id = aa; // string string } else - if ((aret = argcmp(next_a, "SecurityGroupIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "OsuExport")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupIds argument missing\n"); + TRY((!*eq_ptr), "OsuExport argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + char *dot_pos; - TRY(!(dot_pos++), "SecurityGroupIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "SecurityGroupIds require an index\n"); - if (s->security_group_ids) { - for (; s->security_group_ids[last]; ++last); - } - if (pos < last) { - s->security_group_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->security_group_ids, "", pa); - SET_NEXT(s->security_group_ids, (aa), pa); - } - } else { - TRY(!aa, "SecurityGroupIds argument missing\n"); - s->security_group_ids_str = aa; - } - } else if (!(aret = argcmp(str, "SecurityGroupIds[]")) || aret == '=') { - TRY(!aa, "SecurityGroupIds[] argument missing\n"); - SET_NEXT(s->security_group_ids, (aa), pa); + TRY(!aa, "OsuExport argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->osu_export; + cascade_parser = osu_export_to_create_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(osu_export_to_create_parser(&s->osu_export, dot_pos, aa, pa)); + s->is_set_osu_export = 1; + } else { + s->osu_export_str = aa; + } } else { - BAD_RET("'%s' is not a valide argument for 'UpdateNic'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateImageExportTask'\n", next_a); } i += incr; - goto update_nic_arg; + goto create_image_export_task_arg; } - cret = osc_update_nic(&e, &r, &a); - TRY(cret, "fail to call UpdateNic: %s\n", curl_easy_strerror(cret)); + cret = osc_create_image_export_task(&e, &r, &a); + TRY(cret, "fail to call CreateImageExportTask: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -20606,19 +20515,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateNetAccessPoint", av[i])) { + if (!strcmp("CreateImage", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_net_access_point_arg a = {0}; - struct osc_update_net_access_point_arg *s = &a; + struct osc_create_image_arg a = {0}; + struct osc_create_image_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_net_access_point_arg: + create_image_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -20637,7 +20546,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_net_access_point_arg; + goto create_image_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -20651,39 +20560,58 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "AddRouteTableIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Architecture")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "AddRouteTableIds argument missing\n"); + TRY((!*eq_ptr), "Architecture argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "Architecture argument missing\n"); + s->architecture = aa; // string string + + } else + if ((aret = argcmp(next_a, "BlockDeviceMappings")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "BlockDeviceMappings argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'BlockDeviceMappings' require an index (example array ref BlockDeviceMappingImage.BlockDeviceMappings.0)\n"); + else if (*endptr != '.') + BAD_RET("'BlockDeviceMappings' require a .\n"); + TRY_ALLOC_AT(s,block_device_mappings, pa, pos, sizeof(*s->block_device_mappings)); + cascade_struct = &s->block_device_mappings[pos]; + cascade_parser = block_device_mapping_image_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(block_device_mapping_image_parser(&s->block_device_mappings[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "BlockDeviceMappings argument missing\n"); + s->block_device_mappings_str = aa; // array ref BlockDeviceMappingImage ref + } + } else + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Description argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string - TRY(!(dot_pos++), "AddRouteTableIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "AddRouteTableIds require an index\n"); - if (s->add_route_table_ids) { - for (; s->add_route_table_ids[last]; ++last); - } - if (pos < last) { - s->add_route_table_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->add_route_table_ids, "", pa); - SET_NEXT(s->add_route_table_ids, (aa), pa); - } - } else { - TRY(!aa, "AddRouteTableIds argument missing\n"); - s->add_route_table_ids_str = aa; - } - } else if (!(aret = argcmp(str, "AddRouteTableIds[]")) || aret == '=') { - TRY(!aa, "AddRouteTableIds[] argument missing\n"); - SET_NEXT(s->add_route_table_ids, (aa), pa); } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); @@ -20701,21 +20629,48 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NetAccessPointId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "FileLocation")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NetAccessPointId argument missing\n"); + TRY((!*eq_ptr), "FileLocation argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NetAccessPointId argument missing\n"); - s->net_access_point_id = aa; // string string + TRY(!aa, "FileLocation argument missing\n"); + s->file_location = aa; // string string } else - if ((aret = argcmp(next_a, "RemoveRouteTableIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ImageName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "RemoveRouteTableIds argument missing\n"); + TRY((!*eq_ptr), "ImageName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ImageName argument missing\n"); + s->image_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "NoReboot")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NoReboot argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_no_reboot = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->no_reboot = 1; + } else if (!strcasecmp(aa, "false")) { + s->no_reboot = 0; + } else { + BAD_RET("NoReboot require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "ProductCodes")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ProductCodes argument missing\n"); aa = eq_ptr + 1; incr = 1; } @@ -20725,74 +20680,118 @@ int main(int ac, char **av) int last = 0; char *dot_pos = strchr(str, '.'); - TRY(!(dot_pos++), "RemoveRouteTableIds argument missing\n"); + TRY(!(dot_pos++), "ProductCodes argument missing\n"); pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "RemoveRouteTableIds require an index\n"); - if (s->remove_route_table_ids) { - for (; s->remove_route_table_ids[last]; ++last); + TRY(endptr == dot_pos, "ProductCodes require an index\n"); + if (s->product_codes) { + for (; s->product_codes[last]; ++last); } if (pos < last) { - s->remove_route_table_ids[pos] = (aa); + s->product_codes[pos] = (aa); } else { for (int i = last; i < pos; ++i) - SET_NEXT(s->remove_route_table_ids, "", pa); - SET_NEXT(s->remove_route_table_ids, (aa), pa); + SET_NEXT(s->product_codes, "", pa); + SET_NEXT(s->product_codes, (aa), pa); } } else { - TRY(!aa, "RemoveRouteTableIds argument missing\n"); - s->remove_route_table_ids_str = aa; + TRY(!aa, "ProductCodes argument missing\n"); + s->product_codes_str = aa; } - } else if (!(aret = argcmp(str, "RemoveRouteTableIds[]")) || aret == '=') { - TRY(!aa, "RemoveRouteTableIds[] argument missing\n"); - SET_NEXT(s->remove_route_table_ids, (aa), pa); + } else if (!(aret = argcmp(str, "ProductCodes[]")) || aret == '=') { + TRY(!aa, "ProductCodes[] argument missing\n"); + SET_NEXT(s->product_codes, (aa), pa); } else - { - BAD_RET("'%s' is not a valide argument for 'UpdateNetAccessPoint'\n", next_a); - } - i += incr; - goto update_net_access_point_arg; - } - cret = osc_update_net_access_point(&e, &r, &a); - TRY(cret, "fail to call UpdateNetAccessPoint: %s\n", curl_easy_strerror(cret)); - CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); - jobj = NULL; - if (program_flag & OAPI_RAW_OUTPUT) - puts(r.buf); - else { - jobj = json_tokener_parse(r.buf); - puts(json_object_to_json_string_ext(jobj, - JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | - color_flag)); - } - while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { - ++i; - TRY(i + 1 >= ac, "--set-var require an argument"); - if (!jobj) - jobj = json_tokener_parse(r.buf); - if (parse_variable(jobj, av, ac, i)) - return -1; - ++i; - } + if ((aret = argcmp(next_a, "RootDeviceName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "RootDeviceName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "RootDeviceName argument missing\n"); + s->root_device_name = aa; // string string - if (jobj) { - json_object_put(jobj); - jobj = NULL; - } - osc_deinit_str(&r); - } else - if (!strcmp("UpdateNet", av[i])) { + } else + if ((aret = argcmp(next_a, "SourceImageId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SourceImageId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SourceImageId argument missing\n"); + s->source_image_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "SourceRegionName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SourceRegionName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SourceRegionName argument missing\n"); + s->source_region_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VmId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VmId argument missing\n"); + s->vm_id = aa; // string string + + } else + { + BAD_RET("'%s' is not a valide argument for 'CreateImage'\n", next_a); + } + i += incr; + goto create_image_arg; + } + cret = osc_create_image(&e, &r, &a); + TRY(cret, "fail to call CreateImage: %s\n", curl_easy_strerror(cret)); + CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); + jobj = NULL; + if (program_flag & OAPI_RAW_OUTPUT) + puts(r.buf); + else { + jobj = json_tokener_parse(r.buf); + puts(json_object_to_json_string_ext(jobj, + JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | + color_flag)); + } + while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { + ++i; + TRY(i + 1 >= ac, "--set-var require an argument"); + if (!jobj) + jobj = json_tokener_parse(r.buf); + if (parse_variable(jobj, av, ac, i)) + return -1; + ++i; + } + + if (jobj) { + json_object_put(jobj); + jobj = NULL; + } + osc_deinit_str(&r); + } else + if (!strcmp("CreateInternetService", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_net_arg a = {0}; - struct osc_update_net_arg *s = &a; + struct osc_create_internet_service_arg a = {0}; + struct osc_create_internet_service_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_net_arg: + create_internet_service_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -20811,7 +20810,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_net_arg; + goto create_internet_service_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -20825,17 +20824,101 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DhcpOptionsSetId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DhcpOptionsSetId argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "DhcpOptionsSetId argument missing\n"); - s->dhcp_options_set_id = aa; // string string + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + { + BAD_RET("'%s' is not a valide argument for 'CreateInternetService'\n", next_a); + } + i += incr; + goto create_internet_service_arg; + } + cret = osc_create_internet_service(&e, &r, &a); + TRY(cret, "fail to call CreateInternetService: %s\n", curl_easy_strerror(cret)); + CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); + jobj = NULL; + if (program_flag & OAPI_RAW_OUTPUT) + puts(r.buf); + else { + jobj = json_tokener_parse(r.buf); + puts(json_object_to_json_string_ext(jobj, + JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | + color_flag)); + } + while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { + ++i; + TRY(i + 1 >= ac, "--set-var require an argument"); + if (!jobj) + jobj = json_tokener_parse(r.buf); + if (parse_variable(jobj, av, ac, i)) + return -1; + ++i; + } - } else + if (jobj) { + json_object_put(jobj); + jobj = NULL; + } + osc_deinit_str(&r); + } else + if (!strcmp("CreateKeypair", av[i])) { + auto_osc_json_c json_object *jobj = NULL; + auto_ptr_array struct ptr_array opa = {0}; + struct ptr_array *pa = &opa; + struct osc_create_keypair_arg a = {0}; + struct osc_create_keypair_arg *s = &a; + __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; + int cret; + + cascade_struct = NULL; + cascade_parser = NULL; + + create_keypair_arg: + + if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { + char *next_a = &av[i + 1][2]; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int incr = 2; + char *eq_ptr = strchr(next_a, '='); + + CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); + if (eq_ptr) { + CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); + incr = 1; + aa = eq_ptr + 1; + } else { + CHK_BAD_RET(!aa, "cascade need an argument\n"); + META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) + } + STRY(cascade_parser(cascade_struct, next_a, aa, pa)); + i += incr; + goto create_keypair_arg; + } + + if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { + char *next_a = &av[i + 1][2]; + char *str = next_a; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int aret = 0; + int incr = aa ? 2 : 1; + + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -20852,25 +20935,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "KeypairName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NetId argument missing\n"); + TRY((!*eq_ptr), "KeypairName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NetId argument missing\n"); - s->net_id = aa; // string string + TRY(!aa, "KeypairName argument missing\n"); + s->keypair_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "PublicKey")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "PublicKey argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "PublicKey argument missing\n"); + s->public_key = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UpdateNet'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateKeypair'\n", next_a); } i += incr; - goto update_net_arg; + goto create_keypair_arg; } - cret = osc_update_net(&e, &r, &a); - TRY(cret, "fail to call UpdateNet: %s\n", curl_easy_strerror(cret)); + cret = osc_create_keypair(&e, &r, &a); + TRY(cret, "fail to call CreateKeypair: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -20897,19 +20991,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateLoadBalancer", av[i])) { + if (!strcmp("CreateListenerRule", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_load_balancer_arg a = {0}; - struct osc_update_load_balancer_arg *s = &a; + struct osc_create_listener_rule_arg a = {0}; + struct osc_create_listener_rule_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_load_balancer_arg: + create_listener_rule_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -20928,7 +21022,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_load_balancer_arg; + goto create_listener_rule_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -20942,29 +21036,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "AccessLog")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "AccessLog argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "AccessLog argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->access_log; - cascade_parser = access_log_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(access_log_parser(&s->access_log, dot_pos, aa, pa)); - s->is_set_access_log = 1; - } else { - s->access_log_str = aa; - } - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -20981,116 +21052,56 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "HealthCheck")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Listener")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "HealthCheck argument missing\n"); + TRY((!*eq_ptr), "Listener argument missing\n"); aa = eq_ptr + 1; incr = 1; } char *dot_pos; - TRY(!aa, "HealthCheck argument missing\n"); + TRY(!aa, "Listener argument missing\n"); dot_pos = strchr(str, '.'); if (dot_pos++) { - cascade_struct = &s->health_check; - cascade_parser = health_check_parser; + cascade_struct = &s->listener; + cascade_parser = load_balancer_light_parser; if (*dot_pos == '.') { ++dot_pos; } - STRY(health_check_parser(&s->health_check, dot_pos, aa, pa)); - s->is_set_health_check = 1; + STRY(load_balancer_light_parser(&s->listener, dot_pos, aa, pa)); + s->is_set_listener = 1; } else { - s->health_check_str = aa; + s->listener_str = aa; } } else - if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ListenerRule")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); + TRY((!*eq_ptr), "ListenerRule argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "LoadBalancerName argument missing\n"); - s->load_balancer_name = aa; // string string + char *dot_pos; - } else - if ((aret = argcmp(next_a, "LoadBalancerPort")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerPort argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "LoadBalancerPort argument missing\n"); - s->is_set_load_balancer_port = 1; - s->load_balancer_port = atoll(aa); - } else - if ((aret = argcmp(next_a, "PolicyNames")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PolicyNames argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "PolicyNames argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "PolicyNames require an index\n"); - if (s->policy_names) { - for (; s->policy_names[last]; ++last); - } - if (pos < last) { - s->policy_names[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->policy_names, "", pa); - SET_NEXT(s->policy_names, (aa), pa); - } - } else { - TRY(!aa, "PolicyNames argument missing\n"); - s->policy_names_str = aa; - } - } else if (!(aret = argcmp(str, "PolicyNames[]")) || aret == '=') { - TRY(!aa, "PolicyNames[] argument missing\n"); - SET_NEXT(s->policy_names, (aa), pa); - } else - if ((aret = argcmp(next_a, "PublicIp")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PublicIp argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "PublicIp argument missing\n"); - s->public_ip = aa; // string string - - } else - if ((aret = argcmp(next_a, "SecuredCookies")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SecuredCookies argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_secured_cookies = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->secured_cookies = 1; - } else if (!strcasecmp(aa, "false")) { - s->secured_cookies = 0; + TRY(!aa, "ListenerRule argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->listener_rule; + cascade_parser = listener_rule_for_creation_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(listener_rule_for_creation_parser(&s->listener_rule, dot_pos, aa, pa)); + s->is_set_listener_rule = 1; } else { - BAD_RET("SecuredCookies require true/false\n"); + s->listener_rule_str = aa; } - } else - if ((aret = argcmp(next_a, "SecurityGroups")) == 0 || aret == '=' || aret == '.') { + } else + if ((aret = argcmp(next_a, "VmIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroups argument missing\n"); + TRY((!*eq_ptr), "VmIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } @@ -21100,46 +21111,35 @@ int main(int ac, char **av) int last = 0; char *dot_pos = strchr(str, '.'); - TRY(!(dot_pos++), "SecurityGroups argument missing\n"); + TRY(!(dot_pos++), "VmIds argument missing\n"); pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "SecurityGroups require an index\n"); - if (s->security_groups) { - for (; s->security_groups[last]; ++last); + TRY(endptr == dot_pos, "VmIds require an index\n"); + if (s->vm_ids) { + for (; s->vm_ids[last]; ++last); } if (pos < last) { - s->security_groups[pos] = (aa); + s->vm_ids[pos] = (aa); } else { for (int i = last; i < pos; ++i) - SET_NEXT(s->security_groups, "", pa); - SET_NEXT(s->security_groups, (aa), pa); + SET_NEXT(s->vm_ids, "", pa); + SET_NEXT(s->vm_ids, (aa), pa); } } else { - TRY(!aa, "SecurityGroups argument missing\n"); - s->security_groups_str = aa; + TRY(!aa, "VmIds argument missing\n"); + s->vm_ids_str = aa; } - } else if (!(aret = argcmp(str, "SecurityGroups[]")) || aret == '=') { - TRY(!aa, "SecurityGroups[] argument missing\n"); - SET_NEXT(s->security_groups, (aa), pa); - } else - if ((aret = argcmp(next_a, "ServerCertificateId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ServerCertificateId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ServerCertificateId argument missing\n"); - s->server_certificate_id = aa; // string string - + } else if (!(aret = argcmp(str, "VmIds[]")) || aret == '=') { + TRY(!aa, "VmIds[] argument missing\n"); + SET_NEXT(s->vm_ids, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'UpdateLoadBalancer'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateListenerRule'\n", next_a); } i += incr; - goto update_load_balancer_arg; + goto create_listener_rule_arg; } - cret = osc_update_load_balancer(&e, &r, &a); - TRY(cret, "fail to call UpdateLoadBalancer: %s\n", curl_easy_strerror(cret)); + cret = osc_create_listener_rule(&e, &r, &a); + TRY(cret, "fail to call CreateListenerRule: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -21166,19 +21166,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateListenerRule", av[i])) { + if (!strcmp("CreateLoadBalancerListeners", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_listener_rule_arg a = {0}; - struct osc_update_listener_rule_arg *s = &a; + struct osc_create_load_balancer_listeners_arg a = {0}; + struct osc_create_load_balancer_listeners_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_listener_rule_arg: + create_load_balancer_listeners_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -21197,7 +21197,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_listener_rule_arg; + goto create_load_balancer_listeners_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -21227,47 +21227,56 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "HostPattern")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Listeners")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "HostPattern argument missing\n"); + TRY((!*eq_ptr), "Listeners argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "HostPattern argument missing\n"); - s->host_pattern = aa; // string string + char *dot_pos = strchr(str, '.'); - } else - if ((aret = argcmp(next_a, "ListenerRuleName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ListenerRuleName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ListenerRuleName argument missing\n"); - s->listener_rule_name = aa; // string string + if (dot_pos) { + int pos; + char *endptr; + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Listeners' require an index (example array ref ListenerForCreation.Listeners.0)\n"); + else if (*endptr != '.') + BAD_RET("'Listeners' require a .\n"); + TRY_ALLOC_AT(s,listeners, pa, pos, sizeof(*s->listeners)); + cascade_struct = &s->listeners[pos]; + cascade_parser = listener_for_creation_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(listener_for_creation_parser(&s->listeners[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Listeners argument missing\n"); + s->listeners_str = aa; // array ref ListenerForCreation ref + } } else - if ((aret = argcmp(next_a, "PathPattern")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PathPattern argument missing\n"); + TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PathPattern argument missing\n"); - s->path_pattern = aa; // string string + TRY(!aa, "LoadBalancerName argument missing\n"); + s->load_balancer_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UpdateListenerRule'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateLoadBalancerListeners'\n", next_a); } i += incr; - goto update_listener_rule_arg; + goto create_load_balancer_listeners_arg; } - cret = osc_update_listener_rule(&e, &r, &a); - TRY(cret, "fail to call UpdateListenerRule: %s\n", curl_easy_strerror(cret)); + cret = osc_create_load_balancer_listeners(&e, &r, &a); + TRY(cret, "fail to call CreateLoadBalancerListeners: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -21294,19 +21303,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateImage", av[i])) { + if (!strcmp("CreateLoadBalancerPolicy", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_image_arg a = {0}; - struct osc_update_image_arg *s = &a; + struct osc_create_load_balancer_policy_arg a = {0}; + struct osc_create_load_balancer_policy_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_image_arg: + create_load_balancer_policy_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -21325,7 +21334,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_image_arg; + goto create_load_balancer_policy_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -21339,15 +21348,26 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "CookieExpirationPeriod")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); + TRY((!*eq_ptr), "CookieExpirationPeriod argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string + TRY(!aa, "CookieExpirationPeriod argument missing\n"); + s->is_set_cookie_expiration_period = 1; + s->cookie_expiration_period = atoll(aa); + } else + if ((aret = argcmp(next_a, "CookieName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "CookieName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "CookieName argument missing\n"); + s->cookie_name = aa; // string string } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { @@ -21366,48 +21386,47 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "ImageId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ImageId argument missing\n"); + TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ImageId argument missing\n"); - s->image_id = aa; // string string + TRY(!aa, "LoadBalancerName argument missing\n"); + s->load_balancer_name = aa; // string string } else - if ((aret = argcmp(next_a, "PermissionsToLaunch")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PolicyName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PermissionsToLaunch argument missing\n"); + TRY((!*eq_ptr), "PolicyName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "PolicyName argument missing\n"); + s->policy_name = aa; // string string - TRY(!aa, "PermissionsToLaunch argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->permissions_to_launch; - cascade_parser = permissions_on_resource_creation_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(permissions_on_resource_creation_parser(&s->permissions_to_launch, dot_pos, aa, pa)); - s->is_set_permissions_to_launch = 1; - } else { - s->permissions_to_launch_str = aa; - } } else - { - BAD_RET("'%s' is not a valide argument for 'UpdateImage'\n", next_a); - } - i += incr; - goto update_image_arg; - } - cret = osc_update_image(&e, &r, &a); - TRY(cret, "fail to call UpdateImage: %s\n", curl_easy_strerror(cret)); + if ((aret = argcmp(next_a, "PolicyType")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "PolicyType argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "PolicyType argument missing\n"); + s->policy_type = aa; // string string + + } else + { + BAD_RET("'%s' is not a valide argument for 'CreateLoadBalancerPolicy'\n", next_a); + } + i += incr; + goto create_load_balancer_policy_arg; + } + cret = osc_create_load_balancer_policy(&e, &r, &a); + TRY(cret, "fail to call CreateLoadBalancerPolicy: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -21434,19 +21453,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateFlexibleGpu", av[i])) { + if (!strcmp("CreateLoadBalancer", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_flexible_gpu_arg a = {0}; - struct osc_update_flexible_gpu_arg *s = &a; + struct osc_create_load_balancer_arg a = {0}; + struct osc_create_load_balancer_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_flexible_gpu_arg: + create_load_balancer_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -21465,7 +21484,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_flexible_gpu_arg; + goto create_load_balancer_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -21479,22 +21498,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DeleteOnVmDeletion")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DeleteOnVmDeletion argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_delete_on_vm_deletion = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->delete_on_vm_deletion = 1; - } else if (!strcasecmp(aa, "false")) { - s->delete_on_vm_deletion = 0; - } else { - BAD_RET("DeleteOnVmDeletion require true/false\n"); - } - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -21511,25 +21514,211 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "FlexibleGpuId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Listeners")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "FlexibleGpuId argument missing\n"); + TRY((!*eq_ptr), "Listeners argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "FlexibleGpuId argument missing\n"); - s->flexible_gpu_id = aa; // string string + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Listeners' require an index (example array ref ListenerForCreation.Listeners.0)\n"); + else if (*endptr != '.') + BAD_RET("'Listeners' require a .\n"); + TRY_ALLOC_AT(s,listeners, pa, pos, sizeof(*s->listeners)); + cascade_struct = &s->listeners[pos]; + cascade_parser = listener_for_creation_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(listener_for_creation_parser(&s->listeners[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Listeners argument missing\n"); + s->listeners_str = aa; // array ref ListenerForCreation ref + } + } else + if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "LoadBalancerName argument missing\n"); + s->load_balancer_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "LoadBalancerType")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "LoadBalancerType argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "LoadBalancerType argument missing\n"); + s->load_balancer_type = aa; // string string + + } else + if ((aret = argcmp(next_a, "PublicIp")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "PublicIp argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "PublicIp argument missing\n"); + s->public_ip = aa; // string string + + } else + if ((aret = argcmp(next_a, "SecurityGroups")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SecurityGroups argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "SecurityGroups argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "SecurityGroups require an index\n"); + if (s->security_groups) { + for (; s->security_groups[last]; ++last); + } + if (pos < last) { + s->security_groups[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->security_groups, "", pa); + SET_NEXT(s->security_groups, (aa), pa); + } + } else { + TRY(!aa, "SecurityGroups argument missing\n"); + s->security_groups_str = aa; + } + } else if (!(aret = argcmp(str, "SecurityGroups[]")) || aret == '=') { + TRY(!aa, "SecurityGroups[] argument missing\n"); + SET_NEXT(s->security_groups, (aa), pa); + } else + if ((aret = argcmp(next_a, "Subnets")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Subnets argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "Subnets argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "Subnets require an index\n"); + if (s->subnets) { + for (; s->subnets[last]; ++last); + } + if (pos < last) { + s->subnets[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->subnets, "", pa); + SET_NEXT(s->subnets, (aa), pa); + } + } else { + TRY(!aa, "Subnets argument missing\n"); + s->subnets_str = aa; + } + } else if (!(aret = argcmp(str, "Subnets[]")) || aret == '=') { + TRY(!aa, "Subnets[] argument missing\n"); + SET_NEXT(s->subnets, (aa), pa); + } else + if ((aret = argcmp(next_a, "SubregionNames")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SubregionNames argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "SubregionNames argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "SubregionNames require an index\n"); + if (s->subregion_names) { + for (; s->subregion_names[last]; ++last); + } + if (pos < last) { + s->subregion_names[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->subregion_names, "", pa); + SET_NEXT(s->subregion_names, (aa), pa); + } + } else { + TRY(!aa, "SubregionNames argument missing\n"); + s->subregion_names_str = aa; + } + } else if (!(aret = argcmp(str, "SubregionNames[]")) || aret == '=') { + TRY(!aa, "SubregionNames[] argument missing\n"); + SET_NEXT(s->subregion_names, (aa), pa); + } else + if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Tags argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); + else if (*endptr != '.') + BAD_RET("'Tags' require a .\n"); + TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); + cascade_struct = &s->tags[pos]; + cascade_parser = resource_tag_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Tags argument missing\n"); + s->tags_str = aa; // array ref ResourceTag ref + } } else { - BAD_RET("'%s' is not a valide argument for 'UpdateFlexibleGpu'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateLoadBalancer'\n", next_a); } i += incr; - goto update_flexible_gpu_arg; + goto create_load_balancer_arg; } - cret = osc_update_flexible_gpu(&e, &r, &a); - TRY(cret, "fail to call UpdateFlexibleGpu: %s\n", curl_easy_strerror(cret)); + cret = osc_create_load_balancer(&e, &r, &a); + TRY(cret, "fail to call CreateLoadBalancer: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -21556,19 +21745,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateDirectLinkInterface", av[i])) { + if (!strcmp("CreateLoadBalancerTags", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_direct_link_interface_arg a = {0}; - struct osc_update_direct_link_interface_arg *s = &a; + struct osc_create_load_balancer_tags_arg a = {0}; + struct osc_create_load_balancer_tags_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_direct_link_interface_arg: + create_load_balancer_tags_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -21587,7 +21776,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_direct_link_interface_arg; + goto create_load_balancer_tags_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -21601,17 +21790,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DirectLinkInterfaceId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DirectLinkInterfaceId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "DirectLinkInterfaceId argument missing\n"); - s->direct_link_interface_id = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -21628,25 +21806,79 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Mtu")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LoadBalancerNames")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Mtu argument missing\n"); + TRY((!*eq_ptr), "LoadBalancerNames argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Mtu argument missing\n"); - s->is_set_mtu = 1; - s->mtu = atoll(aa); + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "LoadBalancerNames argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "LoadBalancerNames require an index\n"); + if (s->load_balancer_names) { + for (; s->load_balancer_names[last]; ++last); + } + if (pos < last) { + s->load_balancer_names[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->load_balancer_names, "", pa); + SET_NEXT(s->load_balancer_names, (aa), pa); + } + } else { + TRY(!aa, "LoadBalancerNames argument missing\n"); + s->load_balancer_names_str = aa; + } + } else if (!(aret = argcmp(str, "LoadBalancerNames[]")) || aret == '=') { + TRY(!aa, "LoadBalancerNames[] argument missing\n"); + SET_NEXT(s->load_balancer_names, (aa), pa); + } else + if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Tags argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); + else if (*endptr != '.') + BAD_RET("'Tags' require a .\n"); + TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); + cascade_struct = &s->tags[pos]; + cascade_parser = resource_tag_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Tags argument missing\n"); + s->tags_str = aa; // array ref ResourceTag ref + } } else { - BAD_RET("'%s' is not a valide argument for 'UpdateDirectLinkInterface'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateLoadBalancerTags'\n", next_a); } i += incr; - goto update_direct_link_interface_arg; + goto create_load_balancer_tags_arg; } - cret = osc_update_direct_link_interface(&e, &r, &a); - TRY(cret, "fail to call UpdateDirectLinkInterface: %s\n", curl_easy_strerror(cret)); + cret = osc_create_load_balancer_tags(&e, &r, &a); + TRY(cret, "fail to call CreateLoadBalancerTags: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -21673,19 +21905,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateDedicatedGroup", av[i])) { + if (!strcmp("CreateNatService", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_dedicated_group_arg a = {0}; - struct osc_update_dedicated_group_arg *s = &a; + struct osc_create_nat_service_arg a = {0}; + struct osc_create_nat_service_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_dedicated_group_arg: + create_nat_service_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -21704,7 +21936,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_dedicated_group_arg; + goto create_nat_service_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -21718,15 +21950,15 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DedicatedGroupId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ClientToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DedicatedGroupId argument missing\n"); + TRY((!*eq_ptr), "ClientToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "DedicatedGroupId argument missing\n"); - s->dedicated_group_id = aa; // string string + TRY(!aa, "ClientToken argument missing\n"); + s->client_token = aa; // string string } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { @@ -21745,25 +21977,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Name")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PublicIpId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Name argument missing\n"); + TRY((!*eq_ptr), "PublicIpId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Name argument missing\n"); - s->name = aa; // string string + TRY(!aa, "PublicIpId argument missing\n"); + s->public_ip_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SubnetId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SubnetId argument missing\n"); + s->subnet_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UpdateDedicatedGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateNatService'\n", next_a); } i += incr; - goto update_dedicated_group_arg; + goto create_nat_service_arg; } - cret = osc_update_dedicated_group(&e, &r, &a); - TRY(cret, "fail to call UpdateDedicatedGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_create_nat_service(&e, &r, &a); + TRY(cret, "fail to call CreateNatService: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -21790,19 +22033,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateCa", av[i])) { + if (!strcmp("CreateNetAccessPoint", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_ca_arg a = {0}; - struct osc_update_ca_arg *s = &a; + struct osc_create_net_access_point_arg a = {0}; + struct osc_create_net_access_point_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_ca_arg: + create_net_access_point_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -21821,7 +22064,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_ca_arg; + goto create_net_access_point_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -21835,52 +22078,86 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "CaId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "CaId argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "CaId argument missing\n"); - s->ca_id = aa; // string string + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NetId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NetId argument missing\n"); + s->net_id = aa; // string string } else - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "RouteTableIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); + TRY((!*eq_ptr), "RouteTableIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "RouteTableIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "RouteTableIds require an index\n"); + if (s->route_table_ids) { + for (; s->route_table_ids[last]; ++last); + } + if (pos < last) { + s->route_table_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->route_table_ids, "", pa); + SET_NEXT(s->route_table_ids, (aa), pa); + } + } else { + TRY(!aa, "RouteTableIds argument missing\n"); + s->route_table_ids_str = aa; + } + } else if (!(aret = argcmp(str, "RouteTableIds[]")) || aret == '=') { + TRY(!aa, "RouteTableIds[] argument missing\n"); + SET_NEXT(s->route_table_ids, (aa), pa); } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ServiceName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "ServiceName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else + TRY(!aa, "ServiceName argument missing\n"); + s->service_name = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'UpdateCa'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateNetAccessPoint'\n", next_a); } i += incr; - goto update_ca_arg; + goto create_net_access_point_arg; } - cret = osc_update_ca(&e, &r, &a); - TRY(cret, "fail to call UpdateCa: %s\n", curl_easy_strerror(cret)); + cret = osc_create_net_access_point(&e, &r, &a); + TRY(cret, "fail to call CreateNetAccessPoint: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -21907,19 +22184,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateApiAccessRule", av[i])) { + if (!strcmp("CreateNetPeering", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_api_access_rule_arg a = {0}; - struct osc_update_api_access_rule_arg *s = &a; + struct osc_create_net_peering_arg a = {0}; + struct osc_create_net_peering_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_api_access_rule_arg: + create_net_peering_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -21938,7 +22215,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_api_access_rule_arg; + goto create_net_peering_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -21952,94 +22229,26 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "ApiAccessRuleId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "AccepterNetId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ApiAccessRuleId argument missing\n"); + TRY((!*eq_ptr), "AccepterNetId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ApiAccessRuleId argument missing\n"); - s->api_access_rule_id = aa; // string string + TRY(!aa, "AccepterNetId argument missing\n"); + s->accepter_net_id = aa; // string string } else - if ((aret = argcmp(next_a, "CaIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "AccepterOwnerId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "CaIds argument missing\n"); + TRY((!*eq_ptr), "AccepterOwnerId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "CaIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "CaIds require an index\n"); - if (s->ca_ids) { - for (; s->ca_ids[last]; ++last); - } - if (pos < last) { - s->ca_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->ca_ids, "", pa); - SET_NEXT(s->ca_ids, (aa), pa); - } - } else { - TRY(!aa, "CaIds argument missing\n"); - s->ca_ids_str = aa; - } - } else if (!(aret = argcmp(str, "CaIds[]")) || aret == '=') { - TRY(!aa, "CaIds[] argument missing\n"); - SET_NEXT(s->ca_ids, (aa), pa); - } else - if ((aret = argcmp(next_a, "Cns")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Cns argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "Cns argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "Cns require an index\n"); - if (s->cns) { - for (; s->cns[last]; ++last); - } - if (pos < last) { - s->cns[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->cns, "", pa); - SET_NEXT(s->cns, (aa), pa); - } - } else { - TRY(!aa, "Cns argument missing\n"); - s->cns_str = aa; - } - } else if (!(aret = argcmp(str, "Cns[]")) || aret == '=') { - TRY(!aa, "Cns[] argument missing\n"); - SET_NEXT(s->cns, (aa), pa); - } else - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string + TRY(!aa, "AccepterOwnerId argument missing\n"); + s->accepter_owner_id = aa; // string string } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { @@ -22058,48 +22267,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "IpRanges")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SourceNetId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "IpRanges argument missing\n"); + TRY((!*eq_ptr), "SourceNetId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "SourceNetId argument missing\n"); + s->source_net_id = aa; // string string - TRY(!(dot_pos++), "IpRanges argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "IpRanges require an index\n"); - if (s->ip_ranges) { - for (; s->ip_ranges[last]; ++last); - } - if (pos < last) { - s->ip_ranges[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->ip_ranges, "", pa); - SET_NEXT(s->ip_ranges, (aa), pa); - } - } else { - TRY(!aa, "IpRanges argument missing\n"); - s->ip_ranges_str = aa; - } - } else if (!(aret = argcmp(str, "IpRanges[]")) || aret == '=') { - TRY(!aa, "IpRanges[] argument missing\n"); - SET_NEXT(s->ip_ranges, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'UpdateApiAccessRule'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateNetPeering'\n", next_a); } i += incr; - goto update_api_access_rule_arg; + goto create_net_peering_arg; } - cret = osc_update_api_access_rule(&e, &r, &a); - TRY(cret, "fail to call UpdateApiAccessRule: %s\n", curl_easy_strerror(cret)); + cret = osc_create_net_peering(&e, &r, &a); + TRY(cret, "fail to call CreateNetPeering: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -22126,19 +22312,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateApiAccessPolicy", av[i])) { + if (!strcmp("CreateNet", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_api_access_policy_arg a = {0}; - struct osc_update_api_access_policy_arg *s = &a; + struct osc_create_net_arg a = {0}; + struct osc_create_net_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_api_access_policy_arg: + create_net_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -22157,7 +22343,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_api_access_policy_arg; + goto create_net_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -22187,41 +22373,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "MaxAccessKeyExpirationSeconds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "IpRange")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "MaxAccessKeyExpirationSeconds argument missing\n"); + TRY((!*eq_ptr), "IpRange argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "MaxAccessKeyExpirationSeconds argument missing\n"); - s->is_set_max_access_key_expiration_seconds = 1; - s->max_access_key_expiration_seconds = atoll(aa); + TRY(!aa, "IpRange argument missing\n"); + s->ip_range = aa; // string string + } else - if ((aret = argcmp(next_a, "RequireTrustedEnv")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Tenancy")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "RequireTrustedEnv argument missing\n"); + TRY((!*eq_ptr), "Tenancy argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_require_trusted_env = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->require_trusted_env = 1; - } else if (!strcasecmp(aa, "false")) { - s->require_trusted_env = 0; - } else { - BAD_RET("RequireTrustedEnv require true/false\n"); - } - } else + TRY(!aa, "Tenancy argument missing\n"); + s->tenancy = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'UpdateApiAccessPolicy'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateNet'\n", next_a); } i += incr; - goto update_api_access_policy_arg; + goto create_net_arg; } - cret = osc_update_api_access_policy(&e, &r, &a); - TRY(cret, "fail to call UpdateApiAccessPolicy: %s\n", curl_easy_strerror(cret)); + cret = osc_create_net(&e, &r, &a); + TRY(cret, "fail to call CreateNet: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -22248,19 +22429,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateAccount", av[i])) { + if (!strcmp("CreateNic", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_account_arg a = {0}; - struct osc_update_account_arg *s = &a; + struct osc_create_nic_arg a = {0}; + struct osc_create_nic_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_account_arg: + create_nic_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -22279,7 +22460,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_account_arg; + goto create_nic_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -22293,71 +22474,15 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "AdditionalEmails")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "AdditionalEmails argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "AdditionalEmails argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "AdditionalEmails require an index\n"); - if (s->additional_emails) { - for (; s->additional_emails[last]; ++last); - } - if (pos < last) { - s->additional_emails[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->additional_emails, "", pa); - SET_NEXT(s->additional_emails, (aa), pa); - } - } else { - TRY(!aa, "AdditionalEmails argument missing\n"); - s->additional_emails_str = aa; - } - } else if (!(aret = argcmp(str, "AdditionalEmails[]")) || aret == '=') { - TRY(!aa, "AdditionalEmails[] argument missing\n"); - SET_NEXT(s->additional_emails, (aa), pa); - } else - if ((aret = argcmp(next_a, "City")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "City argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "City argument missing\n"); - s->city = aa; // string string - - } else - if ((aret = argcmp(next_a, "CompanyName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "CompanyName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "CompanyName argument missing\n"); - s->company_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "Country")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Country argument missing\n"); + TRY((!*eq_ptr), "Description argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Country argument missing\n"); - s->country = aa; // string string + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { @@ -22376,113 +22501,90 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Email")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PrivateIps")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Email argument missing\n"); + TRY((!*eq_ptr), "PrivateIps argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Email argument missing\n"); - s->email = aa; // string string + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'PrivateIps' require an index (example array ref PrivateIpLight.PrivateIps.0)\n"); + else if (*endptr != '.') + BAD_RET("'PrivateIps' require a .\n"); + TRY_ALLOC_AT(s,private_ips, pa, pos, sizeof(*s->private_ips)); + cascade_struct = &s->private_ips[pos]; + cascade_parser = private_ip_light_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(private_ip_light_parser(&s->private_ips[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "PrivateIps argument missing\n"); + s->private_ips_str = aa; // array ref PrivateIpLight ref + } } else - if ((aret = argcmp(next_a, "FirstName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SecurityGroupIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "FirstName argument missing\n"); + TRY((!*eq_ptr), "SecurityGroupIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "FirstName argument missing\n"); - s->first_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "JobTitle")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "JobTitle argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "JobTitle argument missing\n"); - s->job_title = aa; // string string - - } else - if ((aret = argcmp(next_a, "LastName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "LastName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "LastName argument missing\n"); - s->last_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "MobileNumber")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "MobileNumber argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "MobileNumber argument missing\n"); - s->mobile_number = aa; // string string - - } else - if ((aret = argcmp(next_a, "PhoneNumber")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PhoneNumber argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "PhoneNumber argument missing\n"); - s->phone_number = aa; // string string - - } else - if ((aret = argcmp(next_a, "StateProvince")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "StateProvince argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "StateProvince argument missing\n"); - s->state_province = aa; // string string - - } else - if ((aret = argcmp(next_a, "VatNumber")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "VatNumber argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "VatNumber argument missing\n"); - s->vat_number = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "SecurityGroupIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "SecurityGroupIds require an index\n"); + if (s->security_group_ids) { + for (; s->security_group_ids[last]; ++last); + } + if (pos < last) { + s->security_group_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->security_group_ids, "", pa); + SET_NEXT(s->security_group_ids, (aa), pa); + } + } else { + TRY(!aa, "SecurityGroupIds argument missing\n"); + s->security_group_ids_str = aa; + } + } else if (!(aret = argcmp(str, "SecurityGroupIds[]")) || aret == '=') { + TRY(!aa, "SecurityGroupIds[] argument missing\n"); + SET_NEXT(s->security_group_ids, (aa), pa); } else - if ((aret = argcmp(next_a, "ZipCode")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ZipCode argument missing\n"); + TRY((!*eq_ptr), "SubnetId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ZipCode argument missing\n"); - s->zip_code = aa; // string string + TRY(!aa, "SubnetId argument missing\n"); + s->subnet_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UpdateAccount'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateNic'\n", next_a); } i += incr; - goto update_account_arg; + goto create_nic_arg; } - cret = osc_update_account(&e, &r, &a); - TRY(cret, "fail to call UpdateAccount: %s\n", curl_easy_strerror(cret)); + cret = osc_create_nic(&e, &r, &a); + TRY(cret, "fail to call CreateNic: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -22509,19 +22611,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UpdateAccessKey", av[i])) { + if (!strcmp("CreatePolicy", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_update_access_key_arg a = {0}; - struct osc_update_access_key_arg *s = &a; + struct osc_create_policy_arg a = {0}; + struct osc_create_policy_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - update_access_key_arg: + create_policy_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -22540,7 +22642,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto update_access_key_arg; + goto create_policy_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -22554,15 +22656,26 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "AccessKeyId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "AccessKeyId argument missing\n"); + TRY((!*eq_ptr), "Description argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "AccessKeyId argument missing\n"); - s->access_key_id = aa; // string string + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string + + } else + if ((aret = argcmp(next_a, "Document")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Document argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Document argument missing\n"); + s->document = aa; // string string } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { @@ -22581,47 +22694,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "ExpirationDate")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ExpirationDate argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ExpirationDate argument missing\n"); - s->expiration_date = aa; // string string - - } else - if ((aret = argcmp(next_a, "State")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "State argument missing\n"); + TRY((!*eq_ptr), "Path argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "State argument missing\n"); - s->state = aa; // string string + TRY(!aa, "Path argument missing\n"); + s->path = aa; // string string } else - if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PolicyName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserName argument missing\n"); + TRY((!*eq_ptr), "PolicyName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserName argument missing\n"); - s->user_name = aa; // string string + TRY(!aa, "PolicyName argument missing\n"); + s->policy_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UpdateAccessKey'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreatePolicy'\n", next_a); } i += incr; - goto update_access_key_arg; + goto create_policy_arg; } - cret = osc_update_access_key(&e, &r, &a); - TRY(cret, "fail to call UpdateAccessKey: %s\n", curl_easy_strerror(cret)); + cret = osc_create_policy(&e, &r, &a); + TRY(cret, "fail to call CreatePolicy: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -22648,19 +22750,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UnlinkVolume", av[i])) { + if (!strcmp("CreatePolicyVersion", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_unlink_volume_arg a = {0}; - struct osc_unlink_volume_arg *s = &a; + struct osc_create_policy_version_arg a = {0}; + struct osc_create_policy_version_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - unlink_volume_arg: + create_policy_version_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -22679,7 +22781,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto unlink_volume_arg; + goto create_policy_version_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -22693,57 +22795,52 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Document")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "Document argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "ForceUnlink")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "Document argument missing\n"); + s->document = aa; // string string + + } else + if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ForceUnlink argument missing\n"); + TRY((!*eq_ptr), "PolicyOrn argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_force_unlink = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->force_unlink = 1; - } else if (!strcasecmp(aa, "false")) { - s->force_unlink = 0; - } else { - BAD_RET("ForceUnlink require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "VolumeId")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "PolicyOrn argument missing\n"); + s->policy_orn = aa; // string string + + } else + if ((aret = argcmp(next_a, "SetAsDefault")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VolumeId argument missing\n"); + TRY((!*eq_ptr), "SetAsDefault argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VolumeId argument missing\n"); - s->volume_id = aa; // string string - - } else + s->is_set_set_as_default = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->set_as_default = 1; + } else if (!strcasecmp(aa, "false")) { + s->set_as_default = 0; + } else { + BAD_RET("SetAsDefault require true/false\n"); + } + } else { - BAD_RET("'%s' is not a valide argument for 'UnlinkVolume'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreatePolicyVersion'\n", next_a); } i += incr; - goto unlink_volume_arg; + goto create_policy_version_arg; } - cret = osc_unlink_volume(&e, &r, &a); - TRY(cret, "fail to call UnlinkVolume: %s\n", curl_easy_strerror(cret)); + cret = osc_create_policy_version(&e, &r, &a); + TRY(cret, "fail to call CreatePolicyVersion: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -22770,19 +22867,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UnlinkVirtualGateway", av[i])) { + if (!strcmp("CreateProductType", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_unlink_virtual_gateway_arg a = {0}; - struct osc_unlink_virtual_gateway_arg *s = &a; + struct osc_create_product_type_arg a = {0}; + struct osc_create_product_type_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - unlink_virtual_gateway_arg: + create_product_type_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -22801,7 +22898,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto unlink_virtual_gateway_arg; + goto create_product_type_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -22815,6 +22912,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Description argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -22831,36 +22939,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NetId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NetId argument missing\n"); - s->net_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "VirtualGatewayId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Vendor")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VirtualGatewayId argument missing\n"); + TRY((!*eq_ptr), "Vendor argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VirtualGatewayId argument missing\n"); - s->virtual_gateway_id = aa; // string string + TRY(!aa, "Vendor argument missing\n"); + s->vendor = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UnlinkVirtualGateway'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateProductType'\n", next_a); } i += incr; - goto unlink_virtual_gateway_arg; + goto create_product_type_arg; } - cret = osc_unlink_virtual_gateway(&e, &r, &a); - TRY(cret, "fail to call UnlinkVirtualGateway: %s\n", curl_easy_strerror(cret)); + cret = osc_create_product_type(&e, &r, &a); + TRY(cret, "fail to call CreateProductType: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -22887,19 +22984,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UnlinkRouteTable", av[i])) { + if (!strcmp("CreatePublicIp", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_unlink_route_table_arg a = {0}; - struct osc_unlink_route_table_arg *s = &a; + struct osc_create_public_ip_arg a = {0}; + struct osc_create_public_ip_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - unlink_route_table_arg: + create_public_ip_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -22918,7 +23015,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto unlink_route_table_arg; + goto create_public_ip_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -22948,25 +23045,14 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "LinkRouteTableId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "LinkRouteTableId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "LinkRouteTableId argument missing\n"); - s->link_route_table_id = aa; // string string - - } else { - BAD_RET("'%s' is not a valide argument for 'UnlinkRouteTable'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreatePublicIp'\n", next_a); } i += incr; - goto unlink_route_table_arg; + goto create_public_ip_arg; } - cret = osc_unlink_route_table(&e, &r, &a); - TRY(cret, "fail to call UnlinkRouteTable: %s\n", curl_easy_strerror(cret)); + cret = osc_create_public_ip(&e, &r, &a); + TRY(cret, "fail to call CreatePublicIp: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -22993,19 +23079,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UnlinkPublicIp", av[i])) { + if (!strcmp("CreateRoute", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_unlink_public_ip_arg a = {0}; - struct osc_unlink_public_ip_arg *s = &a; + struct osc_create_route_arg a = {0}; + struct osc_create_route_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - unlink_public_ip_arg: + create_route_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -23024,7 +23110,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto unlink_public_ip_arg; + goto create_route_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -23038,6 +23124,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "DestinationIpRange")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DestinationIpRange argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "DestinationIpRange argument missing\n"); + s->destination_ip_range = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -23054,36 +23151,80 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "LinkPublicIpId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "GatewayId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LinkPublicIpId argument missing\n"); + TRY((!*eq_ptr), "GatewayId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "LinkPublicIpId argument missing\n"); - s->link_public_ip_id = aa; // string string + TRY(!aa, "GatewayId argument missing\n"); + s->gateway_id = aa; // string string } else - if ((aret = argcmp(next_a, "PublicIp")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NatServiceId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PublicIp argument missing\n"); + TRY((!*eq_ptr), "NatServiceId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PublicIp argument missing\n"); - s->public_ip = aa; // string string + TRY(!aa, "NatServiceId argument missing\n"); + s->nat_service_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "NetPeeringId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NetPeeringId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NetPeeringId argument missing\n"); + s->net_peering_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NicId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NicId argument missing\n"); + s->nic_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "RouteTableId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "RouteTableId argument missing\n"); + s->route_table_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VmId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VmId argument missing\n"); + s->vm_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UnlinkPublicIp'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateRoute'\n", next_a); } i += incr; - goto unlink_public_ip_arg; + goto create_route_arg; } - cret = osc_unlink_public_ip(&e, &r, &a); - TRY(cret, "fail to call UnlinkPublicIp: %s\n", curl_easy_strerror(cret)); + cret = osc_create_route(&e, &r, &a); + TRY(cret, "fail to call CreateRoute: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -23110,19 +23251,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UnlinkPrivateIps", av[i])) { + if (!strcmp("CreateRouteTable", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_unlink_private_ips_arg a = {0}; - struct osc_unlink_private_ips_arg *s = &a; + struct osc_create_route_table_arg a = {0}; + struct osc_create_route_table_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - unlink_private_ips_arg: + create_route_table_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -23141,7 +23282,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto unlink_private_ips_arg; + goto create_route_table_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -23171,59 +23312,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NicId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NicId argument missing\n"); - s->nic_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "PrivateIps")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PrivateIps argument missing\n"); + TRY((!*eq_ptr), "NetId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "NetId argument missing\n"); + s->net_id = aa; // string string - TRY(!(dot_pos++), "PrivateIps argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "PrivateIps require an index\n"); - if (s->private_ips) { - for (; s->private_ips[last]; ++last); - } - if (pos < last) { - s->private_ips[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->private_ips, "", pa); - SET_NEXT(s->private_ips, (aa), pa); - } - } else { - TRY(!aa, "PrivateIps argument missing\n"); - s->private_ips_str = aa; - } - } else if (!(aret = argcmp(str, "PrivateIps[]")) || aret == '=') { - TRY(!aa, "PrivateIps[] argument missing\n"); - SET_NEXT(s->private_ips, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'UnlinkPrivateIps'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateRouteTable'\n", next_a); } i += incr; - goto unlink_private_ips_arg; + goto create_route_table_arg; } - cret = osc_unlink_private_ips(&e, &r, &a); - TRY(cret, "fail to call UnlinkPrivateIps: %s\n", curl_easy_strerror(cret)); + cret = osc_create_route_table(&e, &r, &a); + TRY(cret, "fail to call CreateRouteTable: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -23250,19 +23357,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UnlinkPolicy", av[i])) { + if (!strcmp("CreateSecurityGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_unlink_policy_arg a = {0}; - struct osc_unlink_policy_arg *s = &a; + struct osc_create_security_group_arg a = {0}; + struct osc_create_security_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - unlink_policy_arg: + create_security_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -23281,7 +23388,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto unlink_policy_arg; + goto create_security_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -23295,6 +23402,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Description argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -23311,36 +23429,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PolicyOrn argument missing\n"); + TRY((!*eq_ptr), "NetId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PolicyOrn argument missing\n"); - s->policy_orn = aa; // string string + TRY(!aa, "NetId argument missing\n"); + s->net_id = aa; // string string } else - if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SecurityGroupName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserName argument missing\n"); + TRY((!*eq_ptr), "SecurityGroupName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserName argument missing\n"); - s->user_name = aa; // string string + TRY(!aa, "SecurityGroupName argument missing\n"); + s->security_group_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UnlinkPolicy'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateSecurityGroup'\n", next_a); } i += incr; - goto unlink_policy_arg; + goto create_security_group_arg; } - cret = osc_unlink_policy(&e, &r, &a); - TRY(cret, "fail to call UnlinkPolicy: %s\n", curl_easy_strerror(cret)); + cret = osc_create_security_group(&e, &r, &a); + TRY(cret, "fail to call CreateSecurityGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -23367,19 +23485,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UnlinkNic", av[i])) { + if (!strcmp("CreateSecurityGroupRule", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_unlink_nic_arg a = {0}; - struct osc_unlink_nic_arg *s = &a; + struct osc_create_security_group_rule_arg a = {0}; + struct osc_create_security_group_rule_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - unlink_nic_arg: + create_security_group_rule_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -23398,7 +23516,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto unlink_nic_arg; + goto create_security_group_rule_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -23428,25 +23546,133 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "LinkNicId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Flow")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LinkNicId argument missing\n"); + TRY((!*eq_ptr), "Flow argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "LinkNicId argument missing\n"); - s->link_nic_id = aa; // string string + TRY(!aa, "Flow argument missing\n"); + s->flow = aa; // string string + + } else + if ((aret = argcmp(next_a, "FromPortRange")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "FromPortRange argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "FromPortRange argument missing\n"); + s->is_set_from_port_range = 1; + s->from_port_range = atoll(aa); + } else + if ((aret = argcmp(next_a, "IpProtocol")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "IpProtocol argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "IpProtocol argument missing\n"); + s->ip_protocol = aa; // string string + + } else + if ((aret = argcmp(next_a, "IpRange")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "IpRange argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "IpRange argument missing\n"); + s->ip_range = aa; // string string + + } else + if ((aret = argcmp(next_a, "Rules")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Rules argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Rules' require an index (example array ref SecurityGroupRule.Rules.0)\n"); + else if (*endptr != '.') + BAD_RET("'Rules' require a .\n"); + TRY_ALLOC_AT(s,rules, pa, pos, sizeof(*s->rules)); + cascade_struct = &s->rules[pos]; + cascade_parser = security_group_rule_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(security_group_rule_parser(&s->rules[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Rules argument missing\n"); + s->rules_str = aa; // array ref SecurityGroupRule ref + } + } else + if ((aret = argcmp(next_a, "SecurityGroupAccountIdToLink")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SecurityGroupAccountIdToLink argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SecurityGroupAccountIdToLink argument missing\n"); + s->security_group_account_id_to_link = aa; // string string + + } else + if ((aret = argcmp(next_a, "SecurityGroupId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SecurityGroupId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SecurityGroupId argument missing\n"); + s->security_group_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "SecurityGroupNameToLink")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SecurityGroupNameToLink argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SecurityGroupNameToLink argument missing\n"); + s->security_group_name_to_link = aa; // string string } else + if ((aret = argcmp(next_a, "ToPortRange")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ToPortRange argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ToPortRange argument missing\n"); + s->is_set_to_port_range = 1; + s->to_port_range = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'UnlinkNic'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateSecurityGroupRule'\n", next_a); } i += incr; - goto unlink_nic_arg; + goto create_security_group_rule_arg; } - cret = osc_unlink_nic(&e, &r, &a); - TRY(cret, "fail to call UnlinkNic: %s\n", curl_easy_strerror(cret)); + cret = osc_create_security_group_rule(&e, &r, &a); + TRY(cret, "fail to call CreateSecurityGroupRule: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -23473,19 +23699,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UnlinkManagedPolicyFromUserGroup", av[i])) { + if (!strcmp("CreateServerCertificate", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_unlink_managed_policy_from_user_group_arg a = {0}; - struct osc_unlink_managed_policy_from_user_group_arg *s = &a; + struct osc_create_server_certificate_arg a = {0}; + struct osc_create_server_certificate_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - unlink_managed_policy_from_user_group_arg: + create_server_certificate_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -23504,7 +23730,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto unlink_managed_policy_from_user_group_arg; + goto create_server_certificate_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -23518,6 +23744,28 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "Body")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Body argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Body argument missing\n"); + s->body = aa; // string string + + } else + if ((aret = argcmp(next_a, "Chain")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Chain argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Chain argument missing\n"); + s->chain = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -23534,36 +23782,47 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Name")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PolicyOrn argument missing\n"); + TRY((!*eq_ptr), "Name argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PolicyOrn argument missing\n"); - s->policy_orn = aa; // string string + TRY(!aa, "Name argument missing\n"); + s->name = aa; // string string } else - if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupName argument missing\n"); + TRY((!*eq_ptr), "Path argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserGroupName argument missing\n"); - s->user_group_name = aa; // string string + TRY(!aa, "Path argument missing\n"); + s->path = aa; // string string + + } else + if ((aret = argcmp(next_a, "PrivateKey")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "PrivateKey argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "PrivateKey argument missing\n"); + s->private_key = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UnlinkManagedPolicyFromUserGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateServerCertificate'\n", next_a); } i += incr; - goto unlink_managed_policy_from_user_group_arg; + goto create_server_certificate_arg; } - cret = osc_unlink_managed_policy_from_user_group(&e, &r, &a); - TRY(cret, "fail to call UnlinkManagedPolicyFromUserGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_create_server_certificate(&e, &r, &a); + TRY(cret, "fail to call CreateServerCertificate: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -23590,19 +23849,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UnlinkLoadBalancerBackendMachines", av[i])) { + if (!strcmp("CreateSnapshotExportTask", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_unlink_load_balancer_backend_machines_arg a = {0}; - struct osc_unlink_load_balancer_backend_machines_arg *s = &a; + struct osc_create_snapshot_export_task_arg a = {0}; + struct osc_create_snapshot_export_task_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - unlink_load_balancer_backend_machines_arg: + create_snapshot_export_task_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -23621,7 +23880,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto unlink_load_balancer_backend_machines_arg; + goto create_snapshot_export_task_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -23635,109 +23894,64 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "BackendIps")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "BackendIps argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "BackendIps argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "BackendIps require an index\n"); - if (s->backend_ips) { - for (; s->backend_ips[last]; ++last); - } - if (pos < last) { - s->backend_ips[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->backend_ips, "", pa); - SET_NEXT(s->backend_ips, (aa), pa); - } - } else { - TRY(!aa, "BackendIps argument missing\n"); - s->backend_ips_str = aa; - } - } else if (!(aret = argcmp(str, "BackendIps[]")) || aret == '=') { - TRY(!aa, "BackendIps[] argument missing\n"); - SET_NEXT(s->backend_ips, (aa), pa); - } else - if ((aret = argcmp(next_a, "BackendVmIds")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "OsuExport")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "BackendVmIds argument missing\n"); + TRY((!*eq_ptr), "OsuExport argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + char *dot_pos; - TRY(!(dot_pos++), "BackendVmIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "BackendVmIds require an index\n"); - if (s->backend_vm_ids) { - for (; s->backend_vm_ids[last]; ++last); - } - if (pos < last) { - s->backend_vm_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->backend_vm_ids, "", pa); - SET_NEXT(s->backend_vm_ids, (aa), pa); - } - } else { - TRY(!aa, "BackendVmIds argument missing\n"); - s->backend_vm_ids_str = aa; - } - } else if (!(aret = argcmp(str, "BackendVmIds[]")) || aret == '=') { - TRY(!aa, "BackendVmIds[] argument missing\n"); - SET_NEXT(s->backend_vm_ids, (aa), pa); - } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; + TRY(!aa, "OsuExport argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->osu_export; + cascade_parser = osu_export_to_create_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(osu_export_to_create_parser(&s->osu_export, dot_pos, aa, pa)); + s->is_set_osu_export = 1; } else { - BAD_RET("DryRun require true/false\n"); + s->osu_export_str = aa; } - } else - if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { + } else + if ((aret = argcmp(next_a, "SnapshotId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); + TRY((!*eq_ptr), "SnapshotId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "LoadBalancerName argument missing\n"); - s->load_balancer_name = aa; // string string + TRY(!aa, "SnapshotId argument missing\n"); + s->snapshot_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UnlinkLoadBalancerBackendMachines'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateSnapshotExportTask'\n", next_a); } i += incr; - goto unlink_load_balancer_backend_machines_arg; + goto create_snapshot_export_task_arg; } - cret = osc_unlink_load_balancer_backend_machines(&e, &r, &a); - TRY(cret, "fail to call UnlinkLoadBalancerBackendMachines: %s\n", curl_easy_strerror(cret)); + cret = osc_create_snapshot_export_task(&e, &r, &a); + TRY(cret, "fail to call CreateSnapshotExportTask: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -23764,19 +23978,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UnlinkInternetService", av[i])) { + if (!strcmp("CreateSnapshot", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_unlink_internet_service_arg a = {0}; - struct osc_unlink_internet_service_arg *s = &a; + struct osc_create_snapshot_arg a = {0}; + struct osc_create_snapshot_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - unlink_internet_service_arg: + create_snapshot_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -23795,7 +24009,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto unlink_internet_service_arg; + goto create_snapshot_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -23809,6 +24023,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Description argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -23825,36 +24050,69 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "InternetServiceId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "FileLocation")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "InternetServiceId argument missing\n"); + TRY((!*eq_ptr), "FileLocation argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "InternetServiceId argument missing\n"); - s->internet_service_id = aa; // string string + TRY(!aa, "FileLocation argument missing\n"); + s->file_location = aa; // string string } else - if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SnapshotSize")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NetId argument missing\n"); + TRY((!*eq_ptr), "SnapshotSize argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NetId argument missing\n"); - s->net_id = aa; // string string + TRY(!aa, "SnapshotSize argument missing\n"); + s->is_set_snapshot_size = 1; + s->snapshot_size = atoll(aa); + } else + if ((aret = argcmp(next_a, "SourceRegionName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SourceRegionName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SourceRegionName argument missing\n"); + s->source_region_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "SourceSnapshotId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SourceSnapshotId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SourceSnapshotId argument missing\n"); + s->source_snapshot_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "VolumeId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VolumeId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VolumeId argument missing\n"); + s->volume_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UnlinkInternetService'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateSnapshot'\n", next_a); } i += incr; - goto unlink_internet_service_arg; + goto create_snapshot_arg; } - cret = osc_unlink_internet_service(&e, &r, &a); - TRY(cret, "fail to call UnlinkInternetService: %s\n", curl_easy_strerror(cret)); + cret = osc_create_snapshot(&e, &r, &a); + TRY(cret, "fail to call CreateSnapshot: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -23881,19 +24139,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("UnlinkFlexibleGpu", av[i])) { + if (!strcmp("CreateSubnet", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_unlink_flexible_gpu_arg a = {0}; - struct osc_unlink_flexible_gpu_arg *s = &a; + struct osc_create_subnet_arg a = {0}; + struct osc_create_subnet_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - unlink_flexible_gpu_arg: + create_subnet_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -23912,7 +24170,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto unlink_flexible_gpu_arg; + goto create_subnet_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -23942,25 +24200,47 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "FlexibleGpuId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "IpRange")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "FlexibleGpuId argument missing\n"); + TRY((!*eq_ptr), "IpRange argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "FlexibleGpuId argument missing\n"); - s->flexible_gpu_id = aa; // string string + TRY(!aa, "IpRange argument missing\n"); + s->ip_range = aa; // string string + + } else + if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NetId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NetId argument missing\n"); + s->net_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "SubregionName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SubregionName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SubregionName argument missing\n"); + s->subregion_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'UnlinkFlexibleGpu'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateSubnet'\n", next_a); } i += incr; - goto unlink_flexible_gpu_arg; + goto create_subnet_arg; } - cret = osc_unlink_flexible_gpu(&e, &r, &a); - TRY(cret, "fail to call UnlinkFlexibleGpu: %s\n", curl_easy_strerror(cret)); + cret = osc_create_subnet(&e, &r, &a); + TRY(cret, "fail to call CreateSubnet: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -23987,19 +24267,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("StopVms", av[i])) { + if (!strcmp("CreateTags", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_stop_vms_arg a = {0}; - struct osc_stop_vms_arg *s = &a; + struct osc_create_tags_arg a = {0}; + struct osc_create_tags_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - stop_vms_arg: + create_tags_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -24018,7 +24298,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto stop_vms_arg; + goto create_tags_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -24048,26 +24328,10 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "ForceStop")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ForceStop argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_force_stop = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->force_stop = 1; - } else if (!strcasecmp(aa, "false")) { - s->force_stop = 0; - } else { - BAD_RET("ForceStop require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "VmIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResourceIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmIds argument missing\n"); + TRY((!*eq_ptr), "ResourceIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } @@ -24077,42 +24341,73 @@ int main(int ac, char **av) int last = 0; char *dot_pos = strchr(str, '.'); - TRY(!(dot_pos++), "VmIds argument missing\n"); + TRY(!(dot_pos++), "ResourceIds argument missing\n"); pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "VmIds require an index\n"); - if (s->vm_ids) { - for (; s->vm_ids[last]; ++last); + TRY(endptr == dot_pos, "ResourceIds require an index\n"); + if (s->resource_ids) { + for (; s->resource_ids[last]; ++last); } if (pos < last) { - s->vm_ids[pos] = (aa); + s->resource_ids[pos] = (aa); } else { for (int i = last; i < pos; ++i) - SET_NEXT(s->vm_ids, "", pa); - SET_NEXT(s->vm_ids, (aa), pa); + SET_NEXT(s->resource_ids, "", pa); + SET_NEXT(s->resource_ids, (aa), pa); } } else { - TRY(!aa, "VmIds argument missing\n"); - s->vm_ids_str = aa; + TRY(!aa, "ResourceIds argument missing\n"); + s->resource_ids_str = aa; } - } else if (!(aret = argcmp(str, "VmIds[]")) || aret == '=') { - TRY(!aa, "VmIds[] argument missing\n"); - SET_NEXT(s->vm_ids, (aa), pa); + } else if (!(aret = argcmp(str, "ResourceIds[]")) || aret == '=') { + TRY(!aa, "ResourceIds[] argument missing\n"); + SET_NEXT(s->resource_ids, (aa), pa); } else - { - BAD_RET("'%s' is not a valide argument for 'StopVms'\n", next_a); - } - i += incr; - goto stop_vms_arg; - } - cret = osc_stop_vms(&e, &r, &a); - TRY(cret, "fail to call StopVms: %s\n", curl_easy_strerror(cret)); - CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); - jobj = NULL; - if (program_flag & OAPI_RAW_OUTPUT) - puts(r.buf); - else { - jobj = json_tokener_parse(r.buf); - puts(json_object_to_json_string_ext(jobj, + if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Tags argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); + else if (*endptr != '.') + BAD_RET("'Tags' require a .\n"); + TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); + cascade_struct = &s->tags[pos]; + cascade_parser = resource_tag_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Tags argument missing\n"); + s->tags_str = aa; // array ref ResourceTag ref + } + } else + { + BAD_RET("'%s' is not a valide argument for 'CreateTags'\n", next_a); + } + i += incr; + goto create_tags_arg; + } + cret = osc_create_tags(&e, &r, &a); + TRY(cret, "fail to call CreateTags: %s\n", curl_easy_strerror(cret)); + CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); + jobj = NULL; + if (program_flag & OAPI_RAW_OUTPUT) + puts(r.buf); + else { + jobj = json_tokener_parse(r.buf); + puts(json_object_to_json_string_ext(jobj, JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | color_flag)); } @@ -24132,19 +24427,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("StartVms", av[i])) { + if (!strcmp("CreateUserGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_start_vms_arg a = {0}; - struct osc_start_vms_arg *s = &a; + struct osc_create_user_group_arg a = {0}; + struct osc_create_user_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - start_vms_arg: + create_user_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -24163,7 +24458,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto start_vms_arg; + goto create_user_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -24193,48 +24488,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VmIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmIds argument missing\n"); + TRY((!*eq_ptr), "Path argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "Path argument missing\n"); + s->path = aa; // string string + + } else + if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserGroupName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserGroupName argument missing\n"); + s->user_group_name = aa; // string string - TRY(!(dot_pos++), "VmIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "VmIds require an index\n"); - if (s->vm_ids) { - for (; s->vm_ids[last]; ++last); - } - if (pos < last) { - s->vm_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->vm_ids, "", pa); - SET_NEXT(s->vm_ids, (aa), pa); - } - } else { - TRY(!aa, "VmIds argument missing\n"); - s->vm_ids_str = aa; - } - } else if (!(aret = argcmp(str, "VmIds[]")) || aret == '=') { - TRY(!aa, "VmIds[] argument missing\n"); - SET_NEXT(s->vm_ids, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'StartVms'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateUserGroup'\n", next_a); } i += incr; - goto start_vms_arg; + goto create_user_group_arg; } - cret = osc_start_vms(&e, &r, &a); - TRY(cret, "fail to call StartVms: %s\n", curl_easy_strerror(cret)); + cret = osc_create_user_group(&e, &r, &a); + TRY(cret, "fail to call CreateUserGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -24261,19 +24544,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("SetDefaultPolicyVersion", av[i])) { + if (!strcmp("CreateUser", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_set_default_policy_version_arg a = {0}; - struct osc_set_default_policy_version_arg *s = &a; + struct osc_create_user_arg a = {0}; + struct osc_create_user_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - set_default_policy_version_arg: + create_user_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -24292,7 +24575,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto set_default_policy_version_arg; + goto create_user_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -24306,36 +24589,63 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PolicyOrn argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PolicyOrn argument missing\n"); - s->policy_orn = aa; // string string + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Path argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Path argument missing\n"); + s->path = aa; // string string } else - if ((aret = argcmp(next_a, "VersionId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserEmail")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VersionId argument missing\n"); + TRY((!*eq_ptr), "UserEmail argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VersionId argument missing\n"); - s->version_id = aa; // string string + TRY(!aa, "UserEmail argument missing\n"); + s->user_email = aa; // string string + + } else + if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserName argument missing\n"); + s->user_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'SetDefaultPolicyVersion'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateUser'\n", next_a); } i += incr; - goto set_default_policy_version_arg; + goto create_user_arg; } - cret = osc_set_default_policy_version(&e, &r, &a); - TRY(cret, "fail to call SetDefaultPolicyVersion: %s\n", curl_easy_strerror(cret)); + cret = osc_create_user(&e, &r, &a); + TRY(cret, "fail to call CreateUser: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -24362,19 +24672,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ScaleUpVmGroup", av[i])) { + if (!strcmp("CreateVirtualGateway", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_scale_up_vm_group_arg a = {0}; - struct osc_scale_up_vm_group_arg *s = &a; + struct osc_create_virtual_gateway_arg a = {0}; + struct osc_create_virtual_gateway_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - scale_up_vm_group_arg: + create_virtual_gateway_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -24393,7 +24703,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto scale_up_vm_group_arg; + goto create_virtual_gateway_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -24407,6 +24717,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "ConnectionType")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ConnectionType argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ConnectionType argument missing\n"); + s->connection_type = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -24423,36 +24744,14 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VmAddition")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "VmAddition argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "VmAddition argument missing\n"); - s->is_set_vm_addition = 1; - s->vm_addition = atoll(aa); - } else - if ((aret = argcmp(next_a, "VmGroupId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "VmGroupId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "VmGroupId argument missing\n"); - s->vm_group_id = aa; // string string - - } else { - BAD_RET("'%s' is not a valide argument for 'ScaleUpVmGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateVirtualGateway'\n", next_a); } i += incr; - goto scale_up_vm_group_arg; + goto create_virtual_gateway_arg; } - cret = osc_scale_up_vm_group(&e, &r, &a); - TRY(cret, "fail to call ScaleUpVmGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_create_virtual_gateway(&e, &r, &a); + TRY(cret, "fail to call CreateVirtualGateway: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -24479,19 +24778,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ScaleDownVmGroup", av[i])) { + if (!strcmp("CreateVmGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_scale_down_vm_group_arg a = {0}; - struct osc_scale_down_vm_group_arg *s = &a; + struct osc_create_vm_group_arg a = {0}; + struct osc_create_vm_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - scale_down_vm_group_arg: + create_vm_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -24510,7 +24809,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto scale_down_vm_group_arg; + goto create_vm_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -24524,6 +24823,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Description argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -24540,36 +24850,134 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VmGroupId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PositioningStrategy")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmGroupId argument missing\n"); + TRY((!*eq_ptr), "PositioningStrategy argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmGroupId argument missing\n"); - s->vm_group_id = aa; // string string + TRY(!aa, "PositioningStrategy argument missing\n"); + s->positioning_strategy = aa; // string string } else - if ((aret = argcmp(next_a, "VmSubtraction")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SecurityGroupIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmSubtraction argument missing\n"); + TRY((!*eq_ptr), "SecurityGroupIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmSubtraction argument missing\n"); - s->is_set_vm_subtraction = 1; - s->vm_subtraction = atoll(aa); - } else - { - BAD_RET("'%s' is not a valide argument for 'ScaleDownVmGroup'\n", next_a); + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "SecurityGroupIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "SecurityGroupIds require an index\n"); + if (s->security_group_ids) { + for (; s->security_group_ids[last]; ++last); + } + if (pos < last) { + s->security_group_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->security_group_ids, "", pa); + SET_NEXT(s->security_group_ids, (aa), pa); + } + } else { + TRY(!aa, "SecurityGroupIds argument missing\n"); + s->security_group_ids_str = aa; + } + } else if (!(aret = argcmp(str, "SecurityGroupIds[]")) || aret == '=') { + TRY(!aa, "SecurityGroupIds[] argument missing\n"); + SET_NEXT(s->security_group_ids, (aa), pa); + } else + if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SubnetId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SubnetId argument missing\n"); + s->subnet_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Tags argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); + else if (*endptr != '.') + BAD_RET("'Tags' require a .\n"); + TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); + cascade_struct = &s->tags[pos]; + cascade_parser = resource_tag_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Tags argument missing\n"); + s->tags_str = aa; // array ref ResourceTag ref + } + } else + if ((aret = argcmp(next_a, "VmCount")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VmCount argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VmCount argument missing\n"); + s->is_set_vm_count = 1; + s->vm_count = atoll(aa); + } else + if ((aret = argcmp(next_a, "VmGroupName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VmGroupName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VmGroupName argument missing\n"); + s->vm_group_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "VmTemplateId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VmTemplateId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VmTemplateId argument missing\n"); + s->vm_template_id = aa; // string string + + } else + { + BAD_RET("'%s' is not a valide argument for 'CreateVmGroup'\n", next_a); } i += incr; - goto scale_down_vm_group_arg; + goto create_vm_group_arg; } - cret = osc_scale_down_vm_group(&e, &r, &a); - TRY(cret, "fail to call ScaleDownVmGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_create_vm_group(&e, &r, &a); + TRY(cret, "fail to call CreateVmGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -24596,19 +25004,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("RemoveUserFromUserGroup", av[i])) { + if (!strcmp("CreateVmTemplate", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_remove_user_from_user_group_arg a = {0}; - struct osc_remove_user_from_user_group_arg *s = &a; + struct osc_create_vm_template_arg a = {0}; + struct osc_create_vm_template_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - remove_user_from_user_group_arg: + create_vm_template_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -24627,7 +25035,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto remove_user_from_user_group_arg; + goto create_vm_template_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -24641,6 +25049,50 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "CpuCores")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "CpuCores argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "CpuCores argument missing\n"); + s->is_set_cpu_cores = 1; + s->cpu_cores = atoll(aa); + } else + if ((aret = argcmp(next_a, "CpuGeneration")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "CpuGeneration argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "CpuGeneration argument missing\n"); + s->cpu_generation = aa; // string string + + } else + if ((aret = argcmp(next_a, "CpuPerformance")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "CpuPerformance argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "CpuPerformance argument missing\n"); + s->cpu_performance = aa; // string string + + } else + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Description argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -24657,58 +25109,89 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ImageId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupName argument missing\n"); + TRY((!*eq_ptr), "ImageId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserGroupName argument missing\n"); - s->user_group_name = aa; // string string + TRY(!aa, "ImageId argument missing\n"); + s->image_id = aa; // string string } else - if ((aret = argcmp(next_a, "UserGroupPath")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "KeypairName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupPath argument missing\n"); + TRY((!*eq_ptr), "KeypairName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserGroupPath argument missing\n"); - s->user_group_path = aa; // string string + TRY(!aa, "KeypairName argument missing\n"); + s->keypair_name = aa; // string string } else - if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Ram")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserName argument missing\n"); + TRY((!*eq_ptr), "Ram argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserName argument missing\n"); - s->user_name = aa; // string string + TRY(!aa, "Ram argument missing\n"); + s->is_set_ram = 1; + s->ram = atoll(aa); + } else + if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Tags argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); + else if (*endptr != '.') + BAD_RET("'Tags' require a .\n"); + TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); + cascade_struct = &s->tags[pos]; + cascade_parser = resource_tag_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Tags argument missing\n"); + s->tags_str = aa; // array ref ResourceTag ref + } } else - if ((aret = argcmp(next_a, "UserPath")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmTemplateName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserPath argument missing\n"); + TRY((!*eq_ptr), "VmTemplateName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserPath argument missing\n"); - s->user_path = aa; // string string + TRY(!aa, "VmTemplateName argument missing\n"); + s->vm_template_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'RemoveUserFromUserGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateVmTemplate'\n", next_a); } i += incr; - goto remove_user_from_user_group_arg; + goto create_vm_template_arg; } - cret = osc_remove_user_from_user_group(&e, &r, &a); - TRY(cret, "fail to call RemoveUserFromUserGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_create_vm_template(&e, &r, &a); + TRY(cret, "fail to call CreateVmTemplate: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -24735,19 +25218,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("RejectNetPeering", av[i])) { + if (!strcmp("CreateVms", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_reject_net_peering_arg a = {0}; - struct osc_reject_net_peering_arg *s = &a; + struct osc_create_vms_arg a = {0}; + struct osc_create_vms_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - reject_net_peering_arg: + create_vms_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -24766,7 +25249,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto reject_net_peering_arg; + goto create_vms_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -24780,146 +25263,96 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "BlockDeviceMappings")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "BlockDeviceMappings argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'BlockDeviceMappings' require an index (example array ref BlockDeviceMappingVmCreation.BlockDeviceMappings.0)\n"); + else if (*endptr != '.') + BAD_RET("'BlockDeviceMappings' require a .\n"); + TRY_ALLOC_AT(s,block_device_mappings, pa, pos, sizeof(*s->block_device_mappings)); + cascade_struct = &s->block_device_mappings[pos]; + cascade_parser = block_device_mapping_vm_creation_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(block_device_mapping_vm_creation_parser(&s->block_device_mappings[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "BlockDeviceMappings argument missing\n"); + s->block_device_mappings_str = aa; // array ref BlockDeviceMappingVmCreation ref + } + } else + if ((aret = argcmp(next_a, "BootOnCreation")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "BootOnCreation argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_boot_on_creation = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->boot_on_creation = 1; + } else if (!strcasecmp(aa, "false")) { + s->boot_on_creation = 0; + } else { + BAD_RET("BootOnCreation require true/false\n"); } } else - if ((aret = argcmp(next_a, "NetPeeringId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "BsuOptimized")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NetPeeringId argument missing\n"); + TRY((!*eq_ptr), "BsuOptimized argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NetPeeringId argument missing\n"); - s->net_peering_id = aa; // string string - - } else - { - BAD_RET("'%s' is not a valide argument for 'RejectNetPeering'\n", next_a); - } - i += incr; - goto reject_net_peering_arg; - } - cret = osc_reject_net_peering(&e, &r, &a); - TRY(cret, "fail to call RejectNetPeering: %s\n", curl_easy_strerror(cret)); - CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); - jobj = NULL; - if (program_flag & OAPI_RAW_OUTPUT) - puts(r.buf); - else { - jobj = json_tokener_parse(r.buf); - puts(json_object_to_json_string_ext(jobj, - JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | - color_flag)); - } - while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { - ++i; - TRY(i + 1 >= ac, "--set-var require an argument"); - if (!jobj) - jobj = json_tokener_parse(r.buf); - if (parse_variable(jobj, av, ac, i)) - return -1; - ++i; - } - - if (jobj) { - json_object_put(jobj); - jobj = NULL; - } - osc_deinit_str(&r); - } else - if (!strcmp("RegisterVmsInLoadBalancer", av[i])) { - auto_osc_json_c json_object *jobj = NULL; - auto_ptr_array struct ptr_array opa = {0}; - struct ptr_array *pa = &opa; - struct osc_register_vms_in_load_balancer_arg a = {0}; - struct osc_register_vms_in_load_balancer_arg *s = &a; - __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; - int cret; - - cascade_struct = NULL; - cascade_parser = NULL; - - register_vms_in_load_balancer_arg: - - if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { - char *next_a = &av[i + 1][2]; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int incr = 2; - char *eq_ptr = strchr(next_a, '='); - - CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); - if (eq_ptr) { - CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); - incr = 1; - aa = eq_ptr + 1; - } else { - CHK_BAD_RET(!aa, "cascade need an argument\n"); - META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) - } - STRY(cascade_parser(cascade_struct, next_a, aa, pa)); - i += incr; - goto register_vms_in_load_balancer_arg; - } - - if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { - char *next_a = &av[i + 1][2]; - char *str = next_a; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int aret = 0; - int incr = aa ? 2 : 1; - - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "BackendVmIds")) == 0 || aret == '=' || aret == '.') { + s->is_set_bsu_optimized = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->bsu_optimized = 1; + } else if (!strcasecmp(aa, "false")) { + s->bsu_optimized = 0; + } else { + BAD_RET("BsuOptimized require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "ClientToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "BackendVmIds argument missing\n"); + TRY((!*eq_ptr), "ClientToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "ClientToken argument missing\n"); + s->client_token = aa; // string string - TRY(!(dot_pos++), "BackendVmIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "BackendVmIds require an index\n"); - if (s->backend_vm_ids) { - for (; s->backend_vm_ids[last]; ++last); - } - if (pos < last) { - s->backend_vm_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->backend_vm_ids, "", pa); - SET_NEXT(s->backend_vm_ids, (aa), pa); - } - } else { - TRY(!aa, "BackendVmIds argument missing\n"); - s->backend_vm_ids_str = aa; - } - } else if (!(aret = argcmp(str, "BackendVmIds[]")) || aret == '=') { - TRY(!aa, "BackendVmIds[] argument missing\n"); - SET_NEXT(s->backend_vm_ids, (aa), pa); } else + if ((aret = argcmp(next_a, "DeletionProtection")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DeletionProtection argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_deletion_protection = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->deletion_protection = 1; + } else if (!strcasecmp(aa, "false")) { + s->deletion_protection = 0; + } else { + BAD_RET("DeletionProtection require true/false\n"); + } + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -24936,665 +25369,169 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ImageId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); + TRY((!*eq_ptr), "ImageId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "LoadBalancerName argument missing\n"); - s->load_balancer_name = aa; // string string + TRY(!aa, "ImageId argument missing\n"); + s->image_id = aa; // string string } else - { - BAD_RET("'%s' is not a valide argument for 'RegisterVmsInLoadBalancer'\n", next_a); - } - i += incr; - goto register_vms_in_load_balancer_arg; - } - cret = osc_register_vms_in_load_balancer(&e, &r, &a); - TRY(cret, "fail to call RegisterVmsInLoadBalancer: %s\n", curl_easy_strerror(cret)); - CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); - jobj = NULL; - if (program_flag & OAPI_RAW_OUTPUT) - puts(r.buf); - else { - jobj = json_tokener_parse(r.buf); - puts(json_object_to_json_string_ext(jobj, - JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | - color_flag)); - } - while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { - ++i; - TRY(i + 1 >= ac, "--set-var require an argument"); - if (!jobj) - jobj = json_tokener_parse(r.buf); - if (parse_variable(jobj, av, ac, i)) - return -1; - ++i; - } - - if (jobj) { - json_object_put(jobj); - jobj = NULL; - } - osc_deinit_str(&r); - } else - if (!strcmp("RebootVms", av[i])) { - auto_osc_json_c json_object *jobj = NULL; - auto_ptr_array struct ptr_array opa = {0}; - struct ptr_array *pa = &opa; - struct osc_reboot_vms_arg a = {0}; - struct osc_reboot_vms_arg *s = &a; - __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; - int cret; - - cascade_struct = NULL; - cascade_parser = NULL; - - reboot_vms_arg: - - if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { - char *next_a = &av[i + 1][2]; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int incr = 2; - char *eq_ptr = strchr(next_a, '='); + if ((aret = argcmp(next_a, "KeypairName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "KeypairName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "KeypairName argument missing\n"); + s->keypair_name = aa; // string string - CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); - if (eq_ptr) { - CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); - incr = 1; - aa = eq_ptr + 1; - } else { - CHK_BAD_RET(!aa, "cascade need an argument\n"); - META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) - } - STRY(cascade_parser(cascade_struct, next_a, aa, pa)); - i += incr; - goto reboot_vms_arg; - } - - if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { - char *next_a = &av[i + 1][2]; - char *str = next_a; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int aret = 0; - int incr = aa ? 2 : 1; - - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + } else + if ((aret = argcmp(next_a, "MaxVmsCount")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "MaxVmsCount argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; + TRY(!aa, "MaxVmsCount argument missing\n"); + s->is_set_max_vms_count = 1; + s->max_vms_count = atoll(aa); + } else + if ((aret = argcmp(next_a, "MinVmsCount")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "MinVmsCount argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "MinVmsCount argument missing\n"); + s->is_set_min_vms_count = 1; + s->min_vms_count = atoll(aa); + } else + if ((aret = argcmp(next_a, "NestedVirtualization")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NestedVirtualization argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_nested_virtualization = 1; if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; + s->nested_virtualization = 1; } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; + s->nested_virtualization = 0; } else { - BAD_RET("DryRun require true/false\n"); + BAD_RET("NestedVirtualization require true/false\n"); } } else - if ((aret = argcmp(next_a, "VmIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Nics")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmIds argument missing\n"); + TRY((!*eq_ptr), "Nics argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "VmIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "VmIds require an index\n"); - if (s->vm_ids) { - for (; s->vm_ids[last]; ++last); - } - if (pos < last) { - s->vm_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->vm_ids, "", pa); - SET_NEXT(s->vm_ids, (aa), pa); - } - } else { - TRY(!aa, "VmIds argument missing\n"); - s->vm_ids_str = aa; - } - } else if (!(aret = argcmp(str, "VmIds[]")) || aret == '=') { - TRY(!aa, "VmIds[] argument missing\n"); - SET_NEXT(s->vm_ids, (aa), pa); - } else - { - BAD_RET("'%s' is not a valide argument for 'RebootVms'\n", next_a); - } - i += incr; - goto reboot_vms_arg; - } - cret = osc_reboot_vms(&e, &r, &a); - TRY(cret, "fail to call RebootVms: %s\n", curl_easy_strerror(cret)); - CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); - jobj = NULL; - if (program_flag & OAPI_RAW_OUTPUT) - puts(r.buf); - else { - jobj = json_tokener_parse(r.buf); - puts(json_object_to_json_string_ext(jobj, - JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | - color_flag)); - } - while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { - ++i; - TRY(i + 1 >= ac, "--set-var require an argument"); - if (!jobj) - jobj = json_tokener_parse(r.buf); - if (parse_variable(jobj, av, ac, i)) - return -1; - ++i; - } - - if (jobj) { - json_object_put(jobj); - jobj = NULL; - } - osc_deinit_str(&r); - } else - if (!strcmp("ReadVpnConnections", av[i])) { - auto_osc_json_c json_object *jobj = NULL; - auto_ptr_array struct ptr_array opa = {0}; - struct ptr_array *pa = &opa; - struct osc_read_vpn_connections_arg a = {0}; - struct osc_read_vpn_connections_arg *s = &a; - __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; - int cret; - - cascade_struct = NULL; - cascade_parser = NULL; - - read_vpn_connections_arg: - - if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { - char *next_a = &av[i + 1][2]; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int incr = 2; - char *eq_ptr = strchr(next_a, '='); - - CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); - if (eq_ptr) { - CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); - incr = 1; - aa = eq_ptr + 1; - } else { - CHK_BAD_RET(!aa, "cascade need an argument\n"); - META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) - } - STRY(cascade_parser(cascade_struct, next_a, aa, pa)); - i += incr; - goto read_vpn_connections_arg; - } + char *dot_pos = strchr(str, '.'); - if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { - char *next_a = &av[i + 1][2]; - char *str = next_a; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int aret = 0; - int incr = aa ? 2 : 1; + if (dot_pos) { + int pos; + char *endptr; - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Nics' require an index (example array ref NicForVmCreation.Nics.0)\n"); + else if (*endptr != '.') + BAD_RET("'Nics' require a .\n"); + TRY_ALLOC_AT(s,nics, pa, pos, sizeof(*s->nics)); + cascade_struct = &s->nics[pos]; + cascade_parser = nic_for_vm_creation_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(nic_for_vm_creation_parser(&s->nics[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Nics argument missing\n"); + s->nics_str = aa; // array ref NicForVmCreation ref + } + } else + if ((aret = argcmp(next_a, "Performance")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "Performance argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "Performance argument missing\n"); + s->performance = aa; // string string + + } else + if ((aret = argcmp(next_a, "Placement")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "Placement argument missing\n"); aa = eq_ptr + 1; incr = 1; } char *dot_pos; - TRY(!aa, "Filters argument missing\n"); + TRY(!aa, "Placement argument missing\n"); dot_pos = strchr(str, '.'); if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_vpn_connection_parser; + cascade_struct = &s->placement; + cascade_parser = placement_parser; if (*dot_pos == '.') { ++dot_pos; } - STRY(filters_vpn_connection_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; + STRY(placement_parser(&s->placement, dot_pos, aa, pa)); + s->is_set_placement = 1; } else { - s->filters_str = aa; + s->placement_str = aa; } } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PrivateIps")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "PrivateIps argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "PrivateIps argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "PrivateIps require an index\n"); + if (s->private_ips) { + for (; s->private_ips[last]; ++last); + } + if (pos < last) { + s->private_ips[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->private_ips, "", pa); + SET_NEXT(s->private_ips, (aa), pa); + } + } else { + TRY(!aa, "PrivateIps argument missing\n"); + s->private_ips_str = aa; + } + } else if (!(aret = argcmp(str, "PrivateIps[]")) || aret == '=') { + TRY(!aa, "PrivateIps[] argument missing\n"); + SET_NEXT(s->private_ips, (aa), pa); } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SecurityGroupIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else - { - BAD_RET("'%s' is not a valide argument for 'ReadVpnConnections'\n", next_a); - } - i += incr; - goto read_vpn_connections_arg; - } - cret = osc_read_vpn_connections(&e, &r, &a); - TRY(cret, "fail to call ReadVpnConnections: %s\n", curl_easy_strerror(cret)); - CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); - jobj = NULL; - if (program_flag & OAPI_RAW_OUTPUT) - puts(r.buf); - else { - jobj = json_tokener_parse(r.buf); - puts(json_object_to_json_string_ext(jobj, - JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | - color_flag)); - } - while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { - ++i; - TRY(i + 1 >= ac, "--set-var require an argument"); - if (!jobj) - jobj = json_tokener_parse(r.buf); - if (parse_variable(jobj, av, ac, i)) - return -1; - ++i; - } - - if (jobj) { - json_object_put(jobj); - jobj = NULL; - } - osc_deinit_str(&r); - } else - if (!strcmp("ReadVolumes", av[i])) { - auto_osc_json_c json_object *jobj = NULL; - auto_ptr_array struct ptr_array opa = {0}; - struct ptr_array *pa = &opa; - struct osc_read_volumes_arg a = {0}; - struct osc_read_volumes_arg *s = &a; - __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; - int cret; - - cascade_struct = NULL; - cascade_parser = NULL; - - read_volumes_arg: - - if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { - char *next_a = &av[i + 1][2]; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int incr = 2; - char *eq_ptr = strchr(next_a, '='); - - CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); - if (eq_ptr) { - CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); - incr = 1; - aa = eq_ptr + 1; - } else { - CHK_BAD_RET(!aa, "cascade need an argument\n"); - META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) - } - STRY(cascade_parser(cascade_struct, next_a, aa, pa)); - i += incr; - goto read_volumes_arg; - } - - if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { - char *next_a = &av[i + 1][2]; - char *str = next_a; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int aret = 0; - int incr = aa ? 2 : 1; - - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_volume_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_volume_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string - - } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else - { - BAD_RET("'%s' is not a valide argument for 'ReadVolumes'\n", next_a); - } - i += incr; - goto read_volumes_arg; - } - cret = osc_read_volumes(&e, &r, &a); - TRY(cret, "fail to call ReadVolumes: %s\n", curl_easy_strerror(cret)); - CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); - jobj = NULL; - if (program_flag & OAPI_RAW_OUTPUT) - puts(r.buf); - else { - jobj = json_tokener_parse(r.buf); - puts(json_object_to_json_string_ext(jobj, - JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | - color_flag)); - } - while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { - ++i; - TRY(i + 1 >= ac, "--set-var require an argument"); - if (!jobj) - jobj = json_tokener_parse(r.buf); - if (parse_variable(jobj, av, ac, i)) - return -1; - ++i; - } - - if (jobj) { - json_object_put(jobj); - jobj = NULL; - } - osc_deinit_str(&r); - } else - if (!strcmp("ReadVmsState", av[i])) { - auto_osc_json_c json_object *jobj = NULL; - auto_ptr_array struct ptr_array opa = {0}; - struct ptr_array *pa = &opa; - struct osc_read_vms_state_arg a = {0}; - struct osc_read_vms_state_arg *s = &a; - __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; - int cret; - - cascade_struct = NULL; - cascade_parser = NULL; - - read_vms_state_arg: - - if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { - char *next_a = &av[i + 1][2]; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int incr = 2; - char *eq_ptr = strchr(next_a, '='); - - CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); - if (eq_ptr) { - CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); - incr = 1; - aa = eq_ptr + 1; - } else { - CHK_BAD_RET(!aa, "cascade need an argument\n"); - META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) - } - STRY(cascade_parser(cascade_struct, next_a, aa, pa)); - i += incr; - goto read_vms_state_arg; - } - - if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { - char *next_a = &av[i + 1][2]; - char *str = next_a; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int aret = 0; - int incr = aa ? 2 : 1; - - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "AllVms")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "AllVms argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_all_vms = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->all_vms = 1; - } else if (!strcasecmp(aa, "false")) { - s->all_vms = 0; - } else { - BAD_RET("AllVms require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_vms_state_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_vms_state_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string - - } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else - { - BAD_RET("'%s' is not a valide argument for 'ReadVmsState'\n", next_a); - } - i += incr; - goto read_vms_state_arg; - } - cret = osc_read_vms_state(&e, &r, &a); - TRY(cret, "fail to call ReadVmsState: %s\n", curl_easy_strerror(cret)); - CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); - jobj = NULL; - if (program_flag & OAPI_RAW_OUTPUT) - puts(r.buf); - else { - jobj = json_tokener_parse(r.buf); - puts(json_object_to_json_string_ext(jobj, - JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | - color_flag)); - } - while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { - ++i; - TRY(i + 1 >= ac, "--set-var require an argument"); - if (!jobj) - jobj = json_tokener_parse(r.buf); - if (parse_variable(jobj, av, ac, i)) - return -1; - ++i; - } - - if (jobj) { - json_object_put(jobj); - jobj = NULL; - } - osc_deinit_str(&r); - } else - if (!strcmp("ReadVmsHealth", av[i])) { - auto_osc_json_c json_object *jobj = NULL; - auto_ptr_array struct ptr_array opa = {0}; - struct ptr_array *pa = &opa; - struct osc_read_vms_health_arg a = {0}; - struct osc_read_vms_health_arg *s = &a; - __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; - int cret; - - cascade_struct = NULL; - cascade_parser = NULL; - - read_vms_health_arg: - - if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { - char *next_a = &av[i + 1][2]; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int incr = 2; - char *eq_ptr = strchr(next_a, '='); - - CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); - if (eq_ptr) { - CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); - incr = 1; - aa = eq_ptr + 1; - } else { - CHK_BAD_RET(!aa, "cascade need an argument\n"); - META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) - } - STRY(cascade_parser(cascade_struct, next_a, aa, pa)); - i += incr; - goto read_vms_health_arg; - } - - if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { - char *next_a = &av[i + 1][2]; - char *str = next_a; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int aret = 0; - int incr = aa ? 2 : 1; - - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "BackendVmIds")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "BackendVmIds argument missing\n"); + TRY((!*eq_ptr), "SecurityGroupIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } @@ -25604,202 +25541,113 @@ int main(int ac, char **av) int last = 0; char *dot_pos = strchr(str, '.'); - TRY(!(dot_pos++), "BackendVmIds argument missing\n"); + TRY(!(dot_pos++), "SecurityGroupIds argument missing\n"); pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "BackendVmIds require an index\n"); - if (s->backend_vm_ids) { - for (; s->backend_vm_ids[last]; ++last); + TRY(endptr == dot_pos, "SecurityGroupIds require an index\n"); + if (s->security_group_ids) { + for (; s->security_group_ids[last]; ++last); } if (pos < last) { - s->backend_vm_ids[pos] = (aa); + s->security_group_ids[pos] = (aa); } else { for (int i = last; i < pos; ++i) - SET_NEXT(s->backend_vm_ids, "", pa); - SET_NEXT(s->backend_vm_ids, (aa), pa); + SET_NEXT(s->security_group_ids, "", pa); + SET_NEXT(s->security_group_ids, (aa), pa); } } else { - TRY(!aa, "BackendVmIds argument missing\n"); - s->backend_vm_ids_str = aa; + TRY(!aa, "SecurityGroupIds argument missing\n"); + s->security_group_ids_str = aa; } - } else if (!(aret = argcmp(str, "BackendVmIds[]")) || aret == '=') { - TRY(!aa, "BackendVmIds[] argument missing\n"); - SET_NEXT(s->backend_vm_ids, (aa), pa); + } else if (!(aret = argcmp(str, "SecurityGroupIds[]")) || aret == '=') { + TRY(!aa, "SecurityGroupIds[] argument missing\n"); + SET_NEXT(s->security_group_ids, (aa), pa); } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SecurityGroups")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); + TRY((!*eq_ptr), "SecurityGroups argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "LoadBalancerName argument missing\n"); - s->load_balancer_name = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "SecurityGroups argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "SecurityGroups require an index\n"); + if (s->security_groups) { + for (; s->security_groups[last]; ++last); + } + if (pos < last) { + s->security_groups[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->security_groups, "", pa); + SET_NEXT(s->security_groups, (aa), pa); + } + } else { + TRY(!aa, "SecurityGroups argument missing\n"); + s->security_groups_str = aa; + } + } else if (!(aret = argcmp(str, "SecurityGroups[]")) || aret == '=') { + TRY(!aa, "SecurityGroups[] argument missing\n"); + SET_NEXT(s->security_groups, (aa), pa); } else - { - BAD_RET("'%s' is not a valide argument for 'ReadVmsHealth'\n", next_a); - } - i += incr; - goto read_vms_health_arg; - } - cret = osc_read_vms_health(&e, &r, &a); - TRY(cret, "fail to call ReadVmsHealth: %s\n", curl_easy_strerror(cret)); - CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); - jobj = NULL; - if (program_flag & OAPI_RAW_OUTPUT) - puts(r.buf); - else { - jobj = json_tokener_parse(r.buf); - puts(json_object_to_json_string_ext(jobj, - JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | - color_flag)); - } - while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { - ++i; - TRY(i + 1 >= ac, "--set-var require an argument"); - if (!jobj) - jobj = json_tokener_parse(r.buf); - if (parse_variable(jobj, av, ac, i)) - return -1; - ++i; - } - - if (jobj) { - json_object_put(jobj); - jobj = NULL; - } - osc_deinit_str(&r); - } else - if (!strcmp("ReadVms", av[i])) { - auto_osc_json_c json_object *jobj = NULL; - auto_ptr_array struct ptr_array opa = {0}; - struct ptr_array *pa = &opa; - struct osc_read_vms_arg a = {0}; - struct osc_read_vms_arg *s = &a; - __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; - int cret; - - cascade_struct = NULL; - cascade_parser = NULL; - - read_vms_arg: - - if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { - char *next_a = &av[i + 1][2]; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int incr = 2; - char *eq_ptr = strchr(next_a, '='); - - CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); - if (eq_ptr) { - CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); - incr = 1; - aa = eq_ptr + 1; - } else { - CHK_BAD_RET(!aa, "cascade need an argument\n"); - META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) - } - STRY(cascade_parser(cascade_struct, next_a, aa, pa)); - i += incr; - goto read_vms_arg; - } - - if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { - char *next_a = &av[i + 1][2]; - char *str = next_a; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int aret = 0; - int incr = aa ? 2 : 1; - - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "SubnetId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "SubnetId argument missing\n"); + s->subnet_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "UserData")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "UserData argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "UserData argument missing\n"); + s->user_data = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_vm_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_vm_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmInitiatedShutdownBehavior")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "VmInitiatedShutdownBehavior argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "VmInitiatedShutdownBehavior argument missing\n"); + s->vm_initiated_shutdown_behavior = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmType")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + TRY((!*eq_ptr), "VmType argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); + TRY(!aa, "VmType argument missing\n"); + s->vm_type = aa; // string string + } else { - BAD_RET("'%s' is not a valide argument for 'ReadVms'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateVms'\n", next_a); } i += incr; - goto read_vms_arg; + goto create_vms_arg; } - cret = osc_read_vms(&e, &r, &a); - TRY(cret, "fail to call ReadVms: %s\n", curl_easy_strerror(cret)); + cret = osc_create_vms(&e, &r, &a); + TRY(cret, "fail to call CreateVms: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -25826,19 +25674,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadVmTypes", av[i])) { + if (!strcmp("CreateVolume", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_vm_types_arg a = {0}; - struct osc_read_vm_types_arg *s = &a; + struct osc_create_volume_arg a = {0}; + struct osc_create_volume_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_vm_types_arg: + create_volume_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -25857,7 +25705,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_vm_types_arg; + goto create_volume_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -25887,59 +25735,69 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Iops")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "Iops argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "Iops argument missing\n"); + s->is_set_iops = 1; + s->iops = atoll(aa); + } else + if ((aret = argcmp(next_a, "Size")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Size argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Size argument missing\n"); + s->is_set_size = 1; + s->size = atoll(aa); + } else + if ((aret = argcmp(next_a, "SnapshotId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SnapshotId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SnapshotId argument missing\n"); + s->snapshot_id = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_vm_type_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_vm_type_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SubregionName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "SubregionName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "SubregionName argument missing\n"); + s->subregion_name = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VolumeType")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + TRY((!*eq_ptr), "VolumeType argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); + TRY(!aa, "VolumeType argument missing\n"); + s->volume_type = aa; // string string + } else { - BAD_RET("'%s' is not a valide argument for 'ReadVmTypes'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateVolume'\n", next_a); } i += incr; - goto read_vm_types_arg; + goto create_volume_arg; } - cret = osc_read_vm_types(&e, &r, &a); - TRY(cret, "fail to call ReadVmTypes: %s\n", curl_easy_strerror(cret)); + cret = osc_create_volume(&e, &r, &a); + TRY(cret, "fail to call CreateVolume: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -25966,19 +25824,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadVmTemplates", av[i])) { + if (!strcmp("CreateVpnConnection", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_vm_templates_arg a = {0}; - struct osc_read_vm_templates_arg *s = &a; + struct osc_create_vpn_connection_arg a = {0}; + struct osc_create_vpn_connection_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_vm_templates_arg: + create_vpn_connection_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -25997,7 +25855,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_vm_templates_arg; + goto create_vpn_connection_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -26011,6 +25869,28 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "ClientGatewayId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ClientGatewayId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ClientGatewayId argument missing\n"); + s->client_gateway_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "ConnectionType")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ConnectionType argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ConnectionType argument missing\n"); + s->connection_type = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -26027,37 +25907,41 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "StaticRoutesOnly")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "StaticRoutesOnly argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_vm_template_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_vm_template_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; + s->is_set_static_routes_only = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->static_routes_only = 1; + } else if (!strcasecmp(aa, "false")) { + s->static_routes_only = 0; } else { - s->filters_str = aa; + BAD_RET("StaticRoutesOnly require true/false\n"); } + } else + if ((aret = argcmp(next_a, "VirtualGatewayId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VirtualGatewayId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VirtualGatewayId argument missing\n"); + s->virtual_gateway_id = aa; // string string + } else { - BAD_RET("'%s' is not a valide argument for 'ReadVmTemplates'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateVpnConnection'\n", next_a); } i += incr; - goto read_vm_templates_arg; + goto create_vpn_connection_arg; } - cret = osc_read_vm_templates(&e, &r, &a); - TRY(cret, "fail to call ReadVmTemplates: %s\n", curl_easy_strerror(cret)); + cret = osc_create_vpn_connection(&e, &r, &a); + TRY(cret, "fail to call CreateVpnConnection: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -26084,19 +25968,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadVmGroups", av[i])) { + if (!strcmp("CreateVpnConnectionRoute", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_vm_groups_arg a = {0}; - struct osc_read_vm_groups_arg *s = &a; + struct osc_create_vpn_connection_route_arg a = {0}; + struct osc_create_vpn_connection_route_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_vm_groups_arg: + create_vpn_connection_route_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -26115,7 +25999,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_vm_groups_arg; + goto create_vpn_connection_route_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -26129,6 +26013,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "DestinationIpRange")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DestinationIpRange argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "DestinationIpRange argument missing\n"); + s->destination_ip_range = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -26145,37 +26040,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VpnConnectionId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "VpnConnectionId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "VpnConnectionId argument missing\n"); + s->vpn_connection_id = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_vm_group_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_vm_group_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else { - BAD_RET("'%s' is not a valide argument for 'ReadVmGroups'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'CreateVpnConnectionRoute'\n", next_a); } i += incr; - goto read_vm_groups_arg; + goto create_vpn_connection_route_arg; } - cret = osc_read_vm_groups(&e, &r, &a); - TRY(cret, "fail to call ReadVmGroups: %s\n", curl_easy_strerror(cret)); + cret = osc_create_vpn_connection_route(&e, &r, &a); + TRY(cret, "fail to call CreateVpnConnectionRoute: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -26202,19 +26085,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadVirtualGateways", av[i])) { + if (!strcmp("DeleteAccessKey", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_virtual_gateways_arg a = {0}; - struct osc_read_virtual_gateways_arg *s = &a; + struct osc_delete_access_key_arg a = {0}; + struct osc_delete_access_key_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_virtual_gateways_arg: + delete_access_key_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -26233,7 +26116,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_virtual_gateways_arg; + goto delete_access_key_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -26247,6 +26130,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "AccessKeyId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "AccessKeyId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "AccessKeyId argument missing\n"); + s->access_key_id = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -26263,59 +26157,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_virtual_gateway_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_virtual_gateway_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "UserName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "UserName argument missing\n"); + s->user_name = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadVirtualGateways'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteAccessKey'\n", next_a); } i += incr; - goto read_virtual_gateways_arg; + goto delete_access_key_arg; } - cret = osc_read_virtual_gateways(&e, &r, &a); - TRY(cret, "fail to call ReadVirtualGateways: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_access_key(&e, &r, &a); + TRY(cret, "fail to call DeleteAccessKey: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -26342,19 +26202,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadUsers", av[i])) { + if (!strcmp("DeleteApiAccessRule", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_users_arg a = {0}; - struct osc_read_users_arg *s = &a; + struct osc_delete_api_access_rule_arg a = {0}; + struct osc_delete_api_access_rule_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_users_arg: + delete_api_access_rule_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -26373,7 +26233,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_users_arg; + goto delete_api_access_rule_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -26387,6 +26247,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "ApiAccessRuleId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ApiAccessRuleId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ApiAccessRuleId argument missing\n"); + s->api_access_rule_id = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -26403,59 +26274,14 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_users_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_users_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "FirstItem argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "FirstItem argument missing\n"); - s->is_set_first_item = 1; - s->first_item = atoll(aa); - } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadUsers'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteApiAccessRule'\n", next_a); } i += incr; - goto read_users_arg; + goto delete_api_access_rule_arg; } - cret = osc_read_users(&e, &r, &a); - TRY(cret, "fail to call ReadUsers: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_api_access_rule(&e, &r, &a); + TRY(cret, "fail to call DeleteApiAccessRule: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -26482,19 +26308,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadUserGroupsPerUser", av[i])) { + if (!strcmp("DeleteCa", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_user_groups_per_user_arg a = {0}; - struct osc_read_user_groups_per_user_arg *s = &a; + struct osc_delete_ca_arg a = {0}; + struct osc_delete_ca_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_user_groups_per_user_arg: + delete_ca_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -26513,7 +26339,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_user_groups_per_user_arg; + goto delete_ca_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -26527,6 +26353,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "CaId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "CaId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "CaId argument missing\n"); + s->ca_id = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -26543,36 +26380,14 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "UserName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "UserName argument missing\n"); - s->user_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserPath")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "UserPath argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "UserPath argument missing\n"); - s->user_path = aa; // string string - - } else { - BAD_RET("'%s' is not a valide argument for 'ReadUserGroupsPerUser'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteCa'\n", next_a); } i += incr; - goto read_user_groups_per_user_arg; + goto delete_ca_arg; } - cret = osc_read_user_groups_per_user(&e, &r, &a); - TRY(cret, "fail to call ReadUserGroupsPerUser: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_ca(&e, &r, &a); + TRY(cret, "fail to call DeleteCa: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -26599,19 +26414,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadUserGroups", av[i])) { + if (!strcmp("DeleteClientGateway", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_user_groups_arg a = {0}; - struct osc_read_user_groups_arg *s = &a; + struct osc_delete_client_gateway_arg a = {0}; + struct osc_delete_client_gateway_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_user_groups_arg: + delete_client_gateway_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -26630,7 +26445,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_user_groups_arg; + goto delete_client_gateway_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -26640,79 +26455,45 @@ int main(int ac, char **av) int aret = 0; int incr = aa ? 2 : 1; - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_user_group_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_user_group_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } + if ((aret = argcmp(next_a, "ClientGatewayId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "FirstItem argument missing\n"); + TRY((!*eq_ptr), "ClientGatewayId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "FirstItem argument missing\n"); - s->is_set_first_item = 1; - s->first_item = atoll(aa); + TRY(!aa, "ClientGatewayId argument missing\n"); + s->client_gateway_id = aa; // string string + } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else { - BAD_RET("'%s' is not a valide argument for 'ReadUserGroups'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteClientGateway'\n", next_a); } i += incr; - goto read_user_groups_arg; + goto delete_client_gateway_arg; } - cret = osc_read_user_groups(&e, &r, &a); - TRY(cret, "fail to call ReadUserGroups: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_client_gateway(&e, &r, &a); + TRY(cret, "fail to call DeleteClientGateway: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -26739,19 +26520,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadUserGroupPolicy", av[i])) { + if (!strcmp("DeleteDedicatedGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_user_group_policy_arg a = {0}; - struct osc_read_user_group_policy_arg *s = &a; + struct osc_delete_dedicated_group_arg a = {0}; + struct osc_delete_dedicated_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_user_group_policy_arg: + delete_dedicated_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -26770,7 +26551,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_user_group_policy_arg; + goto delete_dedicated_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -26784,6 +26565,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "DedicatedGroupId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DedicatedGroupId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "DedicatedGroupId argument missing\n"); + s->dedicated_group_id = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -26800,47 +26592,30 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "PolicyName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PolicyName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "PolicyName argument missing\n"); - s->policy_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "UserGroupName argument missing\n"); - s->user_group_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserGroupPath")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Force")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupPath argument missing\n"); + TRY((!*eq_ptr), "Force argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserGroupPath argument missing\n"); - s->user_group_path = aa; // string string - - } else + s->is_set_force = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->force = 1; + } else if (!strcasecmp(aa, "false")) { + s->force = 0; + } else { + BAD_RET("Force require true/false\n"); + } + } else { - BAD_RET("'%s' is not a valide argument for 'ReadUserGroupPolicy'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteDedicatedGroup'\n", next_a); } i += incr; - goto read_user_group_policy_arg; + goto delete_dedicated_group_arg; } - cret = osc_read_user_group_policy(&e, &r, &a); - TRY(cret, "fail to call ReadUserGroupPolicy: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_dedicated_group(&e, &r, &a); + TRY(cret, "fail to call DeleteDedicatedGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -26867,19 +26642,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadUserGroupPolicies", av[i])) { + if (!strcmp("DeleteDhcpOptions", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_user_group_policies_arg a = {0}; - struct osc_read_user_group_policies_arg *s = &a; + struct osc_delete_dhcp_options_arg a = {0}; + struct osc_delete_dhcp_options_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_user_group_policies_arg: + delete_dhcp_options_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -26898,7 +26673,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_user_group_policies_arg; + goto delete_dhcp_options_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -26912,6 +26687,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "DhcpOptionsSetId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DhcpOptionsSetId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "DhcpOptionsSetId argument missing\n"); + s->dhcp_options_set_id = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -26928,58 +26714,14 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "FirstItem argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "FirstItem argument missing\n"); - s->is_set_first_item = 1; - s->first_item = atoll(aa); - } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else - if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "UserGroupName argument missing\n"); - s->user_group_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserGroupPath")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupPath argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "UserGroupPath argument missing\n"); - s->user_group_path = aa; // string string - - } else { - BAD_RET("'%s' is not a valide argument for 'ReadUserGroupPolicies'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteDhcpOptions'\n", next_a); } i += incr; - goto read_user_group_policies_arg; + goto delete_dhcp_options_arg; } - cret = osc_read_user_group_policies(&e, &r, &a); - TRY(cret, "fail to call ReadUserGroupPolicies: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_dhcp_options(&e, &r, &a); + TRY(cret, "fail to call DeleteDhcpOptions: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -27006,19 +26748,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadUserGroup", av[i])) { + if (!strcmp("DeleteDirectLinkInterface", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_user_group_arg a = {0}; - struct osc_read_user_group_arg *s = &a; + struct osc_delete_direct_link_interface_arg a = {0}; + struct osc_delete_direct_link_interface_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_user_group_arg: + delete_direct_link_interface_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -27037,7 +26779,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_user_group_arg; + goto delete_direct_link_interface_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -27051,6 +26793,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "DirectLinkInterfaceId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DirectLinkInterfaceId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "DirectLinkInterfaceId argument missing\n"); + s->direct_link_interface_id = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -27067,36 +26820,14 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Path argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Path argument missing\n"); - s->path = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "UserGroupName argument missing\n"); - s->user_group_name = aa; // string string - - } else { - BAD_RET("'%s' is not a valide argument for 'ReadUserGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteDirectLinkInterface'\n", next_a); } i += incr; - goto read_user_group_arg; + goto delete_direct_link_interface_arg; } - cret = osc_read_user_group(&e, &r, &a); - TRY(cret, "fail to call ReadUserGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_direct_link_interface(&e, &r, &a); + TRY(cret, "fail to call DeleteDirectLinkInterface: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -27123,19 +26854,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadUnitPrice", av[i])) { + if (!strcmp("DeleteDirectLink", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_unit_price_arg a = {0}; - struct osc_read_unit_price_arg *s = &a; + struct osc_delete_direct_link_arg a = {0}; + struct osc_delete_direct_link_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_unit_price_arg: + delete_direct_link_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -27154,61 +26885,55 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_unit_price_arg; + goto delete_direct_link_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { char *next_a = &av[i + 1][2]; char *str = next_a; char *aa = i + 2 < ac ? av[i + 2] : 0; - int aret = 0; - int incr = aa ? 2 : 1; - - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "Operation")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Operation argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Operation argument missing\n"); - s->operation = aa; // string string + int aret = 0; + int incr = aa ? 2 : 1; - } else - if ((aret = argcmp(next_a, "Service")) == 0 || aret == '=' || aret == '.') { + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } + if ((aret = argcmp(next_a, "DirectLinkId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Service argument missing\n"); + TRY((!*eq_ptr), "DirectLinkId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Service argument missing\n"); - s->service = aa; // string string + TRY(!aa, "DirectLinkId argument missing\n"); + s->direct_link_id = aa; // string string } else - if ((aret = argcmp(next_a, "Type")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Type argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Type argument missing\n"); - s->type = aa; // string string - - } else + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else { - BAD_RET("'%s' is not a valide argument for 'ReadUnitPrice'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteDirectLink'\n", next_a); } i += incr; - goto read_unit_price_arg; + goto delete_direct_link_arg; } - cret = osc_read_unit_price(&e, &r, &a); - TRY(cret, "fail to call ReadUnitPrice: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_direct_link(&e, &r, &a); + TRY(cret, "fail to call DeleteDirectLink: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -27235,19 +26960,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadTags", av[i])) { + if (!strcmp("DeleteExportTask", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_tags_arg a = {0}; - struct osc_read_tags_arg *s = &a; + struct osc_delete_export_task_arg a = {0}; + struct osc_delete_export_task_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_tags_arg: + delete_export_task_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -27266,7 +26991,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_tags_arg; + goto delete_export_task_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -27296,59 +27021,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_tag_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_tag_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ExportTaskId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "ExportTaskId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "ExportTaskId argument missing\n"); + s->export_task_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadTags'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteExportTask'\n", next_a); } i += incr; - goto read_tags_arg; + goto delete_export_task_arg; } - cret = osc_read_tags(&e, &r, &a); - TRY(cret, "fail to call ReadTags: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_export_task(&e, &r, &a); + TRY(cret, "fail to call DeleteExportTask: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -27375,19 +27066,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadSubregions", av[i])) { + if (!strcmp("DeleteFlexibleGpu", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_subregions_arg a = {0}; - struct osc_read_subregions_arg *s = &a; + struct osc_delete_flexible_gpu_arg a = {0}; + struct osc_delete_flexible_gpu_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_subregions_arg: + delete_flexible_gpu_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -27406,7 +27097,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_subregions_arg; + goto delete_flexible_gpu_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -27436,59 +27127,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_subregion_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_subregion_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "FlexibleGpuId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "FlexibleGpuId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "FlexibleGpuId argument missing\n"); + s->flexible_gpu_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadSubregions'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteFlexibleGpu'\n", next_a); } i += incr; - goto read_subregions_arg; + goto delete_flexible_gpu_arg; } - cret = osc_read_subregions(&e, &r, &a); - TRY(cret, "fail to call ReadSubregions: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_flexible_gpu(&e, &r, &a); + TRY(cret, "fail to call DeleteFlexibleGpu: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -27515,19 +27172,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadSubnets", av[i])) { + if (!strcmp("DeleteImage", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_subnets_arg a = {0}; - struct osc_read_subnets_arg *s = &a; + struct osc_delete_image_arg a = {0}; + struct osc_delete_image_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_subnets_arg: + delete_image_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -27546,7 +27203,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_subnets_arg; + goto delete_image_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -27576,59 +27233,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_subnet_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_subnet_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ImageId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "ImageId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "ImageId argument missing\n"); + s->image_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadSubnets'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteImage'\n", next_a); } i += incr; - goto read_subnets_arg; + goto delete_image_arg; } - cret = osc_read_subnets(&e, &r, &a); - TRY(cret, "fail to call ReadSubnets: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_image(&e, &r, &a); + TRY(cret, "fail to call DeleteImage: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -27655,19 +27278,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadSnapshots", av[i])) { + if (!strcmp("DeleteInternetService", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_snapshots_arg a = {0}; - struct osc_read_snapshots_arg *s = &a; + struct osc_delete_internet_service_arg a = {0}; + struct osc_delete_internet_service_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_snapshots_arg: + delete_internet_service_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -27686,7 +27309,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_snapshots_arg; + goto delete_internet_service_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -27714,61 +27337,27 @@ int main(int ac, char **av) s->dry_run = 0; } else { BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_snapshot_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_snapshot_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + } + } else + if ((aret = argcmp(next_a, "InternetServiceId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "InternetServiceId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "InternetServiceId argument missing\n"); + s->internet_service_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadSnapshots'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteInternetService'\n", next_a); } i += incr; - goto read_snapshots_arg; + goto delete_internet_service_arg; } - cret = osc_read_snapshots(&e, &r, &a); - TRY(cret, "fail to call ReadSnapshots: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_internet_service(&e, &r, &a); + TRY(cret, "fail to call DeleteInternetService: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -27795,19 +27384,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadSnapshotExportTasks", av[i])) { + if (!strcmp("DeleteKeypair", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_snapshot_export_tasks_arg a = {0}; - struct osc_read_snapshot_export_tasks_arg *s = &a; + struct osc_delete_keypair_arg a = {0}; + struct osc_delete_keypair_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_snapshot_export_tasks_arg: + delete_keypair_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -27826,7 +27415,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_snapshot_export_tasks_arg; + goto delete_keypair_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -27856,59 +27445,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_export_task_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_export_task_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "KeypairName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "KeypairName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "KeypairName argument missing\n"); + s->keypair_name = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadSnapshotExportTasks'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteKeypair'\n", next_a); } i += incr; - goto read_snapshot_export_tasks_arg; + goto delete_keypair_arg; } - cret = osc_read_snapshot_export_tasks(&e, &r, &a); - TRY(cret, "fail to call ReadSnapshotExportTasks: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_keypair(&e, &r, &a); + TRY(cret, "fail to call DeleteKeypair: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -27935,19 +27490,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadServerCertificates", av[i])) { + if (!strcmp("DeleteListenerRule", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_server_certificates_arg a = {0}; - struct osc_read_server_certificates_arg *s = &a; + struct osc_delete_listener_rule_arg a = {0}; + struct osc_delete_listener_rule_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_server_certificates_arg: + delete_listener_rule_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -27966,7 +27521,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_server_certificates_arg; + goto delete_listener_rule_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -27996,37 +27551,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ListenerRuleName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "ListenerRuleName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "ListenerRuleName argument missing\n"); + s->listener_rule_name = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_server_certificate_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_server_certificate_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else { - BAD_RET("'%s' is not a valide argument for 'ReadServerCertificates'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteListenerRule'\n", next_a); } i += incr; - goto read_server_certificates_arg; + goto delete_listener_rule_arg; } - cret = osc_read_server_certificates(&e, &r, &a); - TRY(cret, "fail to call ReadServerCertificates: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_listener_rule(&e, &r, &a); + TRY(cret, "fail to call DeleteListenerRule: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -28053,19 +27596,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadSecurityGroups", av[i])) { + if (!strcmp("DeleteLoadBalancerListeners", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_security_groups_arg a = {0}; - struct osc_read_security_groups_arg *s = &a; + struct osc_delete_load_balancer_listeners_arg a = {0}; + struct osc_delete_load_balancer_listeners_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_security_groups_arg: + delete_load_balancer_listeners_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -28084,7 +27627,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_security_groups_arg; + goto delete_load_balancer_listeners_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -28114,59 +27657,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "LoadBalancerName argument missing\n"); + s->load_balancer_name = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_security_group_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_security_group_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LoadBalancerPorts")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "LoadBalancerPorts argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); - } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); + TRY(!(dot_pos++), "LoadBalancerPorts argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "LoadBalancerPorts require an index\n"); + if (s->load_balancer_ports) { + for (; s->load_balancer_ports[last]; ++last); + } + if (pos < last) { + s->load_balancer_ports[pos] = atoi(aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->load_balancer_ports, 0, pa); + SET_NEXT(s->load_balancer_ports, atoi(aa), pa); + } + } else { + TRY(!aa, "LoadBalancerPorts argument missing\n"); + s->load_balancer_ports_str = aa; + } + } else if (!(aret = argcmp(str, "LoadBalancerPorts[]")) || aret == '=') { + TRY(!aa, "LoadBalancerPorts[] argument missing\n"); + SET_NEXT(s->load_balancer_ports, atoi(aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'ReadSecurityGroups'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteLoadBalancerListeners'\n", next_a); } i += incr; - goto read_security_groups_arg; + goto delete_load_balancer_listeners_arg; } - cret = osc_read_security_groups(&e, &r, &a); - TRY(cret, "fail to call ReadSecurityGroups: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_load_balancer_listeners(&e, &r, &a); + TRY(cret, "fail to call DeleteLoadBalancerListeners: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -28193,19 +27736,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadSecretAccessKey", av[i])) { + if (!strcmp("DeleteLoadBalancerPolicy", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_secret_access_key_arg a = {0}; - struct osc_read_secret_access_key_arg *s = &a; + struct osc_delete_load_balancer_policy_arg a = {0}; + struct osc_delete_load_balancer_policy_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_secret_access_key_arg: + delete_load_balancer_policy_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -28224,7 +27767,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_secret_access_key_arg; + goto delete_load_balancer_policy_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -28238,17 +27781,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "AccessKeyId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "AccessKeyId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "AccessKeyId argument missing\n"); - s->access_key_id = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -28265,14 +27797,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else + if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "LoadBalancerName argument missing\n"); + s->load_balancer_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "PolicyName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "PolicyName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "PolicyName argument missing\n"); + s->policy_name = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'ReadSecretAccessKey'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteLoadBalancerPolicy'\n", next_a); } i += incr; - goto read_secret_access_key_arg; + goto delete_load_balancer_policy_arg; } - cret = osc_read_secret_access_key(&e, &r, &a); - TRY(cret, "fail to call ReadSecretAccessKey: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_load_balancer_policy(&e, &r, &a); + TRY(cret, "fail to call DeleteLoadBalancerPolicy: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -28299,19 +27853,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadRouteTables", av[i])) { + if (!strcmp("DeleteLoadBalancer", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_route_tables_arg a = {0}; - struct osc_read_route_tables_arg *s = &a; + struct osc_delete_load_balancer_arg a = {0}; + struct osc_delete_load_balancer_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_route_tables_arg: + delete_load_balancer_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -28330,7 +27884,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_route_tables_arg; + goto delete_load_balancer_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -28360,59 +27914,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_route_table_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_route_table_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "LoadBalancerName argument missing\n"); + s->load_balancer_name = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadRouteTables'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteLoadBalancer'\n", next_a); } i += incr; - goto read_route_tables_arg; + goto delete_load_balancer_arg; } - cret = osc_read_route_tables(&e, &r, &a); - TRY(cret, "fail to call ReadRouteTables: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_load_balancer(&e, &r, &a); + TRY(cret, "fail to call DeleteLoadBalancer: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -28439,19 +27959,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadRegions", av[i])) { + if (!strcmp("DeleteLoadBalancerTags", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_regions_arg a = {0}; - struct osc_read_regions_arg *s = &a; + struct osc_delete_load_balancer_tags_arg a = {0}; + struct osc_delete_load_balancer_tags_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_regions_arg: + delete_load_balancer_tags_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -28470,7 +27990,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_regions_arg; + goto delete_load_balancer_tags_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -28500,14 +28020,79 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else + if ((aret = argcmp(next_a, "LoadBalancerNames")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "LoadBalancerNames argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "LoadBalancerNames argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "LoadBalancerNames require an index\n"); + if (s->load_balancer_names) { + for (; s->load_balancer_names[last]; ++last); + } + if (pos < last) { + s->load_balancer_names[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->load_balancer_names, "", pa); + SET_NEXT(s->load_balancer_names, (aa), pa); + } + } else { + TRY(!aa, "LoadBalancerNames argument missing\n"); + s->load_balancer_names_str = aa; + } + } else if (!(aret = argcmp(str, "LoadBalancerNames[]")) || aret == '=') { + TRY(!aa, "LoadBalancerNames[] argument missing\n"); + SET_NEXT(s->load_balancer_names, (aa), pa); + } else + if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Tags argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Tags' require an index (example array ref ResourceLoadBalancerTag.Tags.0)\n"); + else if (*endptr != '.') + BAD_RET("'Tags' require a .\n"); + TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); + cascade_struct = &s->tags[pos]; + cascade_parser = resource_load_balancer_tag_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(resource_load_balancer_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Tags argument missing\n"); + s->tags_str = aa; // array ref ResourceLoadBalancerTag ref + } + } else { - BAD_RET("'%s' is not a valide argument for 'ReadRegions'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteLoadBalancerTags'\n", next_a); } i += incr; - goto read_regions_arg; + goto delete_load_balancer_tags_arg; } - cret = osc_read_regions(&e, &r, &a); - TRY(cret, "fail to call ReadRegions: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_load_balancer_tags(&e, &r, &a); + TRY(cret, "fail to call DeleteLoadBalancerTags: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -28534,19 +28119,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadQuotas", av[i])) { + if (!strcmp("DeleteNatService", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_quotas_arg a = {0}; - struct osc_read_quotas_arg *s = &a; + struct osc_delete_nat_service_arg a = {0}; + struct osc_delete_nat_service_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_quotas_arg: + delete_nat_service_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -28565,7 +28150,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_quotas_arg; + goto delete_nat_service_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -28595,59 +28180,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_quota_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_quota_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NatServiceId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "NatServiceId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "NatServiceId argument missing\n"); + s->nat_service_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadQuotas'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteNatService'\n", next_a); } i += incr; - goto read_quotas_arg; + goto delete_nat_service_arg; } - cret = osc_read_quotas(&e, &r, &a); - TRY(cret, "fail to call ReadQuotas: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_nat_service(&e, &r, &a); + TRY(cret, "fail to call DeleteNatService: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -28674,19 +28225,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadPublicIps", av[i])) { + if (!strcmp("DeleteNetAccessPoint", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_public_ips_arg a = {0}; - struct osc_read_public_ips_arg *s = &a; + struct osc_delete_net_access_point_arg a = {0}; + struct osc_delete_net_access_point_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_public_ips_arg: + delete_net_access_point_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -28705,7 +28256,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_public_ips_arg; + goto delete_net_access_point_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -28728,66 +28279,32 @@ int main(int ac, char **av) } s->is_set_dry_run = 1; if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_public_ip_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_public_ip_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string - - } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "NetAccessPointId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + TRY((!*eq_ptr), "NetAccessPointId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); + TRY(!aa, "NetAccessPointId argument missing\n"); + s->net_access_point_id = aa; // string string + } else { - BAD_RET("'%s' is not a valide argument for 'ReadPublicIps'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteNetAccessPoint'\n", next_a); } i += incr; - goto read_public_ips_arg; + goto delete_net_access_point_arg; } - cret = osc_read_public_ips(&e, &r, &a); - TRY(cret, "fail to call ReadPublicIps: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_net_access_point(&e, &r, &a); + TRY(cret, "fail to call DeleteNetAccessPoint: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -28814,19 +28331,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadPublicIpRanges", av[i])) { + if (!strcmp("DeleteNetPeering", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_public_ip_ranges_arg a = {0}; - struct osc_read_public_ip_ranges_arg *s = &a; + struct osc_delete_net_peering_arg a = {0}; + struct osc_delete_net_peering_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_public_ip_ranges_arg: + delete_net_peering_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -28845,7 +28362,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_public_ip_ranges_arg; + goto delete_net_peering_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -28875,36 +28392,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NetPeeringId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "NetPeeringId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "NetPeeringId argument missing\n"); + s->net_peering_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadPublicIpRanges'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteNetPeering'\n", next_a); } i += incr; - goto read_public_ip_ranges_arg; + goto delete_net_peering_arg; } - cret = osc_read_public_ip_ranges(&e, &r, &a); - TRY(cret, "fail to call ReadPublicIpRanges: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_net_peering(&e, &r, &a); + TRY(cret, "fail to call DeleteNetPeering: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -28931,19 +28437,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadPublicCatalog", av[i])) { + if (!strcmp("DeleteNet", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_public_catalog_arg a = {0}; - struct osc_read_public_catalog_arg *s = &a; + struct osc_delete_net_arg a = {0}; + struct osc_delete_net_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_public_catalog_arg: + delete_net_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -28962,7 +28468,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_public_catalog_arg; + goto delete_net_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -28992,14 +28498,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else + if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NetId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NetId argument missing\n"); + s->net_id = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'ReadPublicCatalog'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteNet'\n", next_a); } i += incr; - goto read_public_catalog_arg; + goto delete_net_arg; } - cret = osc_read_public_catalog(&e, &r, &a); - TRY(cret, "fail to call ReadPublicCatalog: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_net(&e, &r, &a); + TRY(cret, "fail to call DeleteNet: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -29026,19 +28543,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadProductTypes", av[i])) { + if (!strcmp("DeleteNic", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_product_types_arg a = {0}; - struct osc_read_product_types_arg *s = &a; + struct osc_delete_nic_arg a = {0}; + struct osc_delete_nic_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_product_types_arg: + delete_nic_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -29057,7 +28574,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_product_types_arg; + goto delete_nic_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -29087,59 +28604,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_product_type_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_product_type_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "NicId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "NicId argument missing\n"); + s->nic_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadProductTypes'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteNic'\n", next_a); } i += incr; - goto read_product_types_arg; + goto delete_nic_arg; } - cret = osc_read_product_types(&e, &r, &a); - TRY(cret, "fail to call ReadProductTypes: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_nic(&e, &r, &a); + TRY(cret, "fail to call DeleteNic: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -29166,19 +28649,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadPolicyVersions", av[i])) { + if (!strcmp("DeletePolicy", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_policy_versions_arg a = {0}; - struct osc_read_policy_versions_arg *s = &a; + struct osc_delete_policy_arg a = {0}; + struct osc_delete_policy_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_policy_versions_arg: + delete_policy_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -29197,7 +28680,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_policy_versions_arg; + goto delete_policy_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -29211,17 +28694,22 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "FirstItem argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "FirstItem argument missing\n"); - s->is_set_first_item = 1; - s->first_item = atoll(aa); - } else + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -29233,25 +28721,14 @@ int main(int ac, char **av) s->policy_orn = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadPolicyVersions'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeletePolicy'\n", next_a); } i += incr; - goto read_policy_versions_arg; + goto delete_policy_arg; } - cret = osc_read_policy_versions(&e, &r, &a); - TRY(cret, "fail to call ReadPolicyVersions: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_policy(&e, &r, &a); + TRY(cret, "fail to call DeletePolicy: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -29278,19 +28755,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadPolicyVersion", av[i])) { + if (!strcmp("DeletePolicyVersion", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_policy_version_arg a = {0}; - struct osc_read_policy_version_arg *s = &a; + struct osc_delete_policy_version_arg a = {0}; + struct osc_delete_policy_version_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_policy_version_arg: + delete_policy_version_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -29309,7 +28786,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_policy_version_arg; + goto delete_policy_version_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -29346,13 +28823,13 @@ int main(int ac, char **av) } else { - BAD_RET("'%s' is not a valide argument for 'ReadPolicyVersion'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeletePolicyVersion'\n", next_a); } i += incr; - goto read_policy_version_arg; + goto delete_policy_version_arg; } - cret = osc_read_policy_version(&e, &r, &a); - TRY(cret, "fail to call ReadPolicyVersion: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_policy_version(&e, &r, &a); + TRY(cret, "fail to call DeletePolicyVersion: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -29379,19 +28856,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadPolicy", av[i])) { + if (!strcmp("DeletePublicIp", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_policy_arg a = {0}; - struct osc_read_policy_arg *s = &a; + struct osc_delete_public_ip_arg a = {0}; + struct osc_delete_public_ip_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_policy_arg: + delete_public_ip_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -29410,7 +28887,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_policy_arg; + goto delete_public_ip_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -29424,25 +28901,52 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PolicyOrn argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PolicyOrn argument missing\n"); - s->policy_orn = aa; // string string + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "PublicIp")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "PublicIp argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "PublicIp argument missing\n"); + s->public_ip = aa; // string string + + } else + if ((aret = argcmp(next_a, "PublicIpId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "PublicIpId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "PublicIpId argument missing\n"); + s->public_ip_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'ReadPolicy'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeletePublicIp'\n", next_a); } i += incr; - goto read_policy_arg; + goto delete_public_ip_arg; } - cret = osc_read_policy(&e, &r, &a); - TRY(cret, "fail to call ReadPolicy: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_public_ip(&e, &r, &a); + TRY(cret, "fail to call DeletePublicIp: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -29469,19 +28973,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadPolicies", av[i])) { + if (!strcmp("DeleteRoute", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_policies_arg a = {0}; - struct osc_read_policies_arg *s = &a; + struct osc_delete_route_arg a = {0}; + struct osc_delete_route_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_policies_arg: + delete_route_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -29500,7 +29004,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_policies_arg; + goto delete_route_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -29514,6 +29018,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "DestinationIpRange")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DestinationIpRange argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "DestinationIpRange argument missing\n"); + s->destination_ip_range = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -29530,59 +29045,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "RouteTableId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "RouteTableId argument missing\n"); + s->route_table_id = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = read_policies_filters_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(read_policies_filters_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "FirstItem argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "FirstItem argument missing\n"); - s->is_set_first_item = 1; - s->first_item = atoll(aa); - } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'ReadPolicies'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteRoute'\n", next_a); } i += incr; - goto read_policies_arg; + goto delete_route_arg; } - cret = osc_read_policies(&e, &r, &a); - TRY(cret, "fail to call ReadPolicies: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_route(&e, &r, &a); + TRY(cret, "fail to call DeleteRoute: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -29609,19 +29090,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadNics", av[i])) { + if (!strcmp("DeleteRouteTable", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_nics_arg a = {0}; - struct osc_read_nics_arg *s = &a; + struct osc_delete_route_table_arg a = {0}; + struct osc_delete_route_table_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_nics_arg: + delete_route_table_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -29640,7 +29121,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_nics_arg; + goto delete_route_table_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -29670,37 +29151,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "RouteTableId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "RouteTableId argument missing\n"); + s->route_table_id = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_nic_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_nic_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else { - BAD_RET("'%s' is not a valide argument for 'ReadNics'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteRouteTable'\n", next_a); } i += incr; - goto read_nics_arg; + goto delete_route_table_arg; } - cret = osc_read_nics(&e, &r, &a); - TRY(cret, "fail to call ReadNics: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_route_table(&e, &r, &a); + TRY(cret, "fail to call DeleteRouteTable: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -29727,19 +29196,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadNets", av[i])) { + if (!strcmp("DeleteSecurityGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_nets_arg a = {0}; - struct osc_read_nets_arg *s = &a; + struct osc_delete_security_group_arg a = {0}; + struct osc_delete_security_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_nets_arg: + delete_security_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -29758,7 +29227,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_nets_arg; + goto delete_security_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -29788,59 +29257,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SecurityGroupId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "SecurityGroupId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "SecurityGroupId argument missing\n"); + s->security_group_id = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_net_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_net_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SecurityGroupName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "SecurityGroupName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "SecurityGroupName argument missing\n"); + s->security_group_name = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadNets'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteSecurityGroup'\n", next_a); } i += incr; - goto read_nets_arg; + goto delete_security_group_arg; } - cret = osc_read_nets(&e, &r, &a); - TRY(cret, "fail to call ReadNets: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_security_group(&e, &r, &a); + TRY(cret, "fail to call DeleteSecurityGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -29867,19 +29313,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadNetPeerings", av[i])) { + if (!strcmp("DeleteSecurityGroupRule", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_net_peerings_arg a = {0}; - struct osc_read_net_peerings_arg *s = &a; + struct osc_delete_security_group_rule_arg a = {0}; + struct osc_delete_security_group_rule_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_net_peerings_arg: + delete_security_group_rule_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -29898,7 +29344,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_net_peerings_arg; + goto delete_security_group_rule_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -29915,72 +29361,146 @@ int main(int ac, char **av) if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "Flow")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Flow argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Flow argument missing\n"); + s->flow = aa; // string string + + } else + if ((aret = argcmp(next_a, "FromPortRange")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "FromPortRange argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "FromPortRange argument missing\n"); + s->is_set_from_port_range = 1; + s->from_port_range = atoll(aa); + } else + if ((aret = argcmp(next_a, "IpProtocol")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "IpProtocol argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "IpProtocol argument missing\n"); + s->ip_protocol = aa; // string string + + } else + if ((aret = argcmp(next_a, "IpRange")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "IpRange argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "IpRange argument missing\n"); + s->ip_range = aa; // string string + + } else + if ((aret = argcmp(next_a, "Rules")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Rules argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Rules' require an index (example array ref SecurityGroupRule.Rules.0)\n"); + else if (*endptr != '.') + BAD_RET("'Rules' require a .\n"); + TRY_ALLOC_AT(s,rules, pa, pos, sizeof(*s->rules)); + cascade_struct = &s->rules[pos]; + cascade_parser = security_group_rule_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(security_group_rule_parser(&s->rules[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Rules argument missing\n"); + s->rules_str = aa; // array ref SecurityGroupRule ref + } + } else + if ((aret = argcmp(next_a, "SecurityGroupAccountIdToUnlink")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SecurityGroupAccountIdToUnlink argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "SecurityGroupAccountIdToUnlink argument missing\n"); + s->security_group_account_id_to_unlink = aa; // string string + + } else + if ((aret = argcmp(next_a, "SecurityGroupId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "SecurityGroupId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "SecurityGroupId argument missing\n"); + s->security_group_id = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_net_peering_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_net_peering_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SecurityGroupNameToUnlink")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "SecurityGroupNameToUnlink argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "SecurityGroupNameToUnlink argument missing\n"); + s->security_group_name_to_unlink = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ToPortRange")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + TRY((!*eq_ptr), "ToPortRange argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); + TRY(!aa, "ToPortRange argument missing\n"); + s->is_set_to_port_range = 1; + s->to_port_range = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'ReadNetPeerings'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteSecurityGroupRule'\n", next_a); } i += incr; - goto read_net_peerings_arg; + goto delete_security_group_rule_arg; } - cret = osc_read_net_peerings(&e, &r, &a); - TRY(cret, "fail to call ReadNetPeerings: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_security_group_rule(&e, &r, &a); + TRY(cret, "fail to call DeleteSecurityGroupRule: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -30007,19 +29527,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadNetAccessPoints", av[i])) { + if (!strcmp("DeleteServerCertificate", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_net_access_points_arg a = {0}; - struct osc_read_net_access_points_arg *s = &a; + struct osc_delete_server_certificate_arg a = {0}; + struct osc_delete_server_certificate_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_net_access_points_arg: + delete_server_certificate_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -30038,7 +29558,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_net_access_points_arg; + goto delete_server_certificate_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -30068,59 +29588,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_net_access_point_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_net_access_point_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Name")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "Name argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "Name argument missing\n"); + s->name = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadNetAccessPoints'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteServerCertificate'\n", next_a); } i += incr; - goto read_net_access_points_arg; + goto delete_server_certificate_arg; } - cret = osc_read_net_access_points(&e, &r, &a); - TRY(cret, "fail to call ReadNetAccessPoints: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_server_certificate(&e, &r, &a); + TRY(cret, "fail to call DeleteServerCertificate: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -30147,19 +29633,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadNetAccessPointServices", av[i])) { + if (!strcmp("DeleteSnapshot", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_net_access_point_services_arg a = {0}; - struct osc_read_net_access_point_services_arg *s = &a; + struct osc_delete_snapshot_arg a = {0}; + struct osc_delete_snapshot_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_net_access_point_services_arg: + delete_snapshot_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -30178,7 +29664,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_net_access_point_services_arg; + goto delete_snapshot_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -30208,59 +29694,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_service_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_service_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SnapshotId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "SnapshotId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "SnapshotId argument missing\n"); + s->snapshot_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadNetAccessPointServices'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteSnapshot'\n", next_a); } i += incr; - goto read_net_access_point_services_arg; + goto delete_snapshot_arg; } - cret = osc_read_net_access_point_services(&e, &r, &a); - TRY(cret, "fail to call ReadNetAccessPointServices: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_snapshot(&e, &r, &a); + TRY(cret, "fail to call DeleteSnapshot: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -30287,19 +29739,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadNatServices", av[i])) { + if (!strcmp("DeleteSubnet", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_nat_services_arg a = {0}; - struct osc_read_nat_services_arg *s = &a; + struct osc_delete_subnet_arg a = {0}; + struct osc_delete_subnet_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_nat_services_arg: + delete_subnet_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -30318,7 +29770,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_nat_services_arg; + goto delete_subnet_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -30348,59 +29800,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_nat_service_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_nat_service_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string - - } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + TRY((!*eq_ptr), "SubnetId argument missing\n"); aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); + incr = 1; + } + TRY(!aa, "SubnetId argument missing\n"); + s->subnet_id = aa; // string string + } else { - BAD_RET("'%s' is not a valide argument for 'ReadNatServices'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteSubnet'\n", next_a); } i += incr; - goto read_nat_services_arg; + goto delete_subnet_arg; } - cret = osc_read_nat_services(&e, &r, &a); - TRY(cret, "fail to call ReadNatServices: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_subnet(&e, &r, &a); + TRY(cret, "fail to call DeleteSubnet: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -30427,19 +29845,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadManagedPoliciesLinkedToUserGroup", av[i])) { + if (!strcmp("DeleteTags", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_managed_policies_linked_to_user_group_arg a = {0}; - struct osc_read_managed_policies_linked_to_user_group_arg *s = &a; + struct osc_delete_tags_arg a = {0}; + struct osc_delete_tags_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_managed_policies_linked_to_user_group_arg: + delete_tags_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -30458,7 +29876,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_managed_policies_linked_to_user_group_arg; + goto delete_tags_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -30488,70 +29906,79 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResourceIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "ResourceIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_user_group_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_user_group_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "FirstItem argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "FirstItem argument missing\n"); - s->is_set_first_item = 1; - s->first_item = atoll(aa); - } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); + TRY(!(dot_pos++), "ResourceIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "ResourceIds require an index\n"); + if (s->resource_ids) { + for (; s->resource_ids[last]; ++last); + } + if (pos < last) { + s->resource_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->resource_ids, "", pa); + SET_NEXT(s->resource_ids, (aa), pa); + } + } else { + TRY(!aa, "ResourceIds argument missing\n"); + s->resource_ids_str = aa; + } + } else if (!(aret = argcmp(str, "ResourceIds[]")) || aret == '=') { + TRY(!aa, "ResourceIds[] argument missing\n"); + SET_NEXT(s->resource_ids, (aa), pa); } else - if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupName argument missing\n"); + TRY((!*eq_ptr), "Tags argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserGroupName argument missing\n"); - s->user_group_name = aa; // string string + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); + else if (*endptr != '.') + BAD_RET("'Tags' require a .\n"); + TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); + cascade_struct = &s->tags[pos]; + cascade_parser = resource_tag_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Tags argument missing\n"); + s->tags_str = aa; // array ref ResourceTag ref + } } else { - BAD_RET("'%s' is not a valide argument for 'ReadManagedPoliciesLinkedToUserGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteTags'\n", next_a); } i += incr; - goto read_managed_policies_linked_to_user_group_arg; + goto delete_tags_arg; } - cret = osc_read_managed_policies_linked_to_user_group(&e, &r, &a); - TRY(cret, "fail to call ReadManagedPoliciesLinkedToUserGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_tags(&e, &r, &a); + TRY(cret, "fail to call DeleteTags: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -30578,19 +30005,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadLocations", av[i])) { + if (!strcmp("DeleteUserGroupPolicy", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_locations_arg a = {0}; - struct osc_read_locations_arg *s = &a; + struct osc_delete_user_group_policy_arg a = {0}; + struct osc_delete_user_group_policy_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_locations_arg: + delete_user_group_policy_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -30609,7 +30036,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_locations_arg; + goto delete_user_group_policy_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -30639,36 +30066,47 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PolicyName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "PolicyName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "PolicyName argument missing\n"); + s->policy_name = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + TRY((!*eq_ptr), "UserGroupName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); + TRY(!aa, "UserGroupName argument missing\n"); + s->user_group_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "UserGroupPath")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserGroupPath argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserGroupPath argument missing\n"); + s->user_group_path = aa; // string string + } else { - BAD_RET("'%s' is not a valide argument for 'ReadLocations'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteUserGroupPolicy'\n", next_a); } i += incr; - goto read_locations_arg; + goto delete_user_group_policy_arg; } - cret = osc_read_locations(&e, &r, &a); - TRY(cret, "fail to call ReadLocations: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_user_group_policy(&e, &r, &a); + TRY(cret, "fail to call DeleteUserGroupPolicy: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -30695,19 +30133,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadLoadBalancers", av[i])) { + if (!strcmp("DeleteUserGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_load_balancers_arg a = {0}; - struct osc_read_load_balancers_arg *s = &a; + struct osc_delete_user_group_arg a = {0}; + struct osc_delete_user_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_load_balancers_arg: + delete_user_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -30726,7 +30164,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_load_balancers_arg; + goto delete_user_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -30756,37 +30194,52 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Force")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "Force argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_load_balancer_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_load_balancer_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; + s->is_set_force = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->force = 1; + } else if (!strcasecmp(aa, "false")) { + s->force = 0; } else { - s->filters_str = aa; + BAD_RET("Force require true/false\n"); } + } else + if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Path argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Path argument missing\n"); + s->path = aa; // string string + + } else + if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserGroupName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserGroupName argument missing\n"); + s->user_group_name = aa; // string string + } else { - BAD_RET("'%s' is not a valide argument for 'ReadLoadBalancers'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteUserGroup'\n", next_a); } i += incr; - goto read_load_balancers_arg; + goto delete_user_group_arg; } - cret = osc_read_load_balancers(&e, &r, &a); - TRY(cret, "fail to call ReadLoadBalancers: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_user_group(&e, &r, &a); + TRY(cret, "fail to call DeleteUserGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -30813,19 +30266,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadLoadBalancerTags", av[i])) { + if (!strcmp("DeleteUser", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_load_balancer_tags_arg a = {0}; - struct osc_read_load_balancer_tags_arg *s = &a; + struct osc_delete_user_arg a = {0}; + struct osc_delete_user_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_load_balancer_tags_arg: + delete_user_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -30844,7 +30297,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_load_balancer_tags_arg; + goto delete_user_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -30874,48 +30327,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "LoadBalancerNames")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerNames argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY((!*eq_ptr), "UserName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserName argument missing\n"); + s->user_name = aa; // string string - TRY(!(dot_pos++), "LoadBalancerNames argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "LoadBalancerNames require an index\n"); - if (s->load_balancer_names) { - for (; s->load_balancer_names[last]; ++last); - } - if (pos < last) { - s->load_balancer_names[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->load_balancer_names, "", pa); - SET_NEXT(s->load_balancer_names, (aa), pa); - } - } else { - TRY(!aa, "LoadBalancerNames argument missing\n"); - s->load_balancer_names_str = aa; - } - } else if (!(aret = argcmp(str, "LoadBalancerNames[]")) || aret == '=') { - TRY(!aa, "LoadBalancerNames[] argument missing\n"); - SET_NEXT(s->load_balancer_names, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'ReadLoadBalancerTags'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteUser'\n", next_a); } i += incr; - goto read_load_balancer_tags_arg; + goto delete_user_arg; } - cret = osc_read_load_balancer_tags(&e, &r, &a); - TRY(cret, "fail to call ReadLoadBalancerTags: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_user(&e, &r, &a); + TRY(cret, "fail to call DeleteUser: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -30942,19 +30372,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadListenerRules", av[i])) { + if (!strcmp("DeleteVirtualGateway", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_listener_rules_arg a = {0}; - struct osc_read_listener_rules_arg *s = &a; + struct osc_delete_virtual_gateway_arg a = {0}; + struct osc_delete_virtual_gateway_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_listener_rules_arg: + delete_virtual_gateway_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -30973,7 +30403,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_listener_rules_arg; + goto delete_virtual_gateway_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -31003,37 +30433,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VirtualGatewayId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "VirtualGatewayId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "VirtualGatewayId argument missing\n"); + s->virtual_gateway_id = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_listener_rule_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_listener_rule_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else { - BAD_RET("'%s' is not a valide argument for 'ReadListenerRules'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteVirtualGateway'\n", next_a); } i += incr; - goto read_listener_rules_arg; + goto delete_virtual_gateway_arg; } - cret = osc_read_listener_rules(&e, &r, &a); - TRY(cret, "fail to call ReadListenerRules: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_virtual_gateway(&e, &r, &a); + TRY(cret, "fail to call DeleteVirtualGateway: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -31060,19 +30478,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadLinkedPolicies", av[i])) { + if (!strcmp("DeleteVmGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_linked_policies_arg a = {0}; - struct osc_read_linked_policies_arg *s = &a; + struct osc_delete_vm_group_arg a = {0}; + struct osc_delete_vm_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_linked_policies_arg: + delete_vm_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -31091,7 +30509,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_linked_policies_arg; + goto delete_vm_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -31121,70 +30539,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = read_linked_policies_filters_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(read_linked_policies_filters_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "FirstItem argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "FirstItem argument missing\n"); - s->is_set_first_item = 1; - s->first_item = atoll(aa); - } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else - if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmGroupId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserName argument missing\n"); + TRY((!*eq_ptr), "VmGroupId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserName argument missing\n"); - s->user_name = aa; // string string + TRY(!aa, "VmGroupId argument missing\n"); + s->vm_group_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'ReadLinkedPolicies'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteVmGroup'\n", next_a); } i += incr; - goto read_linked_policies_arg; + goto delete_vm_group_arg; } - cret = osc_read_linked_policies(&e, &r, &a); - TRY(cret, "fail to call ReadLinkedPolicies: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_vm_group(&e, &r, &a); + TRY(cret, "fail to call DeleteVmGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -31211,19 +30584,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadKeypairs", av[i])) { + if (!strcmp("DeleteVmTemplate", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_keypairs_arg a = {0}; - struct osc_read_keypairs_arg *s = &a; + struct osc_delete_vm_template_arg a = {0}; + struct osc_delete_vm_template_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_keypairs_arg: + delete_vm_template_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -31242,7 +30615,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_keypairs_arg; + goto delete_vm_template_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -31272,59 +30645,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_keypair_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_keypair_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmTemplateId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "VmTemplateId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "VmTemplateId argument missing\n"); + s->vm_template_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadKeypairs'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteVmTemplate'\n", next_a); } i += incr; - goto read_keypairs_arg; + goto delete_vm_template_arg; } - cret = osc_read_keypairs(&e, &r, &a); - TRY(cret, "fail to call ReadKeypairs: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_vm_template(&e, &r, &a); + TRY(cret, "fail to call DeleteVmTemplate: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -31351,19 +30690,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadInternetServices", av[i])) { + if (!strcmp("DeleteVms", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_internet_services_arg a = {0}; - struct osc_read_internet_services_arg *s = &a; + struct osc_delete_vms_arg a = {0}; + struct osc_delete_vms_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_internet_services_arg: + delete_vms_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -31382,7 +30721,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_internet_services_arg; + goto delete_vms_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -31412,59 +30751,48 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_internet_service_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_internet_service_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string - - } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + TRY((!*eq_ptr), "VmIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "VmIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "VmIds require an index\n"); + if (s->vm_ids) { + for (; s->vm_ids[last]; ++last); + } + if (pos < last) { + s->vm_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->vm_ids, "", pa); + SET_NEXT(s->vm_ids, (aa), pa); + } + } else { + TRY(!aa, "VmIds argument missing\n"); + s->vm_ids_str = aa; + } + } else if (!(aret = argcmp(str, "VmIds[]")) || aret == '=') { + TRY(!aa, "VmIds[] argument missing\n"); + SET_NEXT(s->vm_ids, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'ReadInternetServices'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteVms'\n", next_a); } i += incr; - goto read_internet_services_arg; + goto delete_vms_arg; } - cret = osc_read_internet_services(&e, &r, &a); - TRY(cret, "fail to call ReadInternetServices: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_vms(&e, &r, &a); + TRY(cret, "fail to call DeleteVms: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -31491,19 +30819,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadImages", av[i])) { + if (!strcmp("DeleteVolume", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_images_arg a = {0}; - struct osc_read_images_arg *s = &a; + struct osc_delete_volume_arg a = {0}; + struct osc_delete_volume_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_images_arg: + delete_volume_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -31522,7 +30850,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_images_arg; + goto delete_volume_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -31552,59 +30880,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_image_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_image_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VolumeId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "VolumeId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "VolumeId argument missing\n"); + s->volume_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadImages'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteVolume'\n", next_a); } i += incr; - goto read_images_arg; + goto delete_volume_arg; } - cret = osc_read_images(&e, &r, &a); - TRY(cret, "fail to call ReadImages: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_volume(&e, &r, &a); + TRY(cret, "fail to call DeleteVolume: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -31631,19 +30925,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadImageExportTasks", av[i])) { + if (!strcmp("DeleteVpnConnection", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_image_export_tasks_arg a = {0}; - struct osc_read_image_export_tasks_arg *s = &a; + struct osc_delete_vpn_connection_arg a = {0}; + struct osc_delete_vpn_connection_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_image_export_tasks_arg: + delete_vpn_connection_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -31662,7 +30956,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_image_export_tasks_arg; + goto delete_vpn_connection_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -31692,59 +30986,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_export_task_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_export_task_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VpnConnectionId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "VpnConnectionId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "VpnConnectionId argument missing\n"); + s->vpn_connection_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadImageExportTasks'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteVpnConnection'\n", next_a); } i += incr; - goto read_image_export_tasks_arg; + goto delete_vpn_connection_arg; } - cret = osc_read_image_export_tasks(&e, &r, &a); - TRY(cret, "fail to call ReadImageExportTasks: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_vpn_connection(&e, &r, &a); + TRY(cret, "fail to call DeleteVpnConnection: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -31771,19 +31031,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadFlexibleGpus", av[i])) { + if (!strcmp("DeleteVpnConnectionRoute", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_flexible_gpus_arg a = {0}; - struct osc_read_flexible_gpus_arg *s = &a; + struct osc_delete_vpn_connection_route_arg a = {0}; + struct osc_delete_vpn_connection_route_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_flexible_gpus_arg: + delete_vpn_connection_route_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -31802,7 +31062,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_flexible_gpus_arg; + goto delete_vpn_connection_route_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -31816,6 +31076,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "DestinationIpRange")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DestinationIpRange argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "DestinationIpRange argument missing\n"); + s->destination_ip_range = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -31832,37 +31103,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VpnConnectionId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "VpnConnectionId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "VpnConnectionId argument missing\n"); + s->vpn_connection_id = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_flexible_gpu_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_flexible_gpu_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else { - BAD_RET("'%s' is not a valide argument for 'ReadFlexibleGpus'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeleteVpnConnectionRoute'\n", next_a); } i += incr; - goto read_flexible_gpus_arg; + goto delete_vpn_connection_route_arg; } - cret = osc_read_flexible_gpus(&e, &r, &a); - TRY(cret, "fail to call ReadFlexibleGpus: %s\n", curl_easy_strerror(cret)); + cret = osc_delete_vpn_connection_route(&e, &r, &a); + TRY(cret, "fail to call DeleteVpnConnectionRoute: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -31889,19 +31148,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadFlexibleGpuCatalog", av[i])) { + if (!strcmp("DeregisterVmsInLoadBalancer", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_flexible_gpu_catalog_arg a = {0}; - struct osc_read_flexible_gpu_catalog_arg *s = &a; + struct osc_deregister_vms_in_load_balancer_arg a = {0}; + struct osc_deregister_vms_in_load_balancer_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_flexible_gpu_catalog_arg: + deregister_vms_in_load_balancer_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -31920,7 +31179,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_flexible_gpu_catalog_arg; + goto deregister_vms_in_load_balancer_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -31934,6 +31193,40 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "BackendVmIds")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "BackendVmIds argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "BackendVmIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "BackendVmIds require an index\n"); + if (s->backend_vm_ids) { + for (; s->backend_vm_ids[last]; ++last); + } + if (pos < last) { + s->backend_vm_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->backend_vm_ids, "", pa); + SET_NEXT(s->backend_vm_ids, (aa), pa); + } + } else { + TRY(!aa, "BackendVmIds argument missing\n"); + s->backend_vm_ids_str = aa; + } + } else if (!(aret = argcmp(str, "BackendVmIds[]")) || aret == '=') { + TRY(!aa, "BackendVmIds[] argument missing\n"); + SET_NEXT(s->backend_vm_ids, (aa), pa); + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -31950,14 +31243,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else + if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "LoadBalancerName argument missing\n"); + s->load_balancer_name = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'ReadFlexibleGpuCatalog'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'DeregisterVmsInLoadBalancer'\n", next_a); } i += incr; - goto read_flexible_gpu_catalog_arg; + goto deregister_vms_in_load_balancer_arg; } - cret = osc_read_flexible_gpu_catalog(&e, &r, &a); - TRY(cret, "fail to call ReadFlexibleGpuCatalog: %s\n", curl_easy_strerror(cret)); + cret = osc_deregister_vms_in_load_balancer(&e, &r, &a); + TRY(cret, "fail to call DeregisterVmsInLoadBalancer: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -31984,19 +31288,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadEntitiesLinkedToPolicy", av[i])) { + if (!strcmp("LinkFlexibleGpu", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_entities_linked_to_policy_arg a = {0}; - struct osc_read_entities_linked_to_policy_arg *s = &a; + struct osc_link_flexible_gpu_arg a = {0}; + struct osc_link_flexible_gpu_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_entities_linked_to_policy_arg: + link_flexible_gpu_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -32015,7 +31319,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_entities_linked_to_policy_arg; + goto link_flexible_gpu_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -32029,81 +31333,52 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "EntitiesType")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "EntitiesType argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "EntitiesType argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "EntitiesType require an index\n"); - if (s->entities_type) { - for (; s->entities_type[last]; ++last); - } - if (pos < last) { - s->entities_type[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->entities_type, "", pa); - SET_NEXT(s->entities_type, (aa), pa); - } - } else { - TRY(!aa, "EntitiesType argument missing\n"); - s->entities_type_str = aa; - } - } else if (!(aret = argcmp(str, "EntitiesType[]")) || aret == '=') { - TRY(!aa, "EntitiesType[] argument missing\n"); - SET_NEXT(s->entities_type, (aa), pa); - } else - if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "FirstItem argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "FirstItem argument missing\n"); - s->is_set_first_item = 1; - s->first_item = atoll(aa); - } else - if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "FlexibleGpuId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PolicyOrn argument missing\n"); + TRY((!*eq_ptr), "FlexibleGpuId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PolicyOrn argument missing\n"); - s->policy_orn = aa; // string string + TRY(!aa, "FlexibleGpuId argument missing\n"); + s->flexible_gpu_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + TRY((!*eq_ptr), "VmId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); + TRY(!aa, "VmId argument missing\n"); + s->vm_id = aa; // string string + } else { - BAD_RET("'%s' is not a valide argument for 'ReadEntitiesLinkedToPolicy'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'LinkFlexibleGpu'\n", next_a); } i += incr; - goto read_entities_linked_to_policy_arg; + goto link_flexible_gpu_arg; } - cret = osc_read_entities_linked_to_policy(&e, &r, &a); - TRY(cret, "fail to call ReadEntitiesLinkedToPolicy: %s\n", curl_easy_strerror(cret)); + cret = osc_link_flexible_gpu(&e, &r, &a); + TRY(cret, "fail to call LinkFlexibleGpu: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -32130,19 +31405,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadDirectLinks", av[i])) { + if (!strcmp("LinkInternetService", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_direct_links_arg a = {0}; - struct osc_read_direct_links_arg *s = &a; + struct osc_link_internet_service_arg a = {0}; + struct osc_link_internet_service_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_direct_links_arg: + link_internet_service_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -32161,7 +31436,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_direct_links_arg; + goto link_internet_service_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -32191,59 +31466,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "InternetServiceId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "InternetServiceId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "InternetServiceId argument missing\n"); + s->internet_service_id = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_direct_link_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_direct_link_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "NetId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "NetId argument missing\n"); + s->net_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadDirectLinks'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'LinkInternetService'\n", next_a); } i += incr; - goto read_direct_links_arg; + goto link_internet_service_arg; } - cret = osc_read_direct_links(&e, &r, &a); - TRY(cret, "fail to call ReadDirectLinks: %s\n", curl_easy_strerror(cret)); + cret = osc_link_internet_service(&e, &r, &a); + TRY(cret, "fail to call LinkInternetService: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -32270,19 +31522,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadDirectLinkInterfaces", av[i])) { + if (!strcmp("LinkLoadBalancerBackendMachines", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_direct_link_interfaces_arg a = {0}; - struct osc_read_direct_link_interfaces_arg *s = &a; + struct osc_link_load_balancer_backend_machines_arg a = {0}; + struct osc_link_load_balancer_backend_machines_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_direct_link_interfaces_arg: + link_load_balancer_backend_machines_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -32301,7 +31553,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_direct_link_interfaces_arg; + goto link_load_balancer_backend_machines_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -32315,75 +31567,109 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "BackendIps")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "BackendIps argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "BackendIps argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "BackendIps require an index\n"); + if (s->backend_ips) { + for (; s->backend_ips[last]; ++last); + } + if (pos < last) { + s->backend_ips[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->backend_ips, "", pa); + SET_NEXT(s->backend_ips, (aa), pa); + } + } else { + TRY(!aa, "BackendIps argument missing\n"); + s->backend_ips_str = aa; + } + } else if (!(aret = argcmp(str, "BackendIps[]")) || aret == '=') { + TRY(!aa, "BackendIps[] argument missing\n"); + SET_NEXT(s->backend_ips, (aa), pa); + } else + if ((aret = argcmp(next_a, "BackendVmIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "BackendVmIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_direct_link_interface_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_direct_link_interface_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } + TRY(!(dot_pos++), "BackendVmIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "BackendVmIds require an index\n"); + if (s->backend_vm_ids) { + for (; s->backend_vm_ids[last]; ++last); + } + if (pos < last) { + s->backend_vm_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->backend_vm_ids, "", pa); + SET_NEXT(s->backend_vm_ids, (aa), pa); + } + } else { + TRY(!aa, "BackendVmIds argument missing\n"); + s->backend_vm_ids_str = aa; + } + } else if (!(aret = argcmp(str, "BackendVmIds[]")) || aret == '=') { + TRY(!aa, "BackendVmIds[] argument missing\n"); + SET_NEXT(s->backend_vm_ids, (aa), pa); } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string - - } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); + TRY(!aa, "LoadBalancerName argument missing\n"); + s->load_balancer_name = aa; // string string + } else { - BAD_RET("'%s' is not a valide argument for 'ReadDirectLinkInterfaces'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'LinkLoadBalancerBackendMachines'\n", next_a); } i += incr; - goto read_direct_link_interfaces_arg; + goto link_load_balancer_backend_machines_arg; } - cret = osc_read_direct_link_interfaces(&e, &r, &a); - TRY(cret, "fail to call ReadDirectLinkInterfaces: %s\n", curl_easy_strerror(cret)); + cret = osc_link_load_balancer_backend_machines(&e, &r, &a); + TRY(cret, "fail to call LinkLoadBalancerBackendMachines: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -32410,19 +31696,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadDhcpOptions", av[i])) { + if (!strcmp("LinkManagedPolicyToUserGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_dhcp_options_arg a = {0}; - struct osc_read_dhcp_options_arg *s = &a; + struct osc_link_managed_policy_to_user_group_arg a = {0}; + struct osc_link_managed_policy_to_user_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_dhcp_options_arg: + link_managed_policy_to_user_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -32441,7 +31727,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_dhcp_options_arg; + goto link_managed_policy_to_user_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -32471,59 +31757,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "PolicyOrn argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "PolicyOrn argument missing\n"); + s->policy_orn = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_dhcp_options_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_dhcp_options_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "UserGroupName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "UserGroupName argument missing\n"); + s->user_group_name = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadDhcpOptions'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'LinkManagedPolicyToUserGroup'\n", next_a); } i += incr; - goto read_dhcp_options_arg; + goto link_managed_policy_to_user_group_arg; } - cret = osc_read_dhcp_options(&e, &r, &a); - TRY(cret, "fail to call ReadDhcpOptions: %s\n", curl_easy_strerror(cret)); + cret = osc_link_managed_policy_to_user_group(&e, &r, &a); + TRY(cret, "fail to call LinkManagedPolicyToUserGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -32550,19 +31813,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadDedicatedGroups", av[i])) { + if (!strcmp("LinkNic", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_dedicated_groups_arg a = {0}; - struct osc_read_dedicated_groups_arg *s = &a; + struct osc_link_nic_arg a = {0}; + struct osc_link_nic_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_dedicated_groups_arg: + link_nic_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -32581,7 +31844,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_dedicated_groups_arg; + goto link_nic_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -32595,6 +31858,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "DeviceNumber")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DeviceNumber argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "DeviceNumber argument missing\n"); + s->is_set_device_number = 1; + s->device_number = atoll(aa); + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -32611,59 +31885,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "NicId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "NicId argument missing\n"); + s->nic_id = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_dedicated_group_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_dedicated_group_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "VmId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "VmId argument missing\n"); + s->vm_id = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); - } else { - BAD_RET("'%s' is not a valide argument for 'ReadDedicatedGroups'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'LinkNic'\n", next_a); } i += incr; - goto read_dedicated_groups_arg; + goto link_nic_arg; } - cret = osc_read_dedicated_groups(&e, &r, &a); - TRY(cret, "fail to call ReadDedicatedGroups: %s\n", curl_easy_strerror(cret)); + cret = osc_link_nic(&e, &r, &a); + TRY(cret, "fail to call LinkNic: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -32690,19 +31941,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadConsumptionAccount", av[i])) { + if (!strcmp("LinkPolicy", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_consumption_account_arg a = {0}; - struct osc_read_consumption_account_arg *s = &a; + struct osc_link_policy_arg a = {0}; + struct osc_link_policy_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_consumption_account_arg: + link_policy_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -32721,7 +31972,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_consumption_account_arg; + goto link_policy_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -32751,68 +32002,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "FromDate")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "FromDate argument missing\n"); + TRY((!*eq_ptr), "PolicyOrn argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "FromDate argument missing\n"); - s->from_date = aa; // string string + TRY(!aa, "PolicyOrn argument missing\n"); + s->policy_orn = aa; // string string } else - if ((aret = argcmp(next_a, "Overall")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Overall argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_overall = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->overall = 1; - } else if (!strcasecmp(aa, "false")) { - s->overall = 0; - } else { - BAD_RET("Overall require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "ShowPrice")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ShowPrice argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_show_price = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->show_price = 1; - } else if (!strcasecmp(aa, "false")) { - s->show_price = 0; - } else { - BAD_RET("ShowPrice require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "ToDate")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ToDate argument missing\n"); + TRY((!*eq_ptr), "UserName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ToDate argument missing\n"); - s->to_date = aa; // string string + TRY(!aa, "UserName argument missing\n"); + s->user_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'ReadConsumptionAccount'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'LinkPolicy'\n", next_a); } i += incr; - goto read_consumption_account_arg; + goto link_policy_arg; } - cret = osc_read_consumption_account(&e, &r, &a); - TRY(cret, "fail to call ReadConsumptionAccount: %s\n", curl_easy_strerror(cret)); + cret = osc_link_policy(&e, &r, &a); + TRY(cret, "fail to call LinkPolicy: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -32839,19 +32058,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadConsoleOutput", av[i])) { + if (!strcmp("LinkPrivateIps", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_console_output_arg a = {0}; - struct osc_read_console_output_arg *s = &a; + struct osc_link_private_ips_arg a = {0}; + struct osc_link_private_ips_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_console_output_arg: + link_private_ips_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -32870,7 +32089,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_console_output_arg; + goto link_private_ips_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -32884,6 +32103,22 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "AllowRelink")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "AllowRelink argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_allow_relink = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->allow_relink = 1; + } else if (!strcasecmp(aa, "false")) { + s->allow_relink = 0; + } else { + BAD_RET("AllowRelink require true/false\n"); + } + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -32900,25 +32135,70 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NicId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NicId argument missing\n"); + s->nic_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "PrivateIps")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "PrivateIps argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "PrivateIps argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "PrivateIps require an index\n"); + if (s->private_ips) { + for (; s->private_ips[last]; ++last); + } + if (pos < last) { + s->private_ips[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->private_ips, "", pa); + SET_NEXT(s->private_ips, (aa), pa); + } + } else { + TRY(!aa, "PrivateIps argument missing\n"); + s->private_ips_str = aa; + } + } else if (!(aret = argcmp(str, "PrivateIps[]")) || aret == '=') { + TRY(!aa, "PrivateIps[] argument missing\n"); + SET_NEXT(s->private_ips, (aa), pa); + } else + if ((aret = argcmp(next_a, "SecondaryPrivateIpCount")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmId argument missing\n"); + TRY((!*eq_ptr), "SecondaryPrivateIpCount argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmId argument missing\n"); - s->vm_id = aa; // string string - + TRY(!aa, "SecondaryPrivateIpCount argument missing\n"); + s->is_set_secondary_private_ip_count = 1; + s->secondary_private_ip_count = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'ReadConsoleOutput'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'LinkPrivateIps'\n", next_a); } i += incr; - goto read_console_output_arg; + goto link_private_ips_arg; } - cret = osc_read_console_output(&e, &r, &a); - TRY(cret, "fail to call ReadConsoleOutput: %s\n", curl_easy_strerror(cret)); + cret = osc_link_private_ips(&e, &r, &a); + TRY(cret, "fail to call LinkPrivateIps: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -32945,19 +32225,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadClientGateways", av[i])) { + if (!strcmp("LinkPublicIp", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_client_gateways_arg a = {0}; - struct osc_read_client_gateways_arg *s = &a; + struct osc_link_public_ip_arg a = {0}; + struct osc_link_public_ip_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_client_gateways_arg: + link_public_ip_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -32976,7 +32256,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_client_gateways_arg; + goto link_public_ip_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -32990,6 +32270,22 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "AllowRelink")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "AllowRelink argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_allow_relink = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->allow_relink = 1; + } else if (!strcasecmp(aa, "false")) { + s->allow_relink = 0; + } else { + BAD_RET("AllowRelink require true/false\n"); + } + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -33006,59 +32302,69 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "NicId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "NicId argument missing\n"); + s->nic_id = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_client_gateway_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_client_gateway_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PrivateIp")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "PrivateIp argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "PrivateIp argument missing\n"); + s->private_ip = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PublicIp")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + TRY((!*eq_ptr), "PublicIp argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); + TRY(!aa, "PublicIp argument missing\n"); + s->public_ip = aa; // string string + + } else + if ((aret = argcmp(next_a, "PublicIpId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "PublicIpId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "PublicIpId argument missing\n"); + s->public_ip_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VmId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VmId argument missing\n"); + s->vm_id = aa; // string string + } else { - BAD_RET("'%s' is not a valide argument for 'ReadClientGateways'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'LinkPublicIp'\n", next_a); } i += incr; - goto read_client_gateways_arg; + goto link_public_ip_arg; } - cret = osc_read_client_gateways(&e, &r, &a); - TRY(cret, "fail to call ReadClientGateways: %s\n", curl_easy_strerror(cret)); + cret = osc_link_public_ip(&e, &r, &a); + TRY(cret, "fail to call LinkPublicIp: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -33085,19 +32391,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadCatalogs", av[i])) { + if (!strcmp("LinkRouteTable", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_catalogs_arg a = {0}; - struct osc_read_catalogs_arg *s = &a; + struct osc_link_route_table_arg a = {0}; + struct osc_link_route_table_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_catalogs_arg: + link_route_table_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -33116,7 +32422,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_catalogs_arg; + goto link_route_table_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -33146,37 +32452,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "RouteTableId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "RouteTableId argument missing\n"); + s->route_table_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SubnetId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SubnetId argument missing\n"); + s->subnet_id = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_catalogs_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_catalogs_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else { - BAD_RET("'%s' is not a valide argument for 'ReadCatalogs'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'LinkRouteTable'\n", next_a); } i += incr; - goto read_catalogs_arg; + goto link_route_table_arg; } - cret = osc_read_catalogs(&e, &r, &a); - TRY(cret, "fail to call ReadCatalogs: %s\n", curl_easy_strerror(cret)); + cret = osc_link_route_table(&e, &r, &a); + TRY(cret, "fail to call LinkRouteTable: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -33203,19 +32508,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadCatalog", av[i])) { + if (!strcmp("LinkVirtualGateway", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_catalog_arg a = {0}; - struct osc_read_catalog_arg *s = &a; + struct osc_link_virtual_gateway_arg a = {0}; + struct osc_link_virtual_gateway_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_catalog_arg: + link_virtual_gateway_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -33234,7 +32539,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_catalog_arg; + goto link_virtual_gateway_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -33264,14 +32569,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else + if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NetId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NetId argument missing\n"); + s->net_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "VirtualGatewayId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VirtualGatewayId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VirtualGatewayId argument missing\n"); + s->virtual_gateway_id = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'ReadCatalog'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'LinkVirtualGateway'\n", next_a); } i += incr; - goto read_catalog_arg; + goto link_virtual_gateway_arg; } - cret = osc_read_catalog(&e, &r, &a); - TRY(cret, "fail to call ReadCatalog: %s\n", curl_easy_strerror(cret)); + cret = osc_link_virtual_gateway(&e, &r, &a); + TRY(cret, "fail to call LinkVirtualGateway: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -33298,19 +32625,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadCas", av[i])) { + if (!strcmp("LinkVolume", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_cas_arg a = {0}; - struct osc_read_cas_arg *s = &a; + struct osc_link_volume_arg a = {0}; + struct osc_link_volume_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_cas_arg: + link_volume_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -33329,7 +32656,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_cas_arg; + goto link_volume_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -33343,6 +32670,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "DeviceName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DeviceName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "DeviceName argument missing\n"); + s->device_name = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -33359,37 +32697,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VmId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VmId argument missing\n"); + s->vm_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "VolumeId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "VolumeId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "VolumeId argument missing\n"); + s->volume_id = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_ca_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_ca_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else { - BAD_RET("'%s' is not a valide argument for 'ReadCas'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'LinkVolume'\n", next_a); } i += incr; - goto read_cas_arg; + goto link_volume_arg; } - cret = osc_read_cas(&e, &r, &a); - TRY(cret, "fail to call ReadCas: %s\n", curl_easy_strerror(cret)); + cret = osc_link_volume(&e, &r, &a); + TRY(cret, "fail to call LinkVolume: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -33416,19 +32753,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadApiLogs", av[i])) { + if (!strcmp("PutUserGroupPolicy", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_api_logs_arg a = {0}; - struct osc_read_api_logs_arg *s = &a; + struct osc_put_user_group_policy_arg a = {0}; + struct osc_put_user_group_policy_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_api_logs_arg: + put_user_group_policy_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -33447,7 +32784,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_api_logs_arg; + goto put_user_group_policy_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -33477,82 +32814,58 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PolicyDocument")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); + TRY((!*eq_ptr), "PolicyDocument argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "PolicyDocument argument missing\n"); + s->policy_document = aa; // string string - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_api_log_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_api_log_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } } else - if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PolicyName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NextPageToken argument missing\n"); + TRY((!*eq_ptr), "PolicyName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NextPageToken argument missing\n"); - s->next_page_token = aa; // string string + TRY(!aa, "PolicyName argument missing\n"); + s->policy_name = aa; // string string } else - if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + TRY((!*eq_ptr), "UserGroupName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ResultsPerPage argument missing\n"); - s->is_set_results_per_page = 1; - s->results_per_page = atoll(aa); + TRY(!aa, "UserGroupName argument missing\n"); + s->user_group_name = aa; // string string + } else - if ((aret = argcmp(next_a, "With")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserGroupPath")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "With argument missing\n"); + TRY((!*eq_ptr), "UserGroupPath argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "UserGroupPath argument missing\n"); + s->user_group_path = aa; // string string - TRY(!aa, "With argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->with; - cascade_parser = with_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(with_parser(&s->with, dot_pos, aa, pa)); - s->is_set_with = 1; - } else { - s->with_str = aa; - } } else { - BAD_RET("'%s' is not a valide argument for 'ReadApiLogs'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'PutUserGroupPolicy'\n", next_a); } i += incr; - goto read_api_logs_arg; + goto put_user_group_policy_arg; } - cret = osc_read_api_logs(&e, &r, &a); - TRY(cret, "fail to call ReadApiLogs: %s\n", curl_easy_strerror(cret)); + cret = osc_put_user_group_policy(&e, &r, &a); + TRY(cret, "fail to call PutUserGroupPolicy: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -33579,19 +32892,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadApiAccessRules", av[i])) { + if (!strcmp("ReadAccessKeys", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_api_access_rules_arg a = {0}; - struct osc_read_api_access_rules_arg *s = &a; + struct osc_read_access_keys_arg a = {0}; + struct osc_read_access_keys_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_api_access_rules_arg: + read_access_keys_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -33610,7 +32923,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_api_access_rules_arg; + goto read_access_keys_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -33653,24 +32966,35 @@ int main(int ac, char **av) dot_pos = strchr(str, '.'); if (dot_pos++) { cascade_struct = &s->filters; - cascade_parser = filters_api_access_rule_parser; + cascade_parser = filters_access_keys_parser; if (*dot_pos == '.') { ++dot_pos; } - STRY(filters_api_access_rule_parser(&s->filters, dot_pos, aa, pa)); + STRY(filters_access_keys_parser(&s->filters, dot_pos, aa, pa)); s->is_set_filters = 1; } else { s->filters_str = aa; } } else + if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserName argument missing\n"); + s->user_name = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'ReadApiAccessRules'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadAccessKeys'\n", next_a); } i += incr; - goto read_api_access_rules_arg; + goto read_access_keys_arg; } - cret = osc_read_api_access_rules(&e, &r, &a); - TRY(cret, "fail to call ReadApiAccessRules: %s\n", curl_easy_strerror(cret)); + cret = osc_read_access_keys(&e, &r, &a); + TRY(cret, "fail to call ReadAccessKeys: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -33697,19 +33021,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadApiAccessPolicy", av[i])) { + if (!strcmp("ReadAccounts", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_api_access_policy_arg a = {0}; - struct osc_read_api_access_policy_arg *s = &a; + struct osc_read_accounts_arg a = {0}; + struct osc_read_accounts_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_api_access_policy_arg: + read_accounts_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -33728,7 +33052,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_api_access_policy_arg; + goto read_accounts_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -33759,13 +33083,13 @@ int main(int ac, char **av) } } else { - BAD_RET("'%s' is not a valide argument for 'ReadApiAccessPolicy'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadAccounts'\n", next_a); } i += incr; - goto read_api_access_policy_arg; + goto read_accounts_arg; } - cret = osc_read_api_access_policy(&e, &r, &a); - TRY(cret, "fail to call ReadApiAccessPolicy: %s\n", curl_easy_strerror(cret)); + cret = osc_read_accounts(&e, &r, &a); + TRY(cret, "fail to call ReadAccounts: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -33865,108 +33189,13 @@ int main(int ac, char **av) } else { - BAD_RET("'%s' is not a valide argument for 'ReadAdminPassword'\n", next_a); - } - i += incr; - goto read_admin_password_arg; - } - cret = osc_read_admin_password(&e, &r, &a); - TRY(cret, "fail to call ReadAdminPassword: %s\n", curl_easy_strerror(cret)); - CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); - jobj = NULL; - if (program_flag & OAPI_RAW_OUTPUT) - puts(r.buf); - else { - jobj = json_tokener_parse(r.buf); - puts(json_object_to_json_string_ext(jobj, - JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | - color_flag)); - } - while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { - ++i; - TRY(i + 1 >= ac, "--set-var require an argument"); - if (!jobj) - jobj = json_tokener_parse(r.buf); - if (parse_variable(jobj, av, ac, i)) - return -1; - ++i; - } - - if (jobj) { - json_object_put(jobj); - jobj = NULL; - } - osc_deinit_str(&r); - } else - if (!strcmp("ReadAccounts", av[i])) { - auto_osc_json_c json_object *jobj = NULL; - auto_ptr_array struct ptr_array opa = {0}; - struct ptr_array *pa = &opa; - struct osc_read_accounts_arg a = {0}; - struct osc_read_accounts_arg *s = &a; - __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; - int cret; - - cascade_struct = NULL; - cascade_parser = NULL; - - read_accounts_arg: - - if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { - char *next_a = &av[i + 1][2]; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int incr = 2; - char *eq_ptr = strchr(next_a, '='); - - CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); - if (eq_ptr) { - CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); - incr = 1; - aa = eq_ptr + 1; - } else { - CHK_BAD_RET(!aa, "cascade need an argument\n"); - META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) - } - STRY(cascade_parser(cascade_struct, next_a, aa, pa)); - i += incr; - goto read_accounts_arg; - } - - if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { - char *next_a = &av[i + 1][2]; - char *str = next_a; - char *aa = i + 2 < ac ? av[i + 2] : 0; - int aret = 0; - int incr = aa ? 2 : 1; - - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - { - BAD_RET("'%s' is not a valide argument for 'ReadAccounts'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadAdminPassword'\n", next_a); } i += incr; - goto read_accounts_arg; + goto read_admin_password_arg; } - cret = osc_read_accounts(&e, &r, &a); - TRY(cret, "fail to call ReadAccounts: %s\n", curl_easy_strerror(cret)); + cret = osc_read_admin_password(&e, &r, &a); + TRY(cret, "fail to call ReadAdminPassword: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -33993,19 +33222,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("ReadAccessKeys", av[i])) { + if (!strcmp("ReadApiAccessPolicy", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_read_access_keys_arg a = {0}; - struct osc_read_access_keys_arg *s = &a; + struct osc_read_api_access_policy_arg a = {0}; + struct osc_read_api_access_policy_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - read_access_keys_arg: + read_api_access_policy_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -34024,7 +33253,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto read_access_keys_arg; + goto read_api_access_policy_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -34054,48 +33283,14 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Filters argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos; - - TRY(!aa, "Filters argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->filters; - cascade_parser = filters_access_keys_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(filters_access_keys_parser(&s->filters, dot_pos, aa, pa)); - s->is_set_filters = 1; - } else { - s->filters_str = aa; - } - } else - if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "UserName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "UserName argument missing\n"); - s->user_name = aa; // string string - - } else { - BAD_RET("'%s' is not a valide argument for 'ReadAccessKeys'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadApiAccessPolicy'\n", next_a); } i += incr; - goto read_access_keys_arg; + goto read_api_access_policy_arg; } - cret = osc_read_access_keys(&e, &r, &a); - TRY(cret, "fail to call ReadAccessKeys: %s\n", curl_easy_strerror(cret)); + cret = osc_read_api_access_policy(&e, &r, &a); + TRY(cret, "fail to call ReadApiAccessPolicy: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -34122,19 +33317,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("PutUserGroupPolicy", av[i])) { + if (!strcmp("ReadApiAccessRules", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_put_user_group_policy_arg a = {0}; - struct osc_put_user_group_policy_arg *s = &a; + struct osc_read_api_access_rules_arg a = {0}; + struct osc_read_api_access_rules_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - put_user_group_policy_arg: + read_api_access_rules_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -34153,7 +33348,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto put_user_group_policy_arg; + goto read_api_access_rules_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -34183,58 +33378,37 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "PolicyDocument")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PolicyDocument argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "PolicyDocument argument missing\n"); - s->policy_document = aa; // string string - - } else - if ((aret = argcmp(next_a, "PolicyName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PolicyName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "PolicyName argument missing\n"); - s->policy_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "UserGroupName argument missing\n"); - s->user_group_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserGroupPath")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupPath argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserGroupPath argument missing\n"); - s->user_group_path = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_api_access_rule_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_api_access_rule_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else { - BAD_RET("'%s' is not a valide argument for 'PutUserGroupPolicy'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadApiAccessRules'\n", next_a); } i += incr; - goto put_user_group_policy_arg; + goto read_api_access_rules_arg; } - cret = osc_put_user_group_policy(&e, &r, &a); - TRY(cret, "fail to call PutUserGroupPolicy: %s\n", curl_easy_strerror(cret)); + cret = osc_read_api_access_rules(&e, &r, &a); + TRY(cret, "fail to call ReadApiAccessRules: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -34261,19 +33435,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("LinkVolume", av[i])) { + if (!strcmp("ReadApiLogs", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_link_volume_arg a = {0}; - struct osc_link_volume_arg *s = &a; + struct osc_read_api_logs_arg a = {0}; + struct osc_read_api_logs_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - link_volume_arg: + read_api_logs_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -34292,7 +33466,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto link_volume_arg; + goto read_api_logs_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -34306,17 +33480,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DeviceName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DeviceName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "DeviceName argument missing\n"); - s->device_name = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -34333,36 +33496,82 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmId argument missing\n"); - s->vm_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_api_log_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_api_log_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else - if ((aret = argcmp(next_a, "VolumeId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VolumeId argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VolumeId argument missing\n"); - s->volume_id = aa; // string string + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else + if ((aret = argcmp(next_a, "With")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "With argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos; + TRY(!aa, "With argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->with; + cascade_parser = with_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(with_parser(&s->with, dot_pos, aa, pa)); + s->is_set_with = 1; + } else { + s->with_str = aa; + } } else { - BAD_RET("'%s' is not a valide argument for 'LinkVolume'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadApiLogs'\n", next_a); } i += incr; - goto link_volume_arg; + goto read_api_logs_arg; } - cret = osc_link_volume(&e, &r, &a); - TRY(cret, "fail to call LinkVolume: %s\n", curl_easy_strerror(cret)); + cret = osc_read_api_logs(&e, &r, &a); + TRY(cret, "fail to call ReadApiLogs: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -34389,19 +33598,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("LinkVirtualGateway", av[i])) { + if (!strcmp("ReadCas", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_link_virtual_gateway_arg a = {0}; - struct osc_link_virtual_gateway_arg *s = &a; + struct osc_read_cas_arg a = {0}; + struct osc_read_cas_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - link_virtual_gateway_arg: + read_cas_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -34420,7 +33629,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto link_virtual_gateway_arg; + goto read_cas_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -34450,36 +33659,37 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NetId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NetId argument missing\n"); - s->net_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "VirtualGatewayId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VirtualGatewayId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VirtualGatewayId argument missing\n"); - s->virtual_gateway_id = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_ca_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_ca_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else { - BAD_RET("'%s' is not a valide argument for 'LinkVirtualGateway'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadCas'\n", next_a); } i += incr; - goto link_virtual_gateway_arg; + goto read_cas_arg; } - cret = osc_link_virtual_gateway(&e, &r, &a); - TRY(cret, "fail to call LinkVirtualGateway: %s\n", curl_easy_strerror(cret)); + cret = osc_read_cas(&e, &r, &a); + TRY(cret, "fail to call ReadCas: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -34506,19 +33716,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("LinkRouteTable", av[i])) { + if (!strcmp("ReadCatalog", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_link_route_table_arg a = {0}; - struct osc_link_route_table_arg *s = &a; + struct osc_read_catalog_arg a = {0}; + struct osc_read_catalog_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - link_route_table_arg: + read_catalog_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -34537,7 +33747,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto link_route_table_arg; + goto read_catalog_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -34567,36 +33777,14 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "RouteTableId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "RouteTableId argument missing\n"); - s->route_table_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SubnetId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "SubnetId argument missing\n"); - s->subnet_id = aa; // string string - - } else { - BAD_RET("'%s' is not a valide argument for 'LinkRouteTable'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadCatalog'\n", next_a); } i += incr; - goto link_route_table_arg; + goto read_catalog_arg; } - cret = osc_link_route_table(&e, &r, &a); - TRY(cret, "fail to call LinkRouteTable: %s\n", curl_easy_strerror(cret)); + cret = osc_read_catalog(&e, &r, &a); + TRY(cret, "fail to call ReadCatalog: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -34623,19 +33811,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("LinkPublicIp", av[i])) { + if (!strcmp("ReadCatalogs", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_link_public_ip_arg a = {0}; - struct osc_link_public_ip_arg *s = &a; + struct osc_read_catalogs_arg a = {0}; + struct osc_read_catalogs_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - link_public_ip_arg: + read_catalogs_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -34654,7 +33842,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto link_public_ip_arg; + goto read_catalogs_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -34668,22 +33856,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "AllowRelink")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "AllowRelink argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_allow_relink = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->allow_relink = 1; - } else if (!strcasecmp(aa, "false")) { - s->allow_relink = 0; - } else { - BAD_RET("AllowRelink require true/false\n"); - } - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -34700,69 +33872,37 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NicId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NicId argument missing\n"); - s->nic_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "PrivateIp")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PrivateIp argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "PrivateIp argument missing\n"); - s->private_ip = aa; // string string - - } else - if ((aret = argcmp(next_a, "PublicIp")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PublicIp argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "PublicIp argument missing\n"); - s->public_ip = aa; // string string - - } else - if ((aret = argcmp(next_a, "PublicIpId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PublicIpId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "PublicIpId argument missing\n"); - s->public_ip_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmId argument missing\n"); - s->vm_id = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_catalogs_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_catalogs_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else { - BAD_RET("'%s' is not a valide argument for 'LinkPublicIp'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadCatalogs'\n", next_a); } i += incr; - goto link_public_ip_arg; + goto read_catalogs_arg; } - cret = osc_link_public_ip(&e, &r, &a); - TRY(cret, "fail to call LinkPublicIp: %s\n", curl_easy_strerror(cret)); + cret = osc_read_catalogs(&e, &r, &a); + TRY(cret, "fail to call ReadCatalogs: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -34789,19 +33929,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("LinkPrivateIps", av[i])) { + if (!strcmp("ReadClientGateways", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_link_private_ips_arg a = {0}; - struct osc_link_private_ips_arg *s = &a; + struct osc_read_client_gateways_arg a = {0}; + struct osc_read_client_gateways_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - link_private_ips_arg: + read_client_gateways_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -34820,7 +33960,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto link_private_ips_arg; + goto read_client_gateways_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -34834,22 +33974,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "AllowRelink")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "AllowRelink argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_allow_relink = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->allow_relink = 1; - } else if (!strcasecmp(aa, "false")) { - s->allow_relink = 0; - } else { - BAD_RET("AllowRelink require true/false\n"); - } - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -34866,70 +33990,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NicId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NicId argument missing\n"); - s->nic_id = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_client_gateway_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_client_gateway_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else - if ((aret = argcmp(next_a, "PrivateIps")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PrivateIps argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string - TRY(!(dot_pos++), "PrivateIps argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "PrivateIps require an index\n"); - if (s->private_ips) { - for (; s->private_ips[last]; ++last); - } - if (pos < last) { - s->private_ips[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->private_ips, "", pa); - SET_NEXT(s->private_ips, (aa), pa); - } - } else { - TRY(!aa, "PrivateIps argument missing\n"); - s->private_ips_str = aa; - } - } else if (!(aret = argcmp(str, "PrivateIps[]")) || aret == '=') { - TRY(!aa, "PrivateIps[] argument missing\n"); - SET_NEXT(s->private_ips, (aa), pa); } else - if ((aret = argcmp(next_a, "SecondaryPrivateIpCount")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SecondaryPrivateIpCount argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SecondaryPrivateIpCount argument missing\n"); - s->is_set_secondary_private_ip_count = 1; - s->secondary_private_ip_count = atoll(aa); + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'LinkPrivateIps'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadClientGateways'\n", next_a); } i += incr; - goto link_private_ips_arg; + goto read_client_gateways_arg; } - cret = osc_link_private_ips(&e, &r, &a); - TRY(cret, "fail to call LinkPrivateIps: %s\n", curl_easy_strerror(cret)); + cret = osc_read_client_gateways(&e, &r, &a); + TRY(cret, "fail to call ReadClientGateways: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -34956,19 +34069,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("LinkPolicy", av[i])) { + if (!strcmp("ReadConsoleOutput", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_link_policy_arg a = {0}; - struct osc_link_policy_arg *s = &a; + struct osc_read_console_output_arg a = {0}; + struct osc_read_console_output_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - link_policy_arg: + read_console_output_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -34987,7 +34100,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto link_policy_arg; + goto read_console_output_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -35017,36 +34130,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PolicyOrn argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "PolicyOrn argument missing\n"); - s->policy_orn = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserName argument missing\n"); + TRY((!*eq_ptr), "VmId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserName argument missing\n"); - s->user_name = aa; // string string + TRY(!aa, "VmId argument missing\n"); + s->vm_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'LinkPolicy'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadConsoleOutput'\n", next_a); } i += incr; - goto link_policy_arg; + goto read_console_output_arg; } - cret = osc_link_policy(&e, &r, &a); - TRY(cret, "fail to call LinkPolicy: %s\n", curl_easy_strerror(cret)); + cret = osc_read_console_output(&e, &r, &a); + TRY(cret, "fail to call ReadConsoleOutput: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -35073,19 +34175,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("LinkNic", av[i])) { + if (!strcmp("ReadConsumptionAccount", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_link_nic_arg a = {0}; - struct osc_link_nic_arg *s = &a; + struct osc_read_consumption_account_arg a = {0}; + struct osc_read_consumption_account_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - link_nic_arg: + read_consumption_account_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -35104,7 +34206,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto link_nic_arg; + goto read_consumption_account_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -35118,17 +34220,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DeviceNumber")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DeviceNumber argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "DeviceNumber argument missing\n"); - s->is_set_device_number = 1; - s->device_number = atoll(aa); - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -35145,36 +34236,68 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "FromDate")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NicId argument missing\n"); + TRY((!*eq_ptr), "FromDate argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NicId argument missing\n"); - s->nic_id = aa; // string string + TRY(!aa, "FromDate argument missing\n"); + s->from_date = aa; // string string } else - if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Overall")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmId argument missing\n"); + TRY((!*eq_ptr), "Overall argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmId argument missing\n"); - s->vm_id = aa; // string string + s->is_set_overall = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->overall = 1; + } else if (!strcasecmp(aa, "false")) { + s->overall = 0; + } else { + BAD_RET("Overall require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "ShowPrice")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ShowPrice argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_show_price = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->show_price = 1; + } else if (!strcasecmp(aa, "false")) { + s->show_price = 0; + } else { + BAD_RET("ShowPrice require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "ToDate")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ToDate argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ToDate argument missing\n"); + s->to_date = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'LinkNic'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadConsumptionAccount'\n", next_a); } i += incr; - goto link_nic_arg; + goto read_consumption_account_arg; } - cret = osc_link_nic(&e, &r, &a); - TRY(cret, "fail to call LinkNic: %s\n", curl_easy_strerror(cret)); + cret = osc_read_consumption_account(&e, &r, &a); + TRY(cret, "fail to call ReadConsumptionAccount: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -35201,19 +34324,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("LinkManagedPolicyToUserGroup", av[i])) { + if (!strcmp("ReadDedicatedGroups", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_link_managed_policy_to_user_group_arg a = {0}; - struct osc_link_managed_policy_to_user_group_arg *s = &a; + struct osc_read_dedicated_groups_arg a = {0}; + struct osc_read_dedicated_groups_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - link_managed_policy_to_user_group_arg: + read_dedicated_groups_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -35232,7 +34355,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto link_managed_policy_to_user_group_arg; + goto read_dedicated_groups_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -35262,36 +34385,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PolicyOrn argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PolicyOrn argument missing\n"); - s->policy_orn = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_dedicated_group_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_dedicated_group_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else - if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupName argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserGroupName argument missing\n"); - s->user_group_name = aa; // string string + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'LinkManagedPolicyToUserGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadDedicatedGroups'\n", next_a); } i += incr; - goto link_managed_policy_to_user_group_arg; + goto read_dedicated_groups_arg; } - cret = osc_link_managed_policy_to_user_group(&e, &r, &a); - TRY(cret, "fail to call LinkManagedPolicyToUserGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_read_dedicated_groups(&e, &r, &a); + TRY(cret, "fail to call ReadDedicatedGroups: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -35318,19 +34464,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("LinkLoadBalancerBackendMachines", av[i])) { + if (!strcmp("ReadDhcpOptions", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_link_load_balancer_backend_machines_arg a = {0}; - struct osc_link_load_balancer_backend_machines_arg *s = &a; + struct osc_read_dhcp_options_arg a = {0}; + struct osc_read_dhcp_options_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - link_load_balancer_backend_machines_arg: + read_dhcp_options_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -35349,7 +34495,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto link_load_balancer_backend_machines_arg; + goto read_dhcp_options_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -35363,109 +34509,75 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "BackendIps")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "BackendIps argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "BackendIps argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "BackendIps require an index\n"); - if (s->backend_ips) { - for (; s->backend_ips[last]; ++last); - } - if (pos < last) { - s->backend_ips[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->backend_ips, "", pa); - SET_NEXT(s->backend_ips, (aa), pa); - } - } else { - TRY(!aa, "BackendIps argument missing\n"); - s->backend_ips_str = aa; - } - } else if (!(aret = argcmp(str, "BackendIps[]")) || aret == '=') { - TRY(!aa, "BackendIps[] argument missing\n"); - SET_NEXT(s->backend_ips, (aa), pa); - } else - if ((aret = argcmp(next_a, "BackendVmIds")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "BackendVmIds argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + char *dot_pos; - TRY(!(dot_pos++), "BackendVmIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "BackendVmIds require an index\n"); - if (s->backend_vm_ids) { - for (; s->backend_vm_ids[last]; ++last); - } - if (pos < last) { - s->backend_vm_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->backend_vm_ids, "", pa); - SET_NEXT(s->backend_vm_ids, (aa), pa); - } - } else { - TRY(!aa, "BackendVmIds argument missing\n"); - s->backend_vm_ids_str = aa; - } - } else if (!(aret = argcmp(str, "BackendVmIds[]")) || aret == '=') { - TRY(!aa, "BackendVmIds[] argument missing\n"); - SET_NEXT(s->backend_vm_ids, (aa), pa); + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_dhcp_options_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_dhcp_options_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string + + } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "LoadBalancerName argument missing\n"); - s->load_balancer_name = aa; // string string - + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'LinkLoadBalancerBackendMachines'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadDhcpOptions'\n", next_a); } i += incr; - goto link_load_balancer_backend_machines_arg; + goto read_dhcp_options_arg; } - cret = osc_link_load_balancer_backend_machines(&e, &r, &a); - TRY(cret, "fail to call LinkLoadBalancerBackendMachines: %s\n", curl_easy_strerror(cret)); + cret = osc_read_dhcp_options(&e, &r, &a); + TRY(cret, "fail to call ReadDhcpOptions: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -35492,19 +34604,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("LinkInternetService", av[i])) { + if (!strcmp("ReadDirectLinkInterfaces", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_link_internet_service_arg a = {0}; - struct osc_link_internet_service_arg *s = &a; + struct osc_read_direct_link_interfaces_arg a = {0}; + struct osc_read_direct_link_interfaces_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - link_internet_service_arg: + read_direct_link_interfaces_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -35523,7 +34635,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto link_internet_service_arg; + goto read_direct_link_interfaces_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -35553,36 +34665,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "InternetServiceId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "InternetServiceId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "InternetServiceId argument missing\n"); - s->internet_service_id = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_direct_link_interface_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_direct_link_interface_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else - if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NetId argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NetId argument missing\n"); - s->net_id = aa; // string string + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'LinkInternetService'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadDirectLinkInterfaces'\n", next_a); } i += incr; - goto link_internet_service_arg; + goto read_direct_link_interfaces_arg; } - cret = osc_link_internet_service(&e, &r, &a); - TRY(cret, "fail to call LinkInternetService: %s\n", curl_easy_strerror(cret)); + cret = osc_read_direct_link_interfaces(&e, &r, &a); + TRY(cret, "fail to call ReadDirectLinkInterfaces: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -35609,19 +34744,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("LinkFlexibleGpu", av[i])) { + if (!strcmp("ReadDirectLinks", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_link_flexible_gpu_arg a = {0}; - struct osc_link_flexible_gpu_arg *s = &a; + struct osc_read_direct_links_arg a = {0}; + struct osc_read_direct_links_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - link_flexible_gpu_arg: + read_direct_links_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -35640,7 +34775,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto link_flexible_gpu_arg; + goto read_direct_links_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -35670,36 +34805,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "FlexibleGpuId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "FlexibleGpuId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "FlexibleGpuId argument missing\n"); - s->flexible_gpu_id = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_direct_link_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_direct_link_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else - if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmId argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmId argument missing\n"); - s->vm_id = aa; // string string + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'LinkFlexibleGpu'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadDirectLinks'\n", next_a); } i += incr; - goto link_flexible_gpu_arg; + goto read_direct_links_arg; } - cret = osc_link_flexible_gpu(&e, &r, &a); - TRY(cret, "fail to call LinkFlexibleGpu: %s\n", curl_easy_strerror(cret)); + cret = osc_read_direct_links(&e, &r, &a); + TRY(cret, "fail to call ReadDirectLinks: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -35726,19 +34884,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeregisterVmsInLoadBalancer", av[i])) { + if (!strcmp("ReadEntitiesLinkedToPolicy", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_deregister_vms_in_load_balancer_arg a = {0}; - struct osc_deregister_vms_in_load_balancer_arg *s = &a; + struct osc_read_entities_linked_to_policy_arg a = {0}; + struct osc_read_entities_linked_to_policy_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - deregister_vms_in_load_balancer_arg: + read_entities_linked_to_policy_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -35757,7 +34915,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto deregister_vms_in_load_balancer_arg; + goto read_entities_linked_to_policy_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -35771,10 +34929,10 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "BackendVmIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "EntitiesType")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "BackendVmIds argument missing\n"); + TRY((!*eq_ptr), "EntitiesType argument missing\n"); aa = eq_ptr + 1; incr = 1; } @@ -35784,62 +34942,68 @@ int main(int ac, char **av) int last = 0; char *dot_pos = strchr(str, '.'); - TRY(!(dot_pos++), "BackendVmIds argument missing\n"); + TRY(!(dot_pos++), "EntitiesType argument missing\n"); pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "BackendVmIds require an index\n"); - if (s->backend_vm_ids) { - for (; s->backend_vm_ids[last]; ++last); + TRY(endptr == dot_pos, "EntitiesType require an index\n"); + if (s->entities_type) { + for (; s->entities_type[last]; ++last); } if (pos < last) { - s->backend_vm_ids[pos] = (aa); + s->entities_type[pos] = (aa); } else { for (int i = last; i < pos; ++i) - SET_NEXT(s->backend_vm_ids, "", pa); - SET_NEXT(s->backend_vm_ids, (aa), pa); + SET_NEXT(s->entities_type, "", pa); + SET_NEXT(s->entities_type, (aa), pa); } } else { - TRY(!aa, "BackendVmIds argument missing\n"); - s->backend_vm_ids_str = aa; + TRY(!aa, "EntitiesType argument missing\n"); + s->entities_type_str = aa; } - } else if (!(aret = argcmp(str, "BackendVmIds[]")) || aret == '=') { - TRY(!aa, "BackendVmIds[] argument missing\n"); - SET_NEXT(s->backend_vm_ids, (aa), pa); + } else if (!(aret = argcmp(str, "EntitiesType[]")) || aret == '=') { + TRY(!aa, "EntitiesType[] argument missing\n"); + SET_NEXT(s->entities_type, (aa), pa); } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "FirstItem argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "FirstItem argument missing\n"); + s->is_set_first_item = 1; + s->first_item = atoll(aa); + } else + if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); + TRY((!*eq_ptr), "PolicyOrn argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "LoadBalancerName argument missing\n"); - s->load_balancer_name = aa; // string string + TRY(!aa, "PolicyOrn argument missing\n"); + s->policy_orn = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeregisterVmsInLoadBalancer'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadEntitiesLinkedToPolicy'\n", next_a); } i += incr; - goto deregister_vms_in_load_balancer_arg; + goto read_entities_linked_to_policy_arg; } - cret = osc_deregister_vms_in_load_balancer(&e, &r, &a); - TRY(cret, "fail to call DeregisterVmsInLoadBalancer: %s\n", curl_easy_strerror(cret)); + cret = osc_read_entities_linked_to_policy(&e, &r, &a); + TRY(cret, "fail to call ReadEntitiesLinkedToPolicy: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -35866,19 +35030,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteVpnConnectionRoute", av[i])) { + if (!strcmp("ReadFlexibleGpuCatalog", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_vpn_connection_route_arg a = {0}; - struct osc_delete_vpn_connection_route_arg *s = &a; + struct osc_read_flexible_gpu_catalog_arg a = {0}; + struct osc_read_flexible_gpu_catalog_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_vpn_connection_route_arg: + read_flexible_gpu_catalog_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -35897,7 +35061,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_vpn_connection_route_arg; + goto read_flexible_gpu_catalog_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -35907,21 +35071,10 @@ int main(int ac, char **av) int aret = 0; int incr = aa ? 2 : 1; - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "DestinationIpRange")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DestinationIpRange argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "DestinationIpRange argument missing\n"); - s->destination_ip_range = aa; // string string - - } else + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -35938,25 +35091,14 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VpnConnectionId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "VpnConnectionId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "VpnConnectionId argument missing\n"); - s->vpn_connection_id = aa; // string string - - } else { - BAD_RET("'%s' is not a valide argument for 'DeleteVpnConnectionRoute'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadFlexibleGpuCatalog'\n", next_a); } i += incr; - goto delete_vpn_connection_route_arg; + goto read_flexible_gpu_catalog_arg; } - cret = osc_delete_vpn_connection_route(&e, &r, &a); - TRY(cret, "fail to call DeleteVpnConnectionRoute: %s\n", curl_easy_strerror(cret)); + cret = osc_read_flexible_gpu_catalog(&e, &r, &a); + TRY(cret, "fail to call ReadFlexibleGpuCatalog: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -35983,19 +35125,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteVpnConnection", av[i])) { + if (!strcmp("ReadFlexibleGpus", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_vpn_connection_arg a = {0}; - struct osc_delete_vpn_connection_arg *s = &a; + struct osc_read_flexible_gpus_arg a = {0}; + struct osc_read_flexible_gpus_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_vpn_connection_arg: + read_flexible_gpus_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -36014,7 +35156,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_vpn_connection_arg; + goto read_flexible_gpus_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -36044,25 +35186,37 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VpnConnectionId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VpnConnectionId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VpnConnectionId argument missing\n"); - s->vpn_connection_id = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_flexible_gpu_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_flexible_gpu_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else { - BAD_RET("'%s' is not a valide argument for 'DeleteVpnConnection'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadFlexibleGpus'\n", next_a); } i += incr; - goto delete_vpn_connection_arg; + goto read_flexible_gpus_arg; } - cret = osc_delete_vpn_connection(&e, &r, &a); - TRY(cret, "fail to call DeleteVpnConnection: %s\n", curl_easy_strerror(cret)); + cret = osc_read_flexible_gpus(&e, &r, &a); + TRY(cret, "fail to call ReadFlexibleGpus: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -36089,19 +35243,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteVolume", av[i])) { + if (!strcmp("ReadImageExportTasks", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_volume_arg a = {0}; - struct osc_delete_volume_arg *s = &a; + struct osc_read_image_export_tasks_arg a = {0}; + struct osc_read_image_export_tasks_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_volume_arg: + read_image_export_tasks_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -36120,7 +35274,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_volume_arg; + goto read_image_export_tasks_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -36150,25 +35304,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VolumeId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VolumeId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VolumeId argument missing\n"); - s->volume_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_export_task_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_export_task_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteVolume'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadImageExportTasks'\n", next_a); } i += incr; - goto delete_volume_arg; + goto read_image_export_tasks_arg; } - cret = osc_delete_volume(&e, &r, &a); - TRY(cret, "fail to call DeleteVolume: %s\n", curl_easy_strerror(cret)); + cret = osc_read_image_export_tasks(&e, &r, &a); + TRY(cret, "fail to call ReadImageExportTasks: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -36195,19 +35383,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteVms", av[i])) { + if (!strcmp("ReadImages", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_vms_arg a = {0}; - struct osc_delete_vms_arg *s = &a; + struct osc_read_images_arg a = {0}; + struct osc_read_images_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_vms_arg: + read_images_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -36226,7 +35414,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_vms_arg; + goto read_images_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -36256,48 +35444,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VmIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmIds argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + char *dot_pos; - TRY(!(dot_pos++), "VmIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "VmIds require an index\n"); - if (s->vm_ids) { - for (; s->vm_ids[last]; ++last); - } - if (pos < last) { - s->vm_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->vm_ids, "", pa); - SET_NEXT(s->vm_ids, (aa), pa); - } - } else { - TRY(!aa, "VmIds argument missing\n"); - s->vm_ids_str = aa; - } - } else if (!(aret = argcmp(str, "VmIds[]")) || aret == '=') { - TRY(!aa, "VmIds[] argument missing\n"); - SET_NEXT(s->vm_ids, (aa), pa); + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_image_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_image_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string + + } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'DeleteVms'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadImages'\n", next_a); } i += incr; - goto delete_vms_arg; + goto read_images_arg; } - cret = osc_delete_vms(&e, &r, &a); - TRY(cret, "fail to call DeleteVms: %s\n", curl_easy_strerror(cret)); + cret = osc_read_images(&e, &r, &a); + TRY(cret, "fail to call ReadImages: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -36324,19 +35523,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteVmTemplate", av[i])) { + if (!strcmp("ReadInternetServices", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_vm_template_arg a = {0}; - struct osc_delete_vm_template_arg *s = &a; + struct osc_read_internet_services_arg a = {0}; + struct osc_read_internet_services_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_vm_template_arg: + read_internet_services_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -36355,7 +35554,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_vm_template_arg; + goto read_internet_services_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -36385,25 +35584,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VmTemplateId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmTemplateId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmTemplateId argument missing\n"); - s->vm_template_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_internet_service_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_internet_service_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteVmTemplate'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadInternetServices'\n", next_a); } i += incr; - goto delete_vm_template_arg; + goto read_internet_services_arg; } - cret = osc_delete_vm_template(&e, &r, &a); - TRY(cret, "fail to call DeleteVmTemplate: %s\n", curl_easy_strerror(cret)); + cret = osc_read_internet_services(&e, &r, &a); + TRY(cret, "fail to call ReadInternetServices: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -36430,19 +35663,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteVmGroup", av[i])) { + if (!strcmp("ReadKeypairs", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_vm_group_arg a = {0}; - struct osc_delete_vm_group_arg *s = &a; + struct osc_read_keypairs_arg a = {0}; + struct osc_read_keypairs_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_vm_group_arg: + read_keypairs_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -36461,7 +35694,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_vm_group_arg; + goto read_keypairs_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -36491,25 +35724,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VmGroupId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmGroupId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmGroupId argument missing\n"); - s->vm_group_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_keypair_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_keypair_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteVmGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadKeypairs'\n", next_a); } i += incr; - goto delete_vm_group_arg; + goto read_keypairs_arg; } - cret = osc_delete_vm_group(&e, &r, &a); - TRY(cret, "fail to call DeleteVmGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_read_keypairs(&e, &r, &a); + TRY(cret, "fail to call ReadKeypairs: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -36536,19 +35803,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteVirtualGateway", av[i])) { + if (!strcmp("ReadLinkedPolicies", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_virtual_gateway_arg a = {0}; - struct osc_delete_virtual_gateway_arg *s = &a; + struct osc_read_linked_policies_arg a = {0}; + struct osc_read_linked_policies_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_virtual_gateway_arg: + read_linked_policies_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -36567,7 +35834,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_virtual_gateway_arg; + goto read_linked_policies_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -36597,25 +35864,70 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VirtualGatewayId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VirtualGatewayId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VirtualGatewayId argument missing\n"); - s->virtual_gateway_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = read_linked_policies_filters_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(read_linked_policies_filters_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "FirstItem argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "FirstItem argument missing\n"); + s->is_set_first_item = 1; + s->first_item = atoll(aa); + } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else + if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserName argument missing\n"); + s->user_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'DeleteVirtualGateway'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadLinkedPolicies'\n", next_a); } i += incr; - goto delete_virtual_gateway_arg; + goto read_linked_policies_arg; } - cret = osc_delete_virtual_gateway(&e, &r, &a); - TRY(cret, "fail to call DeleteVirtualGateway: %s\n", curl_easy_strerror(cret)); + cret = osc_read_linked_policies(&e, &r, &a); + TRY(cret, "fail to call ReadLinkedPolicies: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -36642,19 +35954,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteUserGroupPolicy", av[i])) { + if (!strcmp("ReadListenerRules", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_user_group_policy_arg a = {0}; - struct osc_delete_user_group_policy_arg *s = &a; + struct osc_read_listener_rules_arg a = {0}; + struct osc_read_listener_rules_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_user_group_policy_arg: + read_listener_rules_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -36673,7 +35985,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_user_group_policy_arg; + goto read_listener_rules_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -36703,47 +36015,37 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "PolicyName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PolicyName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "PolicyName argument missing\n"); - s->policy_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "UserGroupName argument missing\n"); - s->user_group_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserGroupPath")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupPath argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserGroupPath argument missing\n"); - s->user_group_path = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_listener_rule_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_listener_rule_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else { - BAD_RET("'%s' is not a valide argument for 'DeleteUserGroupPolicy'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadListenerRules'\n", next_a); } i += incr; - goto delete_user_group_policy_arg; + goto read_listener_rules_arg; } - cret = osc_delete_user_group_policy(&e, &r, &a); - TRY(cret, "fail to call DeleteUserGroupPolicy: %s\n", curl_easy_strerror(cret)); + cret = osc_read_listener_rules(&e, &r, &a); + TRY(cret, "fail to call ReadListenerRules: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -36770,19 +36072,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteUserGroup", av[i])) { + if (!strcmp("ReadLoadBalancerTags", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_user_group_arg a = {0}; - struct osc_delete_user_group_arg *s = &a; + struct osc_read_load_balancer_tags_arg a = {0}; + struct osc_read_load_balancer_tags_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_user_group_arg: + read_load_balancer_tags_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -36801,7 +36103,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_user_group_arg; + goto read_load_balancer_tags_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -36831,52 +36133,48 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Force")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Force argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_force = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->force = 1; - } else if (!strcasecmp(aa, "false")) { - s->force = 0; - } else { - BAD_RET("Force require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Path argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Path argument missing\n"); - s->path = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LoadBalancerNames")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupName argument missing\n"); + TRY((!*eq_ptr), "LoadBalancerNames argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserGroupName argument missing\n"); - s->user_group_name = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "LoadBalancerNames argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "LoadBalancerNames require an index\n"); + if (s->load_balancer_names) { + for (; s->load_balancer_names[last]; ++last); + } + if (pos < last) { + s->load_balancer_names[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->load_balancer_names, "", pa); + SET_NEXT(s->load_balancer_names, (aa), pa); + } + } else { + TRY(!aa, "LoadBalancerNames argument missing\n"); + s->load_balancer_names_str = aa; + } + } else if (!(aret = argcmp(str, "LoadBalancerNames[]")) || aret == '=') { + TRY(!aa, "LoadBalancerNames[] argument missing\n"); + SET_NEXT(s->load_balancer_names, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'DeleteUserGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadLoadBalancerTags'\n", next_a); } i += incr; - goto delete_user_group_arg; + goto read_load_balancer_tags_arg; } - cret = osc_delete_user_group(&e, &r, &a); - TRY(cret, "fail to call DeleteUserGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_read_load_balancer_tags(&e, &r, &a); + TRY(cret, "fail to call ReadLoadBalancerTags: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -36903,19 +36201,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteUser", av[i])) { + if (!strcmp("ReadLoadBalancers", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_user_arg a = {0}; - struct osc_delete_user_arg *s = &a; + struct osc_read_load_balancers_arg a = {0}; + struct osc_read_load_balancers_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_user_arg: + read_load_balancers_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -36934,7 +36232,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_user_arg; + goto read_load_balancers_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -36964,25 +36262,37 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserName argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserName argument missing\n"); - s->user_name = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_load_balancer_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_load_balancer_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else { - BAD_RET("'%s' is not a valide argument for 'DeleteUser'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadLoadBalancers'\n", next_a); } i += incr; - goto delete_user_arg; + goto read_load_balancers_arg; } - cret = osc_delete_user(&e, &r, &a); - TRY(cret, "fail to call DeleteUser: %s\n", curl_easy_strerror(cret)); + cret = osc_read_load_balancers(&e, &r, &a); + TRY(cret, "fail to call ReadLoadBalancers: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -37009,19 +36319,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteTags", av[i])) { + if (!strcmp("ReadLocations", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_tags_arg a = {0}; - struct osc_delete_tags_arg *s = &a; + struct osc_read_locations_arg a = {0}; + struct osc_read_locations_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_tags_arg: + read_locations_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -37040,7 +36350,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_tags_arg; + goto read_locations_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -37070,79 +36380,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "ResourceIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ResourceIds argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string - TRY(!(dot_pos++), "ResourceIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "ResourceIds require an index\n"); - if (s->resource_ids) { - for (; s->resource_ids[last]; ++last); - } - if (pos < last) { - s->resource_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->resource_ids, "", pa); - SET_NEXT(s->resource_ids, (aa), pa); - } - } else { - TRY(!aa, "ResourceIds argument missing\n"); - s->resource_ids_str = aa; - } - } else if (!(aret = argcmp(str, "ResourceIds[]")) || aret == '=') { - TRY(!aa, "ResourceIds[] argument missing\n"); - SET_NEXT(s->resource_ids, (aa), pa); } else - if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Tags argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; - - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); - else if (*endptr != '.') - BAD_RET("'Tags' require a .\n"); - TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); - cascade_struct = &s->tags[pos]; - cascade_parser = resource_tag_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); - } else { - TRY(!aa, "Tags argument missing\n"); - s->tags_str = aa; // array ref ResourceTag ref - } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'DeleteTags'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadLocations'\n", next_a); } i += incr; - goto delete_tags_arg; + goto read_locations_arg; } - cret = osc_delete_tags(&e, &r, &a); - TRY(cret, "fail to call DeleteTags: %s\n", curl_easy_strerror(cret)); + cret = osc_read_locations(&e, &r, &a); + TRY(cret, "fail to call ReadLocations: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -37169,19 +36436,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteSubnet", av[i])) { + if (!strcmp("ReadManagedPoliciesLinkedToUserGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_subnet_arg a = {0}; - struct osc_delete_subnet_arg *s = &a; + struct osc_read_managed_policies_linked_to_user_group_arg a = {0}; + struct osc_read_managed_policies_linked_to_user_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_subnet_arg: + read_managed_policies_linked_to_user_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -37200,7 +36467,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_subnet_arg; + goto read_managed_policies_linked_to_user_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -37230,25 +36497,70 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SubnetId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SubnetId argument missing\n"); - s->subnet_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_user_group_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_user_group_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "FirstItem argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "FirstItem argument missing\n"); + s->is_set_first_item = 1; + s->first_item = atoll(aa); + } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else + if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserGroupName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserGroupName argument missing\n"); + s->user_group_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'DeleteSubnet'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadManagedPoliciesLinkedToUserGroup'\n", next_a); } i += incr; - goto delete_subnet_arg; + goto read_managed_policies_linked_to_user_group_arg; } - cret = osc_delete_subnet(&e, &r, &a); - TRY(cret, "fail to call DeleteSubnet: %s\n", curl_easy_strerror(cret)); + cret = osc_read_managed_policies_linked_to_user_group(&e, &r, &a); + TRY(cret, "fail to call ReadManagedPoliciesLinkedToUserGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -37275,19 +36587,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteSnapshot", av[i])) { + if (!strcmp("ReadNatServices", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_snapshot_arg a = {0}; - struct osc_delete_snapshot_arg *s = &a; + struct osc_read_nat_services_arg a = {0}; + struct osc_read_nat_services_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_snapshot_arg: + read_nat_services_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -37306,7 +36618,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_snapshot_arg; + goto read_nat_services_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -37336,25 +36648,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "SnapshotId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SnapshotId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SnapshotId argument missing\n"); - s->snapshot_id = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_nat_service_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_nat_service_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string + + } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'DeleteSnapshot'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadNatServices'\n", next_a); } i += incr; - goto delete_snapshot_arg; + goto read_nat_services_arg; } - cret = osc_delete_snapshot(&e, &r, &a); - TRY(cret, "fail to call DeleteSnapshot: %s\n", curl_easy_strerror(cret)); + cret = osc_read_nat_services(&e, &r, &a); + TRY(cret, "fail to call ReadNatServices: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -37381,19 +36727,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteServerCertificate", av[i])) { + if (!strcmp("ReadNetAccessPointServices", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_server_certificate_arg a = {0}; - struct osc_delete_server_certificate_arg *s = &a; + struct osc_read_net_access_point_services_arg a = {0}; + struct osc_read_net_access_point_services_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_server_certificate_arg: + read_net_access_point_services_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -37412,7 +36758,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_server_certificate_arg; + goto read_net_access_point_services_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -37442,25 +36788,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Name")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Name argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Name argument missing\n"); - s->name = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_service_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_service_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteServerCertificate'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadNetAccessPointServices'\n", next_a); } i += incr; - goto delete_server_certificate_arg; + goto read_net_access_point_services_arg; } - cret = osc_delete_server_certificate(&e, &r, &a); - TRY(cret, "fail to call DeleteServerCertificate: %s\n", curl_easy_strerror(cret)); + cret = osc_read_net_access_point_services(&e, &r, &a); + TRY(cret, "fail to call ReadNetAccessPointServices: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -37487,19 +36867,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteSecurityGroupRule", av[i])) { + if (!strcmp("ReadNetAccessPoints", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_security_group_rule_arg a = {0}; - struct osc_delete_security_group_rule_arg *s = &a; + struct osc_read_net_access_points_arg a = {0}; + struct osc_read_net_access_points_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_security_group_rule_arg: + read_net_access_points_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -37518,7 +36898,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_security_group_rule_arg; + goto read_net_access_points_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -37548,133 +36928,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Flow")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Flow argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Flow argument missing\n"); - s->flow = aa; // string string - - } else - if ((aret = argcmp(next_a, "FromPortRange")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "FromPortRange argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "FromPortRange argument missing\n"); - s->is_set_from_port_range = 1; - s->from_port_range = atoll(aa); - } else - if ((aret = argcmp(next_a, "IpProtocol")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "IpProtocol argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "IpProtocol argument missing\n"); - s->ip_protocol = aa; // string string - - } else - if ((aret = argcmp(next_a, "IpRange")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "IpRange argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "IpRange argument missing\n"); - s->ip_range = aa; // string string - - } else - if ((aret = argcmp(next_a, "Rules")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Rules argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; + char *dot_pos; - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Rules' require an index (example array ref SecurityGroupRule.Rules.0)\n"); - else if (*endptr != '.') - BAD_RET("'Rules' require a .\n"); - TRY_ALLOC_AT(s,rules, pa, pos, sizeof(*s->rules)); - cascade_struct = &s->rules[pos]; - cascade_parser = security_group_rule_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(security_group_rule_parser(&s->rules[pos], endptr + 1, aa, pa)); + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_net_access_point_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_net_access_point_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; } else { - TRY(!aa, "Rules argument missing\n"); - s->rules_str = aa; // array ref SecurityGroupRule ref - } - } else - if ((aret = argcmp(next_a, "SecurityGroupAccountIdToUnlink")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupAccountIdToUnlink argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "SecurityGroupAccountIdToUnlink argument missing\n"); - s->security_group_account_id_to_unlink = aa; // string string - - } else - if ((aret = argcmp(next_a, "SecurityGroupId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "SecurityGroupId argument missing\n"); - s->security_group_id = aa; // string string - + s->filters_str = aa; + } } else - if ((aret = argcmp(next_a, "SecurityGroupNameToUnlink")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupNameToUnlink argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SecurityGroupNameToUnlink argument missing\n"); - s->security_group_name_to_unlink = aa; // string string + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else - if ((aret = argcmp(next_a, "ToPortRange")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ToPortRange argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ToPortRange argument missing\n"); - s->is_set_to_port_range = 1; - s->to_port_range = atoll(aa); + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'DeleteSecurityGroupRule'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadNetAccessPoints'\n", next_a); } i += incr; - goto delete_security_group_rule_arg; + goto read_net_access_points_arg; } - cret = osc_delete_security_group_rule(&e, &r, &a); - TRY(cret, "fail to call DeleteSecurityGroupRule: %s\n", curl_easy_strerror(cret)); + cret = osc_read_net_access_points(&e, &r, &a); + TRY(cret, "fail to call ReadNetAccessPoints: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -37701,19 +37007,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteSecurityGroup", av[i])) { + if (!strcmp("ReadNetPeerings", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_security_group_arg a = {0}; - struct osc_delete_security_group_arg *s = &a; + struct osc_read_net_peerings_arg a = {0}; + struct osc_read_net_peerings_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_security_group_arg: + read_net_peerings_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -37732,7 +37038,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_security_group_arg; + goto read_net_peerings_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -37762,36 +37068,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "SecurityGroupId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SecurityGroupId argument missing\n"); - s->security_group_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_net_peering_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_net_peering_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else - if ((aret = argcmp(next_a, "SecurityGroupName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupName argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SecurityGroupName argument missing\n"); - s->security_group_name = aa; // string string - + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'DeleteSecurityGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadNetPeerings'\n", next_a); } i += incr; - goto delete_security_group_arg; + goto read_net_peerings_arg; } - cret = osc_delete_security_group(&e, &r, &a); - TRY(cret, "fail to call DeleteSecurityGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_read_net_peerings(&e, &r, &a); + TRY(cret, "fail to call ReadNetPeerings: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -37818,19 +37147,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteRouteTable", av[i])) { + if (!strcmp("ReadNets", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_route_table_arg a = {0}; - struct osc_delete_route_table_arg *s = &a; + struct osc_read_nets_arg a = {0}; + struct osc_read_nets_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_route_table_arg: + read_nets_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -37849,7 +37178,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_route_table_arg; + goto read_nets_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -37879,25 +37208,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "RouteTableId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "RouteTableId argument missing\n"); - s->route_table_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_net_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_net_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteRouteTable'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadNets'\n", next_a); } i += incr; - goto delete_route_table_arg; + goto read_nets_arg; } - cret = osc_delete_route_table(&e, &r, &a); - TRY(cret, "fail to call DeleteRouteTable: %s\n", curl_easy_strerror(cret)); + cret = osc_read_nets(&e, &r, &a); + TRY(cret, "fail to call ReadNets: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -37924,19 +37287,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteRoute", av[i])) { + if (!strcmp("ReadNics", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_route_arg a = {0}; - struct osc_delete_route_arg *s = &a; + struct osc_read_nics_arg a = {0}; + struct osc_read_nics_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_route_arg: + read_nics_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -37955,7 +37318,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_route_arg; + goto read_nics_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -37969,17 +37332,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DestinationIpRange")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DestinationIpRange argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "DestinationIpRange argument missing\n"); - s->destination_ip_range = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -37996,25 +37348,37 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "RouteTableId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "RouteTableId argument missing\n"); - s->route_table_id = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_nic_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_nic_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else { - BAD_RET("'%s' is not a valide argument for 'DeleteRoute'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadNics'\n", next_a); } i += incr; - goto delete_route_arg; + goto read_nics_arg; } - cret = osc_delete_route(&e, &r, &a); - TRY(cret, "fail to call DeleteRoute: %s\n", curl_easy_strerror(cret)); + cret = osc_read_nics(&e, &r, &a); + TRY(cret, "fail to call ReadNics: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -38041,19 +37405,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeletePublicIp", av[i])) { + if (!strcmp("ReadPolicies", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_public_ip_arg a = {0}; - struct osc_delete_public_ip_arg *s = &a; + struct osc_read_policies_arg a = {0}; + struct osc_read_policies_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_public_ip_arg: + read_policies_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -38072,7 +37436,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_public_ip_arg; + goto read_policies_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -38102,36 +37466,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "PublicIp")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PublicIp argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PublicIp argument missing\n"); - s->public_ip = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = read_policies_filters_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(read_policies_filters_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else - if ((aret = argcmp(next_a, "PublicIpId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PublicIpId argument missing\n"); + TRY((!*eq_ptr), "FirstItem argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PublicIpId argument missing\n"); - s->public_ip_id = aa; // string string - + TRY(!aa, "FirstItem argument missing\n"); + s->is_set_first_item = 1; + s->first_item = atoll(aa); + } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'DeletePublicIp'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadPolicies'\n", next_a); } i += incr; - goto delete_public_ip_arg; + goto read_policies_arg; } - cret = osc_delete_public_ip(&e, &r, &a); - TRY(cret, "fail to call DeletePublicIp: %s\n", curl_easy_strerror(cret)); + cret = osc_read_policies(&e, &r, &a); + TRY(cret, "fail to call ReadPolicies: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -38158,19 +37545,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeletePolicyVersion", av[i])) { + if (!strcmp("ReadPolicy", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_policy_version_arg a = {0}; - struct osc_delete_policy_version_arg *s = &a; + struct osc_read_policy_arg a = {0}; + struct osc_read_policy_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_policy_version_arg: + read_policy_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -38189,7 +37576,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_policy_version_arg; + goto read_policy_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -38213,26 +37600,15 @@ int main(int ac, char **av) TRY(!aa, "PolicyOrn argument missing\n"); s->policy_orn = aa; // string string - } else - if ((aret = argcmp(next_a, "VersionId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "VersionId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "VersionId argument missing\n"); - s->version_id = aa; // string string - } else { - BAD_RET("'%s' is not a valide argument for 'DeletePolicyVersion'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadPolicy'\n", next_a); } i += incr; - goto delete_policy_version_arg; + goto read_policy_arg; } - cret = osc_delete_policy_version(&e, &r, &a); - TRY(cret, "fail to call DeletePolicyVersion: %s\n", curl_easy_strerror(cret)); + cret = osc_read_policy(&e, &r, &a); + TRY(cret, "fail to call ReadPolicy: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -38259,19 +37635,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeletePolicy", av[i])) { + if (!strcmp("ReadPolicyVersion", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_policy_arg a = {0}; - struct osc_delete_policy_arg *s = &a; + struct osc_read_policy_version_arg a = {0}; + struct osc_read_policy_version_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_policy_arg: + read_policy_version_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -38290,7 +37666,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_policy_arg; + goto read_policy_version_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -38304,41 +37680,36 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "PolicyOrn argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "PolicyOrn argument missing\n"); + s->policy_orn = aa; // string string + + } else + if ((aret = argcmp(next_a, "VersionId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PolicyOrn argument missing\n"); + TRY((!*eq_ptr), "VersionId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PolicyOrn argument missing\n"); - s->policy_orn = aa; // string string + TRY(!aa, "VersionId argument missing\n"); + s->version_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'DeletePolicy'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadPolicyVersion'\n", next_a); } i += incr; - goto delete_policy_arg; + goto read_policy_version_arg; } - cret = osc_delete_policy(&e, &r, &a); - TRY(cret, "fail to call DeletePolicy: %s\n", curl_easy_strerror(cret)); + cret = osc_read_policy_version(&e, &r, &a); + TRY(cret, "fail to call ReadPolicyVersion: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -38365,19 +37736,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteNic", av[i])) { + if (!strcmp("ReadPolicyVersions", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_nic_arg a = {0}; - struct osc_delete_nic_arg *s = &a; + struct osc_read_policy_versions_arg a = {0}; + struct osc_read_policy_versions_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_nic_arg: + read_policy_versions_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -38396,7 +37767,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_nic_arg; + goto read_policy_versions_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -38410,41 +37781,47 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "FirstItem argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "FirstItem argument missing\n"); + s->is_set_first_item = 1; + s->first_item = atoll(aa); + } else + if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NicId argument missing\n"); + TRY((!*eq_ptr), "PolicyOrn argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NicId argument missing\n"); - s->nic_id = aa; // string string + TRY(!aa, "PolicyOrn argument missing\n"); + s->policy_orn = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteNic'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadPolicyVersions'\n", next_a); } i += incr; - goto delete_nic_arg; + goto read_policy_versions_arg; } - cret = osc_delete_nic(&e, &r, &a); - TRY(cret, "fail to call DeleteNic: %s\n", curl_easy_strerror(cret)); + cret = osc_read_policy_versions(&e, &r, &a); + TRY(cret, "fail to call ReadPolicyVersions: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -38471,19 +37848,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteNetPeering", av[i])) { + if (!strcmp("ReadProductTypes", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_net_peering_arg a = {0}; - struct osc_delete_net_peering_arg *s = &a; + struct osc_read_product_types_arg a = {0}; + struct osc_read_product_types_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_net_peering_arg: + read_product_types_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -38502,7 +37879,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_net_peering_arg; + goto read_product_types_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -38532,25 +37909,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NetPeeringId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NetPeeringId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NetPeeringId argument missing\n"); - s->net_peering_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_product_type_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_product_type_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteNetPeering'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadProductTypes'\n", next_a); } i += incr; - goto delete_net_peering_arg; + goto read_product_types_arg; } - cret = osc_delete_net_peering(&e, &r, &a); - TRY(cret, "fail to call DeleteNetPeering: %s\n", curl_easy_strerror(cret)); + cret = osc_read_product_types(&e, &r, &a); + TRY(cret, "fail to call ReadProductTypes: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -38577,19 +37988,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteNetAccessPoint", av[i])) { + if (!strcmp("ReadPublicCatalog", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_net_access_point_arg a = {0}; - struct osc_delete_net_access_point_arg *s = &a; + struct osc_read_public_catalog_arg a = {0}; + struct osc_read_public_catalog_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_net_access_point_arg: + read_public_catalog_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -38608,7 +38019,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_net_access_point_arg; + goto read_public_catalog_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -38638,25 +38049,14 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NetAccessPointId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NetAccessPointId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NetAccessPointId argument missing\n"); - s->net_access_point_id = aa; // string string - - } else { - BAD_RET("'%s' is not a valide argument for 'DeleteNetAccessPoint'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadPublicCatalog'\n", next_a); } i += incr; - goto delete_net_access_point_arg; + goto read_public_catalog_arg; } - cret = osc_delete_net_access_point(&e, &r, &a); - TRY(cret, "fail to call DeleteNetAccessPoint: %s\n", curl_easy_strerror(cret)); + cret = osc_read_public_catalog(&e, &r, &a); + TRY(cret, "fail to call ReadPublicCatalog: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -38683,19 +38083,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteNet", av[i])) { + if (!strcmp("ReadPublicIpRanges", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_net_arg a = {0}; - struct osc_delete_net_arg *s = &a; + struct osc_read_public_ip_ranges_arg a = {0}; + struct osc_read_public_ip_ranges_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_net_arg: + read_public_ip_ranges_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -38714,7 +38114,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_net_arg; + goto read_public_ip_ranges_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -38744,25 +38144,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NetId argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NetId argument missing\n"); - s->net_id = aa; // string string + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteNet'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadPublicIpRanges'\n", next_a); } i += incr; - goto delete_net_arg; + goto read_public_ip_ranges_arg; } - cret = osc_delete_net(&e, &r, &a); - TRY(cret, "fail to call DeleteNet: %s\n", curl_easy_strerror(cret)); + cret = osc_read_public_ip_ranges(&e, &r, &a); + TRY(cret, "fail to call ReadPublicIpRanges: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -38789,19 +38200,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteNatService", av[i])) { + if (!strcmp("ReadPublicIps", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_nat_service_arg a = {0}; - struct osc_delete_nat_service_arg *s = &a; + struct osc_read_public_ips_arg a = {0}; + struct osc_read_public_ips_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_nat_service_arg: + read_public_ips_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -38820,7 +38231,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_nat_service_arg; + goto read_public_ips_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -38850,25 +38261,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NatServiceId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NatServiceId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NatServiceId argument missing\n"); - s->nat_service_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_public_ip_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_public_ip_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteNatService'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadPublicIps'\n", next_a); } i += incr; - goto delete_nat_service_arg; + goto read_public_ips_arg; } - cret = osc_delete_nat_service(&e, &r, &a); - TRY(cret, "fail to call DeleteNatService: %s\n", curl_easy_strerror(cret)); + cret = osc_read_public_ips(&e, &r, &a); + TRY(cret, "fail to call ReadPublicIps: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -38895,19 +38340,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteLoadBalancerTags", av[i])) { + if (!strcmp("ReadQuotas", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_load_balancer_tags_arg a = {0}; - struct osc_delete_load_balancer_tags_arg *s = &a; + struct osc_read_quotas_arg a = {0}; + struct osc_read_quotas_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_load_balancer_tags_arg: + read_quotas_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -38926,7 +38371,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_load_balancer_tags_arg; + goto read_quotas_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -38953,82 +38398,62 @@ int main(int ac, char **av) } else if (!strcasecmp(aa, "false")) { s->dry_run = 0; } else { - BAD_RET("DryRun require true/false\n"); + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Filters argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_quota_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_quota_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; } - } else - if ((aret = argcmp(next_a, "LoadBalancerNames")) == 0 || aret == '=' || aret == '.') { + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerNames argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string - TRY(!(dot_pos++), "LoadBalancerNames argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "LoadBalancerNames require an index\n"); - if (s->load_balancer_names) { - for (; s->load_balancer_names[last]; ++last); - } - if (pos < last) { - s->load_balancer_names[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->load_balancer_names, "", pa); - SET_NEXT(s->load_balancer_names, (aa), pa); - } - } else { - TRY(!aa, "LoadBalancerNames argument missing\n"); - s->load_balancer_names_str = aa; - } - } else if (!(aret = argcmp(str, "LoadBalancerNames[]")) || aret == '=') { - TRY(!aa, "LoadBalancerNames[] argument missing\n"); - SET_NEXT(s->load_balancer_names, (aa), pa); } else - if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Tags argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; - - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Tags' require an index (example array ref ResourceLoadBalancerTag.Tags.0)\n"); - else if (*endptr != '.') - BAD_RET("'Tags' require a .\n"); - TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); - cascade_struct = &s->tags[pos]; - cascade_parser = resource_load_balancer_tag_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(resource_load_balancer_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); - } else { - TRY(!aa, "Tags argument missing\n"); - s->tags_str = aa; // array ref ResourceLoadBalancerTag ref - } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'DeleteLoadBalancerTags'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadQuotas'\n", next_a); } i += incr; - goto delete_load_balancer_tags_arg; + goto read_quotas_arg; } - cret = osc_delete_load_balancer_tags(&e, &r, &a); - TRY(cret, "fail to call DeleteLoadBalancerTags: %s\n", curl_easy_strerror(cret)); + cret = osc_read_quotas(&e, &r, &a); + TRY(cret, "fail to call ReadQuotas: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -39055,19 +38480,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteLoadBalancerPolicy", av[i])) { + if (!strcmp("ReadRegions", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_load_balancer_policy_arg a = {0}; - struct osc_delete_load_balancer_policy_arg *s = &a; + struct osc_read_regions_arg a = {0}; + struct osc_read_regions_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_load_balancer_policy_arg: + read_regions_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -39086,7 +38511,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_load_balancer_policy_arg; + goto read_regions_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -39116,36 +38541,14 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "LoadBalancerName argument missing\n"); - s->load_balancer_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "PolicyName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PolicyName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "PolicyName argument missing\n"); - s->policy_name = aa; // string string - - } else { - BAD_RET("'%s' is not a valide argument for 'DeleteLoadBalancerPolicy'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadRegions'\n", next_a); } i += incr; - goto delete_load_balancer_policy_arg; + goto read_regions_arg; } - cret = osc_delete_load_balancer_policy(&e, &r, &a); - TRY(cret, "fail to call DeleteLoadBalancerPolicy: %s\n", curl_easy_strerror(cret)); + cret = osc_read_regions(&e, &r, &a); + TRY(cret, "fail to call ReadRegions: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -39172,19 +38575,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteLoadBalancerListeners", av[i])) { + if (!strcmp("ReadRouteTables", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_load_balancer_listeners_arg a = {0}; - struct osc_delete_load_balancer_listeners_arg *s = &a; + struct osc_read_route_tables_arg a = {0}; + struct osc_read_route_tables_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_load_balancer_listeners_arg: + read_route_tables_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -39203,7 +38606,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_load_balancer_listeners_arg; + goto read_route_tables_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -39233,59 +38636,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "LoadBalancerName argument missing\n"); - s->load_balancer_name = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_route_table_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_route_table_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else - if ((aret = argcmp(next_a, "LoadBalancerPorts")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerPorts argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string - TRY(!(dot_pos++), "LoadBalancerPorts argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "LoadBalancerPorts require an index\n"); - if (s->load_balancer_ports) { - for (; s->load_balancer_ports[last]; ++last); - } - if (pos < last) { - s->load_balancer_ports[pos] = atoi(aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->load_balancer_ports, 0, pa); - SET_NEXT(s->load_balancer_ports, atoi(aa), pa); - } - } else { - TRY(!aa, "LoadBalancerPorts argument missing\n"); - s->load_balancer_ports_str = aa; - } - } else if (!(aret = argcmp(str, "LoadBalancerPorts[]")) || aret == '=') { - TRY(!aa, "LoadBalancerPorts[] argument missing\n"); - SET_NEXT(s->load_balancer_ports, atoi(aa), pa); + } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'DeleteLoadBalancerListeners'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadRouteTables'\n", next_a); } i += incr; - goto delete_load_balancer_listeners_arg; + goto read_route_tables_arg; } - cret = osc_delete_load_balancer_listeners(&e, &r, &a); - TRY(cret, "fail to call DeleteLoadBalancerListeners: %s\n", curl_easy_strerror(cret)); + cret = osc_read_route_tables(&e, &r, &a); + TRY(cret, "fail to call ReadRouteTables: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -39312,19 +38715,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteLoadBalancer", av[i])) { + if (!strcmp("ReadSecretAccessKey", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_load_balancer_arg a = {0}; - struct osc_delete_load_balancer_arg *s = &a; + struct osc_read_secret_access_key_arg a = {0}; + struct osc_read_secret_access_key_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_load_balancer_arg: + read_secret_access_key_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -39343,7 +38746,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_load_balancer_arg; + goto read_secret_access_key_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -39357,6 +38760,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "AccessKeyId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "AccessKeyId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "AccessKeyId argument missing\n"); + s->access_key_id = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -39373,25 +38787,14 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "LoadBalancerName argument missing\n"); - s->load_balancer_name = aa; // string string - - } else { - BAD_RET("'%s' is not a valide argument for 'DeleteLoadBalancer'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadSecretAccessKey'\n", next_a); } i += incr; - goto delete_load_balancer_arg; + goto read_secret_access_key_arg; } - cret = osc_delete_load_balancer(&e, &r, &a); - TRY(cret, "fail to call DeleteLoadBalancer: %s\n", curl_easy_strerror(cret)); + cret = osc_read_secret_access_key(&e, &r, &a); + TRY(cret, "fail to call ReadSecretAccessKey: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -39418,19 +38821,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteListenerRule", av[i])) { + if (!strcmp("ReadSecurityGroups", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_listener_rule_arg a = {0}; - struct osc_delete_listener_rule_arg *s = &a; + struct osc_read_security_groups_arg a = {0}; + struct osc_read_security_groups_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_listener_rule_arg: + read_security_groups_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -39449,7 +38852,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_listener_rule_arg; + goto read_security_groups_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -39479,25 +38882,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "ListenerRuleName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ListenerRuleName argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ListenerRuleName argument missing\n"); - s->listener_rule_name = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_security_group_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_security_group_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteListenerRule'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadSecurityGroups'\n", next_a); } i += incr; - goto delete_listener_rule_arg; + goto read_security_groups_arg; } - cret = osc_delete_listener_rule(&e, &r, &a); - TRY(cret, "fail to call DeleteListenerRule: %s\n", curl_easy_strerror(cret)); + cret = osc_read_security_groups(&e, &r, &a); + TRY(cret, "fail to call ReadSecurityGroups: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -39524,19 +38961,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteKeypair", av[i])) { + if (!strcmp("ReadServerCertificates", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_keypair_arg a = {0}; - struct osc_delete_keypair_arg *s = &a; + struct osc_read_server_certificates_arg a = {0}; + struct osc_read_server_certificates_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_keypair_arg: + read_server_certificates_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -39555,7 +38992,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_keypair_arg; + goto read_server_certificates_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -39585,25 +39022,37 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "KeypairName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "KeypairName argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "KeypairName argument missing\n"); - s->keypair_name = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_server_certificate_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_server_certificate_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else { - BAD_RET("'%s' is not a valide argument for 'DeleteKeypair'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadServerCertificates'\n", next_a); } i += incr; - goto delete_keypair_arg; + goto read_server_certificates_arg; } - cret = osc_delete_keypair(&e, &r, &a); - TRY(cret, "fail to call DeleteKeypair: %s\n", curl_easy_strerror(cret)); + cret = osc_read_server_certificates(&e, &r, &a); + TRY(cret, "fail to call ReadServerCertificates: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -39630,19 +39079,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteInternetService", av[i])) { + if (!strcmp("ReadSnapshotExportTasks", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_internet_service_arg a = {0}; - struct osc_delete_internet_service_arg *s = &a; + struct osc_read_snapshot_export_tasks_arg a = {0}; + struct osc_read_snapshot_export_tasks_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_internet_service_arg: + read_snapshot_export_tasks_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -39661,7 +39110,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_internet_service_arg; + goto read_snapshot_export_tasks_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -39691,25 +39140,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "InternetServiceId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "InternetServiceId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "InternetServiceId argument missing\n"); - s->internet_service_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_export_task_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_export_task_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteInternetService'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadSnapshotExportTasks'\n", next_a); } i += incr; - goto delete_internet_service_arg; + goto read_snapshot_export_tasks_arg; } - cret = osc_delete_internet_service(&e, &r, &a); - TRY(cret, "fail to call DeleteInternetService: %s\n", curl_easy_strerror(cret)); + cret = osc_read_snapshot_export_tasks(&e, &r, &a); + TRY(cret, "fail to call ReadSnapshotExportTasks: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -39736,19 +39219,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteImage", av[i])) { + if (!strcmp("ReadSnapshots", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_image_arg a = {0}; - struct osc_delete_image_arg *s = &a; + struct osc_read_snapshots_arg a = {0}; + struct osc_read_snapshots_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_image_arg: + read_snapshots_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -39767,7 +39250,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_image_arg; + goto read_snapshots_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -39797,25 +39280,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "ImageId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ImageId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ImageId argument missing\n"); - s->image_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_snapshot_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_snapshot_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteImage'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadSnapshots'\n", next_a); } i += incr; - goto delete_image_arg; + goto read_snapshots_arg; } - cret = osc_delete_image(&e, &r, &a); - TRY(cret, "fail to call DeleteImage: %s\n", curl_easy_strerror(cret)); + cret = osc_read_snapshots(&e, &r, &a); + TRY(cret, "fail to call ReadSnapshots: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -39842,19 +39359,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteFlexibleGpu", av[i])) { + if (!strcmp("ReadSubnets", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_flexible_gpu_arg a = {0}; - struct osc_delete_flexible_gpu_arg *s = &a; + struct osc_read_subnets_arg a = {0}; + struct osc_read_subnets_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_flexible_gpu_arg: + read_subnets_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -39873,7 +39390,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_flexible_gpu_arg; + goto read_subnets_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -39890,38 +39407,72 @@ int main(int ac, char **av) if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Filters argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_subnet_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_subnet_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "FlexibleGpuId")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string + + } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "FlexibleGpuId argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "FlexibleGpuId argument missing\n"); - s->flexible_gpu_id = aa; // string string - + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'DeleteFlexibleGpu'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadSubnets'\n", next_a); } i += incr; - goto delete_flexible_gpu_arg; + goto read_subnets_arg; } - cret = osc_delete_flexible_gpu(&e, &r, &a); - TRY(cret, "fail to call DeleteFlexibleGpu: %s\n", curl_easy_strerror(cret)); + cret = osc_read_subnets(&e, &r, &a); + TRY(cret, "fail to call ReadSubnets: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -39948,19 +39499,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteExportTask", av[i])) { + if (!strcmp("ReadSubregions", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_export_task_arg a = {0}; - struct osc_delete_export_task_arg *s = &a; + struct osc_read_subregions_arg a = {0}; + struct osc_read_subregions_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_export_task_arg: + read_subregions_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -39979,7 +39530,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_export_task_arg; + goto read_subregions_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -40009,25 +39560,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "ExportTaskId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ExportTaskId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ExportTaskId argument missing\n"); - s->export_task_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_subregion_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_subregion_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteExportTask'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadSubregions'\n", next_a); } i += incr; - goto delete_export_task_arg; + goto read_subregions_arg; } - cret = osc_delete_export_task(&e, &r, &a); - TRY(cret, "fail to call DeleteExportTask: %s\n", curl_easy_strerror(cret)); + cret = osc_read_subregions(&e, &r, &a); + TRY(cret, "fail to call ReadSubregions: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -40054,19 +39639,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteDirectLinkInterface", av[i])) { + if (!strcmp("ReadTags", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_direct_link_interface_arg a = {0}; - struct osc_delete_direct_link_interface_arg *s = &a; + struct osc_read_tags_arg a = {0}; + struct osc_read_tags_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_direct_link_interface_arg: + read_tags_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -40085,7 +39670,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_direct_link_interface_arg; + goto read_tags_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -40099,17 +39684,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DirectLinkInterfaceId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DirectLinkInterfaceId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "DirectLinkInterfaceId argument missing\n"); - s->direct_link_interface_id = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -40126,14 +39700,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Filters argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_tag_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_tag_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string + + } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteDirectLinkInterface'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadTags'\n", next_a); } i += incr; - goto delete_direct_link_interface_arg; + goto read_tags_arg; } - cret = osc_delete_direct_link_interface(&e, &r, &a); - TRY(cret, "fail to call DeleteDirectLinkInterface: %s\n", curl_easy_strerror(cret)); + cret = osc_read_tags(&e, &r, &a); + TRY(cret, "fail to call ReadTags: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -40160,19 +39779,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteDirectLink", av[i])) { + if (!strcmp("ReadUnitPrice", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_direct_link_arg a = {0}; - struct osc_delete_direct_link_arg *s = &a; + struct osc_read_unit_price_arg a = {0}; + struct osc_read_unit_price_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_direct_link_arg: + read_unit_price_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -40191,7 +39810,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_direct_link_arg; + goto read_unit_price_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -40205,41 +39824,47 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DirectLinkId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Operation")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DirectLinkId argument missing\n"); + TRY((!*eq_ptr), "Operation argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "DirectLinkId argument missing\n"); - s->direct_link_id = aa; // string string + TRY(!aa, "Operation argument missing\n"); + s->operation = aa; // string string } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Service")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "Service argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else + TRY(!aa, "Service argument missing\n"); + s->service = aa; // string string + + } else + if ((aret = argcmp(next_a, "Type")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Type argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Type argument missing\n"); + s->type = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteDirectLink'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadUnitPrice'\n", next_a); } i += incr; - goto delete_direct_link_arg; + goto read_unit_price_arg; } - cret = osc_delete_direct_link(&e, &r, &a); - TRY(cret, "fail to call DeleteDirectLink: %s\n", curl_easy_strerror(cret)); + cret = osc_read_unit_price(&e, &r, &a); + TRY(cret, "fail to call ReadUnitPrice: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -40266,19 +39891,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteDhcpOptions", av[i])) { + if (!strcmp("ReadUserGroupPolicies", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_dhcp_options_arg a = {0}; - struct osc_delete_dhcp_options_arg *s = &a; + struct osc_read_user_group_policies_arg a = {0}; + struct osc_read_user_group_policies_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_dhcp_options_arg: + read_user_group_policies_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -40297,7 +39922,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_dhcp_options_arg; + goto read_user_group_policies_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -40311,41 +39936,74 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DhcpOptionsSetId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DryRun argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "FirstItem argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "FirstItem argument missing\n"); + s->is_set_first_item = 1; + s->first_item = atoll(aa); + } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DhcpOptionsSetId argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "DhcpOptionsSetId argument missing\n"); - s->dhcp_options_set_id = aa; // string string + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else + if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserGroupName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserGroupName argument missing\n"); + s->user_group_name = aa; // string string } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserGroupPath")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "UserGroupPath argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else + TRY(!aa, "UserGroupPath argument missing\n"); + s->user_group_path = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteDhcpOptions'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadUserGroupPolicies'\n", next_a); } i += incr; - goto delete_dhcp_options_arg; + goto read_user_group_policies_arg; } - cret = osc_delete_dhcp_options(&e, &r, &a); - TRY(cret, "fail to call DeleteDhcpOptions: %s\n", curl_easy_strerror(cret)); + cret = osc_read_user_group_policies(&e, &r, &a); + TRY(cret, "fail to call ReadUserGroupPolicies: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -40372,19 +40030,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteDedicatedGroup", av[i])) { + if (!strcmp("ReadUserGroupPolicy", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_dedicated_group_arg a = {0}; - struct osc_delete_dedicated_group_arg *s = &a; + struct osc_read_user_group_policy_arg a = {0}; + struct osc_read_user_group_policy_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_dedicated_group_arg: + read_user_group_policy_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -40403,7 +40061,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_dedicated_group_arg; + goto read_user_group_policy_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -40417,17 +40075,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DedicatedGroupId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DedicatedGroupId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "DedicatedGroupId argument missing\n"); - s->dedicated_group_id = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -40444,30 +40091,47 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Force")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PolicyName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Force argument missing\n"); + TRY((!*eq_ptr), "PolicyName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_force = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->force = 1; - } else if (!strcasecmp(aa, "false")) { - s->force = 0; - } else { - BAD_RET("Force require true/false\n"); - } - } else + TRY(!aa, "PolicyName argument missing\n"); + s->policy_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserGroupName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserGroupName argument missing\n"); + s->user_group_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "UserGroupPath")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserGroupPath argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserGroupPath argument missing\n"); + s->user_group_path = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteDedicatedGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadUserGroupPolicy'\n", next_a); } i += incr; - goto delete_dedicated_group_arg; + goto read_user_group_policy_arg; } - cret = osc_delete_dedicated_group(&e, &r, &a); - TRY(cret, "fail to call DeleteDedicatedGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_read_user_group_policy(&e, &r, &a); + TRY(cret, "fail to call ReadUserGroupPolicy: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -40494,19 +40158,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteClientGateway", av[i])) { + if (!strcmp("ReadUserGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_client_gateway_arg a = {0}; - struct osc_delete_client_gateway_arg *s = &a; + struct osc_read_user_group_arg a = {0}; + struct osc_read_user_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_client_gateway_arg: + read_user_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -40525,7 +40189,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_client_gateway_arg; + goto read_user_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -40539,17 +40203,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "ClientGatewayId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ClientGatewayId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ClientGatewayId argument missing\n"); - s->client_gateway_id = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -40566,14 +40219,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else + if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Path argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Path argument missing\n"); + s->path = aa; // string string + + } else + if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserGroupName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserGroupName argument missing\n"); + s->user_group_name = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteClientGateway'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadUserGroup'\n", next_a); } i += incr; - goto delete_client_gateway_arg; + goto read_user_group_arg; } - cret = osc_delete_client_gateway(&e, &r, &a); - TRY(cret, "fail to call DeleteClientGateway: %s\n", curl_easy_strerror(cret)); + cret = osc_read_user_group(&e, &r, &a); + TRY(cret, "fail to call ReadUserGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -40600,19 +40275,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteCa", av[i])) { + if (!strcmp("ReadUserGroupsPerUser", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_ca_arg a = {0}; - struct osc_delete_ca_arg *s = &a; + struct osc_read_user_groups_per_user_arg a = {0}; + struct osc_read_user_groups_per_user_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_ca_arg: + read_user_groups_per_user_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -40631,7 +40306,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_ca_arg; + goto read_user_groups_per_user_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -40645,17 +40320,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "CaId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "CaId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "CaId argument missing\n"); - s->ca_id = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -40672,14 +40336,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else + if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserName argument missing\n"); + s->user_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "UserPath")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserPath argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserPath argument missing\n"); + s->user_path = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteCa'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadUserGroupsPerUser'\n", next_a); } i += incr; - goto delete_ca_arg; + goto read_user_groups_per_user_arg; } - cret = osc_delete_ca(&e, &r, &a); - TRY(cret, "fail to call DeleteCa: %s\n", curl_easy_strerror(cret)); + cret = osc_read_user_groups_per_user(&e, &r, &a); + TRY(cret, "fail to call ReadUserGroupsPerUser: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -40706,19 +40392,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteApiAccessRule", av[i])) { + if (!strcmp("ReadUserGroups", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_api_access_rule_arg a = {0}; - struct osc_delete_api_access_rule_arg *s = &a; + struct osc_read_user_groups_arg a = {0}; + struct osc_read_user_groups_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_api_access_rule_arg: + read_user_groups_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -40737,7 +40423,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_api_access_rule_arg; + goto read_user_groups_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -40751,41 +40437,75 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "ApiAccessRuleId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DryRun argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Filters argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_user_group_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_user_group_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ApiAccessRuleId argument missing\n"); + TRY((!*eq_ptr), "FirstItem argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ApiAccessRuleId argument missing\n"); - s->api_access_rule_id = aa; // string string - + TRY(!aa, "FirstItem argument missing\n"); + s->is_set_first_item = 1; + s->first_item = atoll(aa); } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'DeleteApiAccessRule'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadUserGroups'\n", next_a); } i += incr; - goto delete_api_access_rule_arg; + goto read_user_groups_arg; } - cret = osc_delete_api_access_rule(&e, &r, &a); - TRY(cret, "fail to call DeleteApiAccessRule: %s\n", curl_easy_strerror(cret)); + cret = osc_read_user_groups(&e, &r, &a); + TRY(cret, "fail to call ReadUserGroups: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -40812,19 +40532,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("DeleteAccessKey", av[i])) { + if (!strcmp("ReadUsers", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_delete_access_key_arg a = {0}; - struct osc_delete_access_key_arg *s = &a; + struct osc_read_users_arg a = {0}; + struct osc_read_users_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - delete_access_key_arg: + read_users_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -40843,7 +40563,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto delete_access_key_arg; + goto read_users_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -40857,17 +40577,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "AccessKeyId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "AccessKeyId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "AccessKeyId argument missing\n"); - s->access_key_id = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -40884,25 +40593,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserName argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserName argument missing\n"); - s->user_name = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_users_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_users_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "FirstItem")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "FirstItem argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "FirstItem argument missing\n"); + s->is_set_first_item = 1; + s->first_item = atoll(aa); + } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'DeleteAccessKey'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadUsers'\n", next_a); } i += incr; - goto delete_access_key_arg; + goto read_users_arg; } - cret = osc_delete_access_key(&e, &r, &a); - TRY(cret, "fail to call DeleteAccessKey: %s\n", curl_easy_strerror(cret)); + cret = osc_read_users(&e, &r, &a); + TRY(cret, "fail to call ReadUsers: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -40929,19 +40672,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateVpnConnectionRoute", av[i])) { + if (!strcmp("ReadVirtualGateways", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_vpn_connection_route_arg a = {0}; - struct osc_create_vpn_connection_route_arg *s = &a; + struct osc_read_virtual_gateways_arg a = {0}; + struct osc_read_virtual_gateways_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_vpn_connection_route_arg: + read_virtual_gateways_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -40960,7 +40703,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_vpn_connection_route_arg; + goto read_virtual_gateways_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -40974,17 +40717,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DestinationIpRange")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DestinationIpRange argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "DestinationIpRange argument missing\n"); - s->destination_ip_range = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -41001,25 +40733,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "VpnConnectionId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VpnConnectionId argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VpnConnectionId argument missing\n"); - s->vpn_connection_id = aa; // string string + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_virtual_gateway_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_virtual_gateway_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NextPageToken argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'CreateVpnConnectionRoute'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadVirtualGateways'\n", next_a); } i += incr; - goto create_vpn_connection_route_arg; + goto read_virtual_gateways_arg; } - cret = osc_create_vpn_connection_route(&e, &r, &a); - TRY(cret, "fail to call CreateVpnConnectionRoute: %s\n", curl_easy_strerror(cret)); + cret = osc_read_virtual_gateways(&e, &r, &a); + TRY(cret, "fail to call ReadVirtualGateways: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -41046,19 +40812,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateVpnConnection", av[i])) { + if (!strcmp("ReadVmGroups", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_vpn_connection_arg a = {0}; - struct osc_create_vpn_connection_arg *s = &a; + struct osc_read_vm_groups_arg a = {0}; + struct osc_read_vm_groups_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_vpn_connection_arg: + read_vm_groups_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -41077,7 +40843,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_vpn_connection_arg; + goto read_vm_groups_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -41091,28 +40857,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "ClientGatewayId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ClientGatewayId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ClientGatewayId argument missing\n"); - s->client_gateway_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "ConnectionType")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ConnectionType argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ConnectionType argument missing\n"); - s->connection_type = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -41129,41 +40873,37 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "StaticRoutesOnly")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "StaticRoutesOnly argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_static_routes_only = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->static_routes_only = 1; - } else if (!strcasecmp(aa, "false")) { - s->static_routes_only = 0; + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_vm_group_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_vm_group_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; } else { - BAD_RET("StaticRoutesOnly require true/false\n"); + s->filters_str = aa; } - } else - if ((aret = argcmp(next_a, "VirtualGatewayId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "VirtualGatewayId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "VirtualGatewayId argument missing\n"); - s->virtual_gateway_id = aa; // string string - } else { - BAD_RET("'%s' is not a valide argument for 'CreateVpnConnection'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadVmGroups'\n", next_a); } i += incr; - goto create_vpn_connection_arg; + goto read_vm_groups_arg; } - cret = osc_create_vpn_connection(&e, &r, &a); - TRY(cret, "fail to call CreateVpnConnection: %s\n", curl_easy_strerror(cret)); + cret = osc_read_vm_groups(&e, &r, &a); + TRY(cret, "fail to call ReadVmGroups: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -41190,19 +40930,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateVolume", av[i])) { + if (!strcmp("ReadVmTemplates", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_volume_arg a = {0}; - struct osc_create_volume_arg *s = &a; + struct osc_read_vm_templates_arg a = {0}; + struct osc_read_vm_templates_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_volume_arg: + read_vm_templates_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -41221,7 +40961,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_volume_arg; + goto read_vm_templates_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -41251,69 +40991,37 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Iops")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Iops argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Iops argument missing\n"); - s->is_set_iops = 1; - s->iops = atoll(aa); - } else - if ((aret = argcmp(next_a, "Size")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Size argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Size argument missing\n"); - s->is_set_size = 1; - s->size = atoll(aa); - } else - if ((aret = argcmp(next_a, "SnapshotId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SnapshotId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "SnapshotId argument missing\n"); - s->snapshot_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "SubregionName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SubregionName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "SubregionName argument missing\n"); - s->subregion_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "VolumeType")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VolumeType argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VolumeType argument missing\n"); - s->volume_type = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_vm_template_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_vm_template_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else { - BAD_RET("'%s' is not a valide argument for 'CreateVolume'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadVmTemplates'\n", next_a); } i += incr; - goto create_volume_arg; + goto read_vm_templates_arg; } - cret = osc_create_volume(&e, &r, &a); - TRY(cret, "fail to call CreateVolume: %s\n", curl_easy_strerror(cret)); + cret = osc_read_vm_templates(&e, &r, &a); + TRY(cret, "fail to call ReadVmTemplates: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -41340,19 +41048,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateVms", av[i])) { + if (!strcmp("ReadVmTypes", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_vms_arg a = {0}; - struct osc_create_vms_arg *s = &a; + struct osc_read_vm_types_arg a = {0}; + struct osc_read_vm_types_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_vms_arg: + read_vm_types_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -41371,7 +41079,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_vms_arg; + goto read_vm_types_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -41379,397 +41087,221 @@ int main(int ac, char **av) char *str = next_a; char *aa = i + 2 < ac ? av[i + 2] : 0; int aret = 0; - int incr = aa ? 2 : 1; - - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "BlockDeviceMappings")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "BlockDeviceMappings argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; - - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'BlockDeviceMappings' require an index (example array ref BlockDeviceMappingVmCreation.BlockDeviceMappings.0)\n"); - else if (*endptr != '.') - BAD_RET("'BlockDeviceMappings' require a .\n"); - TRY_ALLOC_AT(s,block_device_mappings, pa, pos, sizeof(*s->block_device_mappings)); - cascade_struct = &s->block_device_mappings[pos]; - cascade_parser = block_device_mapping_vm_creation_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(block_device_mapping_vm_creation_parser(&s->block_device_mappings[pos], endptr + 1, aa, pa)); - } else { - TRY(!aa, "BlockDeviceMappings argument missing\n"); - s->block_device_mappings_str = aa; // array ref BlockDeviceMappingVmCreation ref - } - } else - if ((aret = argcmp(next_a, "BootOnCreation")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "BootOnCreation argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_boot_on_creation = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->boot_on_creation = 1; - } else if (!strcasecmp(aa, "false")) { - s->boot_on_creation = 0; - } else { - BAD_RET("BootOnCreation require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "BsuOptimized")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "BsuOptimized argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_bsu_optimized = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->bsu_optimized = 1; - } else if (!strcasecmp(aa, "false")) { - s->bsu_optimized = 0; - } else { - BAD_RET("BsuOptimized require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "ClientToken")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ClientToken argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ClientToken argument missing\n"); - s->client_token = aa; // string string - - } else - if ((aret = argcmp(next_a, "DeletionProtection")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DeletionProtection argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_deletion_protection = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->deletion_protection = 1; - } else if (!strcasecmp(aa, "false")) { - s->deletion_protection = 0; - } else { - BAD_RET("DeletionProtection require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "ImageId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ImageId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ImageId argument missing\n"); - s->image_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "KeypairName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "KeypairName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "KeypairName argument missing\n"); - s->keypair_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "MaxVmsCount")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "MaxVmsCount argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "MaxVmsCount argument missing\n"); - s->is_set_max_vms_count = 1; - s->max_vms_count = atoll(aa); - } else - if ((aret = argcmp(next_a, "MinVmsCount")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "MinVmsCount argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "MinVmsCount argument missing\n"); - s->is_set_min_vms_count = 1; - s->min_vms_count = atoll(aa); - } else - if ((aret = argcmp(next_a, "NestedVirtualization")) == 0 || aret == '=' || aret == '.') { + int incr = aa ? 2 : 1; + + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NestedVirtualization argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_nested_virtualization = 1; + s->is_set_dry_run = 1; if (!aa || !strcasecmp(aa, "true")) { - s->nested_virtualization = 1; + s->dry_run = 1; } else if (!strcasecmp(aa, "false")) { - s->nested_virtualization = 0; + s->dry_run = 0; } else { - BAD_RET("NestedVirtualization require true/false\n"); + BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Nics")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Nics argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; - - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Nics' require an index (example array ref NicForVmCreation.Nics.0)\n"); - else if (*endptr != '.') - BAD_RET("'Nics' require a .\n"); - TRY_ALLOC_AT(s,nics, pa, pos, sizeof(*s->nics)); - cascade_struct = &s->nics[pos]; - cascade_parser = nic_for_vm_creation_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(nic_for_vm_creation_parser(&s->nics[pos], endptr + 1, aa, pa)); - } else { - TRY(!aa, "Nics argument missing\n"); - s->nics_str = aa; // array ref NicForVmCreation ref - } - } else - if ((aret = argcmp(next_a, "Performance")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Performance argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Performance argument missing\n"); - s->performance = aa; // string string - - } else - if ((aret = argcmp(next_a, "Placement")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Placement argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } char *dot_pos; - TRY(!aa, "Placement argument missing\n"); + TRY(!aa, "Filters argument missing\n"); dot_pos = strchr(str, '.'); if (dot_pos++) { - cascade_struct = &s->placement; - cascade_parser = placement_parser; + cascade_struct = &s->filters; + cascade_parser = filters_vm_type_parser; if (*dot_pos == '.') { ++dot_pos; } - STRY(placement_parser(&s->placement, dot_pos, aa, pa)); - s->is_set_placement = 1; + STRY(filters_vm_type_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; } else { - s->placement_str = aa; + s->filters_str = aa; } } else - if ((aret = argcmp(next_a, "PrivateIps")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PrivateIps argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string - TRY(!(dot_pos++), "PrivateIps argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "PrivateIps require an index\n"); - if (s->private_ips) { - for (; s->private_ips[last]; ++last); - } - if (pos < last) { - s->private_ips[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->private_ips, "", pa); - SET_NEXT(s->private_ips, (aa), pa); - } - } else { - TRY(!aa, "PrivateIps argument missing\n"); - s->private_ips_str = aa; - } - } else if (!(aret = argcmp(str, "PrivateIps[]")) || aret == '=') { - TRY(!aa, "PrivateIps[] argument missing\n"); - SET_NEXT(s->private_ips, (aa), pa); } else - if ((aret = argcmp(next_a, "SecurityGroupIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupIds argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "SecurityGroupIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "SecurityGroupIds require an index\n"); - if (s->security_group_ids) { - for (; s->security_group_ids[last]; ++last); - } - if (pos < last) { - s->security_group_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->security_group_ids, "", pa); - SET_NEXT(s->security_group_ids, (aa), pa); - } - } else { - TRY(!aa, "SecurityGroupIds argument missing\n"); - s->security_group_ids_str = aa; - } - } else if (!(aret = argcmp(str, "SecurityGroupIds[]")) || aret == '=') { - TRY(!aa, "SecurityGroupIds[] argument missing\n"); - SET_NEXT(s->security_group_ids, (aa), pa); + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else - if ((aret = argcmp(next_a, "SecurityGroups")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroups argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + { + BAD_RET("'%s' is not a valide argument for 'ReadVmTypes'\n", next_a); + } + i += incr; + goto read_vm_types_arg; + } + cret = osc_read_vm_types(&e, &r, &a); + TRY(cret, "fail to call ReadVmTypes: %s\n", curl_easy_strerror(cret)); + CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); + jobj = NULL; + if (program_flag & OAPI_RAW_OUTPUT) + puts(r.buf); + else { + jobj = json_tokener_parse(r.buf); + puts(json_object_to_json_string_ext(jobj, + JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | + color_flag)); + } + while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { + ++i; + TRY(i + 1 >= ac, "--set-var require an argument"); + if (!jobj) + jobj = json_tokener_parse(r.buf); + if (parse_variable(jobj, av, ac, i)) + return -1; + ++i; + } - TRY(!(dot_pos++), "SecurityGroups argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "SecurityGroups require an index\n"); - if (s->security_groups) { - for (; s->security_groups[last]; ++last); - } - if (pos < last) { - s->security_groups[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->security_groups, "", pa); - SET_NEXT(s->security_groups, (aa), pa); - } - } else { - TRY(!aa, "SecurityGroups argument missing\n"); - s->security_groups_str = aa; - } - } else if (!(aret = argcmp(str, "SecurityGroups[]")) || aret == '=') { - TRY(!aa, "SecurityGroups[] argument missing\n"); - SET_NEXT(s->security_groups, (aa), pa); - } else - if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SubnetId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "SubnetId argument missing\n"); - s->subnet_id = aa; // string string + if (jobj) { + json_object_put(jobj); + jobj = NULL; + } + osc_deinit_str(&r); + } else + if (!strcmp("ReadVmsHealth", av[i])) { + auto_osc_json_c json_object *jobj = NULL; + auto_ptr_array struct ptr_array opa = {0}; + struct ptr_array *pa = &opa; + struct osc_read_vms_health_arg a = {0}; + struct osc_read_vms_health_arg *s = &a; + __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; + int cret; - } else - if ((aret = argcmp(next_a, "UserData")) == 0 || aret == '=' || aret == '.') { + cascade_struct = NULL; + cascade_parser = NULL; + + read_vms_health_arg: + + if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { + char *next_a = &av[i + 1][2]; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int incr = 2; + char *eq_ptr = strchr(next_a, '='); + + CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); + if (eq_ptr) { + CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); + incr = 1; + aa = eq_ptr + 1; + } else { + CHK_BAD_RET(!aa, "cascade need an argument\n"); + META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) + } + STRY(cascade_parser(cascade_struct, next_a, aa, pa)); + i += incr; + goto read_vms_health_arg; + } + + if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { + char *next_a = &av[i + 1][2]; + char *str = next_a; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int aret = 0; + int incr = aa ? 2 : 1; + + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } + if ((aret = argcmp(next_a, "BackendVmIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserData argument missing\n"); + TRY((!*eq_ptr), "BackendVmIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserData argument missing\n"); - s->user_data = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "BackendVmIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "BackendVmIds require an index\n"); + if (s->backend_vm_ids) { + for (; s->backend_vm_ids[last]; ++last); + } + if (pos < last) { + s->backend_vm_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->backend_vm_ids, "", pa); + SET_NEXT(s->backend_vm_ids, (aa), pa); + } + } else { + TRY(!aa, "BackendVmIds argument missing\n"); + s->backend_vm_ids_str = aa; + } + } else if (!(aret = argcmp(str, "BackendVmIds[]")) || aret == '=') { + TRY(!aa, "BackendVmIds[] argument missing\n"); + SET_NEXT(s->backend_vm_ids, (aa), pa); } else - if ((aret = argcmp(next_a, "VmInitiatedShutdownBehavior")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmInitiatedShutdownBehavior argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmInitiatedShutdownBehavior argument missing\n"); - s->vm_initiated_shutdown_behavior = aa; // string string - - } else - if ((aret = argcmp(next_a, "VmType")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmType argument missing\n"); + TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmType argument missing\n"); - s->vm_type = aa; // string string + TRY(!aa, "LoadBalancerName argument missing\n"); + s->load_balancer_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateVms'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadVmsHealth'\n", next_a); } i += incr; - goto create_vms_arg; + goto read_vms_health_arg; } - cret = osc_create_vms(&e, &r, &a); - TRY(cret, "fail to call CreateVms: %s\n", curl_easy_strerror(cret)); + cret = osc_read_vms_health(&e, &r, &a); + TRY(cret, "fail to call ReadVmsHealth: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -41796,19 +41328,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateVmTemplate", av[i])) { + if (!strcmp("ReadVms", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_vm_template_arg a = {0}; - struct osc_create_vm_template_arg *s = &a; + struct osc_read_vms_arg a = {0}; + struct osc_read_vms_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_vm_template_arg: + read_vms_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -41827,7 +41359,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_vm_template_arg; + goto read_vms_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -41841,50 +41373,162 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "CpuCores")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "CpuCores argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "CpuCores argument missing\n"); - s->is_set_cpu_cores = 1; - s->cpu_cores = atoll(aa); - } else - if ((aret = argcmp(next_a, "CpuGeneration")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "CpuGeneration argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "CpuGeneration argument missing\n"); - s->cpu_generation = aa; // string string + char *dot_pos; + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_vm_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_vm_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else - if ((aret = argcmp(next_a, "CpuPerformance")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "CpuPerformance argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "CpuPerformance argument missing\n"); - s->cpu_performance = aa; // string string + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string - + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else + { + BAD_RET("'%s' is not a valide argument for 'ReadVms'\n", next_a); + } + i += incr; + goto read_vms_arg; + } + cret = osc_read_vms(&e, &r, &a); + TRY(cret, "fail to call ReadVms: %s\n", curl_easy_strerror(cret)); + CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); + jobj = NULL; + if (program_flag & OAPI_RAW_OUTPUT) + puts(r.buf); + else { + jobj = json_tokener_parse(r.buf); + puts(json_object_to_json_string_ext(jobj, + JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | + color_flag)); + } + while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { + ++i; + TRY(i + 1 >= ac, "--set-var require an argument"); + if (!jobj) + jobj = json_tokener_parse(r.buf); + if (parse_variable(jobj, av, ac, i)) + return -1; + ++i; + } + + if (jobj) { + json_object_put(jobj); + jobj = NULL; + } + osc_deinit_str(&r); + } else + if (!strcmp("ReadVmsState", av[i])) { + auto_osc_json_c json_object *jobj = NULL; + auto_ptr_array struct ptr_array opa = {0}; + struct ptr_array *pa = &opa; + struct osc_read_vms_state_arg a = {0}; + struct osc_read_vms_state_arg *s = &a; + __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; + int cret; + + cascade_struct = NULL; + cascade_parser = NULL; + + read_vms_state_arg: + + if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { + char *next_a = &av[i + 1][2]; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int incr = 2; + char *eq_ptr = strchr(next_a, '='); + + CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); + if (eq_ptr) { + CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); + incr = 1; + aa = eq_ptr + 1; + } else { + CHK_BAD_RET(!aa, "cascade need an argument\n"); + META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) + } + STRY(cascade_parser(cascade_struct, next_a, aa, pa)); + i += incr; + goto read_vms_state_arg; + } + + if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { + char *next_a = &av[i + 1][2]; + char *str = next_a; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int aret = 0; + int incr = aa ? 2 : 1; + + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } + if ((aret = argcmp(next_a, "AllVms")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "AllVms argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_all_vms = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->all_vms = 1; + } else if (!strcasecmp(aa, "false")) { + s->all_vms = 0; + } else { + BAD_RET("AllVms require true/false\n"); + } + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -41901,89 +41545,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "ImageId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ImageId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ImageId argument missing\n"); - s->image_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "KeypairName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "KeypairName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "KeypairName argument missing\n"); - s->keypair_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "Ram")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Ram argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Ram argument missing\n"); - s->is_set_ram = 1; - s->ram = atoll(aa); + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_vms_state_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_vms_state_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } } else - if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Tags argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); - else if (*endptr != '.') - BAD_RET("'Tags' require a .\n"); - TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); - cascade_struct = &s->tags[pos]; - cascade_parser = resource_tag_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); - } else { - TRY(!aa, "Tags argument missing\n"); - s->tags_str = aa; // array ref ResourceTag ref - } } else - if ((aret = argcmp(next_a, "VmTemplateName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmTemplateName argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmTemplateName argument missing\n"); - s->vm_template_name = aa; // string string - + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'CreateVmTemplate'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadVmsState'\n", next_a); } i += incr; - goto create_vm_template_arg; + goto read_vms_state_arg; } - cret = osc_create_vm_template(&e, &r, &a); - TRY(cret, "fail to call CreateVmTemplate: %s\n", curl_easy_strerror(cret)); + cret = osc_read_vms_state(&e, &r, &a); + TRY(cret, "fail to call ReadVmsState: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -42010,19 +41624,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateVmGroup", av[i])) { + if (!strcmp("ReadVolumes", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_vm_group_arg a = {0}; - struct osc_create_vm_group_arg *s = &a; + struct osc_read_volumes_arg a = {0}; + struct osc_read_volumes_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_vm_group_arg: + read_volumes_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -42041,7 +41655,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_vm_group_arg; + goto read_volumes_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -42055,17 +41669,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -42082,134 +41685,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "PositioningStrategy")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PositioningStrategy argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "PositioningStrategy argument missing\n"); - s->positioning_strategy = aa; // string string - - } else - if ((aret = argcmp(next_a, "SecurityGroupIds")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupIds argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "SecurityGroupIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "SecurityGroupIds require an index\n"); - if (s->security_group_ids) { - for (; s->security_group_ids[last]; ++last); - } - if (pos < last) { - s->security_group_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->security_group_ids, "", pa); - SET_NEXT(s->security_group_ids, (aa), pa); - } - } else { - TRY(!aa, "SecurityGroupIds argument missing\n"); - s->security_group_ids_str = aa; - } - } else if (!(aret = argcmp(str, "SecurityGroupIds[]")) || aret == '=') { - TRY(!aa, "SecurityGroupIds[] argument missing\n"); - SET_NEXT(s->security_group_ids, (aa), pa); - } else - if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SubnetId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "SubnetId argument missing\n"); - s->subnet_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Tags argument missing\n"); + TRY((!*eq_ptr), "Filters argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; + char *dot_pos; - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); - else if (*endptr != '.') - BAD_RET("'Tags' require a .\n"); - TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); - cascade_struct = &s->tags[pos]; - cascade_parser = resource_tag_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_volume_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_volume_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; } else { - TRY(!aa, "Tags argument missing\n"); - s->tags_str = aa; // array ref ResourceTag ref - } - } else - if ((aret = argcmp(next_a, "VmCount")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "VmCount argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "VmCount argument missing\n"); - s->is_set_vm_count = 1; - s->vm_count = atoll(aa); + s->filters_str = aa; + } } else - if ((aret = argcmp(next_a, "VmGroupName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmGroupName argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmGroupName argument missing\n"); - s->vm_group_name = aa; // string string + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else - if ((aret = argcmp(next_a, "VmTemplateId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmTemplateId argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmTemplateId argument missing\n"); - s->vm_template_id = aa; // string string - + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'CreateVmGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadVolumes'\n", next_a); } i += incr; - goto create_vm_group_arg; + goto read_volumes_arg; } - cret = osc_create_vm_group(&e, &r, &a); - TRY(cret, "fail to call CreateVmGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_read_volumes(&e, &r, &a); + TRY(cret, "fail to call ReadVolumes: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -42236,19 +41764,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateVirtualGateway", av[i])) { + if (!strcmp("ReadVpnConnections", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_virtual_gateway_arg a = {0}; - struct osc_create_virtual_gateway_arg *s = &a; + struct osc_read_vpn_connections_arg a = {0}; + struct osc_read_vpn_connections_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_virtual_gateway_arg: + read_vpn_connections_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -42267,7 +41795,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_virtual_gateway_arg; + goto read_vpn_connections_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -42281,41 +41809,75 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "ConnectionType")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DryRun argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "Filters")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Filters argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos; + + TRY(!aa, "Filters argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->filters; + cascade_parser = filters_vpn_connection_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(filters_vpn_connection_parser(&s->filters, dot_pos, aa, pa)); + s->is_set_filters = 1; + } else { + s->filters_str = aa; + } + } else + if ((aret = argcmp(next_a, "NextPageToken")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ConnectionType argument missing\n"); + TRY((!*eq_ptr), "NextPageToken argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ConnectionType argument missing\n"); - s->connection_type = aa; // string string + TRY(!aa, "NextPageToken argument missing\n"); + s->next_page_token = aa; // string string } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ResultsPerPage")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "ResultsPerPage argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else + TRY(!aa, "ResultsPerPage argument missing\n"); + s->is_set_results_per_page = 1; + s->results_per_page = atoll(aa); + } else { - BAD_RET("'%s' is not a valide argument for 'CreateVirtualGateway'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ReadVpnConnections'\n", next_a); } i += incr; - goto create_virtual_gateway_arg; + goto read_vpn_connections_arg; } - cret = osc_create_virtual_gateway(&e, &r, &a); - TRY(cret, "fail to call CreateVirtualGateway: %s\n", curl_easy_strerror(cret)); + cret = osc_read_vpn_connections(&e, &r, &a); + TRY(cret, "fail to call ReadVpnConnections: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -42342,19 +41904,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateUserGroup", av[i])) { + if (!strcmp("RebootVms", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_user_group_arg a = {0}; - struct osc_create_user_group_arg *s = &a; + struct osc_reboot_vms_arg a = {0}; + struct osc_reboot_vms_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_user_group_arg: + reboot_vms_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -42373,7 +41935,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_user_group_arg; + goto reboot_vms_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -42403,36 +41965,48 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Path argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Path argument missing\n"); - s->path = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupName argument missing\n"); + TRY((!*eq_ptr), "VmIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserGroupName argument missing\n"); - s->user_group_name = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "VmIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "VmIds require an index\n"); + if (s->vm_ids) { + for (; s->vm_ids[last]; ++last); + } + if (pos < last) { + s->vm_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->vm_ids, "", pa); + SET_NEXT(s->vm_ids, (aa), pa); + } + } else { + TRY(!aa, "VmIds argument missing\n"); + s->vm_ids_str = aa; + } + } else if (!(aret = argcmp(str, "VmIds[]")) || aret == '=') { + TRY(!aa, "VmIds[] argument missing\n"); + SET_NEXT(s->vm_ids, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'CreateUserGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'RebootVms'\n", next_a); } i += incr; - goto create_user_group_arg; + goto reboot_vms_arg; } - cret = osc_create_user_group(&e, &r, &a); - TRY(cret, "fail to call CreateUserGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_reboot_vms(&e, &r, &a); + TRY(cret, "fail to call RebootVms: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -42459,19 +42033,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateUser", av[i])) { + if (!strcmp("RegisterVmsInLoadBalancer", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_user_arg a = {0}; - struct osc_create_user_arg *s = &a; + struct osc_register_vms_in_load_balancer_arg a = {0}; + struct osc_register_vms_in_load_balancer_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_user_arg: + register_vms_in_load_balancer_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -42490,7 +42064,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_user_arg; + goto register_vms_in_load_balancer_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -42504,6 +42078,40 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "BackendVmIds")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "BackendVmIds argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "BackendVmIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "BackendVmIds require an index\n"); + if (s->backend_vm_ids) { + for (; s->backend_vm_ids[last]; ++last); + } + if (pos < last) { + s->backend_vm_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->backend_vm_ids, "", pa); + SET_NEXT(s->backend_vm_ids, (aa), pa); + } + } else { + TRY(!aa, "BackendVmIds argument missing\n"); + s->backend_vm_ids_str = aa; + } + } else if (!(aret = argcmp(str, "BackendVmIds[]")) || aret == '=') { + TRY(!aa, "BackendVmIds[] argument missing\n"); + SET_NEXT(s->backend_vm_ids, (aa), pa); + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -42520,47 +42128,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Path argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Path argument missing\n"); - s->path = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserEmail")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "UserEmail argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "UserEmail argument missing\n"); - s->user_email = aa; // string string - - } else - if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserName argument missing\n"); + TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserName argument missing\n"); - s->user_name = aa; // string string + TRY(!aa, "LoadBalancerName argument missing\n"); + s->load_balancer_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateUser'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'RegisterVmsInLoadBalancer'\n", next_a); } i += incr; - goto create_user_arg; + goto register_vms_in_load_balancer_arg; } - cret = osc_create_user(&e, &r, &a); - TRY(cret, "fail to call CreateUser: %s\n", curl_easy_strerror(cret)); + cret = osc_register_vms_in_load_balancer(&e, &r, &a); + TRY(cret, "fail to call RegisterVmsInLoadBalancer: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -42587,19 +42173,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateTags", av[i])) { + if (!strcmp("RejectNetPeering", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_tags_arg a = {0}; - struct osc_create_tags_arg *s = &a; + struct osc_reject_net_peering_arg a = {0}; + struct osc_reject_net_peering_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_tags_arg: + reject_net_peering_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -42618,7 +42204,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_tags_arg; + goto reject_net_peering_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -42647,80 +42233,26 @@ int main(int ac, char **av) } else { BAD_RET("DryRun require true/false\n"); } - } else - if ((aret = argcmp(next_a, "ResourceIds")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ResourceIds argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "ResourceIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "ResourceIds require an index\n"); - if (s->resource_ids) { - for (; s->resource_ids[last]; ++last); - } - if (pos < last) { - s->resource_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->resource_ids, "", pa); - SET_NEXT(s->resource_ids, (aa), pa); - } - } else { - TRY(!aa, "ResourceIds argument missing\n"); - s->resource_ids_str = aa; - } - } else if (!(aret = argcmp(str, "ResourceIds[]")) || aret == '=') { - TRY(!aa, "ResourceIds[] argument missing\n"); - SET_NEXT(s->resource_ids, (aa), pa); - } else - if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Tags argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; - - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); - else if (*endptr != '.') - BAD_RET("'Tags' require a .\n"); - TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); - cascade_struct = &s->tags[pos]; - cascade_parser = resource_tag_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); - } else { - TRY(!aa, "Tags argument missing\n"); - s->tags_str = aa; // array ref ResourceTag ref - } + } else + if ((aret = argcmp(next_a, "NetPeeringId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NetPeeringId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NetPeeringId argument missing\n"); + s->net_peering_id = aa; // string string + } else { - BAD_RET("'%s' is not a valide argument for 'CreateTags'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'RejectNetPeering'\n", next_a); } i += incr; - goto create_tags_arg; + goto reject_net_peering_arg; } - cret = osc_create_tags(&e, &r, &a); - TRY(cret, "fail to call CreateTags: %s\n", curl_easy_strerror(cret)); + cret = osc_reject_net_peering(&e, &r, &a); + TRY(cret, "fail to call RejectNetPeering: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -42747,19 +42279,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateSubnet", av[i])) { + if (!strcmp("RemoveUserFromUserGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_subnet_arg a = {0}; - struct osc_create_subnet_arg *s = &a; + struct osc_remove_user_from_user_group_arg a = {0}; + struct osc_remove_user_from_user_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_subnet_arg: + remove_user_from_user_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -42778,7 +42310,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_subnet_arg; + goto remove_user_from_user_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -42808,47 +42340,58 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "IpRange")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "IpRange argument missing\n"); + TRY((!*eq_ptr), "UserGroupName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "IpRange argument missing\n"); - s->ip_range = aa; // string string + TRY(!aa, "UserGroupName argument missing\n"); + s->user_group_name = aa; // string string } else - if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserGroupPath")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NetId argument missing\n"); + TRY((!*eq_ptr), "UserGroupPath argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NetId argument missing\n"); - s->net_id = aa; // string string + TRY(!aa, "UserGroupPath argument missing\n"); + s->user_group_path = aa; // string string } else - if ((aret = argcmp(next_a, "SubregionName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SubregionName argument missing\n"); + TRY((!*eq_ptr), "UserName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SubregionName argument missing\n"); - s->subregion_name = aa; // string string + TRY(!aa, "UserName argument missing\n"); + s->user_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "UserPath")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserPath argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserPath argument missing\n"); + s->user_path = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateSubnet'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'RemoveUserFromUserGroup'\n", next_a); } i += incr; - goto create_subnet_arg; + goto remove_user_from_user_group_arg; } - cret = osc_create_subnet(&e, &r, &a); - TRY(cret, "fail to call CreateSubnet: %s\n", curl_easy_strerror(cret)); + cret = osc_remove_user_from_user_group(&e, &r, &a); + TRY(cret, "fail to call RemoveUserFromUserGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -42875,19 +42418,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateSnapshotExportTask", av[i])) { + if (!strcmp("ScaleDownVmGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_snapshot_export_task_arg a = {0}; - struct osc_create_snapshot_export_task_arg *s = &a; + struct osc_scale_down_vm_group_arg a = {0}; + struct osc_scale_down_vm_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_snapshot_export_task_arg: + scale_down_vm_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -42906,7 +42449,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_snapshot_export_task_arg; + goto scale_down_vm_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -42936,48 +42479,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "OsuExport")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmGroupId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "OsuExport argument missing\n"); + TRY((!*eq_ptr), "VmGroupId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "VmGroupId argument missing\n"); + s->vm_group_id = aa; // string string - TRY(!aa, "OsuExport argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->osu_export; - cascade_parser = osu_export_to_create_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(osu_export_to_create_parser(&s->osu_export, dot_pos, aa, pa)); - s->is_set_osu_export = 1; - } else { - s->osu_export_str = aa; - } } else - if ((aret = argcmp(next_a, "SnapshotId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmSubtraction")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SnapshotId argument missing\n"); + TRY((!*eq_ptr), "VmSubtraction argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SnapshotId argument missing\n"); - s->snapshot_id = aa; // string string - + TRY(!aa, "VmSubtraction argument missing\n"); + s->is_set_vm_subtraction = 1; + s->vm_subtraction = atoll(aa); } else { - BAD_RET("'%s' is not a valide argument for 'CreateSnapshotExportTask'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'ScaleDownVmGroup'\n", next_a); } i += incr; - goto create_snapshot_export_task_arg; + goto scale_down_vm_group_arg; } - cret = osc_create_snapshot_export_task(&e, &r, &a); - TRY(cret, "fail to call CreateSnapshotExportTask: %s\n", curl_easy_strerror(cret)); + cret = osc_scale_down_vm_group(&e, &r, &a); + TRY(cret, "fail to call ScaleDownVmGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -43004,19 +42535,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateSnapshot", av[i])) { + if (!strcmp("ScaleUpVmGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_snapshot_arg a = {0}; - struct osc_create_snapshot_arg *s = &a; + struct osc_scale_up_vm_group_arg a = {0}; + struct osc_scale_up_vm_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_snapshot_arg: + scale_up_vm_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -43035,7 +42566,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_snapshot_arg; + goto scale_up_vm_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -43049,17 +42580,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -43076,69 +42596,137 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "FileLocation")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "FileLocation argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "FileLocation argument missing\n"); - s->file_location = aa; // string string - - } else - if ((aret = argcmp(next_a, "SnapshotSize")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmAddition")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SnapshotSize argument missing\n"); + TRY((!*eq_ptr), "VmAddition argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SnapshotSize argument missing\n"); - s->is_set_snapshot_size = 1; - s->snapshot_size = atoll(aa); + TRY(!aa, "VmAddition argument missing\n"); + s->is_set_vm_addition = 1; + s->vm_addition = atoll(aa); } else - if ((aret = argcmp(next_a, "SourceRegionName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmGroupId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SourceRegionName argument missing\n"); + TRY((!*eq_ptr), "VmGroupId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SourceRegionName argument missing\n"); - s->source_region_name = aa; // string string + TRY(!aa, "VmGroupId argument missing\n"); + s->vm_group_id = aa; // string string } else - if ((aret = argcmp(next_a, "SourceSnapshotId")) == 0 || aret == '=' || aret == '.') { + { + BAD_RET("'%s' is not a valide argument for 'ScaleUpVmGroup'\n", next_a); + } + i += incr; + goto scale_up_vm_group_arg; + } + cret = osc_scale_up_vm_group(&e, &r, &a); + TRY(cret, "fail to call ScaleUpVmGroup: %s\n", curl_easy_strerror(cret)); + CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); + jobj = NULL; + if (program_flag & OAPI_RAW_OUTPUT) + puts(r.buf); + else { + jobj = json_tokener_parse(r.buf); + puts(json_object_to_json_string_ext(jobj, + JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | + color_flag)); + } + while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { + ++i; + TRY(i + 1 >= ac, "--set-var require an argument"); + if (!jobj) + jobj = json_tokener_parse(r.buf); + if (parse_variable(jobj, av, ac, i)) + return -1; + ++i; + } + + if (jobj) { + json_object_put(jobj); + jobj = NULL; + } + osc_deinit_str(&r); + } else + if (!strcmp("SetDefaultPolicyVersion", av[i])) { + auto_osc_json_c json_object *jobj = NULL; + auto_ptr_array struct ptr_array opa = {0}; + struct ptr_array *pa = &opa; + struct osc_set_default_policy_version_arg a = {0}; + struct osc_set_default_policy_version_arg *s = &a; + __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; + int cret; + + cascade_struct = NULL; + cascade_parser = NULL; + + set_default_policy_version_arg: + + if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { + char *next_a = &av[i + 1][2]; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int incr = 2; + char *eq_ptr = strchr(next_a, '='); + + CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); + if (eq_ptr) { + CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); + incr = 1; + aa = eq_ptr + 1; + } else { + CHK_BAD_RET(!aa, "cascade need an argument\n"); + META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) + } + STRY(cascade_parser(cascade_struct, next_a, aa, pa)); + i += incr; + goto set_default_policy_version_arg; + } + + if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { + char *next_a = &av[i + 1][2]; + char *str = next_a; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int aret = 0; + int incr = aa ? 2 : 1; + + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } + if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SourceSnapshotId argument missing\n"); + TRY((!*eq_ptr), "PolicyOrn argument missing\n"); aa = eq_ptr + 1; incr = 1; - } - TRY(!aa, "SourceSnapshotId argument missing\n"); - s->source_snapshot_id = aa; // string string + } + TRY(!aa, "PolicyOrn argument missing\n"); + s->policy_orn = aa; // string string } else - if ((aret = argcmp(next_a, "VolumeId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VersionId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VolumeId argument missing\n"); + TRY((!*eq_ptr), "VersionId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VolumeId argument missing\n"); - s->volume_id = aa; // string string + TRY(!aa, "VersionId argument missing\n"); + s->version_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateSnapshot'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'SetDefaultPolicyVersion'\n", next_a); } i += incr; - goto create_snapshot_arg; + goto set_default_policy_version_arg; } - cret = osc_create_snapshot(&e, &r, &a); - TRY(cret, "fail to call CreateSnapshot: %s\n", curl_easy_strerror(cret)); + cret = osc_set_default_policy_version(&e, &r, &a); + TRY(cret, "fail to call SetDefaultPolicyVersion: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -43165,19 +42753,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateServerCertificate", av[i])) { + if (!strcmp("StartVms", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_server_certificate_arg a = {0}; - struct osc_create_server_certificate_arg *s = &a; + struct osc_start_vms_arg a = {0}; + struct osc_start_vms_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_server_certificate_arg: + start_vms_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -43196,7 +42784,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_server_certificate_arg; + goto start_vms_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -43210,28 +42798,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "Body")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Body argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Body argument missing\n"); - s->body = aa; // string string - - } else - if ((aret = argcmp(next_a, "Chain")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Chain argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Chain argument missing\n"); - s->chain = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -43248,47 +42814,48 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Name")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Name argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Name argument missing\n"); - s->name = aa; // string string - - } else - if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Path argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Path argument missing\n"); - s->path = aa; // string string - - } else - if ((aret = argcmp(next_a, "PrivateKey")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PrivateKey argument missing\n"); + TRY((!*eq_ptr), "VmIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PrivateKey argument missing\n"); - s->private_key = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "VmIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "VmIds require an index\n"); + if (s->vm_ids) { + for (; s->vm_ids[last]; ++last); + } + if (pos < last) { + s->vm_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->vm_ids, "", pa); + SET_NEXT(s->vm_ids, (aa), pa); + } + } else { + TRY(!aa, "VmIds argument missing\n"); + s->vm_ids_str = aa; + } + } else if (!(aret = argcmp(str, "VmIds[]")) || aret == '=') { + TRY(!aa, "VmIds[] argument missing\n"); + SET_NEXT(s->vm_ids, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'CreateServerCertificate'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'StartVms'\n", next_a); } i += incr; - goto create_server_certificate_arg; + goto start_vms_arg; } - cret = osc_create_server_certificate(&e, &r, &a); - TRY(cret, "fail to call CreateServerCertificate: %s\n", curl_easy_strerror(cret)); + cret = osc_start_vms(&e, &r, &a); + TRY(cret, "fail to call StartVms: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -43315,19 +42882,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateSecurityGroupRule", av[i])) { + if (!strcmp("StopVms", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_security_group_rule_arg a = {0}; - struct osc_create_security_group_rule_arg *s = &a; + struct osc_stop_vms_arg a = {0}; + struct osc_stop_vms_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_security_group_rule_arg: + stop_vms_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -43346,7 +42913,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_security_group_rule_arg; + goto stop_vms_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -43376,133 +42943,64 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Flow")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Flow argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Flow argument missing\n"); - s->flow = aa; // string string - - } else - if ((aret = argcmp(next_a, "FromPortRange")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "FromPortRange argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "FromPortRange argument missing\n"); - s->is_set_from_port_range = 1; - s->from_port_range = atoll(aa); - } else - if ((aret = argcmp(next_a, "IpProtocol")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "IpProtocol argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "IpProtocol argument missing\n"); - s->ip_protocol = aa; // string string - - } else - if ((aret = argcmp(next_a, "IpRange")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "IpRange argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "IpRange argument missing\n"); - s->ip_range = aa; // string string - - } else - if ((aret = argcmp(next_a, "Rules")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ForceStop")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Rules argument missing\n"); + TRY((!*eq_ptr), "ForceStop argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; - - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Rules' require an index (example array ref SecurityGroupRule.Rules.0)\n"); - else if (*endptr != '.') - BAD_RET("'Rules' require a .\n"); - TRY_ALLOC_AT(s,rules, pa, pos, sizeof(*s->rules)); - cascade_struct = &s->rules[pos]; - cascade_parser = security_group_rule_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(security_group_rule_parser(&s->rules[pos], endptr + 1, aa, pa)); + s->is_set_force_stop = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->force_stop = 1; + } else if (!strcasecmp(aa, "false")) { + s->force_stop = 0; } else { - TRY(!aa, "Rules argument missing\n"); - s->rules_str = aa; // array ref SecurityGroupRule ref - } - } else - if ((aret = argcmp(next_a, "SecurityGroupAccountIdToLink")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupAccountIdToLink argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "SecurityGroupAccountIdToLink argument missing\n"); - s->security_group_account_id_to_link = aa; // string string - - } else - if ((aret = argcmp(next_a, "SecurityGroupId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "SecurityGroupId argument missing\n"); - s->security_group_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "SecurityGroupNameToLink")) == 0 || aret == '=' || aret == '.') { + BAD_RET("ForceStop require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "VmIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupNameToLink argument missing\n"); + TRY((!*eq_ptr), "VmIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SecurityGroupNameToLink argument missing\n"); - s->security_group_name_to_link = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); - } else - if ((aret = argcmp(next_a, "ToPortRange")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ToPortRange argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ToPortRange argument missing\n"); - s->is_set_to_port_range = 1; - s->to_port_range = atoll(aa); + TRY(!(dot_pos++), "VmIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "VmIds require an index\n"); + if (s->vm_ids) { + for (; s->vm_ids[last]; ++last); + } + if (pos < last) { + s->vm_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->vm_ids, "", pa); + SET_NEXT(s->vm_ids, (aa), pa); + } + } else { + TRY(!aa, "VmIds argument missing\n"); + s->vm_ids_str = aa; + } + } else if (!(aret = argcmp(str, "VmIds[]")) || aret == '=') { + TRY(!aa, "VmIds[] argument missing\n"); + SET_NEXT(s->vm_ids, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'CreateSecurityGroupRule'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'StopVms'\n", next_a); } i += incr; - goto create_security_group_rule_arg; + goto stop_vms_arg; } - cret = osc_create_security_group_rule(&e, &r, &a); - TRY(cret, "fail to call CreateSecurityGroupRule: %s\n", curl_easy_strerror(cret)); + cret = osc_stop_vms(&e, &r, &a); + TRY(cret, "fail to call StopVms: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -43529,19 +43027,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateSecurityGroup", av[i])) { + if (!strcmp("UnlinkFlexibleGpu", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_security_group_arg a = {0}; - struct osc_create_security_group_arg *s = &a; + struct osc_unlink_flexible_gpu_arg a = {0}; + struct osc_unlink_flexible_gpu_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_security_group_arg: + unlink_flexible_gpu_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -43560,7 +43058,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_security_group_arg; + goto unlink_flexible_gpu_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -43574,17 +43072,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -43601,36 +43088,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NetId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NetId argument missing\n"); - s->net_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "SecurityGroupName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "FlexibleGpuId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupName argument missing\n"); + TRY((!*eq_ptr), "FlexibleGpuId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SecurityGroupName argument missing\n"); - s->security_group_name = aa; // string string + TRY(!aa, "FlexibleGpuId argument missing\n"); + s->flexible_gpu_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateSecurityGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UnlinkFlexibleGpu'\n", next_a); } i += incr; - goto create_security_group_arg; + goto unlink_flexible_gpu_arg; } - cret = osc_create_security_group(&e, &r, &a); - TRY(cret, "fail to call CreateSecurityGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_unlink_flexible_gpu(&e, &r, &a); + TRY(cret, "fail to call UnlinkFlexibleGpu: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -43657,19 +43133,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateRouteTable", av[i])) { + if (!strcmp("UnlinkInternetService", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_route_table_arg a = {0}; - struct osc_create_route_table_arg *s = &a; + struct osc_unlink_internet_service_arg a = {0}; + struct osc_unlink_internet_service_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_route_table_arg: + unlink_internet_service_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -43688,7 +43164,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_route_table_arg; + goto unlink_internet_service_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -43718,6 +43194,17 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else + if ((aret = argcmp(next_a, "InternetServiceId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "InternetServiceId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "InternetServiceId argument missing\n"); + s->internet_service_id = aa; // string string + + } else if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -43730,13 +43217,13 @@ int main(int ac, char **av) } else { - BAD_RET("'%s' is not a valide argument for 'CreateRouteTable'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UnlinkInternetService'\n", next_a); } i += incr; - goto create_route_table_arg; + goto unlink_internet_service_arg; } - cret = osc_create_route_table(&e, &r, &a); - TRY(cret, "fail to call CreateRouteTable: %s\n", curl_easy_strerror(cret)); + cret = osc_unlink_internet_service(&e, &r, &a); + TRY(cret, "fail to call UnlinkInternetService: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -43763,19 +43250,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateRoute", av[i])) { + if (!strcmp("UnlinkLoadBalancerBackendMachines", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_route_arg a = {0}; - struct osc_create_route_arg *s = &a; + struct osc_unlink_load_balancer_backend_machines_arg a = {0}; + struct osc_unlink_load_balancer_backend_machines_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_route_arg: + unlink_load_balancer_backend_machines_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -43794,7 +43281,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_route_arg; + goto unlink_load_balancer_backend_machines_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -43808,16 +43295,73 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DestinationIpRange")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "BackendIps")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DestinationIpRange argument missing\n"); + TRY((!*eq_ptr), "BackendIps argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "DestinationIpRange argument missing\n"); - s->destination_ip_range = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "BackendIps argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "BackendIps require an index\n"); + if (s->backend_ips) { + for (; s->backend_ips[last]; ++last); + } + if (pos < last) { + s->backend_ips[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->backend_ips, "", pa); + SET_NEXT(s->backend_ips, (aa), pa); + } + } else { + TRY(!aa, "BackendIps argument missing\n"); + s->backend_ips_str = aa; + } + } else if (!(aret = argcmp(str, "BackendIps[]")) || aret == '=') { + TRY(!aa, "BackendIps[] argument missing\n"); + SET_NEXT(s->backend_ips, (aa), pa); + } else + if ((aret = argcmp(next_a, "BackendVmIds")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "BackendVmIds argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "BackendVmIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "BackendVmIds require an index\n"); + if (s->backend_vm_ids) { + for (; s->backend_vm_ids[last]; ++last); + } + if (pos < last) { + s->backend_vm_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->backend_vm_ids, "", pa); + SET_NEXT(s->backend_vm_ids, (aa), pa); + } + } else { + TRY(!aa, "BackendVmIds argument missing\n"); + s->backend_vm_ids_str = aa; + } + } else if (!(aret = argcmp(str, "BackendVmIds[]")) || aret == '=') { + TRY(!aa, "BackendVmIds[] argument missing\n"); + SET_NEXT(s->backend_vm_ids, (aa), pa); } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); @@ -43835,80 +43379,142 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "GatewayId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "GatewayId argument missing\n"); + TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "GatewayId argument missing\n"); - s->gateway_id = aa; // string string + TRY(!aa, "LoadBalancerName argument missing\n"); + s->load_balancer_name = aa; // string string } else - if ((aret = argcmp(next_a, "NatServiceId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NatServiceId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NatServiceId argument missing\n"); - s->nat_service_id = aa; // string string + { + BAD_RET("'%s' is not a valide argument for 'UnlinkLoadBalancerBackendMachines'\n", next_a); + } + i += incr; + goto unlink_load_balancer_backend_machines_arg; + } + cret = osc_unlink_load_balancer_backend_machines(&e, &r, &a); + TRY(cret, "fail to call UnlinkLoadBalancerBackendMachines: %s\n", curl_easy_strerror(cret)); + CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); + jobj = NULL; + if (program_flag & OAPI_RAW_OUTPUT) + puts(r.buf); + else { + jobj = json_tokener_parse(r.buf); + puts(json_object_to_json_string_ext(jobj, + JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | + color_flag)); + } + while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { + ++i; + TRY(i + 1 >= ac, "--set-var require an argument"); + if (!jobj) + jobj = json_tokener_parse(r.buf); + if (parse_variable(jobj, av, ac, i)) + return -1; + ++i; + } - } else - if ((aret = argcmp(next_a, "NetPeeringId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NetPeeringId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NetPeeringId argument missing\n"); - s->net_peering_id = aa; // string string + if (jobj) { + json_object_put(jobj); + jobj = NULL; + } + osc_deinit_str(&r); + } else + if (!strcmp("UnlinkManagedPolicyFromUserGroup", av[i])) { + auto_osc_json_c json_object *jobj = NULL; + auto_ptr_array struct ptr_array opa = {0}; + struct ptr_array *pa = &opa; + struct osc_unlink_managed_policy_from_user_group_arg a = {0}; + struct osc_unlink_managed_policy_from_user_group_arg *s = &a; + __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; + int cret; + + cascade_struct = NULL; + cascade_parser = NULL; + + unlink_managed_policy_from_user_group_arg: + + if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { + char *next_a = &av[i + 1][2]; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int incr = 2; + char *eq_ptr = strchr(next_a, '='); + + CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); + if (eq_ptr) { + CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); + incr = 1; + aa = eq_ptr + 1; + } else { + CHK_BAD_RET(!aa, "cascade need an argument\n"); + META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) + } + STRY(cascade_parser(cascade_struct, next_a, aa, pa)); + i += incr; + goto unlink_managed_policy_from_user_group_arg; + } - } else - if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { + if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { + char *next_a = &av[i + 1][2]; + char *str = next_a; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int aret = 0; + int incr = aa ? 2 : 1; + + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NicId argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NicId argument missing\n"); - s->nic_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "RouteTableId argument missing\n"); + TRY((!*eq_ptr), "PolicyOrn argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "RouteTableId argument missing\n"); - s->route_table_id = aa; // string string + TRY(!aa, "PolicyOrn argument missing\n"); + s->policy_orn = aa; // string string } else - if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmId argument missing\n"); + TRY((!*eq_ptr), "UserGroupName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmId argument missing\n"); - s->vm_id = aa; // string string + TRY(!aa, "UserGroupName argument missing\n"); + s->user_group_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateRoute'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UnlinkManagedPolicyFromUserGroup'\n", next_a); } i += incr; - goto create_route_arg; + goto unlink_managed_policy_from_user_group_arg; } - cret = osc_create_route(&e, &r, &a); - TRY(cret, "fail to call CreateRoute: %s\n", curl_easy_strerror(cret)); + cret = osc_unlink_managed_policy_from_user_group(&e, &r, &a); + TRY(cret, "fail to call UnlinkManagedPolicyFromUserGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -43935,19 +43541,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreatePublicIp", av[i])) { + if (!strcmp("UnlinkNic", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_public_ip_arg a = {0}; - struct osc_create_public_ip_arg *s = &a; + struct osc_unlink_nic_arg a = {0}; + struct osc_unlink_nic_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_public_ip_arg: + unlink_nic_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -43966,7 +43572,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_public_ip_arg; + goto unlink_nic_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -43996,14 +43602,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else + if ((aret = argcmp(next_a, "LinkNicId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "LinkNicId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "LinkNicId argument missing\n"); + s->link_nic_id = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'CreatePublicIp'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UnlinkNic'\n", next_a); } i += incr; - goto create_public_ip_arg; + goto unlink_nic_arg; } - cret = osc_create_public_ip(&e, &r, &a); - TRY(cret, "fail to call CreatePublicIp: %s\n", curl_easy_strerror(cret)); + cret = osc_unlink_nic(&e, &r, &a); + TRY(cret, "fail to call UnlinkNic: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -44030,19 +43647,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateProductType", av[i])) { + if (!strcmp("UnlinkPolicy", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_product_type_arg a = {0}; - struct osc_create_product_type_arg *s = &a; + struct osc_unlink_policy_arg a = {0}; + struct osc_unlink_policy_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_product_type_arg: + unlink_policy_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -44061,7 +43678,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_product_type_arg; + goto unlink_policy_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -44075,17 +43692,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -44102,25 +43708,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Vendor")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Vendor argument missing\n"); + TRY((!*eq_ptr), "PolicyOrn argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Vendor argument missing\n"); - s->vendor = aa; // string string + TRY(!aa, "PolicyOrn argument missing\n"); + s->policy_orn = aa; // string string + + } else + if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserName argument missing\n"); + s->user_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateProductType'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UnlinkPolicy'\n", next_a); } i += incr; - goto create_product_type_arg; + goto unlink_policy_arg; } - cret = osc_create_product_type(&e, &r, &a); - TRY(cret, "fail to call CreateProductType: %s\n", curl_easy_strerror(cret)); + cret = osc_unlink_policy(&e, &r, &a); + TRY(cret, "fail to call UnlinkPolicy: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -44147,19 +43764,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreatePolicyVersion", av[i])) { + if (!strcmp("UnlinkPrivateIps", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_policy_version_arg a = {0}; - struct osc_create_policy_version_arg *s = &a; + struct osc_unlink_private_ips_arg a = {0}; + struct osc_unlink_private_ips_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_policy_version_arg: + unlink_private_ips_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -44178,7 +43795,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_policy_version_arg; + goto unlink_private_ips_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -44192,52 +43809,75 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "Document")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Document argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Document argument missing\n"); - s->document = aa; // string string - - } else - if ((aret = argcmp(next_a, "PolicyOrn")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PolicyOrn argument missing\n"); + TRY((!*eq_ptr), "NicId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PolicyOrn argument missing\n"); - s->policy_orn = aa; // string string + TRY(!aa, "NicId argument missing\n"); + s->nic_id = aa; // string string } else - if ((aret = argcmp(next_a, "SetAsDefault")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PrivateIps")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SetAsDefault argument missing\n"); + TRY((!*eq_ptr), "PrivateIps argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_set_as_default = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->set_as_default = 1; - } else if (!strcasecmp(aa, "false")) { - s->set_as_default = 0; - } else { - BAD_RET("SetAsDefault require true/false\n"); - } - } else + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "PrivateIps argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "PrivateIps require an index\n"); + if (s->private_ips) { + for (; s->private_ips[last]; ++last); + } + if (pos < last) { + s->private_ips[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->private_ips, "", pa); + SET_NEXT(s->private_ips, (aa), pa); + } + } else { + TRY(!aa, "PrivateIps argument missing\n"); + s->private_ips_str = aa; + } + } else if (!(aret = argcmp(str, "PrivateIps[]")) || aret == '=') { + TRY(!aa, "PrivateIps[] argument missing\n"); + SET_NEXT(s->private_ips, (aa), pa); + } else { - BAD_RET("'%s' is not a valide argument for 'CreatePolicyVersion'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UnlinkPrivateIps'\n", next_a); } i += incr; - goto create_policy_version_arg; + goto unlink_private_ips_arg; } - cret = osc_create_policy_version(&e, &r, &a); - TRY(cret, "fail to call CreatePolicyVersion: %s\n", curl_easy_strerror(cret)); + cret = osc_unlink_private_ips(&e, &r, &a); + TRY(cret, "fail to call UnlinkPrivateIps: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -44264,19 +43904,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreatePolicy", av[i])) { + if (!strcmp("UnlinkPublicIp", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_policy_arg a = {0}; - struct osc_create_policy_arg *s = &a; + struct osc_unlink_public_ip_arg a = {0}; + struct osc_unlink_public_ip_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_policy_arg: + unlink_public_ip_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -44295,42 +43935,20 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_policy_arg; + goto unlink_public_ip_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { char *next_a = &av[i + 1][2]; char *str = next_a; char *aa = i + 2 < ac ? av[i + 2] : 0; - int aret = 0; - int incr = aa ? 2 : 1; - - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string - - } else - if ((aret = argcmp(next_a, "Document")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Document argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Document argument missing\n"); - s->document = aa; // string string + int aret = 0; + int incr = aa ? 2 : 1; - } else + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -44347,36 +43965,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LinkPublicIpId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Path argument missing\n"); + TRY((!*eq_ptr), "LinkPublicIpId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Path argument missing\n"); - s->path = aa; // string string + TRY(!aa, "LinkPublicIpId argument missing\n"); + s->link_public_ip_id = aa; // string string } else - if ((aret = argcmp(next_a, "PolicyName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PublicIp")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PolicyName argument missing\n"); + TRY((!*eq_ptr), "PublicIp argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PolicyName argument missing\n"); - s->policy_name = aa; // string string + TRY(!aa, "PublicIp argument missing\n"); + s->public_ip = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreatePolicy'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UnlinkPublicIp'\n", next_a); } i += incr; - goto create_policy_arg; + goto unlink_public_ip_arg; } - cret = osc_create_policy(&e, &r, &a); - TRY(cret, "fail to call CreatePolicy: %s\n", curl_easy_strerror(cret)); + cret = osc_unlink_public_ip(&e, &r, &a); + TRY(cret, "fail to call UnlinkPublicIp: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -44403,19 +44021,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateNic", av[i])) { + if (!strcmp("UnlinkRouteTable", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_nic_arg a = {0}; - struct osc_create_nic_arg *s = &a; + struct osc_unlink_route_table_arg a = {0}; + struct osc_unlink_route_table_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_nic_arg: + unlink_route_table_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -44434,7 +44052,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_nic_arg; + goto unlink_route_table_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -44448,17 +44066,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -44475,90 +44082,25 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "PrivateIps")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PrivateIps argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; - - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'PrivateIps' require an index (example array ref PrivateIpLight.PrivateIps.0)\n"); - else if (*endptr != '.') - BAD_RET("'PrivateIps' require a .\n"); - TRY_ALLOC_AT(s,private_ips, pa, pos, sizeof(*s->private_ips)); - cascade_struct = &s->private_ips[pos]; - cascade_parser = private_ip_light_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(private_ip_light_parser(&s->private_ips[pos], endptr + 1, aa, pa)); - } else { - TRY(!aa, "PrivateIps argument missing\n"); - s->private_ips_str = aa; // array ref PrivateIpLight ref - } - } else - if ((aret = argcmp(next_a, "SecurityGroupIds")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroupIds argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "SecurityGroupIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "SecurityGroupIds require an index\n"); - if (s->security_group_ids) { - for (; s->security_group_ids[last]; ++last); - } - if (pos < last) { - s->security_group_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->security_group_ids, "", pa); - SET_NEXT(s->security_group_ids, (aa), pa); - } - } else { - TRY(!aa, "SecurityGroupIds argument missing\n"); - s->security_group_ids_str = aa; - } - } else if (!(aret = argcmp(str, "SecurityGroupIds[]")) || aret == '=') { - TRY(!aa, "SecurityGroupIds[] argument missing\n"); - SET_NEXT(s->security_group_ids, (aa), pa); - } else - if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LinkRouteTableId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SubnetId argument missing\n"); + TRY((!*eq_ptr), "LinkRouteTableId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SubnetId argument missing\n"); - s->subnet_id = aa; // string string + TRY(!aa, "LinkRouteTableId argument missing\n"); + s->link_route_table_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateNic'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UnlinkRouteTable'\n", next_a); } i += incr; - goto create_nic_arg; + goto unlink_route_table_arg; } - cret = osc_create_nic(&e, &r, &a); - TRY(cret, "fail to call CreateNic: %s\n", curl_easy_strerror(cret)); + cret = osc_unlink_route_table(&e, &r, &a); + TRY(cret, "fail to call UnlinkRouteTable: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -44585,19 +44127,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateNetPeering", av[i])) { + if (!strcmp("UnlinkVirtualGateway", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_net_peering_arg a = {0}; - struct osc_create_net_peering_arg *s = &a; + struct osc_unlink_virtual_gateway_arg a = {0}; + struct osc_unlink_virtual_gateway_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_net_peering_arg: + unlink_virtual_gateway_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -44616,7 +44158,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_net_peering_arg; + goto unlink_virtual_gateway_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -44630,28 +44172,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "AccepterNetId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "AccepterNetId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "AccepterNetId argument missing\n"); - s->accepter_net_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "AccepterOwnerId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "AccepterOwnerId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "AccepterOwnerId argument missing\n"); - s->accepter_owner_id = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -44668,25 +44188,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "SourceNetId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SourceNetId argument missing\n"); + TRY((!*eq_ptr), "NetId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SourceNetId argument missing\n"); - s->source_net_id = aa; // string string + TRY(!aa, "NetId argument missing\n"); + s->net_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "VirtualGatewayId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VirtualGatewayId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VirtualGatewayId argument missing\n"); + s->virtual_gateway_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateNetPeering'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UnlinkVirtualGateway'\n", next_a); } i += incr; - goto create_net_peering_arg; + goto unlink_virtual_gateway_arg; } - cret = osc_create_net_peering(&e, &r, &a); - TRY(cret, "fail to call CreateNetPeering: %s\n", curl_easy_strerror(cret)); + cret = osc_unlink_virtual_gateway(&e, &r, &a); + TRY(cret, "fail to call UnlinkVirtualGateway: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -44713,19 +44244,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateNetAccessPoint", av[i])) { + if (!strcmp("UnlinkVolume", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_net_access_point_arg a = {0}; - struct osc_create_net_access_point_arg *s = &a; + struct osc_unlink_volume_arg a = {0}; + struct osc_unlink_volume_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_net_access_point_arg: + unlink_volume_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -44744,7 +44275,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_net_access_point_arg; + goto unlink_volume_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -44774,70 +44305,41 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NetId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "NetId argument missing\n"); - s->net_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "RouteTableIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ForceUnlink")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "RouteTableIds argument missing\n"); + TRY((!*eq_ptr), "ForceUnlink argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "RouteTableIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "RouteTableIds require an index\n"); - if (s->route_table_ids) { - for (; s->route_table_ids[last]; ++last); - } - if (pos < last) { - s->route_table_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->route_table_ids, "", pa); - SET_NEXT(s->route_table_ids, (aa), pa); - } - } else { - TRY(!aa, "RouteTableIds argument missing\n"); - s->route_table_ids_str = aa; - } - } else if (!(aret = argcmp(str, "RouteTableIds[]")) || aret == '=') { - TRY(!aa, "RouteTableIds[] argument missing\n"); - SET_NEXT(s->route_table_ids, (aa), pa); - } else - if ((aret = argcmp(next_a, "ServiceName")) == 0 || aret == '=' || aret == '.') { + s->is_set_force_unlink = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->force_unlink = 1; + } else if (!strcasecmp(aa, "false")) { + s->force_unlink = 0; + } else { + BAD_RET("ForceUnlink require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "VolumeId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ServiceName argument missing\n"); + TRY((!*eq_ptr), "VolumeId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ServiceName argument missing\n"); - s->service_name = aa; // string string + TRY(!aa, "VolumeId argument missing\n"); + s->volume_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateNetAccessPoint'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UnlinkVolume'\n", next_a); } i += incr; - goto create_net_access_point_arg; + goto unlink_volume_arg; } - cret = osc_create_net_access_point(&e, &r, &a); - TRY(cret, "fail to call CreateNetAccessPoint: %s\n", curl_easy_strerror(cret)); + cret = osc_unlink_volume(&e, &r, &a); + TRY(cret, "fail to call UnlinkVolume: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -44864,19 +44366,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateNet", av[i])) { + if (!strcmp("UpdateAccessKey", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_net_arg a = {0}; - struct osc_create_net_arg *s = &a; + struct osc_update_access_key_arg a = {0}; + struct osc_update_access_key_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_net_arg: + update_access_key_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -44895,7 +44397,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_net_arg; + goto update_access_key_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -44909,6 +44411,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "AccessKeyId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "AccessKeyId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "AccessKeyId argument missing\n"); + s->access_key_id = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -44925,36 +44438,47 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "IpRange")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ExpirationDate")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "IpRange argument missing\n"); + TRY((!*eq_ptr), "ExpirationDate argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "IpRange argument missing\n"); - s->ip_range = aa; // string string + TRY(!aa, "ExpirationDate argument missing\n"); + s->expiration_date = aa; // string string } else - if ((aret = argcmp(next_a, "Tenancy")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "State")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Tenancy argument missing\n"); + TRY((!*eq_ptr), "State argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Tenancy argument missing\n"); - s->tenancy = aa; // string string + TRY(!aa, "State argument missing\n"); + s->state = aa; // string string + + } else + if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserName argument missing\n"); + s->user_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateNet'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateAccessKey'\n", next_a); } i += incr; - goto create_net_arg; + goto update_access_key_arg; } - cret = osc_create_net(&e, &r, &a); - TRY(cret, "fail to call CreateNet: %s\n", curl_easy_strerror(cret)); + cret = osc_update_access_key(&e, &r, &a); + TRY(cret, "fail to call UpdateAccessKey: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -44981,19 +44505,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateNatService", av[i])) { + if (!strcmp("UpdateAccount", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_nat_service_arg a = {0}; - struct osc_create_nat_service_arg *s = &a; + struct osc_update_account_arg a = {0}; + struct osc_update_account_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_nat_service_arg: + update_account_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -45012,7 +44536,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_nat_service_arg; + goto update_account_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -45026,15 +44550,71 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "ClientToken")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "AdditionalEmails")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ClientToken argument missing\n"); + TRY((!*eq_ptr), "AdditionalEmails argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ClientToken argument missing\n"); - s->client_token = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "AdditionalEmails argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "AdditionalEmails require an index\n"); + if (s->additional_emails) { + for (; s->additional_emails[last]; ++last); + } + if (pos < last) { + s->additional_emails[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->additional_emails, "", pa); + SET_NEXT(s->additional_emails, (aa), pa); + } + } else { + TRY(!aa, "AdditionalEmails argument missing\n"); + s->additional_emails_str = aa; + } + } else if (!(aret = argcmp(str, "AdditionalEmails[]")) || aret == '=') { + TRY(!aa, "AdditionalEmails[] argument missing\n"); + SET_NEXT(s->additional_emails, (aa), pa); + } else + if ((aret = argcmp(next_a, "City")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "City argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "City argument missing\n"); + s->city = aa; // string string + + } else + if ((aret = argcmp(next_a, "CompanyName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "CompanyName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "CompanyName argument missing\n"); + s->company_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "Country")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Country argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Country argument missing\n"); + s->country = aa; // string string } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { @@ -45053,36 +44633,113 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "PublicIpId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Email")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PublicIpId argument missing\n"); + TRY((!*eq_ptr), "Email argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PublicIpId argument missing\n"); - s->public_ip_id = aa; // string string + TRY(!aa, "Email argument missing\n"); + s->email = aa; // string string } else - if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "FirstName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SubnetId argument missing\n"); + TRY((!*eq_ptr), "FirstName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SubnetId argument missing\n"); - s->subnet_id = aa; // string string + TRY(!aa, "FirstName argument missing\n"); + s->first_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "JobTitle")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "JobTitle argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "JobTitle argument missing\n"); + s->job_title = aa; // string string + + } else + if ((aret = argcmp(next_a, "LastName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "LastName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "LastName argument missing\n"); + s->last_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "MobileNumber")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "MobileNumber argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "MobileNumber argument missing\n"); + s->mobile_number = aa; // string string + + } else + if ((aret = argcmp(next_a, "PhoneNumber")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "PhoneNumber argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "PhoneNumber argument missing\n"); + s->phone_number = aa; // string string + + } else + if ((aret = argcmp(next_a, "StateProvince")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "StateProvince argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "StateProvince argument missing\n"); + s->state_province = aa; // string string + + } else + if ((aret = argcmp(next_a, "VatNumber")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VatNumber argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VatNumber argument missing\n"); + s->vat_number = aa; // string string + + } else + if ((aret = argcmp(next_a, "ZipCode")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ZipCode argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ZipCode argument missing\n"); + s->zip_code = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateNatService'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateAccount'\n", next_a); } i += incr; - goto create_nat_service_arg; + goto update_account_arg; } - cret = osc_create_nat_service(&e, &r, &a); - TRY(cret, "fail to call CreateNatService: %s\n", curl_easy_strerror(cret)); + cret = osc_update_account(&e, &r, &a); + TRY(cret, "fail to call UpdateAccount: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -45109,19 +44766,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateLoadBalancerTags", av[i])) { + if (!strcmp("UpdateApiAccessPolicy", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_load_balancer_tags_arg a = {0}; - struct osc_create_load_balancer_tags_arg *s = &a; + struct osc_update_api_access_policy_arg a = {0}; + struct osc_update_api_access_policy_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_load_balancer_tags_arg: + update_api_access_policy_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -45140,7 +44797,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_load_balancer_tags_arg; + goto update_api_access_policy_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -45170,79 +44827,41 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "LoadBalancerNames")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "MaxAccessKeyExpirationSeconds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerNames argument missing\n"); + TRY((!*eq_ptr), "MaxAccessKeyExpirationSeconds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "LoadBalancerNames argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "LoadBalancerNames require an index\n"); - if (s->load_balancer_names) { - for (; s->load_balancer_names[last]; ++last); - } - if (pos < last) { - s->load_balancer_names[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->load_balancer_names, "", pa); - SET_NEXT(s->load_balancer_names, (aa), pa); - } - } else { - TRY(!aa, "LoadBalancerNames argument missing\n"); - s->load_balancer_names_str = aa; - } - } else if (!(aret = argcmp(str, "LoadBalancerNames[]")) || aret == '=') { - TRY(!aa, "LoadBalancerNames[] argument missing\n"); - SET_NEXT(s->load_balancer_names, (aa), pa); + TRY(!aa, "MaxAccessKeyExpirationSeconds argument missing\n"); + s->is_set_max_access_key_expiration_seconds = 1; + s->max_access_key_expiration_seconds = atoll(aa); } else - if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "RequireTrustedEnv")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Tags argument missing\n"); + TRY((!*eq_ptr), "RequireTrustedEnv argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; - - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); - else if (*endptr != '.') - BAD_RET("'Tags' require a .\n"); - TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); - cascade_struct = &s->tags[pos]; - cascade_parser = resource_tag_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); + s->is_set_require_trusted_env = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->require_trusted_env = 1; + } else if (!strcasecmp(aa, "false")) { + s->require_trusted_env = 0; } else { - TRY(!aa, "Tags argument missing\n"); - s->tags_str = aa; // array ref ResourceTag ref - } - } else + BAD_RET("RequireTrustedEnv require true/false\n"); + } + } else { - BAD_RET("'%s' is not a valide argument for 'CreateLoadBalancerTags'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateApiAccessPolicy'\n", next_a); } i += incr; - goto create_load_balancer_tags_arg; + goto update_api_access_policy_arg; } - cret = osc_create_load_balancer_tags(&e, &r, &a); - TRY(cret, "fail to call CreateLoadBalancerTags: %s\n", curl_easy_strerror(cret)); + cret = osc_update_api_access_policy(&e, &r, &a); + TRY(cret, "fail to call UpdateApiAccessPolicy: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -45269,19 +44888,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateLoadBalancerPolicy", av[i])) { + if (!strcmp("UpdateApiAccessRule", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_load_balancer_policy_arg a = {0}; - struct osc_create_load_balancer_policy_arg *s = &a; + struct osc_update_api_access_rule_arg a = {0}; + struct osc_update_api_access_rule_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_load_balancer_policy_arg: + update_api_access_rule_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -45300,7 +44919,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_load_balancer_policy_arg; + goto update_api_access_rule_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -45314,85 +44933,154 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "CookieExpirationPeriod")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ApiAccessRuleId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "CookieExpirationPeriod argument missing\n"); + TRY((!*eq_ptr), "ApiAccessRuleId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "CookieExpirationPeriod argument missing\n"); - s->is_set_cookie_expiration_period = 1; - s->cookie_expiration_period = atoll(aa); + TRY(!aa, "ApiAccessRuleId argument missing\n"); + s->api_access_rule_id = aa; // string string + } else - if ((aret = argcmp(next_a, "CookieName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "CaIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "CookieName argument missing\n"); + TRY((!*eq_ptr), "CaIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "CookieName argument missing\n"); - s->cookie_name = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "CaIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "CaIds require an index\n"); + if (s->ca_ids) { + for (; s->ca_ids[last]; ++last); + } + if (pos < last) { + s->ca_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->ca_ids, "", pa); + SET_NEXT(s->ca_ids, (aa), pa); + } + } else { + TRY(!aa, "CaIds argument missing\n"); + s->ca_ids_str = aa; + } + } else if (!(aret = argcmp(str, "CaIds[]")) || aret == '=') { + TRY(!aa, "CaIds[] argument missing\n"); + SET_NEXT(s->ca_ids, (aa), pa); } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Cns")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "Cns argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "Cns argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "Cns require an index\n"); + if (s->cns) { + for (; s->cns[last]; ++last); + } + if (pos < last) { + s->cns[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->cns, "", pa); + SET_NEXT(s->cns, (aa), pa); + } + } else { + TRY(!aa, "Cns argument missing\n"); + s->cns_str = aa; + } + } else if (!(aret = argcmp(str, "Cns[]")) || aret == '=') { + TRY(!aa, "Cns[] argument missing\n"); + SET_NEXT(s->cns, (aa), pa); + } else + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); + TRY((!*eq_ptr), "Description argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "LoadBalancerName argument missing\n"); - s->load_balancer_name = aa; // string string + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string } else - if ((aret = argcmp(next_a, "PolicyName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PolicyName argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PolicyName argument missing\n"); - s->policy_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "PolicyType")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "IpRanges")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PolicyType argument missing\n"); + TRY((!*eq_ptr), "IpRanges argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PolicyType argument missing\n"); - s->policy_type = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "IpRanges argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "IpRanges require an index\n"); + if (s->ip_ranges) { + for (; s->ip_ranges[last]; ++last); + } + if (pos < last) { + s->ip_ranges[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->ip_ranges, "", pa); + SET_NEXT(s->ip_ranges, (aa), pa); + } + } else { + TRY(!aa, "IpRanges argument missing\n"); + s->ip_ranges_str = aa; + } + } else if (!(aret = argcmp(str, "IpRanges[]")) || aret == '=') { + TRY(!aa, "IpRanges[] argument missing\n"); + SET_NEXT(s->ip_ranges, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'CreateLoadBalancerPolicy'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateApiAccessRule'\n", next_a); } i += incr; - goto create_load_balancer_policy_arg; + goto update_api_access_rule_arg; } - cret = osc_create_load_balancer_policy(&e, &r, &a); - TRY(cret, "fail to call CreateLoadBalancerPolicy: %s\n", curl_easy_strerror(cret)); + cret = osc_update_api_access_rule(&e, &r, &a); + TRY(cret, "fail to call UpdateApiAccessRule: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -45419,19 +45107,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateLoadBalancerListeners", av[i])) { + if (!strcmp("UpdateCa", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_load_balancer_listeners_arg a = {0}; - struct osc_create_load_balancer_listeners_arg *s = &a; + struct osc_update_ca_arg a = {0}; + struct osc_update_ca_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_load_balancer_listeners_arg: + update_ca_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -45450,7 +45138,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_load_balancer_listeners_arg; + goto update_ca_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -45460,10 +45148,32 @@ int main(int ac, char **av) int aret = 0; int incr = aa ? 2 : 1; - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } + if ((aret = argcmp(next_a, "CaId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "CaId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "CaId argument missing\n"); + s->ca_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Description argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -45480,56 +45190,14 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Listeners")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Listeners argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; - - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Listeners' require an index (example array ref ListenerForCreation.Listeners.0)\n"); - else if (*endptr != '.') - BAD_RET("'Listeners' require a .\n"); - TRY_ALLOC_AT(s,listeners, pa, pos, sizeof(*s->listeners)); - cascade_struct = &s->listeners[pos]; - cascade_parser = listener_for_creation_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(listener_for_creation_parser(&s->listeners[pos], endptr + 1, aa, pa)); - } else { - TRY(!aa, "Listeners argument missing\n"); - s->listeners_str = aa; // array ref ListenerForCreation ref - } - } else - if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "LoadBalancerName argument missing\n"); - s->load_balancer_name = aa; // string string - - } else { - BAD_RET("'%s' is not a valide argument for 'CreateLoadBalancerListeners'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateCa'\n", next_a); } i += incr; - goto create_load_balancer_listeners_arg; + goto update_ca_arg; } - cret = osc_create_load_balancer_listeners(&e, &r, &a); - TRY(cret, "fail to call CreateLoadBalancerListeners: %s\n", curl_easy_strerror(cret)); + cret = osc_update_ca(&e, &r, &a); + TRY(cret, "fail to call UpdateCa: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -45556,19 +45224,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateLoadBalancer", av[i])) { + if (!strcmp("UpdateDedicatedGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_load_balancer_arg a = {0}; - struct osc_create_load_balancer_arg *s = &a; + struct osc_update_dedicated_group_arg a = {0}; + struct osc_update_dedicated_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_load_balancer_arg: + update_dedicated_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -45587,7 +45255,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_load_balancer_arg; + goto update_dedicated_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -45601,227 +45269,52 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "Listeners")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Listeners argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; - - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Listeners' require an index (example array ref ListenerForCreation.Listeners.0)\n"); - else if (*endptr != '.') - BAD_RET("'Listeners' require a .\n"); - TRY_ALLOC_AT(s,listeners, pa, pos, sizeof(*s->listeners)); - cascade_struct = &s->listeners[pos]; - cascade_parser = listener_for_creation_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(listener_for_creation_parser(&s->listeners[pos], endptr + 1, aa, pa)); - } else { - TRY(!aa, "Listeners argument missing\n"); - s->listeners_str = aa; // array ref ListenerForCreation ref - } - } else - if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "LoadBalancerName argument missing\n"); - s->load_balancer_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "LoadBalancerType")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "LoadBalancerType argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "LoadBalancerType argument missing\n"); - s->load_balancer_type = aa; // string string - - } else - if ((aret = argcmp(next_a, "PublicIp")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "PublicIp argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "PublicIp argument missing\n"); - s->public_ip = aa; // string string - - } else - if ((aret = argcmp(next_a, "SecurityGroups")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SecurityGroups argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "SecurityGroups argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "SecurityGroups require an index\n"); - if (s->security_groups) { - for (; s->security_groups[last]; ++last); - } - if (pos < last) { - s->security_groups[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->security_groups, "", pa); - SET_NEXT(s->security_groups, (aa), pa); - } - } else { - TRY(!aa, "SecurityGroups argument missing\n"); - s->security_groups_str = aa; - } - } else if (!(aret = argcmp(str, "SecurityGroups[]")) || aret == '=') { - TRY(!aa, "SecurityGroups[] argument missing\n"); - SET_NEXT(s->security_groups, (aa), pa); - } else - if ((aret = argcmp(next_a, "Subnets")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Subnets argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "Subnets argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "Subnets require an index\n"); - if (s->subnets) { - for (; s->subnets[last]; ++last); - } - if (pos < last) { - s->subnets[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->subnets, "", pa); - SET_NEXT(s->subnets, (aa), pa); - } - } else { - TRY(!aa, "Subnets argument missing\n"); - s->subnets_str = aa; - } - } else if (!(aret = argcmp(str, "Subnets[]")) || aret == '=') { - TRY(!aa, "Subnets[] argument missing\n"); - SET_NEXT(s->subnets, (aa), pa); - } else - if ((aret = argcmp(next_a, "SubregionNames")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "SubregionNames argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "SubregionNames argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "SubregionNames require an index\n"); - if (s->subregion_names) { - for (; s->subregion_names[last]; ++last); - } - if (pos < last) { - s->subregion_names[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->subregion_names, "", pa); - SET_NEXT(s->subregion_names, (aa), pa); - } - } else { - TRY(!aa, "SubregionNames argument missing\n"); - s->subregion_names_str = aa; - } - } else if (!(aret = argcmp(str, "SubregionNames[]")) || aret == '=') { - TRY(!aa, "SubregionNames[] argument missing\n"); - SET_NEXT(s->subregion_names, (aa), pa); - } else - if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DedicatedGroupId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Tags argument missing\n"); + TRY((!*eq_ptr), "DedicatedGroupId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; + TRY(!aa, "DedicatedGroupId argument missing\n"); + s->dedicated_group_id = aa; // string string - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); - else if (*endptr != '.') - BAD_RET("'Tags' require a .\n"); - TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); - cascade_struct = &s->tags[pos]; - cascade_parser = resource_tag_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); + } else + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DryRun argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; } else { - TRY(!aa, "Tags argument missing\n"); - s->tags_str = aa; // array ref ResourceTag ref - } + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "Name")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Name argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Name argument missing\n"); + s->name = aa; // string string + } else { - BAD_RET("'%s' is not a valide argument for 'CreateLoadBalancer'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateDedicatedGroup'\n", next_a); } i += incr; - goto create_load_balancer_arg; + goto update_dedicated_group_arg; } - cret = osc_create_load_balancer(&e, &r, &a); - TRY(cret, "fail to call CreateLoadBalancer: %s\n", curl_easy_strerror(cret)); + cret = osc_update_dedicated_group(&e, &r, &a); + TRY(cret, "fail to call UpdateDedicatedGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -45848,19 +45341,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateListenerRule", av[i])) { + if (!strcmp("UpdateDirectLinkInterface", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_listener_rule_arg a = {0}; - struct osc_create_listener_rule_arg *s = &a; + struct osc_update_direct_link_interface_arg a = {0}; + struct osc_update_direct_link_interface_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_listener_rule_arg: + update_direct_link_interface_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -45879,7 +45372,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_listener_rule_arg; + goto update_direct_link_interface_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -45893,6 +45386,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "DirectLinkInterfaceId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DirectLinkInterfaceId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "DirectLinkInterfaceId argument missing\n"); + s->direct_link_interface_id = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -45909,94 +45413,147 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Listener")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Mtu")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Listener argument missing\n"); + TRY((!*eq_ptr), "Mtu argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "Mtu argument missing\n"); + s->is_set_mtu = 1; + s->mtu = atoll(aa); + } else + { + BAD_RET("'%s' is not a valide argument for 'UpdateDirectLinkInterface'\n", next_a); + } + i += incr; + goto update_direct_link_interface_arg; + } + cret = osc_update_direct_link_interface(&e, &r, &a); + TRY(cret, "fail to call UpdateDirectLinkInterface: %s\n", curl_easy_strerror(cret)); + CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); + jobj = NULL; + if (program_flag & OAPI_RAW_OUTPUT) + puts(r.buf); + else { + jobj = json_tokener_parse(r.buf); + puts(json_object_to_json_string_ext(jobj, + JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | + color_flag)); + } + while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { + ++i; + TRY(i + 1 >= ac, "--set-var require an argument"); + if (!jobj) + jobj = json_tokener_parse(r.buf); + if (parse_variable(jobj, av, ac, i)) + return -1; + ++i; + } - TRY(!aa, "Listener argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->listener; - cascade_parser = load_balancer_light_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(load_balancer_light_parser(&s->listener, dot_pos, aa, pa)); - s->is_set_listener = 1; + if (jobj) { + json_object_put(jobj); + jobj = NULL; + } + osc_deinit_str(&r); + } else + if (!strcmp("UpdateFlexibleGpu", av[i])) { + auto_osc_json_c json_object *jobj = NULL; + auto_ptr_array struct ptr_array opa = {0}; + struct ptr_array *pa = &opa; + struct osc_update_flexible_gpu_arg a = {0}; + struct osc_update_flexible_gpu_arg *s = &a; + __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; + int cret; + + cascade_struct = NULL; + cascade_parser = NULL; + + update_flexible_gpu_arg: + + if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { + char *next_a = &av[i + 1][2]; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int incr = 2; + char *eq_ptr = strchr(next_a, '='); + + CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); + if (eq_ptr) { + CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); + incr = 1; + aa = eq_ptr + 1; + } else { + CHK_BAD_RET(!aa, "cascade need an argument\n"); + META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) + } + STRY(cascade_parser(cascade_struct, next_a, aa, pa)); + i += incr; + goto update_flexible_gpu_arg; + } + + if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { + char *next_a = &av[i + 1][2]; + char *str = next_a; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int aret = 0; + int incr = aa ? 2 : 1; + + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } + if ((aret = argcmp(next_a, "DeleteOnVmDeletion")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DeleteOnVmDeletion argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_delete_on_vm_deletion = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->delete_on_vm_deletion = 1; + } else if (!strcasecmp(aa, "false")) { + s->delete_on_vm_deletion = 0; } else { - s->listener_str = aa; + BAD_RET("DeleteOnVmDeletion require true/false\n"); } - } else - if ((aret = argcmp(next_a, "ListenerRule")) == 0 || aret == '=' || aret == '.') { + } else + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ListenerRule argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; - - TRY(!aa, "ListenerRule argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->listener_rule; - cascade_parser = listener_rule_for_creation_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(listener_rule_for_creation_parser(&s->listener_rule, dot_pos, aa, pa)); - s->is_set_listener_rule = 1; + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; } else { - s->listener_rule_str = aa; + BAD_RET("DryRun require true/false\n"); } - } else - if ((aret = argcmp(next_a, "VmIds")) == 0 || aret == '=' || aret == '.') { + } else + if ((aret = argcmp(next_a, "FlexibleGpuId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmIds argument missing\n"); + TRY((!*eq_ptr), "FlexibleGpuId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "FlexibleGpuId argument missing\n"); + s->flexible_gpu_id = aa; // string string - TRY(!(dot_pos++), "VmIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "VmIds require an index\n"); - if (s->vm_ids) { - for (; s->vm_ids[last]; ++last); - } - if (pos < last) { - s->vm_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->vm_ids, "", pa); - SET_NEXT(s->vm_ids, (aa), pa); - } - } else { - TRY(!aa, "VmIds argument missing\n"); - s->vm_ids_str = aa; - } - } else if (!(aret = argcmp(str, "VmIds[]")) || aret == '=') { - TRY(!aa, "VmIds[] argument missing\n"); - SET_NEXT(s->vm_ids, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'CreateListenerRule'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateFlexibleGpu'\n", next_a); } i += incr; - goto create_listener_rule_arg; + goto update_flexible_gpu_arg; } - cret = osc_create_listener_rule(&e, &r, &a); - TRY(cret, "fail to call CreateListenerRule: %s\n", curl_easy_strerror(cret)); + cret = osc_update_flexible_gpu(&e, &r, &a); + TRY(cret, "fail to call UpdateFlexibleGpu: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -46023,19 +45580,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateKeypair", av[i])) { + if (!strcmp("UpdateImage", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_keypair_arg a = {0}; - struct osc_create_keypair_arg *s = &a; + struct osc_update_image_arg a = {0}; + struct osc_update_image_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_keypair_arg: + update_image_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -46054,7 +45611,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_keypair_arg; + goto update_image_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -46068,6 +45625,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Description argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -46084,36 +45652,48 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "KeypairName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ImageId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "KeypairName argument missing\n"); + TRY((!*eq_ptr), "ImageId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "KeypairName argument missing\n"); - s->keypair_name = aa; // string string + TRY(!aa, "ImageId argument missing\n"); + s->image_id = aa; // string string } else - if ((aret = argcmp(next_a, "PublicKey")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PermissionsToLaunch")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PublicKey argument missing\n"); + TRY((!*eq_ptr), "PermissionsToLaunch argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PublicKey argument missing\n"); - s->public_key = aa; // string string + char *dot_pos; + TRY(!aa, "PermissionsToLaunch argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->permissions_to_launch; + cascade_parser = permissions_on_resource_creation_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(permissions_on_resource_creation_parser(&s->permissions_to_launch, dot_pos, aa, pa)); + s->is_set_permissions_to_launch = 1; + } else { + s->permissions_to_launch_str = aa; + } } else { - BAD_RET("'%s' is not a valide argument for 'CreateKeypair'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateImage'\n", next_a); } i += incr; - goto create_keypair_arg; + goto update_image_arg; } - cret = osc_create_keypair(&e, &r, &a); - TRY(cret, "fail to call CreateKeypair: %s\n", curl_easy_strerror(cret)); + cret = osc_update_image(&e, &r, &a); + TRY(cret, "fail to call UpdateImage: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -46140,19 +45720,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateInternetService", av[i])) { + if (!strcmp("UpdateListenerRule", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_internet_service_arg a = {0}; - struct osc_create_internet_service_arg *s = &a; + struct osc_update_listener_rule_arg a = {0}; + struct osc_update_listener_rule_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_internet_service_arg: + update_listener_rule_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -46171,7 +45751,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_internet_service_arg; + goto update_listener_rule_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -46201,14 +45781,47 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else + if ((aret = argcmp(next_a, "HostPattern")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "HostPattern argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "HostPattern argument missing\n"); + s->host_pattern = aa; // string string + + } else + if ((aret = argcmp(next_a, "ListenerRuleName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ListenerRuleName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ListenerRuleName argument missing\n"); + s->listener_rule_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "PathPattern")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "PathPattern argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "PathPattern argument missing\n"); + s->path_pattern = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'CreateInternetService'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateListenerRule'\n", next_a); } i += incr; - goto create_internet_service_arg; + goto update_listener_rule_arg; } - cret = osc_create_internet_service(&e, &r, &a); - TRY(cret, "fail to call CreateInternetService: %s\n", curl_easy_strerror(cret)); + cret = osc_update_listener_rule(&e, &r, &a); + TRY(cret, "fail to call UpdateListenerRule: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -46235,19 +45848,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateImageExportTask", av[i])) { + if (!strcmp("UpdateLoadBalancer", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_image_export_task_arg a = {0}; - struct osc_create_image_export_task_arg *s = &a; + struct osc_update_load_balancer_arg a = {0}; + struct osc_update_load_balancer_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_image_export_task_arg: + update_load_balancer_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -46266,7 +45879,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_image_export_task_arg; + goto update_load_balancer_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -46280,6 +45893,29 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "AccessLog")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "AccessLog argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos; + + TRY(!aa, "AccessLog argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->access_log; + cascade_parser = access_log_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(access_log_parser(&s->access_log, dot_pos, aa, pa)); + s->is_set_access_log = 1; + } else { + s->access_log_str = aa; + } + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -46296,48 +45932,165 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "ImageId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "HealthCheck")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ImageId argument missing\n"); + TRY((!*eq_ptr), "HealthCheck argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ImageId argument missing\n"); - s->image_id = aa; // string string + char *dot_pos; + + TRY(!aa, "HealthCheck argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->health_check; + cascade_parser = health_check_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(health_check_parser(&s->health_check, dot_pos, aa, pa)); + s->is_set_health_check = 1; + } else { + s->health_check_str = aa; + } + } else + if ((aret = argcmp(next_a, "LoadBalancerName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "LoadBalancerName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "LoadBalancerName argument missing\n"); + s->load_balancer_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "LoadBalancerPort")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "LoadBalancerPort argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "LoadBalancerPort argument missing\n"); + s->is_set_load_balancer_port = 1; + s->load_balancer_port = atoll(aa); + } else + if ((aret = argcmp(next_a, "PolicyNames")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "PolicyNames argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "PolicyNames argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "PolicyNames require an index\n"); + if (s->policy_names) { + for (; s->policy_names[last]; ++last); + } + if (pos < last) { + s->policy_names[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->policy_names, "", pa); + SET_NEXT(s->policy_names, (aa), pa); + } + } else { + TRY(!aa, "PolicyNames argument missing\n"); + s->policy_names_str = aa; + } + } else if (!(aret = argcmp(str, "PolicyNames[]")) || aret == '=') { + TRY(!aa, "PolicyNames[] argument missing\n"); + SET_NEXT(s->policy_names, (aa), pa); + } else + if ((aret = argcmp(next_a, "PublicIp")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "PublicIp argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "PublicIp argument missing\n"); + s->public_ip = aa; // string string + + } else + if ((aret = argcmp(next_a, "SecuredCookies")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SecuredCookies argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_secured_cookies = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->secured_cookies = 1; + } else if (!strcasecmp(aa, "false")) { + s->secured_cookies = 0; + } else { + BAD_RET("SecuredCookies require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "SecurityGroups")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SecurityGroups argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "SecurityGroups argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "SecurityGroups require an index\n"); + if (s->security_groups) { + for (; s->security_groups[last]; ++last); + } + if (pos < last) { + s->security_groups[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->security_groups, "", pa); + SET_NEXT(s->security_groups, (aa), pa); + } + } else { + TRY(!aa, "SecurityGroups argument missing\n"); + s->security_groups_str = aa; + } + } else if (!(aret = argcmp(str, "SecurityGroups[]")) || aret == '=') { + TRY(!aa, "SecurityGroups[] argument missing\n"); + SET_NEXT(s->security_groups, (aa), pa); } else - if ((aret = argcmp(next_a, "OsuExport")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "ServerCertificateId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "OsuExport argument missing\n"); + TRY((!*eq_ptr), "ServerCertificateId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; + TRY(!aa, "ServerCertificateId argument missing\n"); + s->server_certificate_id = aa; // string string - TRY(!aa, "OsuExport argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->osu_export; - cascade_parser = osu_export_to_create_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(osu_export_to_create_parser(&s->osu_export, dot_pos, aa, pa)); - s->is_set_osu_export = 1; - } else { - s->osu_export_str = aa; - } } else { - BAD_RET("'%s' is not a valide argument for 'CreateImageExportTask'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateLoadBalancer'\n", next_a); } i += incr; - goto create_image_export_task_arg; + goto update_load_balancer_arg; } - cret = osc_create_image_export_task(&e, &r, &a); - TRY(cret, "fail to call CreateImageExportTask: %s\n", curl_easy_strerror(cret)); + cret = osc_update_load_balancer(&e, &r, &a); + TRY(cret, "fail to call UpdateLoadBalancer: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -46364,19 +46117,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateImage", av[i])) { + if (!strcmp("UpdateNetAccessPoint", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_image_arg a = {0}; - struct osc_create_image_arg *s = &a; + struct osc_update_net_access_point_arg a = {0}; + struct osc_update_net_access_point_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_image_arg: + update_net_access_point_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -46395,7 +46148,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_image_arg; + goto update_net_access_point_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -46409,58 +46162,39 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "Architecture")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Architecture argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Architecture argument missing\n"); - s->architecture = aa; // string string - - } else - if ((aret = argcmp(next_a, "BlockDeviceMappings")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "BlockDeviceMappings argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - char *dot_pos = strchr(str, '.'); - - if (dot_pos) { - int pos; - char *endptr; - - ++dot_pos; - pos = strtoul(dot_pos, &endptr, 0); - if (endptr == dot_pos) - BAD_RET("'BlockDeviceMappings' require an index (example array ref BlockDeviceMappingImage.BlockDeviceMappings.0)\n"); - else if (*endptr != '.') - BAD_RET("'BlockDeviceMappings' require a .\n"); - TRY_ALLOC_AT(s,block_device_mappings, pa, pos, sizeof(*s->block_device_mappings)); - cascade_struct = &s->block_device_mappings[pos]; - cascade_parser = block_device_mapping_image_parser; - if (endptr[1] == '.') { - ++endptr; - } - STRY(block_device_mapping_image_parser(&s->block_device_mappings[pos], endptr + 1, aa, pa)); - } else { - TRY(!aa, "BlockDeviceMappings argument missing\n"); - s->block_device_mappings_str = aa; // array ref BlockDeviceMappingImage ref - } - } else - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "AddRouteTableIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); + TRY((!*eq_ptr), "AddRouteTableIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "AddRouteTableIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "AddRouteTableIds require an index\n"); + if (s->add_route_table_ids) { + for (; s->add_route_table_ids[last]; ++last); + } + if (pos < last) { + s->add_route_table_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->add_route_table_ids, "", pa); + SET_NEXT(s->add_route_table_ids, (aa), pa); + } + } else { + TRY(!aa, "AddRouteTableIds argument missing\n"); + s->add_route_table_ids_str = aa; + } + } else if (!(aret = argcmp(str, "AddRouteTableIds[]")) || aret == '=') { + TRY(!aa, "AddRouteTableIds[] argument missing\n"); + SET_NEXT(s->add_route_table_ids, (aa), pa); } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); @@ -46478,48 +46212,21 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "FileLocation")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "FileLocation argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "FileLocation argument missing\n"); - s->file_location = aa; // string string - - } else - if ((aret = argcmp(next_a, "ImageName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NetAccessPointId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ImageName argument missing\n"); + TRY((!*eq_ptr), "NetAccessPointId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ImageName argument missing\n"); - s->image_name = aa; // string string + TRY(!aa, "NetAccessPointId argument missing\n"); + s->net_access_point_id = aa; // string string } else - if ((aret = argcmp(next_a, "NoReboot")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "NoReboot argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - s->is_set_no_reboot = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->no_reboot = 1; - } else if (!strcasecmp(aa, "false")) { - s->no_reboot = 0; - } else { - BAD_RET("NoReboot require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "ProductCodes")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "RemoveRouteTableIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ProductCodes argument missing\n"); + TRY((!*eq_ptr), "RemoveRouteTableIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } @@ -46529,79 +46236,152 @@ int main(int ac, char **av) int last = 0; char *dot_pos = strchr(str, '.'); - TRY(!(dot_pos++), "ProductCodes argument missing\n"); + TRY(!(dot_pos++), "RemoveRouteTableIds argument missing\n"); pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "ProductCodes require an index\n"); - if (s->product_codes) { - for (; s->product_codes[last]; ++last); + TRY(endptr == dot_pos, "RemoveRouteTableIds require an index\n"); + if (s->remove_route_table_ids) { + for (; s->remove_route_table_ids[last]; ++last); } if (pos < last) { - s->product_codes[pos] = (aa); + s->remove_route_table_ids[pos] = (aa); } else { for (int i = last; i < pos; ++i) - SET_NEXT(s->product_codes, "", pa); - SET_NEXT(s->product_codes, (aa), pa); + SET_NEXT(s->remove_route_table_ids, "", pa); + SET_NEXT(s->remove_route_table_ids, (aa), pa); } } else { - TRY(!aa, "ProductCodes argument missing\n"); - s->product_codes_str = aa; + TRY(!aa, "RemoveRouteTableIds argument missing\n"); + s->remove_route_table_ids_str = aa; } - } else if (!(aret = argcmp(str, "ProductCodes[]")) || aret == '=') { - TRY(!aa, "ProductCodes[] argument missing\n"); - SET_NEXT(s->product_codes, (aa), pa); + } else if (!(aret = argcmp(str, "RemoveRouteTableIds[]")) || aret == '=') { + TRY(!aa, "RemoveRouteTableIds[] argument missing\n"); + SET_NEXT(s->remove_route_table_ids, (aa), pa); } else - if ((aret = argcmp(next_a, "RootDeviceName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "RootDeviceName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "RootDeviceName argument missing\n"); - s->root_device_name = aa; // string string + { + BAD_RET("'%s' is not a valide argument for 'UpdateNetAccessPoint'\n", next_a); + } + i += incr; + goto update_net_access_point_arg; + } + cret = osc_update_net_access_point(&e, &r, &a); + TRY(cret, "fail to call UpdateNetAccessPoint: %s\n", curl_easy_strerror(cret)); + CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); + jobj = NULL; + if (program_flag & OAPI_RAW_OUTPUT) + puts(r.buf); + else { + jobj = json_tokener_parse(r.buf); + puts(json_object_to_json_string_ext(jobj, + JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | + color_flag)); + } + while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { + ++i; + TRY(i + 1 >= ac, "--set-var require an argument"); + if (!jobj) + jobj = json_tokener_parse(r.buf); + if (parse_variable(jobj, av, ac, i)) + return -1; + ++i; + } + + if (jobj) { + json_object_put(jobj); + jobj = NULL; + } + osc_deinit_str(&r); + } else + if (!strcmp("UpdateNet", av[i])) { + auto_osc_json_c json_object *jobj = NULL; + auto_ptr_array struct ptr_array opa = {0}; + struct ptr_array *pa = &opa; + struct osc_update_net_arg a = {0}; + struct osc_update_net_arg *s = &a; + __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; + int cret; + + cascade_struct = NULL; + cascade_parser = NULL; + + update_net_arg: + + if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { + char *next_a = &av[i + 1][2]; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int incr = 2; + char *eq_ptr = strchr(next_a, '='); - } else - if ((aret = argcmp(next_a, "SourceImageId")) == 0 || aret == '=' || aret == '.') { + CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); + if (eq_ptr) { + CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); + incr = 1; + aa = eq_ptr + 1; + } else { + CHK_BAD_RET(!aa, "cascade need an argument\n"); + META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) + } + STRY(cascade_parser(cascade_struct, next_a, aa, pa)); + i += incr; + goto update_net_arg; + } + + if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { + char *next_a = &av[i + 1][2]; + char *str = next_a; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int aret = 0; + int incr = aa ? 2 : 1; + + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } + if ((aret = argcmp(next_a, "DhcpOptionsSetId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SourceImageId argument missing\n"); + TRY((!*eq_ptr), "DhcpOptionsSetId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SourceImageId argument missing\n"); - s->source_image_id = aa; // string string + TRY(!aa, "DhcpOptionsSetId argument missing\n"); + s->dhcp_options_set_id = aa; // string string } else - if ((aret = argcmp(next_a, "SourceRegionName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SourceRegionName argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SourceRegionName argument missing\n"); - s->source_region_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "NetId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VmId argument missing\n"); + TRY((!*eq_ptr), "NetId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VmId argument missing\n"); - s->vm_id = aa; // string string + TRY(!aa, "NetId argument missing\n"); + s->net_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateImage'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateNet'\n", next_a); } i += incr; - goto create_image_arg; + goto update_net_arg; } - cret = osc_create_image(&e, &r, &a); - TRY(cret, "fail to call CreateImage: %s\n", curl_easy_strerror(cret)); + cret = osc_update_net(&e, &r, &a); + TRY(cret, "fail to call UpdateNet: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -46628,19 +46408,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateFlexibleGpu", av[i])) { + if (!strcmp("UpdateNic", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_flexible_gpu_arg a = {0}; - struct osc_create_flexible_gpu_arg *s = &a; + struct osc_update_nic_arg a = {0}; + struct osc_update_nic_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_flexible_gpu_arg: + update_nic_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -46659,7 +46439,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_flexible_gpu_arg; + goto update_nic_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -46673,22 +46453,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DeleteOnVmDeletion")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DeleteOnVmDeletion argument missing\n"); + TRY((!*eq_ptr), "Description argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_delete_on_vm_deletion = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->delete_on_vm_deletion = 1; - } else if (!strcasecmp(aa, "false")) { - s->delete_on_vm_deletion = 0; - } else { - BAD_RET("DeleteOnVmDeletion require true/false\n"); - } - } else + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -46705,47 +46480,82 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Generation")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LinkNic")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Generation argument missing\n"); + TRY((!*eq_ptr), "LinkNic argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Generation argument missing\n"); - s->generation = aa; // string string + char *dot_pos; + TRY(!aa, "LinkNic argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->link_nic; + cascade_parser = link_nic_to_update_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(link_nic_to_update_parser(&s->link_nic, dot_pos, aa, pa)); + s->is_set_link_nic = 1; + } else { + s->link_nic_str = aa; + } } else - if ((aret = argcmp(next_a, "ModelName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ModelName argument missing\n"); + TRY((!*eq_ptr), "NicId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ModelName argument missing\n"); - s->model_name = aa; // string string + TRY(!aa, "NicId argument missing\n"); + s->nic_id = aa; // string string } else - if ((aret = argcmp(next_a, "SubregionName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "SecurityGroupIds")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SubregionName argument missing\n"); + TRY((!*eq_ptr), "SecurityGroupIds argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SubregionName argument missing\n"); - s->subregion_name = aa; // string string + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + TRY(!(dot_pos++), "SecurityGroupIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "SecurityGroupIds require an index\n"); + if (s->security_group_ids) { + for (; s->security_group_ids[last]; ++last); + } + if (pos < last) { + s->security_group_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->security_group_ids, "", pa); + SET_NEXT(s->security_group_ids, (aa), pa); + } + } else { + TRY(!aa, "SecurityGroupIds argument missing\n"); + s->security_group_ids_str = aa; + } + } else if (!(aret = argcmp(str, "SecurityGroupIds[]")) || aret == '=') { + TRY(!aa, "SecurityGroupIds[] argument missing\n"); + SET_NEXT(s->security_group_ids, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'CreateFlexibleGpu'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateNic'\n", next_a); } i += incr; - goto create_flexible_gpu_arg; + goto update_nic_arg; } - cret = osc_create_flexible_gpu(&e, &r, &a); - TRY(cret, "fail to call CreateFlexibleGpu: %s\n", curl_easy_strerror(cret)); + cret = osc_update_nic(&e, &r, &a); + TRY(cret, "fail to call UpdateNic: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -46772,19 +46582,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateDirectLinkInterface", av[i])) { + if (!strcmp("UpdateRoutePropagation", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_direct_link_interface_arg a = {0}; - struct osc_create_direct_link_interface_arg *s = &a; + struct osc_update_route_propagation_arg a = {0}; + struct osc_update_route_propagation_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_direct_link_interface_arg: + update_route_propagation_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -46803,7 +46613,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_direct_link_interface_arg; + goto update_route_propagation_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -46817,64 +46627,68 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DirectLinkId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DirectLinkId argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "DirectLinkId argument missing\n"); - s->direct_link_id = aa; // string string - - } else - if ((aret = argcmp(next_a, "DirectLinkInterface")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "Enable")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DirectLinkInterface argument missing\n"); + TRY((!*eq_ptr), "Enable argument missing\n"); aa = eq_ptr + 1; incr = 1; } - char *dot_pos; - - TRY(!aa, "DirectLinkInterface argument missing\n"); - dot_pos = strchr(str, '.'); - if (dot_pos++) { - cascade_struct = &s->direct_link_interface; - cascade_parser = direct_link_interface_parser; - if (*dot_pos == '.') { - ++dot_pos; - } - STRY(direct_link_interface_parser(&s->direct_link_interface, dot_pos, aa, pa)); - s->is_set_direct_link_interface = 1; + s->is_set_enable = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->enable = 1; + } else if (!strcasecmp(aa, "false")) { + s->enable = 0; } else { - s->direct_link_interface_str = aa; + BAD_RET("Enable require true/false\n"); } + } else + if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "RouteTableId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "RouteTableId argument missing\n"); + s->route_table_id = aa; // string string + } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VirtualGatewayId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "VirtualGatewayId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else + TRY(!aa, "VirtualGatewayId argument missing\n"); + s->virtual_gateway_id = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'CreateDirectLinkInterface'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateRoutePropagation'\n", next_a); } i += incr; - goto create_direct_link_interface_arg; + goto update_route_propagation_arg; } - cret = osc_create_direct_link_interface(&e, &r, &a); - TRY(cret, "fail to call CreateDirectLinkInterface: %s\n", curl_easy_strerror(cret)); + cret = osc_update_route_propagation(&e, &r, &a); + TRY(cret, "fail to call UpdateRoutePropagation: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -46901,19 +46715,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateDirectLink", av[i])) { + if (!strcmp("UpdateRoute", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; - struct ptr_array *pa = &opa; - struct osc_create_direct_link_arg a = {0}; - struct osc_create_direct_link_arg *s = &a; + struct ptr_array *pa = &opa; + struct osc_update_route_arg a = {0}; + struct osc_update_route_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_direct_link_arg: + update_route_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -46932,7 +46746,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_direct_link_arg; + goto update_route_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -46946,26 +46760,15 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "Bandwidth")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Bandwidth argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Bandwidth argument missing\n"); - s->bandwidth = aa; // string string - - } else - if ((aret = argcmp(next_a, "DirectLinkName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DestinationIpRange")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DirectLinkName argument missing\n"); + TRY((!*eq_ptr), "DestinationIpRange argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "DirectLinkName argument missing\n"); - s->direct_link_name = aa; // string string + TRY(!aa, "DestinationIpRange argument missing\n"); + s->destination_ip_range = aa; // string string } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { @@ -46984,25 +46787,80 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Location")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "GatewayId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Location argument missing\n"); + TRY((!*eq_ptr), "GatewayId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Location argument missing\n"); - s->location = aa; // string string + TRY(!aa, "GatewayId argument missing\n"); + s->gateway_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "NatServiceId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NatServiceId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NatServiceId argument missing\n"); + s->nat_service_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "NetPeeringId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NetPeeringId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NetPeeringId argument missing\n"); + s->net_peering_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "NicId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NicId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NicId argument missing\n"); + s->nic_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "RouteTableId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "RouteTableId argument missing\n"); + s->route_table_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VmId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VmId argument missing\n"); + s->vm_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateDirectLink'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateRoute'\n", next_a); } i += incr; - goto create_direct_link_arg; + goto update_route_arg; } - cret = osc_create_direct_link(&e, &r, &a); - TRY(cret, "fail to call CreateDirectLink: %s\n", curl_easy_strerror(cret)); + cret = osc_update_route(&e, &r, &a); + TRY(cret, "fail to call UpdateRoute: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -47029,19 +46887,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateDhcpOptions", av[i])) { + if (!strcmp("UpdateRouteTableLink", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_dhcp_options_arg a = {0}; - struct osc_create_dhcp_options_arg *s = &a; + struct osc_update_route_table_link_arg a = {0}; + struct osc_update_route_table_link_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_dhcp_options_arg: + update_route_table_link_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -47060,7 +46918,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_dhcp_options_arg; + goto update_route_table_link_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -47074,51 +46932,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "DomainName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DomainName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "DomainName argument missing\n"); - s->domain_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "DomainNameServers")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "DomainNameServers argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "DomainNameServers argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "DomainNameServers require an index\n"); - if (s->domain_name_servers) { - for (; s->domain_name_servers[last]; ++last); - } - if (pos < last) { - s->domain_name_servers[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->domain_name_servers, "", pa); - SET_NEXT(s->domain_name_servers, (aa), pa); - } - } else { - TRY(!aa, "DomainNameServers argument missing\n"); - s->domain_name_servers_str = aa; - } - } else if (!(aret = argcmp(str, "DomainNameServers[]")) || aret == '=') { - TRY(!aa, "DomainNameServers[] argument missing\n"); - SET_NEXT(s->domain_name_servers, (aa), pa); - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -47135,82 +46948,36 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "LogServers")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "LinkRouteTableId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LogServers argument missing\n"); + TRY((!*eq_ptr), "LinkRouteTableId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "LinkRouteTableId argument missing\n"); + s->link_route_table_id = aa; // string string - TRY(!(dot_pos++), "LogServers argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "LogServers require an index\n"); - if (s->log_servers) { - for (; s->log_servers[last]; ++last); - } - if (pos < last) { - s->log_servers[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->log_servers, "", pa); - SET_NEXT(s->log_servers, (aa), pa); - } - } else { - TRY(!aa, "LogServers argument missing\n"); - s->log_servers_str = aa; - } - } else if (!(aret = argcmp(str, "LogServers[]")) || aret == '=') { - TRY(!aa, "LogServers[] argument missing\n"); - SET_NEXT(s->log_servers, (aa), pa); } else - if ((aret = argcmp(next_a, "NtpServers")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "RouteTableId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NtpServers argument missing\n"); + TRY((!*eq_ptr), "RouteTableId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "RouteTableId argument missing\n"); + s->route_table_id = aa; // string string - TRY(!(dot_pos++), "NtpServers argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "NtpServers require an index\n"); - if (s->ntp_servers) { - for (; s->ntp_servers[last]; ++last); - } - if (pos < last) { - s->ntp_servers[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->ntp_servers, "", pa); - SET_NEXT(s->ntp_servers, (aa), pa); - } - } else { - TRY(!aa, "NtpServers argument missing\n"); - s->ntp_servers_str = aa; - } - } else if (!(aret = argcmp(str, "NtpServers[]")) || aret == '=') { - TRY(!aa, "NtpServers[] argument missing\n"); - SET_NEXT(s->ntp_servers, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'CreateDhcpOptions'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateRouteTableLink'\n", next_a); } i += incr; - goto create_dhcp_options_arg; + goto update_route_table_link_arg; } - cret = osc_create_dhcp_options(&e, &r, &a); - TRY(cret, "fail to call CreateDhcpOptions: %s\n", curl_easy_strerror(cret)); + cret = osc_update_route_table_link(&e, &r, &a); + TRY(cret, "fail to call UpdateRouteTableLink: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -47237,19 +47004,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateDedicatedGroup", av[i])) { + if (!strcmp("UpdateServerCertificate", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_dedicated_group_arg a = {0}; - struct osc_create_dedicated_group_arg *s = &a; + struct osc_update_server_certificate_arg a = {0}; + struct osc_update_server_certificate_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_dedicated_group_arg: + update_server_certificate_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -47268,7 +47035,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_dedicated_group_arg; + goto update_server_certificate_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -47282,17 +47049,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "CpuGeneration")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "CpuGeneration argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "CpuGeneration argument missing\n"); - s->is_set_cpu_generation = 1; - s->cpu_generation = atoll(aa); - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -47320,25 +47076,36 @@ int main(int ac, char **av) s->name = aa; // string string } else - if ((aret = argcmp(next_a, "SubregionName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NewName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NewName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "NewName argument missing\n"); + s->new_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "NewPath")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "SubregionName argument missing\n"); + TRY((!*eq_ptr), "NewPath argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "SubregionName argument missing\n"); - s->subregion_name = aa; // string string + TRY(!aa, "NewPath argument missing\n"); + s->new_path = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateDedicatedGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateServerCertificate'\n", next_a); } i += incr; - goto create_dedicated_group_arg; + goto update_server_certificate_arg; } - cret = osc_create_dedicated_group(&e, &r, &a); - TRY(cret, "fail to call CreateDedicatedGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_update_server_certificate(&e, &r, &a); + TRY(cret, "fail to call UpdateServerCertificate: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -47365,19 +47132,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateClientGateway", av[i])) { + if (!strcmp("UpdateSnapshot", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_client_gateway_arg a = {0}; - struct osc_create_client_gateway_arg *s = &a; + struct osc_update_snapshot_arg a = {0}; + struct osc_update_snapshot_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_client_gateway_arg: + update_snapshot_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -47396,7 +47163,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_client_gateway_arg; + goto update_snapshot_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -47410,28 +47177,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "BgpAsn")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "BgpAsn argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "BgpAsn argument missing\n"); - s->is_set_bgp_asn = 1; - s->bgp_asn = atoll(aa); - } else - if ((aret = argcmp(next_a, "ConnectionType")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "ConnectionType argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "ConnectionType argument missing\n"); - s->connection_type = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -47448,25 +47193,48 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "PublicIp")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "PermissionsToCreateVolume")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PublicIp argument missing\n"); + TRY((!*eq_ptr), "PermissionsToCreateVolume argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PublicIp argument missing\n"); - s->public_ip = aa; // string string + char *dot_pos; + + TRY(!aa, "PermissionsToCreateVolume argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->permissions_to_create_volume; + cascade_parser = permissions_on_resource_creation_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(permissions_on_resource_creation_parser(&s->permissions_to_create_volume, dot_pos, aa, pa)); + s->is_set_permissions_to_create_volume = 1; + } else { + s->permissions_to_create_volume_str = aa; + } + } else + if ((aret = argcmp(next_a, "SnapshotId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SnapshotId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SnapshotId argument missing\n"); + s->snapshot_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateClientGateway'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateSnapshot'\n", next_a); } i += incr; - goto create_client_gateway_arg; + goto update_snapshot_arg; } - cret = osc_create_client_gateway(&e, &r, &a); - TRY(cret, "fail to call CreateClientGateway: %s\n", curl_easy_strerror(cret)); + cret = osc_update_snapshot(&e, &r, &a); + TRY(cret, "fail to call UpdateSnapshot: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -47493,19 +47261,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateCa", av[i])) { + if (!strcmp("UpdateSubnet", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_ca_arg a = {0}; - struct osc_create_ca_arg *s = &a; + struct osc_update_subnet_arg a = {0}; + struct osc_update_subnet_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_ca_arg: + update_subnet_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -47524,7 +47292,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_ca_arg; + goto update_subnet_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -47538,28 +47306,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "CaPem")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "CaPem argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "CaPem argument missing\n"); - s->ca_pem = aa; // string string - - } else - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -47576,14 +47322,41 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else + if ((aret = argcmp(next_a, "MapPublicIpOnLaunch")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "MapPublicIpOnLaunch argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_map_public_ip_on_launch = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->map_public_ip_on_launch = 1; + } else if (!strcasecmp(aa, "false")) { + s->map_public_ip_on_launch = 0; + } else { + BAD_RET("MapPublicIpOnLaunch require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "SubnetId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SubnetId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "SubnetId argument missing\n"); + s->subnet_id = aa; // string string + + } else { - BAD_RET("'%s' is not a valide argument for 'CreateCa'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateSubnet'\n", next_a); } i += incr; - goto create_ca_arg; + goto update_subnet_arg; } - cret = osc_create_ca(&e, &r, &a); - TRY(cret, "fail to call CreateCa: %s\n", curl_easy_strerror(cret)); + cret = osc_update_subnet(&e, &r, &a); + TRY(cret, "fail to call UpdateSubnet: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -47610,19 +47383,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateApiAccessRule", av[i])) { + if (!strcmp("UpdateUserGroup", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_api_access_rule_arg a = {0}; - struct osc_create_api_access_rule_arg *s = &a; + struct osc_update_user_group_arg a = {0}; + struct osc_update_user_group_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_api_access_rule_arg: + update_user_group_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -47641,7 +47414,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_api_access_rule_arg; + goto update_user_group_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -47655,143 +47428,74 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "CaIds")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "CaIds argument missing\n"); + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "CaIds argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "CaIds require an index\n"); - if (s->ca_ids) { - for (; s->ca_ids[last]; ++last); - } - if (pos < last) { - s->ca_ids[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->ca_ids, "", pa); - SET_NEXT(s->ca_ids, (aa), pa); - } - } else { - TRY(!aa, "CaIds argument missing\n"); - s->ca_ids_str = aa; - } - } else if (!(aret = argcmp(str, "CaIds[]")) || aret == '=') { - TRY(!aa, "CaIds[] argument missing\n"); - SET_NEXT(s->ca_ids, (aa), pa); - } else - if ((aret = argcmp(next_a, "Cns")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "NewPath")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Cns argument missing\n"); + TRY((!*eq_ptr), "NewPath argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "NewPath argument missing\n"); + s->new_path = aa; // string string - TRY(!(dot_pos++), "Cns argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "Cns require an index\n"); - if (s->cns) { - for (; s->cns[last]; ++last); - } - if (pos < last) { - s->cns[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->cns, "", pa); - SET_NEXT(s->cns, (aa), pa); - } - } else { - TRY(!aa, "Cns argument missing\n"); - s->cns_str = aa; - } - } else if (!(aret = argcmp(str, "Cns[]")) || aret == '=') { - TRY(!aa, "Cns[] argument missing\n"); - SET_NEXT(s->cns, (aa), pa); } else - if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NewUserGroupName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Description argument missing\n"); + TRY((!*eq_ptr), "NewUserGroupName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Description argument missing\n"); - s->description = aa; // string string + TRY(!aa, "NewUserGroupName argument missing\n"); + s->new_user_group_name = aa; // string string } else - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Path")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "Path argument missing\n"); aa = eq_ptr + 1; incr = 1; - } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "IpRanges")) == 0 || aret == '=' || aret == '.') { + } + TRY(!aa, "Path argument missing\n"); + s->path = aa; // string string + + } else + if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "IpRanges argument missing\n"); + TRY((!*eq_ptr), "UserGroupName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); + TRY(!aa, "UserGroupName argument missing\n"); + s->user_group_name = aa; // string string - TRY(!(dot_pos++), "IpRanges argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "IpRanges require an index\n"); - if (s->ip_ranges) { - for (; s->ip_ranges[last]; ++last); - } - if (pos < last) { - s->ip_ranges[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->ip_ranges, "", pa); - SET_NEXT(s->ip_ranges, (aa), pa); - } - } else { - TRY(!aa, "IpRanges argument missing\n"); - s->ip_ranges_str = aa; - } - } else if (!(aret = argcmp(str, "IpRanges[]")) || aret == '=') { - TRY(!aa, "IpRanges[] argument missing\n"); - SET_NEXT(s->ip_ranges, (aa), pa); } else { - BAD_RET("'%s' is not a valide argument for 'CreateApiAccessRule'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateUserGroup'\n", next_a); } i += incr; - goto create_api_access_rule_arg; + goto update_user_group_arg; } - cret = osc_create_api_access_rule(&e, &r, &a); - TRY(cret, "fail to call CreateApiAccessRule: %s\n", curl_easy_strerror(cret)); + cret = osc_update_user_group(&e, &r, &a); + TRY(cret, "fail to call UpdateUserGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -47818,19 +47522,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateAccount", av[i])) { + if (!strcmp("UpdateUser", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_account_arg a = {0}; - struct osc_create_account_arg *s = &a; + struct osc_update_user_arg a = {0}; + struct osc_update_user_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_account_arg: + update_user_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -47849,7 +47553,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_account_arg; + goto update_user_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -47863,84 +47567,6 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } - if ((aret = argcmp(next_a, "AdditionalEmails")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "AdditionalEmails argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - if (aret == '.') { - int pos; - char *endptr; - int last = 0; - char *dot_pos = strchr(str, '.'); - - TRY(!(dot_pos++), "AdditionalEmails argument missing\n"); - pos = strtoul(dot_pos, &endptr, 0); - TRY(endptr == dot_pos, "AdditionalEmails require an index\n"); - if (s->additional_emails) { - for (; s->additional_emails[last]; ++last); - } - if (pos < last) { - s->additional_emails[pos] = (aa); - } else { - for (int i = last; i < pos; ++i) - SET_NEXT(s->additional_emails, "", pa); - SET_NEXT(s->additional_emails, (aa), pa); - } - } else { - TRY(!aa, "AdditionalEmails argument missing\n"); - s->additional_emails_str = aa; - } - } else if (!(aret = argcmp(str, "AdditionalEmails[]")) || aret == '=') { - TRY(!aa, "AdditionalEmails[] argument missing\n"); - SET_NEXT(s->additional_emails, (aa), pa); - } else - if ((aret = argcmp(next_a, "City")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "City argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "City argument missing\n"); - s->city = aa; // string string - - } else - if ((aret = argcmp(next_a, "CompanyName")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "CompanyName argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "CompanyName argument missing\n"); - s->company_name = aa; // string string - - } else - if ((aret = argcmp(next_a, "Country")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "Country argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "Country argument missing\n"); - s->country = aa; // string string - - } else - if ((aret = argcmp(next_a, "CustomerId")) == 0 || aret == '=' || aret == '.') { - char *eq_ptr = strchr(next_a, '='); - if (eq_ptr) { - TRY((!*eq_ptr), "CustomerId argument missing\n"); - aa = eq_ptr + 1; - incr = 1; - } - TRY(!aa, "CustomerId argument missing\n"); - s->customer_id = aa; // string string - - } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -47957,113 +47583,228 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Email")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NewPath")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Email argument missing\n"); + TRY((!*eq_ptr), "NewPath argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Email argument missing\n"); - s->email = aa; // string string + TRY(!aa, "NewPath argument missing\n"); + s->new_path = aa; // string string } else - if ((aret = argcmp(next_a, "FirstName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NewUserEmail")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "FirstName argument missing\n"); + TRY((!*eq_ptr), "NewUserEmail argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "FirstName argument missing\n"); - s->first_name = aa; // string string + TRY(!aa, "NewUserEmail argument missing\n"); + s->new_user_email = aa; // string string } else - if ((aret = argcmp(next_a, "JobTitle")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "NewUserName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "JobTitle argument missing\n"); + TRY((!*eq_ptr), "NewUserName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "JobTitle argument missing\n"); - s->job_title = aa; // string string + TRY(!aa, "NewUserName argument missing\n"); + s->new_user_name = aa; // string string } else - if ((aret = argcmp(next_a, "LastName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "LastName argument missing\n"); + TRY((!*eq_ptr), "UserName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "LastName argument missing\n"); - s->last_name = aa; // string string + TRY(!aa, "UserName argument missing\n"); + s->user_name = aa; // string string } else - if ((aret = argcmp(next_a, "MobileNumber")) == 0 || aret == '=' || aret == '.') { + { + BAD_RET("'%s' is not a valide argument for 'UpdateUser'\n", next_a); + } + i += incr; + goto update_user_arg; + } + cret = osc_update_user(&e, &r, &a); + TRY(cret, "fail to call UpdateUser: %s\n", curl_easy_strerror(cret)); + CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); + jobj = NULL; + if (program_flag & OAPI_RAW_OUTPUT) + puts(r.buf); + else { + jobj = json_tokener_parse(r.buf); + puts(json_object_to_json_string_ext(jobj, + JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_NOSLASHESCAPE | + color_flag)); + } + while (i + 1 < ac && !strcmp(av[i + 1], "--set-var")) { + ++i; + TRY(i + 1 >= ac, "--set-var require an argument"); + if (!jobj) + jobj = json_tokener_parse(r.buf); + if (parse_variable(jobj, av, ac, i)) + return -1; + ++i; + } + + if (jobj) { + json_object_put(jobj); + jobj = NULL; + } + osc_deinit_str(&r); + } else + if (!strcmp("UpdateVmGroup", av[i])) { + auto_osc_json_c json_object *jobj = NULL; + auto_ptr_array struct ptr_array opa = {0}; + struct ptr_array *pa = &opa; + struct osc_update_vm_group_arg a = {0}; + struct osc_update_vm_group_arg *s = &a; + __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; + int cret; + + cascade_struct = NULL; + cascade_parser = NULL; + + update_vm_group_arg: + + if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { + char *next_a = &av[i + 1][2]; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int incr = 2; + char *eq_ptr = strchr(next_a, '='); + + CHK_BAD_RET(!cascade_struct, "cascade need to be se first\n"); + if (eq_ptr) { + CHK_BAD_RET(!*eq_ptr, "cascade need an argument\n"); + incr = 1; + aa = eq_ptr + 1; + } else { + CHK_BAD_RET(!aa, "cascade need an argument\n"); + META_ARGS({CHK_BAD_RET(aa[0] == '-', "cascade need an argument"); }) + } + STRY(cascade_parser(cascade_struct, next_a, aa, pa)); + i += incr; + goto update_vm_group_arg; + } + + if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { + char *next_a = &av[i + 1][2]; + char *str = next_a; + char *aa = i + 2 < ac ? av[i + 2] : 0; + int aret = 0; + int incr = aa ? 2 : 1; + + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "MobileNumber argument missing\n"); + TRY((!*eq_ptr), "Description argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string + + } else + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DryRun argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "MobileNumber argument missing\n"); - s->mobile_number = aa; // string string - - } else - if ((aret = argcmp(next_a, "PhoneNumber")) == 0 || aret == '=' || aret == '.') { + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "PhoneNumber argument missing\n"); + TRY((!*eq_ptr), "Tags argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "PhoneNumber argument missing\n"); - s->phone_number = aa; // string string + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); + else if (*endptr != '.') + BAD_RET("'Tags' require a .\n"); + TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); + cascade_struct = &s->tags[pos]; + cascade_parser = resource_tag_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Tags argument missing\n"); + s->tags_str = aa; // array ref ResourceTag ref + } } else - if ((aret = argcmp(next_a, "StateProvince")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmGroupId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "StateProvince argument missing\n"); + TRY((!*eq_ptr), "VmGroupId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "StateProvince argument missing\n"); - s->state_province = aa; // string string + TRY(!aa, "VmGroupId argument missing\n"); + s->vm_group_id = aa; // string string } else - if ((aret = argcmp(next_a, "VatNumber")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmGroupName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "VatNumber argument missing\n"); + TRY((!*eq_ptr), "VmGroupName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "VatNumber argument missing\n"); - s->vat_number = aa; // string string + TRY(!aa, "VmGroupName argument missing\n"); + s->vm_group_name = aa; // string string } else - if ((aret = argcmp(next_a, "ZipCode")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmTemplateId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ZipCode argument missing\n"); + TRY((!*eq_ptr), "VmTemplateId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ZipCode argument missing\n"); - s->zip_code = aa; // string string + TRY(!aa, "VmTemplateId argument missing\n"); + s->vm_template_id = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateAccount'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateVmGroup'\n", next_a); } i += incr; - goto create_account_arg; + goto update_vm_group_arg; } - cret = osc_create_account(&e, &r, &a); - TRY(cret, "fail to call CreateAccount: %s\n", curl_easy_strerror(cret)); + cret = osc_update_vm_group(&e, &r, &a); + TRY(cret, "fail to call UpdateVmGroup: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -48090,19 +47831,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CreateAccessKey", av[i])) { + if (!strcmp("UpdateVm", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_create_access_key_arg a = {0}; - struct osc_create_access_key_arg *s = &a; + struct osc_update_vm_arg a = {0}; + struct osc_update_vm_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - create_access_key_arg: + update_vm_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -48121,7 +47862,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto create_access_key_arg; + goto update_vm_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -48131,56 +47872,229 @@ int main(int ac, char **av) int aret = 0; int incr = aa ? 2 : 1; - (void)str; - if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { - META_ARGS({ aa = 0; incr = 1; }); - } - if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + (void)str; + if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { + META_ARGS({ aa = 0; incr = 1; }); + } + if ((aret = argcmp(next_a, "BlockDeviceMappings")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "BlockDeviceMappings argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'BlockDeviceMappings' require an index (example array ref BlockDeviceMappingVmUpdate.BlockDeviceMappings.0)\n"); + else if (*endptr != '.') + BAD_RET("'BlockDeviceMappings' require a .\n"); + TRY_ALLOC_AT(s,block_device_mappings, pa, pos, sizeof(*s->block_device_mappings)); + cascade_struct = &s->block_device_mappings[pos]; + cascade_parser = block_device_mapping_vm_update_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(block_device_mapping_vm_update_parser(&s->block_device_mappings[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "BlockDeviceMappings argument missing\n"); + s->block_device_mappings_str = aa; // array ref BlockDeviceMappingVmUpdate ref + } + } else + if ((aret = argcmp(next_a, "BsuOptimized")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "BsuOptimized argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_bsu_optimized = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->bsu_optimized = 1; + } else if (!strcasecmp(aa, "false")) { + s->bsu_optimized = 0; + } else { + BAD_RET("BsuOptimized require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "DeletionProtection")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DeletionProtection argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_deletion_protection = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->deletion_protection = 1; + } else if (!strcasecmp(aa, "false")) { + s->deletion_protection = 0; + } else { + BAD_RET("DeletionProtection require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "DryRun argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_dry_run = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->dry_run = 1; + } else if (!strcasecmp(aa, "false")) { + s->dry_run = 0; + } else { + BAD_RET("DryRun require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "IsSourceDestChecked")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "IsSourceDestChecked argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_is_source_dest_checked = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->is_source_dest_checked = 1; + } else if (!strcasecmp(aa, "false")) { + s->is_source_dest_checked = 0; + } else { + BAD_RET("IsSourceDestChecked require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "KeypairName")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "KeypairName argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "KeypairName argument missing\n"); + s->keypair_name = aa; // string string + + } else + if ((aret = argcmp(next_a, "NestedVirtualization")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "NestedVirtualization argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + s->is_set_nested_virtualization = 1; + if (!aa || !strcasecmp(aa, "true")) { + s->nested_virtualization = 1; + } else if (!strcasecmp(aa, "false")) { + s->nested_virtualization = 0; + } else { + BAD_RET("NestedVirtualization require true/false\n"); + } + } else + if ((aret = argcmp(next_a, "Performance")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Performance argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Performance argument missing\n"); + s->performance = aa; // string string + + } else + if ((aret = argcmp(next_a, "SecurityGroupIds")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "SecurityGroupIds argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "SecurityGroupIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "SecurityGroupIds require an index\n"); + if (s->security_group_ids) { + for (; s->security_group_ids[last]; ++last); + } + if (pos < last) { + s->security_group_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->security_group_ids, "", pa); + SET_NEXT(s->security_group_ids, (aa), pa); + } + } else { + TRY(!aa, "SecurityGroupIds argument missing\n"); + s->security_group_ids_str = aa; + } + } else if (!(aret = argcmp(str, "SecurityGroupIds[]")) || aret == '=') { + TRY(!aa, "SecurityGroupIds[] argument missing\n"); + SET_NEXT(s->security_group_ids, (aa), pa); + } else + if ((aret = argcmp(next_a, "UserData")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "UserData argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "UserData argument missing\n"); + s->user_data = aa; // string string + + } else + if ((aret = argcmp(next_a, "VmId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "DryRun argument missing\n"); + TRY((!*eq_ptr), "VmId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - s->is_set_dry_run = 1; - if (!aa || !strcasecmp(aa, "true")) { - s->dry_run = 1; - } else if (!strcasecmp(aa, "false")) { - s->dry_run = 0; - } else { - BAD_RET("DryRun require true/false\n"); - } - } else - if ((aret = argcmp(next_a, "ExpirationDate")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "VmId argument missing\n"); + s->vm_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "VmInitiatedShutdownBehavior")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "ExpirationDate argument missing\n"); + TRY((!*eq_ptr), "VmInitiatedShutdownBehavior argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "ExpirationDate argument missing\n"); - s->expiration_date = aa; // string string + TRY(!aa, "VmInitiatedShutdownBehavior argument missing\n"); + s->vm_initiated_shutdown_behavior = aa; // string string } else - if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmType")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserName argument missing\n"); + TRY((!*eq_ptr), "VmType argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserName argument missing\n"); - s->user_name = aa; // string string + TRY(!aa, "VmType argument missing\n"); + s->vm_type = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CreateAccessKey'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateVm'\n", next_a); } i += incr; - goto create_access_key_arg; + goto update_vm_arg; } - cret = osc_create_access_key(&e, &r, &a); - TRY(cret, "fail to call CreateAccessKey: %s\n", curl_easy_strerror(cret)); + cret = osc_update_vm(&e, &r, &a); + TRY(cret, "fail to call UpdateVm: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -48207,19 +48121,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("CheckAuthentication", av[i])) { + if (!strcmp("UpdateVmTemplate", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_check_authentication_arg a = {0}; - struct osc_check_authentication_arg *s = &a; + struct osc_update_vm_template_arg a = {0}; + struct osc_update_vm_template_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - check_authentication_arg: + update_vm_template_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -48238,7 +48152,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto check_authentication_arg; + goto update_vm_template_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -48252,6 +48166,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "Description")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "Description argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "Description argument missing\n"); + s->description = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -48268,36 +48193,67 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "Login")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Tags")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Login argument missing\n"); + TRY((!*eq_ptr), "Tags argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Login argument missing\n"); - s->login = aa; // string string + char *dot_pos = strchr(str, '.'); + + if (dot_pos) { + int pos; + char *endptr; + + ++dot_pos; + pos = strtoul(dot_pos, &endptr, 0); + if (endptr == dot_pos) + BAD_RET("'Tags' require an index (example array ref ResourceTag.Tags.0)\n"); + else if (*endptr != '.') + BAD_RET("'Tags' require a .\n"); + TRY_ALLOC_AT(s,tags, pa, pos, sizeof(*s->tags)); + cascade_struct = &s->tags[pos]; + cascade_parser = resource_tag_parser; + if (endptr[1] == '.') { + ++endptr; + } + STRY(resource_tag_parser(&s->tags[pos], endptr + 1, aa, pa)); + } else { + TRY(!aa, "Tags argument missing\n"); + s->tags_str = aa; // array ref ResourceTag ref + } + } else + if ((aret = argcmp(next_a, "VmTemplateId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VmTemplateId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VmTemplateId argument missing\n"); + s->vm_template_id = aa; // string string } else - if ((aret = argcmp(next_a, "Password")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VmTemplateName")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "Password argument missing\n"); + TRY((!*eq_ptr), "VmTemplateName argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "Password argument missing\n"); - s->password = aa; // string string + TRY(!aa, "VmTemplateName argument missing\n"); + s->vm_template_name = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'CheckAuthentication'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateVmTemplate'\n", next_a); } i += incr; - goto check_authentication_arg; + goto update_vm_template_arg; } - cret = osc_check_authentication(&e, &r, &a); - TRY(cret, "fail to call CheckAuthentication: %s\n", curl_easy_strerror(cret)); + cret = osc_update_vm_template(&e, &r, &a); + TRY(cret, "fail to call UpdateVmTemplate: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -48324,19 +48280,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("AddUserToUserGroup", av[i])) { + if (!strcmp("UpdateVolume", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_add_user_to_user_group_arg a = {0}; - struct osc_add_user_to_user_group_arg *s = &a; + struct osc_update_volume_arg a = {0}; + struct osc_update_volume_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - add_user_to_user_group_arg: + update_volume_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -48355,7 +48311,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto add_user_to_user_group_arg; + goto update_volume_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -48385,58 +48341,58 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "UserGroupName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Iops")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupName argument missing\n"); + TRY((!*eq_ptr), "Iops argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserGroupName argument missing\n"); - s->user_group_name = aa; // string string - + TRY(!aa, "Iops argument missing\n"); + s->is_set_iops = 1; + s->iops = atoll(aa); } else - if ((aret = argcmp(next_a, "UserGroupPath")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "Size")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserGroupPath argument missing\n"); + TRY((!*eq_ptr), "Size argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserGroupPath argument missing\n"); - s->user_group_path = aa; // string string - + TRY(!aa, "Size argument missing\n"); + s->is_set_size = 1; + s->size = atoll(aa); } else - if ((aret = argcmp(next_a, "UserName")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VolumeId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserName argument missing\n"); + TRY((!*eq_ptr), "VolumeId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserName argument missing\n"); - s->user_name = aa; // string string + TRY(!aa, "VolumeId argument missing\n"); + s->volume_id = aa; // string string } else - if ((aret = argcmp(next_a, "UserPath")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VolumeType")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "UserPath argument missing\n"); + TRY((!*eq_ptr), "VolumeType argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "UserPath argument missing\n"); - s->user_path = aa; // string string + TRY(!aa, "VolumeType argument missing\n"); + s->volume_type = aa; // string string } else { - BAD_RET("'%s' is not a valide argument for 'AddUserToUserGroup'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateVolume'\n", next_a); } i += incr; - goto add_user_to_user_group_arg; + goto update_volume_arg; } - cret = osc_add_user_to_user_group(&e, &r, &a); - TRY(cret, "fail to call AddUserToUserGroup: %s\n", curl_easy_strerror(cret)); + cret = osc_update_volume(&e, &r, &a); + TRY(cret, "fail to call UpdateVolume: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) @@ -48463,19 +48419,19 @@ int main(int ac, char **av) } osc_deinit_str(&r); } else - if (!strcmp("AcceptNetPeering", av[i])) { + if (!strcmp("UpdateVpnConnection", av[i])) { auto_osc_json_c json_object *jobj = NULL; auto_ptr_array struct ptr_array opa = {0}; struct ptr_array *pa = &opa; - struct osc_accept_net_peering_arg a = {0}; - struct osc_accept_net_peering_arg *s = &a; + struct osc_update_vpn_connection_arg a = {0}; + struct osc_update_vpn_connection_arg *s = &a; __attribute__((cleanup(files_cnt_cleanup))) char *files_cnt[MAX_FILES_PER_CMD] = {NULL}; int cret; cascade_struct = NULL; cascade_parser = NULL; - accept_net_peering_arg: + update_vpn_connection_arg: if (i + 1 < ac && av[i + 1][0] == '.' && av[i + 1][1] == '.') { char *next_a = &av[i + 1][2]; @@ -48494,7 +48450,7 @@ int main(int ac, char **av) } STRY(cascade_parser(cascade_struct, next_a, aa, pa)); i += incr; - goto accept_net_peering_arg; + goto update_vpn_connection_arg; } if (i + 1 < ac && av[i + 1][0] == '-' && av[i + 1][1] == '-' && strcmp(av[i + 1] + 2, "set-var")) { @@ -48508,6 +48464,17 @@ int main(int ac, char **av) if (aa && aa[0] == '-' && aa[1] == '-' && aa[2] != '-') { META_ARGS({ aa = 0; incr = 1; }); } + if ((aret = argcmp(next_a, "ClientGatewayId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "ClientGatewayId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "ClientGatewayId argument missing\n"); + s->client_gateway_id = aa; // string string + + } else if ((aret = argcmp(next_a, "DryRun")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { @@ -48524,25 +48491,59 @@ int main(int ac, char **av) BAD_RET("DryRun require true/false\n"); } } else - if ((aret = argcmp(next_a, "NetPeeringId")) == 0 || aret == '=' || aret == '.') { + if ((aret = argcmp(next_a, "VirtualGatewayId")) == 0 || aret == '=' || aret == '.') { char *eq_ptr = strchr(next_a, '='); if (eq_ptr) { - TRY((!*eq_ptr), "NetPeeringId argument missing\n"); + TRY((!*eq_ptr), "VirtualGatewayId argument missing\n"); aa = eq_ptr + 1; incr = 1; } - TRY(!aa, "NetPeeringId argument missing\n"); - s->net_peering_id = aa; // string string + TRY(!aa, "VirtualGatewayId argument missing\n"); + s->virtual_gateway_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "VpnConnectionId")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VpnConnectionId argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + TRY(!aa, "VpnConnectionId argument missing\n"); + s->vpn_connection_id = aa; // string string + + } else + if ((aret = argcmp(next_a, "VpnOptions")) == 0 || aret == '=' || aret == '.') { + char *eq_ptr = strchr(next_a, '='); + if (eq_ptr) { + TRY((!*eq_ptr), "VpnOptions argument missing\n"); + aa = eq_ptr + 1; + incr = 1; + } + char *dot_pos; + TRY(!aa, "VpnOptions argument missing\n"); + dot_pos = strchr(str, '.'); + if (dot_pos++) { + cascade_struct = &s->vpn_options; + cascade_parser = vpn_options_parser; + if (*dot_pos == '.') { + ++dot_pos; + } + STRY(vpn_options_parser(&s->vpn_options, dot_pos, aa, pa)); + s->is_set_vpn_options = 1; + } else { + s->vpn_options_str = aa; + } } else { - BAD_RET("'%s' is not a valide argument for 'AcceptNetPeering'\n", next_a); + BAD_RET("'%s' is not a valide argument for 'UpdateVpnConnection'\n", next_a); } i += incr; - goto accept_net_peering_arg; + goto update_vpn_connection_arg; } - cret = osc_accept_net_peering(&e, &r, &a); - TRY(cret, "fail to call AcceptNetPeering: %s\n", curl_easy_strerror(cret)); + cret = osc_update_vpn_connection(&e, &r, &a); + TRY(cret, "fail to call UpdateVpnConnection: %s\n", curl_easy_strerror(cret)); CHK_BAD_RET(!r.buf, "connection sucessful, but empty responce\n"); jobj = NULL; if (program_flag & OAPI_RAW_OUTPUT) diff --git a/oapi-cli-completion.bash b/oapi-cli-completion.bash index 7b6416f..cec598e 100644 --- a/oapi-cli-completion.bash +++ b/oapi-cli-completion.bash @@ -1,673 +1,673 @@ #/usr/bin/env bash -UpdateVpnConnection() { - COMPREPLY=($(compgen -W " --ClientGatewayId --DryRun --VirtualGatewayId --VpnConnectionId --VpnOptions.Phase1Options.DpdTimeoutAction --VpnOptions.Phase1Options.DpdTimeoutSeconds --VpnOptions.Phase1Options.IkeVersions --VpnOptions.Phase1Options.Phase1DhGroupNumbers --VpnOptions.Phase1Options.Phase1EncryptionAlgorithms --VpnOptions.Phase1Options.Phase1IntegrityAlgorithms --VpnOptions.Phase1Options.Phase1LifetimeSeconds --VpnOptions.Phase1Options.ReplayWindowSize --VpnOptions.Phase1Options.StartupAction --VpnOptions.Phase2Options.Phase2DhGroupNumbers --VpnOptions.Phase2Options.Phase2EncryptionAlgorithms --VpnOptions.Phase2Options.Phase2IntegrityAlgorithms --VpnOptions.Phase2Options.Phase2LifetimeSeconds --VpnOptions.Phase2Options.PreSharedKey --VpnOptions.TunnelInsideIpRange" -- ${cur})) +AcceptNetPeering() { + COMPREPLY=($(compgen -W " --DryRun --NetPeeringId" -- ${cur})) } -UpdateVolume() { - COMPREPLY=($(compgen -W " --DryRun --Iops --Size --VolumeId --VolumeType" -- ${cur})) +AddUserToUserGroup() { + COMPREPLY=($(compgen -W " --DryRun --UserGroupName --UserGroupPath --UserName --UserPath" -- ${cur})) } -UpdateVmTemplate() { - COMPREPLY=($(compgen -W " --Description --DryRun --Tags --VmTemplateId --VmTemplateName" -- ${cur})) +CheckAuthentication() { + COMPREPLY=($(compgen -W " --DryRun --Login --Password" -- ${cur})) } -UpdateVmGroup() { - COMPREPLY=($(compgen -W " --Description --DryRun --Tags --VmGroupId --VmGroupName --VmTemplateId" -- ${cur})) +CreateAccessKey() { + COMPREPLY=($(compgen -W " --DryRun --ExpirationDate --UserName" -- ${cur})) } -UpdateVm() { - COMPREPLY=($(compgen -W " --BlockDeviceMappings --BsuOptimized --DeletionProtection --DryRun --IsSourceDestChecked --KeypairName --NestedVirtualization --Performance --SecurityGroupIds --UserData --VmId --VmInitiatedShutdownBehavior --VmType" -- ${cur})) +CreateAccount() { + COMPREPLY=($(compgen -W " --AdditionalEmails --City --CompanyName --Country --CustomerId --DryRun --Email --FirstName --JobTitle --LastName --MobileNumber --PhoneNumber --StateProvince --VatNumber --ZipCode" -- ${cur})) } -UpdateUserGroup() { - COMPREPLY=($(compgen -W " --DryRun --NewPath --NewUserGroupName --Path --UserGroupName" -- ${cur})) +CreateApiAccessRule() { + COMPREPLY=($(compgen -W " --CaIds --Cns --Description --DryRun --IpRanges" -- ${cur})) } -UpdateUser() { - COMPREPLY=($(compgen -W " --DryRun --NewPath --NewUserEmail --NewUserName --UserName" -- ${cur})) +CreateCa() { + COMPREPLY=($(compgen -W " --CaPem --Description --DryRun" -- ${cur})) } -UpdateSubnet() { - COMPREPLY=($(compgen -W " --DryRun --MapPublicIpOnLaunch --SubnetId" -- ${cur})) +CreateClientGateway() { + COMPREPLY=($(compgen -W " --BgpAsn --ConnectionType --DryRun --PublicIp" -- ${cur})) } -UpdateSnapshot() { - COMPREPLY=($(compgen -W " --DryRun --PermissionsToCreateVolume.Additions.AccountIds --PermissionsToCreateVolume.Additions.GlobalPermission --PermissionsToCreateVolume.Removals.AccountIds --PermissionsToCreateVolume.Removals.GlobalPermission --SnapshotId" -- ${cur})) +CreateDedicatedGroup() { + COMPREPLY=($(compgen -W " --CpuGeneration --DryRun --Name --SubregionName" -- ${cur})) } -UpdateServerCertificate() { - COMPREPLY=($(compgen -W " --DryRun --Name --NewName --NewPath" -- ${cur})) +CreateDhcpOptions() { + COMPREPLY=($(compgen -W " --DomainName --DomainNameServers --DryRun --LogServers --NtpServers" -- ${cur})) } -UpdateRouteTableLink() { - COMPREPLY=($(compgen -W " --DryRun --LinkRouteTableId --RouteTableId" -- ${cur})) +CreateDirectLinkInterface() { + COMPREPLY=($(compgen -W " --DirectLinkId --DirectLinkInterface.BgpAsn --DirectLinkInterface.BgpKey --DirectLinkInterface.ClientPrivateIp --DirectLinkInterface.DirectLinkInterfaceName --DirectLinkInterface.OutscalePrivateIp --DirectLinkInterface.VirtualGatewayId --DirectLinkInterface.Vlan --DryRun" -- ${cur})) } -UpdateRoutePropagation() { - COMPREPLY=($(compgen -W " --DryRun --Enable --RouteTableId --VirtualGatewayId" -- ${cur})) +CreateDirectLink() { + COMPREPLY=($(compgen -W " --Bandwidth --DirectLinkName --DryRun --Location" -- ${cur})) } -UpdateRoute() { - COMPREPLY=($(compgen -W " --DestinationIpRange --DryRun --GatewayId --NatServiceId --NetPeeringId --NicId --RouteTableId --VmId" -- ${cur})) +CreateFlexibleGpu() { + COMPREPLY=($(compgen -W " --DeleteOnVmDeletion --DryRun --Generation --ModelName --SubregionName" -- ${cur})) } -UpdateNic() { - COMPREPLY=($(compgen -W " --Description --DryRun --LinkNic.DeleteOnVmDeletion --LinkNic.LinkNicId --NicId --SecurityGroupIds" -- ${cur})) +CreateImageExportTask() { + COMPREPLY=($(compgen -W " --DryRun --ImageId --OsuExport.DiskImageFormat --OsuExport.OsuApiKey.ApiKeyId --OsuExport.OsuApiKey.SecretKey --OsuExport.OsuBucket --OsuExport.OsuManifestUrl --OsuExport.OsuPrefix" -- ${cur})) } -UpdateNetAccessPoint() { - COMPREPLY=($(compgen -W " --AddRouteTableIds --DryRun --NetAccessPointId --RemoveRouteTableIds" -- ${cur})) +CreateImage() { + COMPREPLY=($(compgen -W " --Architecture --BlockDeviceMappings --Description --DryRun --FileLocation --ImageName --NoReboot --ProductCodes --RootDeviceName --SourceImageId --SourceRegionName --VmId" -- ${cur})) } -UpdateNet() { - COMPREPLY=($(compgen -W " --DhcpOptionsSetId --DryRun --NetId" -- ${cur})) +CreateInternetService() { + COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) } -UpdateLoadBalancer() { - COMPREPLY=($(compgen -W " --AccessLog.IsEnabled --AccessLog.OsuBucketName --AccessLog.OsuBucketPrefix --AccessLog.PublicationInterval --DryRun --HealthCheck.CheckInterval --HealthCheck.HealthyThreshold --HealthCheck.Path --HealthCheck.Port --HealthCheck.Protocol --HealthCheck.Timeout --HealthCheck.UnhealthyThreshold --LoadBalancerName --LoadBalancerPort --PolicyNames --PublicIp --SecuredCookies --SecurityGroups --ServerCertificateId" -- ${cur})) +CreateKeypair() { + COMPREPLY=($(compgen -W " --DryRun --KeypairName --PublicKey" -- ${cur})) } -UpdateListenerRule() { - COMPREPLY=($(compgen -W " --DryRun --HostPattern --ListenerRuleName --PathPattern" -- ${cur})) +CreateListenerRule() { + COMPREPLY=($(compgen -W " --DryRun --Listener.LoadBalancerName --Listener.LoadBalancerPort --ListenerRule.Action --ListenerRule.HostNamePattern --ListenerRule.ListenerRuleName --ListenerRule.PathPattern --ListenerRule.Priority --VmIds" -- ${cur})) } -UpdateImage() { - COMPREPLY=($(compgen -W " --Description --DryRun --ImageId --PermissionsToLaunch.Additions.AccountIds --PermissionsToLaunch.Additions.GlobalPermission --PermissionsToLaunch.Removals.AccountIds --PermissionsToLaunch.Removals.GlobalPermission " -- ${cur})) +CreateLoadBalancerListeners() { + COMPREPLY=($(compgen -W " --DryRun --Listeners --LoadBalancerName" -- ${cur})) } -UpdateFlexibleGpu() { - COMPREPLY=($(compgen -W " --DeleteOnVmDeletion --DryRun --FlexibleGpuId" -- ${cur})) +CreateLoadBalancerPolicy() { + COMPREPLY=($(compgen -W " --CookieExpirationPeriod --CookieName --DryRun --LoadBalancerName --PolicyName --PolicyType" -- ${cur})) } -UpdateDirectLinkInterface() { - COMPREPLY=($(compgen -W " --DirectLinkInterfaceId --DryRun --Mtu" -- ${cur})) +CreateLoadBalancer() { + COMPREPLY=($(compgen -W " --DryRun --Listeners --LoadBalancerName --LoadBalancerType --PublicIp --SecurityGroups --Subnets --SubregionNames --Tags" -- ${cur})) } -UpdateDedicatedGroup() { - COMPREPLY=($(compgen -W " --DedicatedGroupId --DryRun --Name" -- ${cur})) +CreateLoadBalancerTags() { + COMPREPLY=($(compgen -W " --DryRun --LoadBalancerNames --Tags" -- ${cur})) } -UpdateCa() { - COMPREPLY=($(compgen -W " --CaId --Description --DryRun" -- ${cur})) +CreateNatService() { + COMPREPLY=($(compgen -W " --ClientToken --DryRun --PublicIpId --SubnetId" -- ${cur})) } -UpdateApiAccessRule() { - COMPREPLY=($(compgen -W " --ApiAccessRuleId --CaIds --Cns --Description --DryRun --IpRanges" -- ${cur})) +CreateNetAccessPoint() { + COMPREPLY=($(compgen -W " --DryRun --NetId --RouteTableIds --ServiceName" -- ${cur})) } -UpdateApiAccessPolicy() { - COMPREPLY=($(compgen -W " --DryRun --MaxAccessKeyExpirationSeconds --RequireTrustedEnv" -- ${cur})) +CreateNetPeering() { + COMPREPLY=($(compgen -W " --AccepterNetId --AccepterOwnerId --DryRun --SourceNetId" -- ${cur})) } -UpdateAccount() { - COMPREPLY=($(compgen -W " --AdditionalEmails --City --CompanyName --Country --DryRun --Email --FirstName --JobTitle --LastName --MobileNumber --PhoneNumber --StateProvince --VatNumber --ZipCode" -- ${cur})) +CreateNet() { + COMPREPLY=($(compgen -W " --DryRun --IpRange --Tenancy" -- ${cur})) } -UpdateAccessKey() { - COMPREPLY=($(compgen -W " --AccessKeyId --DryRun --ExpirationDate --State --UserName" -- ${cur})) +CreateNic() { + COMPREPLY=($(compgen -W " --Description --DryRun --PrivateIps --SecurityGroupIds --SubnetId" -- ${cur})) } -UnlinkVolume() { - COMPREPLY=($(compgen -W " --DryRun --ForceUnlink --VolumeId" -- ${cur})) +CreatePolicy() { + COMPREPLY=($(compgen -W " --Description --Document --DryRun --Path --PolicyName" -- ${cur})) } -UnlinkVirtualGateway() { - COMPREPLY=($(compgen -W " --DryRun --NetId --VirtualGatewayId" -- ${cur})) +CreatePolicyVersion() { + COMPREPLY=($(compgen -W " --Document --PolicyOrn --SetAsDefault" -- ${cur})) } -UnlinkRouteTable() { - COMPREPLY=($(compgen -W " --DryRun --LinkRouteTableId" -- ${cur})) +CreateProductType() { + COMPREPLY=($(compgen -W " --Description --DryRun --Vendor" -- ${cur})) } -UnlinkPublicIp() { - COMPREPLY=($(compgen -W " --DryRun --LinkPublicIpId --PublicIp" -- ${cur})) +CreatePublicIp() { + COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) } -UnlinkPrivateIps() { - COMPREPLY=($(compgen -W " --DryRun --NicId --PrivateIps" -- ${cur})) +CreateRoute() { + COMPREPLY=($(compgen -W " --DestinationIpRange --DryRun --GatewayId --NatServiceId --NetPeeringId --NicId --RouteTableId --VmId" -- ${cur})) } -UnlinkPolicy() { - COMPREPLY=($(compgen -W " --DryRun --PolicyOrn --UserName" -- ${cur})) +CreateRouteTable() { + COMPREPLY=($(compgen -W " --DryRun --NetId" -- ${cur})) } -UnlinkNic() { - COMPREPLY=($(compgen -W " --DryRun --LinkNicId" -- ${cur})) +CreateSecurityGroup() { + COMPREPLY=($(compgen -W " --Description --DryRun --NetId --SecurityGroupName" -- ${cur})) } -UnlinkManagedPolicyFromUserGroup() { - COMPREPLY=($(compgen -W " --DryRun --PolicyOrn --UserGroupName" -- ${cur})) +CreateSecurityGroupRule() { + COMPREPLY=($(compgen -W " --DryRun --Flow --FromPortRange --IpProtocol --IpRange --Rules --SecurityGroupAccountIdToLink --SecurityGroupId --SecurityGroupNameToLink --ToPortRange" -- ${cur})) } -UnlinkLoadBalancerBackendMachines() { - COMPREPLY=($(compgen -W " --BackendIps --BackendVmIds --DryRun --LoadBalancerName" -- ${cur})) +CreateServerCertificate() { + COMPREPLY=($(compgen -W " --Body --Chain --DryRun --Name --Path --PrivateKey" -- ${cur})) } -UnlinkInternetService() { - COMPREPLY=($(compgen -W " --DryRun --InternetServiceId --NetId" -- ${cur})) +CreateSnapshotExportTask() { + COMPREPLY=($(compgen -W " --DryRun --OsuExport.DiskImageFormat --OsuExport.OsuApiKey.ApiKeyId --OsuExport.OsuApiKey.SecretKey --OsuExport.OsuBucket --OsuExport.OsuManifestUrl --OsuExport.OsuPrefix --SnapshotId" -- ${cur})) } -UnlinkFlexibleGpu() { - COMPREPLY=($(compgen -W " --DryRun --FlexibleGpuId" -- ${cur})) +CreateSnapshot() { + COMPREPLY=($(compgen -W " --Description --DryRun --FileLocation --SnapshotSize --SourceRegionName --SourceSnapshotId --VolumeId" -- ${cur})) } -StopVms() { - COMPREPLY=($(compgen -W " --DryRun --ForceStop --VmIds" -- ${cur})) +CreateSubnet() { + COMPREPLY=($(compgen -W " --DryRun --IpRange --NetId --SubregionName" -- ${cur})) } -StartVms() { - COMPREPLY=($(compgen -W " --DryRun --VmIds" -- ${cur})) +CreateTags() { + COMPREPLY=($(compgen -W " --DryRun --ResourceIds --Tags" -- ${cur})) } -SetDefaultPolicyVersion() { - COMPREPLY=($(compgen -W " --PolicyOrn --VersionId" -- ${cur})) +CreateUserGroup() { + COMPREPLY=($(compgen -W " --DryRun --Path --UserGroupName" -- ${cur})) } -ScaleUpVmGroup() { - COMPREPLY=($(compgen -W " --DryRun --VmAddition --VmGroupId" -- ${cur})) +CreateUser() { + COMPREPLY=($(compgen -W " --DryRun --Path --UserEmail --UserName" -- ${cur})) } -ScaleDownVmGroup() { - COMPREPLY=($(compgen -W " --DryRun --VmGroupId --VmSubtraction" -- ${cur})) +CreateVirtualGateway() { + COMPREPLY=($(compgen -W " --ConnectionType --DryRun" -- ${cur})) } -RemoveUserFromUserGroup() { - COMPREPLY=($(compgen -W " --DryRun --UserGroupName --UserGroupPath --UserName --UserPath" -- ${cur})) +CreateVmGroup() { + COMPREPLY=($(compgen -W " --Description --DryRun --PositioningStrategy --SecurityGroupIds --SubnetId --Tags --VmCount --VmGroupName --VmTemplateId" -- ${cur})) } -RejectNetPeering() { - COMPREPLY=($(compgen -W " --DryRun --NetPeeringId" -- ${cur})) +CreateVmTemplate() { + COMPREPLY=($(compgen -W " --CpuCores --CpuGeneration --CpuPerformance --Description --DryRun --ImageId --KeypairName --Ram --Tags --VmTemplateName" -- ${cur})) } -RegisterVmsInLoadBalancer() { - COMPREPLY=($(compgen -W " --BackendVmIds --DryRun --LoadBalancerName" -- ${cur})) +CreateVms() { + COMPREPLY=($(compgen -W " --BlockDeviceMappings --BootOnCreation --BsuOptimized --ClientToken --DeletionProtection --DryRun --ImageId --KeypairName --MaxVmsCount --MinVmsCount --NestedVirtualization --Nics --Performance --Placement.SubregionName --Placement.Tenancy --PrivateIps --SecurityGroupIds --SecurityGroups --SubnetId --UserData --VmInitiatedShutdownBehavior --VmType" -- ${cur})) } -RebootVms() { - COMPREPLY=($(compgen -W " --DryRun --VmIds" -- ${cur})) +CreateVolume() { + COMPREPLY=($(compgen -W " --DryRun --Iops --Size --SnapshotId --SubregionName --VolumeType" -- ${cur})) } -ReadVpnConnections() { - COMPREPLY=($(compgen -W " --DryRun --Filters.BgpAsns --Filters.ClientGatewayIds --Filters.ConnectionTypes --Filters.RouteDestinationIpRanges --Filters.States --Filters.StaticRoutesOnly --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VirtualGatewayIds --Filters.VpnConnectionIds --NextPageToken --ResultsPerPage" -- ${cur})) +CreateVpnConnection() { + COMPREPLY=($(compgen -W " --ClientGatewayId --ConnectionType --DryRun --StaticRoutesOnly --VirtualGatewayId" -- ${cur})) } -ReadVolumes() { - COMPREPLY=($(compgen -W " --DryRun --Filters.CreationDates --Filters.LinkVolumeDeleteOnVmDeletion --Filters.LinkVolumeDeviceNames --Filters.LinkVolumeLinkDates --Filters.LinkVolumeLinkStates --Filters.LinkVolumeVmIds --Filters.SnapshotIds --Filters.SubregionNames --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VolumeIds --Filters.VolumeSizes --Filters.VolumeStates --Filters.VolumeTypes --NextPageToken --ResultsPerPage" -- ${cur})) +CreateVpnConnectionRoute() { + COMPREPLY=($(compgen -W " --DestinationIpRange --DryRun --VpnConnectionId" -- ${cur})) } -ReadVmsState() { - COMPREPLY=($(compgen -W " --AllVms --DryRun --Filters.MaintenanceEventCodes --Filters.MaintenanceEventDescriptions --Filters.MaintenanceEventsNotAfter --Filters.MaintenanceEventsNotBefore --Filters.SubregionNames --Filters.VmIds --Filters.VmStates --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteAccessKey() { + COMPREPLY=($(compgen -W " --AccessKeyId --DryRun --UserName" -- ${cur})) } -ReadVmsHealth() { - COMPREPLY=($(compgen -W " --BackendVmIds --DryRun --LoadBalancerName" -- ${cur})) +DeleteApiAccessRule() { + COMPREPLY=($(compgen -W " --ApiAccessRuleId --DryRun" -- ${cur})) } -ReadVms() { - COMPREPLY=($(compgen -W " --DryRun --Filters.Architectures --Filters.BlockDeviceMappingDeleteOnVmDeletion --Filters.BlockDeviceMappingDeviceNames --Filters.BlockDeviceMappingLinkDates --Filters.BlockDeviceMappingStates --Filters.BlockDeviceMappingVolumeIds --Filters.ClientTokens --Filters.CreationDates --Filters.ImageIds --Filters.IsSourceDestChecked --Filters.KeypairNames --Filters.LaunchNumbers --Filters.Lifecycles --Filters.NetIds --Filters.NicAccountIds --Filters.NicDescriptions --Filters.NicIsSourceDestChecked --Filters.NicLinkNicDeleteOnVmDeletion --Filters.NicLinkNicDeviceNumbers --Filters.NicLinkNicLinkNicDates --Filters.NicLinkNicLinkNicIds --Filters.NicLinkNicStates --Filters.NicLinkNicVmAccountIds --Filters.NicLinkNicVmIds --Filters.NicLinkPublicIpAccountIds --Filters.NicLinkPublicIpLinkPublicIpIds --Filters.NicLinkPublicIpPublicIpIds --Filters.NicLinkPublicIpPublicIps --Filters.NicMacAddresses --Filters.NicNetIds --Filters.NicNicIds --Filters.NicPrivateIpsLinkPublicIpAccountIds --Filters.NicPrivateIpsLinkPublicIpIds --Filters.NicPrivateIpsPrimaryIp --Filters.NicPrivateIpsPrivateIps --Filters.NicSecurityGroupIds --Filters.NicSecurityGroupNames --Filters.NicStates --Filters.NicSubnetIds --Filters.NicSubregionNames --Filters.Platforms --Filters.PrivateIps --Filters.ProductCodes --Filters.PublicIps --Filters.ReservationIds --Filters.RootDeviceNames --Filters.RootDeviceTypes --Filters.SecurityGroupIds --Filters.SecurityGroupNames --Filters.StateReasonCodes --Filters.StateReasonMessages --Filters.StateReasons --Filters.SubnetIds --Filters.SubregionNames --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.Tenancies --Filters.VmIds --Filters.VmSecurityGroupIds --Filters.VmSecurityGroupNames --Filters.VmStateCodes --Filters.VmStateNames --Filters.VmTypes --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteCa() { + COMPREPLY=($(compgen -W " --CaId --DryRun" -- ${cur})) } -ReadVmTypes() { - COMPREPLY=($(compgen -W " --DryRun --Filters.BsuOptimized --Filters.EphemeralsTypes --Filters.Eths --Filters.Gpus --Filters.MemorySizes --Filters.VcoreCounts --Filters.VmTypeNames --Filters.VolumeCounts --Filters.VolumeSizes --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteClientGateway() { + COMPREPLY=($(compgen -W " --ClientGatewayId --DryRun" -- ${cur})) } -ReadVmTemplates() { - COMPREPLY=($(compgen -W " --DryRun --Filters.CpuCores --Filters.CpuGenerations --Filters.CpuPerformances --Filters.Descriptions --Filters.ImageIds --Filters.KeypairNames --Filters.Rams --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VmTemplateIds --Filters.VmTemplateNames" -- ${cur})) +DeleteDedicatedGroup() { + COMPREPLY=($(compgen -W " --DedicatedGroupId --DryRun --Force" -- ${cur})) } -ReadVmGroups() { - COMPREPLY=($(compgen -W " --DryRun --Filters.Descriptions --Filters.SecurityGroupIds --Filters.SubnetIds --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VmCounts --Filters.VmGroupIds --Filters.VmGroupNames --Filters.VmTemplateIds" -- ${cur})) +DeleteDhcpOptions() { + COMPREPLY=($(compgen -W " --DhcpOptionsSetId --DryRun" -- ${cur})) } -ReadVirtualGateways() { - COMPREPLY=($(compgen -W " --DryRun --Filters.ConnectionTypes --Filters.LinkNetIds --Filters.LinkStates --Filters.States --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VirtualGatewayIds --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteDirectLinkInterface() { + COMPREPLY=($(compgen -W " --DirectLinkInterfaceId --DryRun" -- ${cur})) } -ReadUsers() { - COMPREPLY=($(compgen -W " --DryRun --Filters.UserIds --FirstItem --ResultsPerPage" -- ${cur})) +DeleteDirectLink() { + COMPREPLY=($(compgen -W " --DirectLinkId --DryRun" -- ${cur})) } -ReadUserGroupsPerUser() { - COMPREPLY=($(compgen -W " --DryRun --UserName --UserPath" -- ${cur})) +DeleteExportTask() { + COMPREPLY=($(compgen -W " --DryRun --ExportTaskId" -- ${cur})) } -ReadUserGroups() { - COMPREPLY=($(compgen -W " --DryRun --Filters.PathPrefix --Filters.UserGroupIds --FirstItem --ResultsPerPage" -- ${cur})) +DeleteFlexibleGpu() { + COMPREPLY=($(compgen -W " --DryRun --FlexibleGpuId" -- ${cur})) } -ReadUserGroupPolicy() { - COMPREPLY=($(compgen -W " --DryRun --PolicyName --UserGroupName --UserGroupPath" -- ${cur})) +DeleteImage() { + COMPREPLY=($(compgen -W " --DryRun --ImageId" -- ${cur})) } -ReadUserGroupPolicies() { - COMPREPLY=($(compgen -W " --DryRun --FirstItem --ResultsPerPage --UserGroupName --UserGroupPath" -- ${cur})) +DeleteInternetService() { + COMPREPLY=($(compgen -W " --DryRun --InternetServiceId" -- ${cur})) } -ReadUserGroup() { - COMPREPLY=($(compgen -W " --DryRun --Path --UserGroupName" -- ${cur})) +DeleteKeypair() { + COMPREPLY=($(compgen -W " --DryRun --KeypairName" -- ${cur})) } -ReadUnitPrice() { - COMPREPLY=($(compgen -W " --Operation --Service --Type" -- ${cur})) +DeleteListenerRule() { + COMPREPLY=($(compgen -W " --DryRun --ListenerRuleName" -- ${cur})) } -ReadTags() { - COMPREPLY=($(compgen -W " --DryRun --Filters.Keys --Filters.ResourceIds --Filters.ResourceTypes --Filters.Values --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteLoadBalancerListeners() { + COMPREPLY=($(compgen -W " --DryRun --LoadBalancerName --LoadBalancerPorts" -- ${cur})) } -ReadSubregions() { - COMPREPLY=($(compgen -W " --DryRun --Filters.RegionNames --Filters.States --Filters.SubregionNames --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteLoadBalancerPolicy() { + COMPREPLY=($(compgen -W " --DryRun --LoadBalancerName --PolicyName" -- ${cur})) } -ReadSubnets() { - COMPREPLY=($(compgen -W " --DryRun --Filters.AvailableIpsCounts --Filters.IpRanges --Filters.NetIds --Filters.States --Filters.SubnetIds --Filters.SubregionNames --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteLoadBalancer() { + COMPREPLY=($(compgen -W " --DryRun --LoadBalancerName" -- ${cur})) } -ReadSnapshots() { - COMPREPLY=($(compgen -W " --DryRun --Filters.AccountAliases --Filters.AccountIds --Filters.Descriptions --Filters.FromCreationDate --Filters.PermissionsToCreateVolumeAccountIds --Filters.PermissionsToCreateVolumeGlobalPermission --Filters.Progresses --Filters.SnapshotIds --Filters.States --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.ToCreationDate --Filters.VolumeIds --Filters.VolumeSizes --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteLoadBalancerTags() { + COMPREPLY=($(compgen -W " --DryRun --LoadBalancerNames --Tags" -- ${cur})) } -ReadSnapshotExportTasks() { - COMPREPLY=($(compgen -W " --DryRun --Filters.TaskIds --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteNatService() { + COMPREPLY=($(compgen -W " --DryRun --NatServiceId" -- ${cur})) } -ReadServerCertificates() { - COMPREPLY=($(compgen -W " --DryRun --Filters.Paths" -- ${cur})) +DeleteNetAccessPoint() { + COMPREPLY=($(compgen -W " --DryRun --NetAccessPointId" -- ${cur})) } -ReadSecurityGroups() { - COMPREPLY=($(compgen -W " --DryRun --Filters.Descriptions --Filters.InboundRuleAccountIds --Filters.InboundRuleFromPortRanges --Filters.InboundRuleIpRanges --Filters.InboundRuleProtocols --Filters.InboundRuleSecurityGroupIds --Filters.InboundRuleSecurityGroupNames --Filters.InboundRuleToPortRanges --Filters.NetIds --Filters.OutboundRuleAccountIds --Filters.OutboundRuleFromPortRanges --Filters.OutboundRuleIpRanges --Filters.OutboundRuleProtocols --Filters.OutboundRuleSecurityGroupIds --Filters.OutboundRuleSecurityGroupNames --Filters.OutboundRuleToPortRanges --Filters.SecurityGroupIds --Filters.SecurityGroupNames --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteNetPeering() { + COMPREPLY=($(compgen -W " --DryRun --NetPeeringId" -- ${cur})) } -ReadSecretAccessKey() { - COMPREPLY=($(compgen -W " --AccessKeyId --DryRun" -- ${cur})) +DeleteNet() { + COMPREPLY=($(compgen -W " --DryRun --NetId" -- ${cur})) } -ReadRouteTables() { - COMPREPLY=($(compgen -W " --DryRun --Filters.LinkRouteTableIds --Filters.LinkRouteTableLinkRouteTableIds --Filters.LinkRouteTableMain --Filters.LinkSubnetIds --Filters.NetIds --Filters.RouteCreationMethods --Filters.RouteDestinationIpRanges --Filters.RouteDestinationServiceIds --Filters.RouteGatewayIds --Filters.RouteNatServiceIds --Filters.RouteNetPeeringIds --Filters.RouteStates --Filters.RouteTableIds --Filters.RouteVmIds --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteNic() { + COMPREPLY=($(compgen -W " --DryRun --NicId" -- ${cur})) } -ReadRegions() { - COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) +DeletePolicy() { + COMPREPLY=($(compgen -W " --DryRun --PolicyOrn" -- ${cur})) } -ReadQuotas() { - COMPREPLY=($(compgen -W " --DryRun --Filters.Collections --Filters.QuotaNames --Filters.QuotaTypes --Filters.ShortDescriptions --NextPageToken --ResultsPerPage" -- ${cur})) +DeletePolicyVersion() { + COMPREPLY=($(compgen -W " --PolicyOrn --VersionId" -- ${cur})) } -ReadPublicIps() { - COMPREPLY=($(compgen -W " --DryRun --Filters.LinkPublicIpIds --Filters.NicAccountIds --Filters.NicIds --Filters.Placements --Filters.PrivateIps --Filters.PublicIpIds --Filters.PublicIps --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VmIds --NextPageToken --ResultsPerPage" -- ${cur})) +DeletePublicIp() { + COMPREPLY=($(compgen -W " --DryRun --PublicIp --PublicIpId" -- ${cur})) } -ReadPublicIpRanges() { - COMPREPLY=($(compgen -W " --DryRun --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteRoute() { + COMPREPLY=($(compgen -W " --DestinationIpRange --DryRun --RouteTableId" -- ${cur})) } -ReadPublicCatalog() { - COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) +DeleteRouteTable() { + COMPREPLY=($(compgen -W " --DryRun --RouteTableId" -- ${cur})) } -ReadProductTypes() { - COMPREPLY=($(compgen -W " --DryRun --Filters.ProductTypeIds --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteSecurityGroup() { + COMPREPLY=($(compgen -W " --DryRun --SecurityGroupId --SecurityGroupName" -- ${cur})) } -ReadPolicyVersions() { - COMPREPLY=($(compgen -W " --FirstItem --PolicyOrn --ResultsPerPage" -- ${cur})) +DeleteSecurityGroupRule() { + COMPREPLY=($(compgen -W " --DryRun --Flow --FromPortRange --IpProtocol --IpRange --Rules --SecurityGroupAccountIdToUnlink --SecurityGroupId --SecurityGroupNameToUnlink --ToPortRange" -- ${cur})) } -ReadPolicyVersion() { - COMPREPLY=($(compgen -W " --PolicyOrn --VersionId" -- ${cur})) +DeleteServerCertificate() { + COMPREPLY=($(compgen -W " --DryRun --Name" -- ${cur})) } -ReadPolicy() { - COMPREPLY=($(compgen -W " --PolicyOrn" -- ${cur})) +DeleteSnapshot() { + COMPREPLY=($(compgen -W " --DryRun --SnapshotId" -- ${cur})) } -ReadPolicies() { - COMPREPLY=($(compgen -W " --DryRun --Filters.OnlyLinked --Filters.PathPrefix --Filters.Scope --FirstItem --ResultsPerPage" -- ${cur})) +DeleteSubnet() { + COMPREPLY=($(compgen -W " --DryRun --SubnetId" -- ${cur})) } -ReadNics() { - COMPREPLY=($(compgen -W " --DryRun --Filters.Descriptions --Filters.IsSourceDestCheck --Filters.LinkNicDeleteOnVmDeletion --Filters.LinkNicDeviceNumbers --Filters.LinkNicLinkNicIds --Filters.LinkNicStates --Filters.LinkNicVmAccountIds --Filters.LinkNicVmIds --Filters.LinkPublicIpAccountIds --Filters.LinkPublicIpLinkPublicIpIds --Filters.LinkPublicIpPublicDnsNames --Filters.LinkPublicIpPublicIpIds --Filters.LinkPublicIpPublicIps --Filters.MacAddresses --Filters.NetIds --Filters.NicIds --Filters.PrivateDnsNames --Filters.PrivateIpsLinkPublicIpAccountIds --Filters.PrivateIpsLinkPublicIpPublicIps --Filters.PrivateIpsPrimaryIp --Filters.PrivateIpsPrivateIps --Filters.SecurityGroupIds --Filters.SecurityGroupNames --Filters.States --Filters.SubnetIds --Filters.SubregionNames --Filters.TagKeys --Filters.TagValues --Filters.Tags" -- ${cur})) +DeleteTags() { + COMPREPLY=($(compgen -W " --DryRun --ResourceIds --Tags" -- ${cur})) } -ReadNets() { - COMPREPLY=($(compgen -W " --DryRun --Filters.DhcpOptionsSetIds --Filters.IpRanges --Filters.IsDefault --Filters.NetIds --Filters.States --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteUserGroupPolicy() { + COMPREPLY=($(compgen -W " --DryRun --PolicyName --UserGroupName --UserGroupPath" -- ${cur})) } -ReadNetPeerings() { - COMPREPLY=($(compgen -W " --DryRun --Filters.AccepterNetAccountIds --Filters.AccepterNetIpRanges --Filters.AccepterNetNetIds --Filters.ExpirationDates --Filters.NetPeeringIds --Filters.SourceNetAccountIds --Filters.SourceNetIpRanges --Filters.SourceNetNetIds --Filters.StateMessages --Filters.StateNames --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteUserGroup() { + COMPREPLY=($(compgen -W " --DryRun --Force --Path --UserGroupName" -- ${cur})) } -ReadNetAccessPoints() { - COMPREPLY=($(compgen -W " --DryRun --Filters.NetAccessPointIds --Filters.NetIds --Filters.ServiceNames --Filters.States --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteUser() { + COMPREPLY=($(compgen -W " --DryRun --UserName" -- ${cur})) } -ReadNetAccessPointServices() { - COMPREPLY=($(compgen -W " --DryRun --Filters.ServiceIds --Filters.ServiceNames --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteVirtualGateway() { + COMPREPLY=($(compgen -W " --DryRun --VirtualGatewayId" -- ${cur})) } -ReadNatServices() { - COMPREPLY=($(compgen -W " --DryRun --Filters.ClientTokens --Filters.NatServiceIds --Filters.NetIds --Filters.States --Filters.SubnetIds --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteVmGroup() { + COMPREPLY=($(compgen -W " --DryRun --VmGroupId" -- ${cur})) } -ReadManagedPoliciesLinkedToUserGroup() { - COMPREPLY=($(compgen -W " --DryRun --Filters.PathPrefix --Filters.UserGroupIds --FirstItem --ResultsPerPage --UserGroupName" -- ${cur})) +DeleteVmTemplate() { + COMPREPLY=($(compgen -W " --DryRun --VmTemplateId" -- ${cur})) } -ReadLocations() { - COMPREPLY=($(compgen -W " --DryRun --NextPageToken --ResultsPerPage" -- ${cur})) +DeleteVms() { + COMPREPLY=($(compgen -W " --DryRun --VmIds" -- ${cur})) } -ReadLoadBalancers() { - COMPREPLY=($(compgen -W " --DryRun --Filters.LoadBalancerNames" -- ${cur})) +DeleteVolume() { + COMPREPLY=($(compgen -W " --DryRun --VolumeId" -- ${cur})) } -ReadLoadBalancerTags() { - COMPREPLY=($(compgen -W " --DryRun --LoadBalancerNames" -- ${cur})) +DeleteVpnConnection() { + COMPREPLY=($(compgen -W " --DryRun --VpnConnectionId" -- ${cur})) } -ReadListenerRules() { - COMPREPLY=($(compgen -W " --DryRun --Filters.ListenerRuleNames" -- ${cur})) +DeleteVpnConnectionRoute() { + COMPREPLY=($(compgen -W " --DestinationIpRange --DryRun --VpnConnectionId" -- ${cur})) } -ReadLinkedPolicies() { - COMPREPLY=($(compgen -W " --DryRun --Filters.PathPrefix --FirstItem --ResultsPerPage --UserName" -- ${cur})) +DeregisterVmsInLoadBalancer() { + COMPREPLY=($(compgen -W " --BackendVmIds --DryRun --LoadBalancerName" -- ${cur})) } -ReadKeypairs() { - COMPREPLY=($(compgen -W " --DryRun --Filters.KeypairFingerprints --Filters.KeypairNames --Filters.KeypairTypes --NextPageToken --ResultsPerPage" -- ${cur})) +LinkFlexibleGpu() { + COMPREPLY=($(compgen -W " --DryRun --FlexibleGpuId --VmId" -- ${cur})) } -ReadInternetServices() { - COMPREPLY=($(compgen -W " --DryRun --Filters.InternetServiceIds --Filters.LinkNetIds --Filters.LinkStates --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) +LinkInternetService() { + COMPREPLY=($(compgen -W " --DryRun --InternetServiceId --NetId" -- ${cur})) } -ReadImages() { - COMPREPLY=($(compgen -W " --DryRun --Filters.AccountAliases --Filters.AccountIds --Filters.Architectures --Filters.BlockDeviceMappingDeleteOnVmDeletion --Filters.BlockDeviceMappingDeviceNames --Filters.BlockDeviceMappingSnapshotIds --Filters.BlockDeviceMappingVolumeSizes --Filters.BlockDeviceMappingVolumeTypes --Filters.Descriptions --Filters.FileLocations --Filters.Hypervisors --Filters.ImageIds --Filters.ImageNames --Filters.PermissionsToLaunchAccountIds --Filters.PermissionsToLaunchGlobalPermission --Filters.ProductCodeNames --Filters.ProductCodes --Filters.RootDeviceNames --Filters.RootDeviceTypes --Filters.States --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VirtualizationTypes --NextPageToken --ResultsPerPage" -- ${cur})) +LinkLoadBalancerBackendMachines() { + COMPREPLY=($(compgen -W " --BackendIps --BackendVmIds --DryRun --LoadBalancerName" -- ${cur})) } -ReadImageExportTasks() { - COMPREPLY=($(compgen -W " --DryRun --Filters.TaskIds --NextPageToken --ResultsPerPage" -- ${cur})) +LinkManagedPolicyToUserGroup() { + COMPREPLY=($(compgen -W " --DryRun --PolicyOrn --UserGroupName" -- ${cur})) } -ReadFlexibleGpus() { - COMPREPLY=($(compgen -W " --DryRun --Filters.DeleteOnVmDeletion --Filters.FlexibleGpuIds --Filters.Generations --Filters.ModelNames --Filters.States --Filters.SubregionNames --Filters.VmIds" -- ${cur})) +LinkNic() { + COMPREPLY=($(compgen -W " --DeviceNumber --DryRun --NicId --VmId" -- ${cur})) } -ReadFlexibleGpuCatalog() { - COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) +LinkPolicy() { + COMPREPLY=($(compgen -W " --DryRun --PolicyOrn --UserName" -- ${cur})) } -ReadEntitiesLinkedToPolicy() { - COMPREPLY=($(compgen -W " --EntitiesType --FirstItem --PolicyOrn --ResultsPerPage" -- ${cur})) +LinkPrivateIps() { + COMPREPLY=($(compgen -W " --AllowRelink --DryRun --NicId --PrivateIps --SecondaryPrivateIpCount" -- ${cur})) } -ReadDirectLinks() { - COMPREPLY=($(compgen -W " --DryRun --Filters.DirectLinkIds --NextPageToken --ResultsPerPage" -- ${cur})) +LinkPublicIp() { + COMPREPLY=($(compgen -W " --AllowRelink --DryRun --NicId --PrivateIp --PublicIp --PublicIpId --VmId" -- ${cur})) } -ReadDirectLinkInterfaces() { - COMPREPLY=($(compgen -W " --DryRun --Filters.DirectLinkIds --Filters.DirectLinkInterfaceIds --NextPageToken --ResultsPerPage" -- ${cur})) +LinkRouteTable() { + COMPREPLY=($(compgen -W " --DryRun --RouteTableId --SubnetId" -- ${cur})) } -ReadDhcpOptions() { - COMPREPLY=($(compgen -W " --DryRun --Filters.Default --Filters.DhcpOptionsSetIds --Filters.DomainNameServers --Filters.DomainNames --Filters.LogServers --Filters.NtpServers --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) +LinkVirtualGateway() { + COMPREPLY=($(compgen -W " --DryRun --NetId --VirtualGatewayId" -- ${cur})) } -ReadDedicatedGroups() { - COMPREPLY=($(compgen -W " --DryRun --Filters.CpuGenerations --Filters.DedicatedGroupIds --Filters.Names --Filters.SubregionNames --NextPageToken --ResultsPerPage" -- ${cur})) +LinkVolume() { + COMPREPLY=($(compgen -W " --DeviceName --DryRun --VmId --VolumeId" -- ${cur})) } -ReadConsumptionAccount() { - COMPREPLY=($(compgen -W " --DryRun --FromDate --Overall --ShowPrice --ToDate" -- ${cur})) +PutUserGroupPolicy() { + COMPREPLY=($(compgen -W " --DryRun --PolicyDocument --PolicyName --UserGroupName --UserGroupPath" -- ${cur})) } -ReadConsoleOutput() { - COMPREPLY=($(compgen -W " --DryRun --VmId" -- ${cur})) +ReadAccessKeys() { + COMPREPLY=($(compgen -W " --DryRun --Filters.AccessKeyIds --Filters.States --UserName" -- ${cur})) } -ReadClientGateways() { - COMPREPLY=($(compgen -W " --DryRun --Filters.BgpAsns --Filters.ClientGatewayIds --Filters.ConnectionTypes --Filters.PublicIps --Filters.States --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) +ReadAccounts() { + COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) } -ReadCatalogs() { - COMPREPLY=($(compgen -W " --DryRun --Filters.CurrentCatalogOnly --Filters.FromDate --Filters.ToDate" -- ${cur})) +ReadAdminPassword() { + COMPREPLY=($(compgen -W " --DryRun --VmId" -- ${cur})) } -ReadCatalog() { +ReadApiAccessPolicy() { COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) } -ReadCas() { - COMPREPLY=($(compgen -W " --DryRun --Filters.CaFingerprints --Filters.CaIds --Filters.Descriptions" -- ${cur})) +ReadApiAccessRules() { + COMPREPLY=($(compgen -W " --DryRun --Filters.ApiAccessRuleIds --Filters.CaIds --Filters.Cns --Filters.Descriptions --Filters.IpRanges" -- ${cur})) } ReadApiLogs() { COMPREPLY=($(compgen -W " --DryRun --Filters.QueryAccessKeys --Filters.QueryApiNames --Filters.QueryCallNames --Filters.QueryDateAfter --Filters.QueryDateBefore --Filters.QueryIpAddresses --Filters.QueryUserAgents --Filters.RequestIds --Filters.ResponseStatusCodes --NextPageToken --ResultsPerPage --With.AccountId --With.CallDuration --With.QueryAccessKey --With.QueryApiName --With.QueryApiVersion --With.QueryCallName --With.QueryDate --With.QueryHeaderRaw --With.QueryHeaderSize --With.QueryIpAddress --With.QueryPayloadRaw --With.QueryPayloadSize --With.QueryUserAgent --With.RequestId --With.ResponseSize --With.ResponseStatusCode" -- ${cur})) } -ReadApiAccessRules() { - COMPREPLY=($(compgen -W " --DryRun --Filters.ApiAccessRuleIds --Filters.CaIds --Filters.Cns --Filters.Descriptions --Filters.IpRanges" -- ${cur})) +ReadCas() { + COMPREPLY=($(compgen -W " --DryRun --Filters.CaFingerprints --Filters.CaIds --Filters.Descriptions" -- ${cur})) } -ReadApiAccessPolicy() { +ReadCatalog() { COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) } -ReadAdminPassword() { - COMPREPLY=($(compgen -W " --DryRun --VmId" -- ${cur})) +ReadCatalogs() { + COMPREPLY=($(compgen -W " --DryRun --Filters.CurrentCatalogOnly --Filters.FromDate --Filters.ToDate" -- ${cur})) } -ReadAccounts() { - COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) +ReadClientGateways() { + COMPREPLY=($(compgen -W " --DryRun --Filters.BgpAsns --Filters.ClientGatewayIds --Filters.ConnectionTypes --Filters.PublicIps --Filters.States --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) } -ReadAccessKeys() { - COMPREPLY=($(compgen -W " --DryRun --Filters.AccessKeyIds --Filters.States --UserName" -- ${cur})) +ReadConsoleOutput() { + COMPREPLY=($(compgen -W " --DryRun --VmId" -- ${cur})) } -PutUserGroupPolicy() { - COMPREPLY=($(compgen -W " --DryRun --PolicyDocument --PolicyName --UserGroupName --UserGroupPath" -- ${cur})) +ReadConsumptionAccount() { + COMPREPLY=($(compgen -W " --DryRun --FromDate --Overall --ShowPrice --ToDate" -- ${cur})) } -LinkVolume() { - COMPREPLY=($(compgen -W " --DeviceName --DryRun --VmId --VolumeId" -- ${cur})) +ReadDedicatedGroups() { + COMPREPLY=($(compgen -W " --DryRun --Filters.CpuGenerations --Filters.DedicatedGroupIds --Filters.Names --Filters.SubregionNames --NextPageToken --ResultsPerPage" -- ${cur})) } -LinkVirtualGateway() { - COMPREPLY=($(compgen -W " --DryRun --NetId --VirtualGatewayId" -- ${cur})) +ReadDhcpOptions() { + COMPREPLY=($(compgen -W " --DryRun --Filters.Default --Filters.DhcpOptionsSetIds --Filters.DomainNameServers --Filters.DomainNames --Filters.LogServers --Filters.NtpServers --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) } -LinkRouteTable() { - COMPREPLY=($(compgen -W " --DryRun --RouteTableId --SubnetId" -- ${cur})) +ReadDirectLinkInterfaces() { + COMPREPLY=($(compgen -W " --DryRun --Filters.DirectLinkIds --Filters.DirectLinkInterfaceIds --NextPageToken --ResultsPerPage" -- ${cur})) } -LinkPublicIp() { - COMPREPLY=($(compgen -W " --AllowRelink --DryRun --NicId --PrivateIp --PublicIp --PublicIpId --VmId" -- ${cur})) +ReadDirectLinks() { + COMPREPLY=($(compgen -W " --DryRun --Filters.DirectLinkIds --NextPageToken --ResultsPerPage" -- ${cur})) } -LinkPrivateIps() { - COMPREPLY=($(compgen -W " --AllowRelink --DryRun --NicId --PrivateIps --SecondaryPrivateIpCount" -- ${cur})) +ReadEntitiesLinkedToPolicy() { + COMPREPLY=($(compgen -W " --EntitiesType --FirstItem --PolicyOrn --ResultsPerPage" -- ${cur})) } -LinkPolicy() { - COMPREPLY=($(compgen -W " --DryRun --PolicyOrn --UserName" -- ${cur})) +ReadFlexibleGpuCatalog() { + COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) } -LinkNic() { - COMPREPLY=($(compgen -W " --DeviceNumber --DryRun --NicId --VmId" -- ${cur})) +ReadFlexibleGpus() { + COMPREPLY=($(compgen -W " --DryRun --Filters.DeleteOnVmDeletion --Filters.FlexibleGpuIds --Filters.Generations --Filters.ModelNames --Filters.States --Filters.SubregionNames --Filters.VmIds" -- ${cur})) } -LinkManagedPolicyToUserGroup() { - COMPREPLY=($(compgen -W " --DryRun --PolicyOrn --UserGroupName" -- ${cur})) +ReadImageExportTasks() { + COMPREPLY=($(compgen -W " --DryRun --Filters.TaskIds --NextPageToken --ResultsPerPage" -- ${cur})) } -LinkLoadBalancerBackendMachines() { - COMPREPLY=($(compgen -W " --BackendIps --BackendVmIds --DryRun --LoadBalancerName" -- ${cur})) +ReadImages() { + COMPREPLY=($(compgen -W " --DryRun --Filters.AccountAliases --Filters.AccountIds --Filters.Architectures --Filters.BlockDeviceMappingDeleteOnVmDeletion --Filters.BlockDeviceMappingDeviceNames --Filters.BlockDeviceMappingSnapshotIds --Filters.BlockDeviceMappingVolumeSizes --Filters.BlockDeviceMappingVolumeTypes --Filters.Descriptions --Filters.FileLocations --Filters.Hypervisors --Filters.ImageIds --Filters.ImageNames --Filters.PermissionsToLaunchAccountIds --Filters.PermissionsToLaunchGlobalPermission --Filters.ProductCodeNames --Filters.ProductCodes --Filters.RootDeviceNames --Filters.RootDeviceTypes --Filters.States --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VirtualizationTypes --NextPageToken --ResultsPerPage" -- ${cur})) } -LinkInternetService() { - COMPREPLY=($(compgen -W " --DryRun --InternetServiceId --NetId" -- ${cur})) +ReadInternetServices() { + COMPREPLY=($(compgen -W " --DryRun --Filters.InternetServiceIds --Filters.LinkNetIds --Filters.LinkStates --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) } -LinkFlexibleGpu() { - COMPREPLY=($(compgen -W " --DryRun --FlexibleGpuId --VmId" -- ${cur})) +ReadKeypairs() { + COMPREPLY=($(compgen -W " --DryRun --Filters.KeypairFingerprints --Filters.KeypairNames --Filters.KeypairTypes --NextPageToken --ResultsPerPage" -- ${cur})) } -DeregisterVmsInLoadBalancer() { - COMPREPLY=($(compgen -W " --BackendVmIds --DryRun --LoadBalancerName" -- ${cur})) +ReadLinkedPolicies() { + COMPREPLY=($(compgen -W " --DryRun --Filters.PathPrefix --FirstItem --ResultsPerPage --UserName" -- ${cur})) } -DeleteVpnConnectionRoute() { - COMPREPLY=($(compgen -W " --DestinationIpRange --DryRun --VpnConnectionId" -- ${cur})) +ReadListenerRules() { + COMPREPLY=($(compgen -W " --DryRun --Filters.ListenerRuleNames" -- ${cur})) } -DeleteVpnConnection() { - COMPREPLY=($(compgen -W " --DryRun --VpnConnectionId" -- ${cur})) +ReadLoadBalancerTags() { + COMPREPLY=($(compgen -W " --DryRun --LoadBalancerNames" -- ${cur})) } -DeleteVolume() { - COMPREPLY=($(compgen -W " --DryRun --VolumeId" -- ${cur})) +ReadLoadBalancers() { + COMPREPLY=($(compgen -W " --DryRun --Filters.LoadBalancerNames" -- ${cur})) } -DeleteVms() { - COMPREPLY=($(compgen -W " --DryRun --VmIds" -- ${cur})) +ReadLocations() { + COMPREPLY=($(compgen -W " --DryRun --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteVmTemplate() { - COMPREPLY=($(compgen -W " --DryRun --VmTemplateId" -- ${cur})) +ReadManagedPoliciesLinkedToUserGroup() { + COMPREPLY=($(compgen -W " --DryRun --Filters.PathPrefix --Filters.UserGroupIds --FirstItem --ResultsPerPage --UserGroupName" -- ${cur})) } -DeleteVmGroup() { - COMPREPLY=($(compgen -W " --DryRun --VmGroupId" -- ${cur})) +ReadNatServices() { + COMPREPLY=($(compgen -W " --DryRun --Filters.ClientTokens --Filters.NatServiceIds --Filters.NetIds --Filters.States --Filters.SubnetIds --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteVirtualGateway() { - COMPREPLY=($(compgen -W " --DryRun --VirtualGatewayId" -- ${cur})) +ReadNetAccessPointServices() { + COMPREPLY=($(compgen -W " --DryRun --Filters.ServiceIds --Filters.ServiceNames --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteUserGroupPolicy() { - COMPREPLY=($(compgen -W " --DryRun --PolicyName --UserGroupName --UserGroupPath" -- ${cur})) +ReadNetAccessPoints() { + COMPREPLY=($(compgen -W " --DryRun --Filters.NetAccessPointIds --Filters.NetIds --Filters.ServiceNames --Filters.States --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteUserGroup() { - COMPREPLY=($(compgen -W " --DryRun --Force --Path --UserGroupName" -- ${cur})) +ReadNetPeerings() { + COMPREPLY=($(compgen -W " --DryRun --Filters.AccepterNetAccountIds --Filters.AccepterNetIpRanges --Filters.AccepterNetNetIds --Filters.ExpirationDates --Filters.NetPeeringIds --Filters.SourceNetAccountIds --Filters.SourceNetIpRanges --Filters.SourceNetNetIds --Filters.StateMessages --Filters.StateNames --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteUser() { - COMPREPLY=($(compgen -W " --DryRun --UserName" -- ${cur})) +ReadNets() { + COMPREPLY=($(compgen -W " --DryRun --Filters.DhcpOptionsSetIds --Filters.IpRanges --Filters.IsDefault --Filters.NetIds --Filters.States --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteTags() { - COMPREPLY=($(compgen -W " --DryRun --ResourceIds --Tags" -- ${cur})) +ReadNics() { + COMPREPLY=($(compgen -W " --DryRun --Filters.Descriptions --Filters.IsSourceDestCheck --Filters.LinkNicDeleteOnVmDeletion --Filters.LinkNicDeviceNumbers --Filters.LinkNicLinkNicIds --Filters.LinkNicStates --Filters.LinkNicVmAccountIds --Filters.LinkNicVmIds --Filters.LinkPublicIpAccountIds --Filters.LinkPublicIpLinkPublicIpIds --Filters.LinkPublicIpPublicDnsNames --Filters.LinkPublicIpPublicIpIds --Filters.LinkPublicIpPublicIps --Filters.MacAddresses --Filters.NetIds --Filters.NicIds --Filters.PrivateDnsNames --Filters.PrivateIpsLinkPublicIpAccountIds --Filters.PrivateIpsLinkPublicIpPublicIps --Filters.PrivateIpsPrimaryIp --Filters.PrivateIpsPrivateIps --Filters.SecurityGroupIds --Filters.SecurityGroupNames --Filters.States --Filters.SubnetIds --Filters.SubregionNames --Filters.TagKeys --Filters.TagValues --Filters.Tags" -- ${cur})) } -DeleteSubnet() { - COMPREPLY=($(compgen -W " --DryRun --SubnetId" -- ${cur})) +ReadPolicies() { + COMPREPLY=($(compgen -W " --DryRun --Filters.OnlyLinked --Filters.PathPrefix --Filters.Scope --FirstItem --ResultsPerPage" -- ${cur})) } -DeleteSnapshot() { - COMPREPLY=($(compgen -W " --DryRun --SnapshotId" -- ${cur})) +ReadPolicy() { + COMPREPLY=($(compgen -W " --PolicyOrn" -- ${cur})) } -DeleteServerCertificate() { - COMPREPLY=($(compgen -W " --DryRun --Name" -- ${cur})) +ReadPolicyVersion() { + COMPREPLY=($(compgen -W " --PolicyOrn --VersionId" -- ${cur})) } -DeleteSecurityGroupRule() { - COMPREPLY=($(compgen -W " --DryRun --Flow --FromPortRange --IpProtocol --IpRange --Rules --SecurityGroupAccountIdToUnlink --SecurityGroupId --SecurityGroupNameToUnlink --ToPortRange" -- ${cur})) +ReadPolicyVersions() { + COMPREPLY=($(compgen -W " --FirstItem --PolicyOrn --ResultsPerPage" -- ${cur})) } -DeleteSecurityGroup() { - COMPREPLY=($(compgen -W " --DryRun --SecurityGroupId --SecurityGroupName" -- ${cur})) +ReadProductTypes() { + COMPREPLY=($(compgen -W " --DryRun --Filters.ProductTypeIds --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteRouteTable() { - COMPREPLY=($(compgen -W " --DryRun --RouteTableId" -- ${cur})) +ReadPublicCatalog() { + COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) } -DeleteRoute() { - COMPREPLY=($(compgen -W " --DestinationIpRange --DryRun --RouteTableId" -- ${cur})) +ReadPublicIpRanges() { + COMPREPLY=($(compgen -W " --DryRun --NextPageToken --ResultsPerPage" -- ${cur})) } -DeletePublicIp() { - COMPREPLY=($(compgen -W " --DryRun --PublicIp --PublicIpId" -- ${cur})) +ReadPublicIps() { + COMPREPLY=($(compgen -W " --DryRun --Filters.LinkPublicIpIds --Filters.NicAccountIds --Filters.NicIds --Filters.Placements --Filters.PrivateIps --Filters.PublicIpIds --Filters.PublicIps --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VmIds --NextPageToken --ResultsPerPage" -- ${cur})) } -DeletePolicyVersion() { - COMPREPLY=($(compgen -W " --PolicyOrn --VersionId" -- ${cur})) +ReadQuotas() { + COMPREPLY=($(compgen -W " --DryRun --Filters.Collections --Filters.QuotaNames --Filters.QuotaTypes --Filters.ShortDescriptions --NextPageToken --ResultsPerPage" -- ${cur})) } -DeletePolicy() { - COMPREPLY=($(compgen -W " --DryRun --PolicyOrn" -- ${cur})) +ReadRegions() { + COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) } -DeleteNic() { - COMPREPLY=($(compgen -W " --DryRun --NicId" -- ${cur})) +ReadRouteTables() { + COMPREPLY=($(compgen -W " --DryRun --Filters.LinkRouteTableIds --Filters.LinkRouteTableLinkRouteTableIds --Filters.LinkRouteTableMain --Filters.LinkSubnetIds --Filters.NetIds --Filters.RouteCreationMethods --Filters.RouteDestinationIpRanges --Filters.RouteDestinationServiceIds --Filters.RouteGatewayIds --Filters.RouteNatServiceIds --Filters.RouteNetPeeringIds --Filters.RouteStates --Filters.RouteTableIds --Filters.RouteVmIds --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteNetPeering() { - COMPREPLY=($(compgen -W " --DryRun --NetPeeringId" -- ${cur})) +ReadSecretAccessKey() { + COMPREPLY=($(compgen -W " --AccessKeyId --DryRun" -- ${cur})) } -DeleteNetAccessPoint() { - COMPREPLY=($(compgen -W " --DryRun --NetAccessPointId" -- ${cur})) +ReadSecurityGroups() { + COMPREPLY=($(compgen -W " --DryRun --Filters.Descriptions --Filters.InboundRuleAccountIds --Filters.InboundRuleFromPortRanges --Filters.InboundRuleIpRanges --Filters.InboundRuleProtocols --Filters.InboundRuleSecurityGroupIds --Filters.InboundRuleSecurityGroupNames --Filters.InboundRuleToPortRanges --Filters.NetIds --Filters.OutboundRuleAccountIds --Filters.OutboundRuleFromPortRanges --Filters.OutboundRuleIpRanges --Filters.OutboundRuleProtocols --Filters.OutboundRuleSecurityGroupIds --Filters.OutboundRuleSecurityGroupNames --Filters.OutboundRuleToPortRanges --Filters.SecurityGroupIds --Filters.SecurityGroupNames --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteNet() { - COMPREPLY=($(compgen -W " --DryRun --NetId" -- ${cur})) +ReadServerCertificates() { + COMPREPLY=($(compgen -W " --DryRun --Filters.Paths" -- ${cur})) } -DeleteNatService() { - COMPREPLY=($(compgen -W " --DryRun --NatServiceId" -- ${cur})) +ReadSnapshotExportTasks() { + COMPREPLY=($(compgen -W " --DryRun --Filters.TaskIds --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteLoadBalancerTags() { - COMPREPLY=($(compgen -W " --DryRun --LoadBalancerNames --Tags" -- ${cur})) +ReadSnapshots() { + COMPREPLY=($(compgen -W " --DryRun --Filters.AccountAliases --Filters.AccountIds --Filters.Descriptions --Filters.FromCreationDate --Filters.PermissionsToCreateVolumeAccountIds --Filters.PermissionsToCreateVolumeGlobalPermission --Filters.Progresses --Filters.SnapshotIds --Filters.States --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.ToCreationDate --Filters.VolumeIds --Filters.VolumeSizes --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteLoadBalancerPolicy() { - COMPREPLY=($(compgen -W " --DryRun --LoadBalancerName --PolicyName" -- ${cur})) +ReadSubnets() { + COMPREPLY=($(compgen -W " --DryRun --Filters.AvailableIpsCounts --Filters.IpRanges --Filters.NetIds --Filters.States --Filters.SubnetIds --Filters.SubregionNames --Filters.TagKeys --Filters.TagValues --Filters.Tags --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteLoadBalancerListeners() { - COMPREPLY=($(compgen -W " --DryRun --LoadBalancerName --LoadBalancerPorts" -- ${cur})) +ReadSubregions() { + COMPREPLY=($(compgen -W " --DryRun --Filters.RegionNames --Filters.States --Filters.SubregionNames --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteLoadBalancer() { - COMPREPLY=($(compgen -W " --DryRun --LoadBalancerName" -- ${cur})) +ReadTags() { + COMPREPLY=($(compgen -W " --DryRun --Filters.Keys --Filters.ResourceIds --Filters.ResourceTypes --Filters.Values --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteListenerRule() { - COMPREPLY=($(compgen -W " --DryRun --ListenerRuleName" -- ${cur})) +ReadUnitPrice() { + COMPREPLY=($(compgen -W " --Operation --Service --Type" -- ${cur})) } -DeleteKeypair() { - COMPREPLY=($(compgen -W " --DryRun --KeypairName" -- ${cur})) +ReadUserGroupPolicies() { + COMPREPLY=($(compgen -W " --DryRun --FirstItem --ResultsPerPage --UserGroupName --UserGroupPath" -- ${cur})) } -DeleteInternetService() { - COMPREPLY=($(compgen -W " --DryRun --InternetServiceId" -- ${cur})) +ReadUserGroupPolicy() { + COMPREPLY=($(compgen -W " --DryRun --PolicyName --UserGroupName --UserGroupPath" -- ${cur})) } -DeleteImage() { - COMPREPLY=($(compgen -W " --DryRun --ImageId" -- ${cur})) +ReadUserGroup() { + COMPREPLY=($(compgen -W " --DryRun --Path --UserGroupName" -- ${cur})) } -DeleteFlexibleGpu() { - COMPREPLY=($(compgen -W " --DryRun --FlexibleGpuId" -- ${cur})) +ReadUserGroupsPerUser() { + COMPREPLY=($(compgen -W " --DryRun --UserName --UserPath" -- ${cur})) } -DeleteExportTask() { - COMPREPLY=($(compgen -W " --DryRun --ExportTaskId" -- ${cur})) +ReadUserGroups() { + COMPREPLY=($(compgen -W " --DryRun --Filters.PathPrefix --Filters.UserGroupIds --FirstItem --ResultsPerPage" -- ${cur})) } -DeleteDirectLinkInterface() { - COMPREPLY=($(compgen -W " --DirectLinkInterfaceId --DryRun" -- ${cur})) +ReadUsers() { + COMPREPLY=($(compgen -W " --DryRun --Filters.UserIds --FirstItem --ResultsPerPage" -- ${cur})) } -DeleteDirectLink() { - COMPREPLY=($(compgen -W " --DirectLinkId --DryRun" -- ${cur})) +ReadVirtualGateways() { + COMPREPLY=($(compgen -W " --DryRun --Filters.ConnectionTypes --Filters.LinkNetIds --Filters.LinkStates --Filters.States --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VirtualGatewayIds --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteDhcpOptions() { - COMPREPLY=($(compgen -W " --DhcpOptionsSetId --DryRun" -- ${cur})) +ReadVmGroups() { + COMPREPLY=($(compgen -W " --DryRun --Filters.Descriptions --Filters.SecurityGroupIds --Filters.SubnetIds --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VmCounts --Filters.VmGroupIds --Filters.VmGroupNames --Filters.VmTemplateIds" -- ${cur})) } -DeleteDedicatedGroup() { - COMPREPLY=($(compgen -W " --DedicatedGroupId --DryRun --Force" -- ${cur})) +ReadVmTemplates() { + COMPREPLY=($(compgen -W " --DryRun --Filters.CpuCores --Filters.CpuGenerations --Filters.CpuPerformances --Filters.Descriptions --Filters.ImageIds --Filters.KeypairNames --Filters.Rams --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VmTemplateIds --Filters.VmTemplateNames" -- ${cur})) } -DeleteClientGateway() { - COMPREPLY=($(compgen -W " --ClientGatewayId --DryRun" -- ${cur})) +ReadVmTypes() { + COMPREPLY=($(compgen -W " --DryRun --Filters.BsuOptimized --Filters.EphemeralsTypes --Filters.Eths --Filters.Gpus --Filters.MemorySizes --Filters.VcoreCounts --Filters.VmTypeNames --Filters.VolumeCounts --Filters.VolumeSizes --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteCa() { - COMPREPLY=($(compgen -W " --CaId --DryRun" -- ${cur})) +ReadVmsHealth() { + COMPREPLY=($(compgen -W " --BackendVmIds --DryRun --LoadBalancerName" -- ${cur})) } -DeleteApiAccessRule() { - COMPREPLY=($(compgen -W " --ApiAccessRuleId --DryRun" -- ${cur})) +ReadVms() { + COMPREPLY=($(compgen -W " --DryRun --Filters.Architectures --Filters.BlockDeviceMappingDeleteOnVmDeletion --Filters.BlockDeviceMappingDeviceNames --Filters.BlockDeviceMappingLinkDates --Filters.BlockDeviceMappingStates --Filters.BlockDeviceMappingVolumeIds --Filters.ClientTokens --Filters.CreationDates --Filters.ImageIds --Filters.IsSourceDestChecked --Filters.KeypairNames --Filters.LaunchNumbers --Filters.Lifecycles --Filters.NetIds --Filters.NicAccountIds --Filters.NicDescriptions --Filters.NicIsSourceDestChecked --Filters.NicLinkNicDeleteOnVmDeletion --Filters.NicLinkNicDeviceNumbers --Filters.NicLinkNicLinkNicDates --Filters.NicLinkNicLinkNicIds --Filters.NicLinkNicStates --Filters.NicLinkNicVmAccountIds --Filters.NicLinkNicVmIds --Filters.NicLinkPublicIpAccountIds --Filters.NicLinkPublicIpLinkPublicIpIds --Filters.NicLinkPublicIpPublicIpIds --Filters.NicLinkPublicIpPublicIps --Filters.NicMacAddresses --Filters.NicNetIds --Filters.NicNicIds --Filters.NicPrivateIpsLinkPublicIpAccountIds --Filters.NicPrivateIpsLinkPublicIpIds --Filters.NicPrivateIpsPrimaryIp --Filters.NicPrivateIpsPrivateIps --Filters.NicSecurityGroupIds --Filters.NicSecurityGroupNames --Filters.NicStates --Filters.NicSubnetIds --Filters.NicSubregionNames --Filters.Platforms --Filters.PrivateIps --Filters.ProductCodes --Filters.PublicIps --Filters.ReservationIds --Filters.RootDeviceNames --Filters.RootDeviceTypes --Filters.SecurityGroupIds --Filters.SecurityGroupNames --Filters.StateReasonCodes --Filters.StateReasonMessages --Filters.StateReasons --Filters.SubnetIds --Filters.SubregionNames --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.Tenancies --Filters.VmIds --Filters.VmSecurityGroupIds --Filters.VmSecurityGroupNames --Filters.VmStateCodes --Filters.VmStateNames --Filters.VmTypes --NextPageToken --ResultsPerPage" -- ${cur})) } -DeleteAccessKey() { - COMPREPLY=($(compgen -W " --AccessKeyId --DryRun --UserName" -- ${cur})) +ReadVmsState() { + COMPREPLY=($(compgen -W " --AllVms --DryRun --Filters.MaintenanceEventCodes --Filters.MaintenanceEventDescriptions --Filters.MaintenanceEventsNotAfter --Filters.MaintenanceEventsNotBefore --Filters.SubregionNames --Filters.VmIds --Filters.VmStates --NextPageToken --ResultsPerPage" -- ${cur})) } -CreateVpnConnectionRoute() { - COMPREPLY=($(compgen -W " --DestinationIpRange --DryRun --VpnConnectionId" -- ${cur})) +ReadVolumes() { + COMPREPLY=($(compgen -W " --DryRun --Filters.CreationDates --Filters.LinkVolumeDeleteOnVmDeletion --Filters.LinkVolumeDeviceNames --Filters.LinkVolumeLinkDates --Filters.LinkVolumeLinkStates --Filters.LinkVolumeVmIds --Filters.SnapshotIds --Filters.SubregionNames --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VolumeIds --Filters.VolumeSizes --Filters.VolumeStates --Filters.VolumeTypes --NextPageToken --ResultsPerPage" -- ${cur})) } -CreateVpnConnection() { - COMPREPLY=($(compgen -W " --ClientGatewayId --ConnectionType --DryRun --StaticRoutesOnly --VirtualGatewayId" -- ${cur})) +ReadVpnConnections() { + COMPREPLY=($(compgen -W " --DryRun --Filters.BgpAsns --Filters.ClientGatewayIds --Filters.ConnectionTypes --Filters.RouteDestinationIpRanges --Filters.States --Filters.StaticRoutesOnly --Filters.TagKeys --Filters.TagValues --Filters.Tags --Filters.VirtualGatewayIds --Filters.VpnConnectionIds --NextPageToken --ResultsPerPage" -- ${cur})) } -CreateVolume() { - COMPREPLY=($(compgen -W " --DryRun --Iops --Size --SnapshotId --SubregionName --VolumeType" -- ${cur})) +RebootVms() { + COMPREPLY=($(compgen -W " --DryRun --VmIds" -- ${cur})) } -CreateVms() { - COMPREPLY=($(compgen -W " --BlockDeviceMappings --BootOnCreation --BsuOptimized --ClientToken --DeletionProtection --DryRun --ImageId --KeypairName --MaxVmsCount --MinVmsCount --NestedVirtualization --Nics --Performance --Placement.SubregionName --Placement.Tenancy --PrivateIps --SecurityGroupIds --SecurityGroups --SubnetId --UserData --VmInitiatedShutdownBehavior --VmType" -- ${cur})) +RegisterVmsInLoadBalancer() { + COMPREPLY=($(compgen -W " --BackendVmIds --DryRun --LoadBalancerName" -- ${cur})) } -CreateVmTemplate() { - COMPREPLY=($(compgen -W " --CpuCores --CpuGeneration --CpuPerformance --Description --DryRun --ImageId --KeypairName --Ram --Tags --VmTemplateName" -- ${cur})) +RejectNetPeering() { + COMPREPLY=($(compgen -W " --DryRun --NetPeeringId" -- ${cur})) } -CreateVmGroup() { - COMPREPLY=($(compgen -W " --Description --DryRun --PositioningStrategy --SecurityGroupIds --SubnetId --Tags --VmCount --VmGroupName --VmTemplateId" -- ${cur})) +RemoveUserFromUserGroup() { + COMPREPLY=($(compgen -W " --DryRun --UserGroupName --UserGroupPath --UserName --UserPath" -- ${cur})) } -CreateVirtualGateway() { - COMPREPLY=($(compgen -W " --ConnectionType --DryRun" -- ${cur})) +ScaleDownVmGroup() { + COMPREPLY=($(compgen -W " --DryRun --VmGroupId --VmSubtraction" -- ${cur})) } -CreateUserGroup() { - COMPREPLY=($(compgen -W " --DryRun --Path --UserGroupName" -- ${cur})) +ScaleUpVmGroup() { + COMPREPLY=($(compgen -W " --DryRun --VmAddition --VmGroupId" -- ${cur})) } -CreateUser() { - COMPREPLY=($(compgen -W " --DryRun --Path --UserEmail --UserName" -- ${cur})) +SetDefaultPolicyVersion() { + COMPREPLY=($(compgen -W " --PolicyOrn --VersionId" -- ${cur})) } -CreateTags() { - COMPREPLY=($(compgen -W " --DryRun --ResourceIds --Tags" -- ${cur})) +StartVms() { + COMPREPLY=($(compgen -W " --DryRun --VmIds" -- ${cur})) } -CreateSubnet() { - COMPREPLY=($(compgen -W " --DryRun --IpRange --NetId --SubregionName" -- ${cur})) +StopVms() { + COMPREPLY=($(compgen -W " --DryRun --ForceStop --VmIds" -- ${cur})) } -CreateSnapshotExportTask() { - COMPREPLY=($(compgen -W " --DryRun --OsuExport.DiskImageFormat --OsuExport.OsuApiKey.ApiKeyId --OsuExport.OsuApiKey.SecretKey --OsuExport.OsuBucket --OsuExport.OsuManifestUrl --OsuExport.OsuPrefix --SnapshotId" -- ${cur})) +UnlinkFlexibleGpu() { + COMPREPLY=($(compgen -W " --DryRun --FlexibleGpuId" -- ${cur})) } -CreateSnapshot() { - COMPREPLY=($(compgen -W " --Description --DryRun --FileLocation --SnapshotSize --SourceRegionName --SourceSnapshotId --VolumeId" -- ${cur})) +UnlinkInternetService() { + COMPREPLY=($(compgen -W " --DryRun --InternetServiceId --NetId" -- ${cur})) } -CreateServerCertificate() { - COMPREPLY=($(compgen -W " --Body --Chain --DryRun --Name --Path --PrivateKey" -- ${cur})) +UnlinkLoadBalancerBackendMachines() { + COMPREPLY=($(compgen -W " --BackendIps --BackendVmIds --DryRun --LoadBalancerName" -- ${cur})) } -CreateSecurityGroupRule() { - COMPREPLY=($(compgen -W " --DryRun --Flow --FromPortRange --IpProtocol --IpRange --Rules --SecurityGroupAccountIdToLink --SecurityGroupId --SecurityGroupNameToLink --ToPortRange" -- ${cur})) +UnlinkManagedPolicyFromUserGroup() { + COMPREPLY=($(compgen -W " --DryRun --PolicyOrn --UserGroupName" -- ${cur})) } -CreateSecurityGroup() { - COMPREPLY=($(compgen -W " --Description --DryRun --NetId --SecurityGroupName" -- ${cur})) +UnlinkNic() { + COMPREPLY=($(compgen -W " --DryRun --LinkNicId" -- ${cur})) } -CreateRouteTable() { - COMPREPLY=($(compgen -W " --DryRun --NetId" -- ${cur})) +UnlinkPolicy() { + COMPREPLY=($(compgen -W " --DryRun --PolicyOrn --UserName" -- ${cur})) } -CreateRoute() { - COMPREPLY=($(compgen -W " --DestinationIpRange --DryRun --GatewayId --NatServiceId --NetPeeringId --NicId --RouteTableId --VmId" -- ${cur})) +UnlinkPrivateIps() { + COMPREPLY=($(compgen -W " --DryRun --NicId --PrivateIps" -- ${cur})) } -CreatePublicIp() { - COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) +UnlinkPublicIp() { + COMPREPLY=($(compgen -W " --DryRun --LinkPublicIpId --PublicIp" -- ${cur})) } -CreateProductType() { - COMPREPLY=($(compgen -W " --Description --DryRun --Vendor" -- ${cur})) +UnlinkRouteTable() { + COMPREPLY=($(compgen -W " --DryRun --LinkRouteTableId" -- ${cur})) } -CreatePolicyVersion() { - COMPREPLY=($(compgen -W " --Document --PolicyOrn --SetAsDefault" -- ${cur})) +UnlinkVirtualGateway() { + COMPREPLY=($(compgen -W " --DryRun --NetId --VirtualGatewayId" -- ${cur})) } -CreatePolicy() { - COMPREPLY=($(compgen -W " --Description --Document --DryRun --Path --PolicyName" -- ${cur})) +UnlinkVolume() { + COMPREPLY=($(compgen -W " --DryRun --ForceUnlink --VolumeId" -- ${cur})) } -CreateNic() { - COMPREPLY=($(compgen -W " --Description --DryRun --PrivateIps --SecurityGroupIds --SubnetId" -- ${cur})) +UpdateAccessKey() { + COMPREPLY=($(compgen -W " --AccessKeyId --DryRun --ExpirationDate --State --UserName" -- ${cur})) } -CreateNetPeering() { - COMPREPLY=($(compgen -W " --AccepterNetId --AccepterOwnerId --DryRun --SourceNetId" -- ${cur})) +UpdateAccount() { + COMPREPLY=($(compgen -W " --AdditionalEmails --City --CompanyName --Country --DryRun --Email --FirstName --JobTitle --LastName --MobileNumber --PhoneNumber --StateProvince --VatNumber --ZipCode" -- ${cur})) } -CreateNetAccessPoint() { - COMPREPLY=($(compgen -W " --DryRun --NetId --RouteTableIds --ServiceName" -- ${cur})) +UpdateApiAccessPolicy() { + COMPREPLY=($(compgen -W " --DryRun --MaxAccessKeyExpirationSeconds --RequireTrustedEnv" -- ${cur})) } -CreateNet() { - COMPREPLY=($(compgen -W " --DryRun --IpRange --Tenancy" -- ${cur})) +UpdateApiAccessRule() { + COMPREPLY=($(compgen -W " --ApiAccessRuleId --CaIds --Cns --Description --DryRun --IpRanges" -- ${cur})) } -CreateNatService() { - COMPREPLY=($(compgen -W " --ClientToken --DryRun --PublicIpId --SubnetId" -- ${cur})) +UpdateCa() { + COMPREPLY=($(compgen -W " --CaId --Description --DryRun" -- ${cur})) } -CreateLoadBalancerTags() { - COMPREPLY=($(compgen -W " --DryRun --LoadBalancerNames --Tags" -- ${cur})) +UpdateDedicatedGroup() { + COMPREPLY=($(compgen -W " --DedicatedGroupId --DryRun --Name" -- ${cur})) } -CreateLoadBalancerPolicy() { - COMPREPLY=($(compgen -W " --CookieExpirationPeriod --CookieName --DryRun --LoadBalancerName --PolicyName --PolicyType" -- ${cur})) +UpdateDirectLinkInterface() { + COMPREPLY=($(compgen -W " --DirectLinkInterfaceId --DryRun --Mtu" -- ${cur})) } -CreateLoadBalancerListeners() { - COMPREPLY=($(compgen -W " --DryRun --Listeners --LoadBalancerName" -- ${cur})) +UpdateFlexibleGpu() { + COMPREPLY=($(compgen -W " --DeleteOnVmDeletion --DryRun --FlexibleGpuId" -- ${cur})) } -CreateLoadBalancer() { - COMPREPLY=($(compgen -W " --DryRun --Listeners --LoadBalancerName --LoadBalancerType --PublicIp --SecurityGroups --Subnets --SubregionNames --Tags" -- ${cur})) +UpdateImage() { + COMPREPLY=($(compgen -W " --Description --DryRun --ImageId --PermissionsToLaunch.Additions.AccountIds --PermissionsToLaunch.Additions.GlobalPermission --PermissionsToLaunch.Removals.AccountIds --PermissionsToLaunch.Removals.GlobalPermission " -- ${cur})) } -CreateListenerRule() { - COMPREPLY=($(compgen -W " --DryRun --Listener.LoadBalancerName --Listener.LoadBalancerPort --ListenerRule.Action --ListenerRule.HostNamePattern --ListenerRule.ListenerRuleName --ListenerRule.PathPattern --ListenerRule.Priority --VmIds" -- ${cur})) +UpdateListenerRule() { + COMPREPLY=($(compgen -W " --DryRun --HostPattern --ListenerRuleName --PathPattern" -- ${cur})) } -CreateKeypair() { - COMPREPLY=($(compgen -W " --DryRun --KeypairName --PublicKey" -- ${cur})) +UpdateLoadBalancer() { + COMPREPLY=($(compgen -W " --AccessLog.IsEnabled --AccessLog.OsuBucketName --AccessLog.OsuBucketPrefix --AccessLog.PublicationInterval --DryRun --HealthCheck.CheckInterval --HealthCheck.HealthyThreshold --HealthCheck.Path --HealthCheck.Port --HealthCheck.Protocol --HealthCheck.Timeout --HealthCheck.UnhealthyThreshold --LoadBalancerName --LoadBalancerPort --PolicyNames --PublicIp --SecuredCookies --SecurityGroups --ServerCertificateId" -- ${cur})) } -CreateInternetService() { - COMPREPLY=($(compgen -W " --DryRun" -- ${cur})) +UpdateNetAccessPoint() { + COMPREPLY=($(compgen -W " --AddRouteTableIds --DryRun --NetAccessPointId --RemoveRouteTableIds" -- ${cur})) } -CreateImageExportTask() { - COMPREPLY=($(compgen -W " --DryRun --ImageId --OsuExport.DiskImageFormat --OsuExport.OsuApiKey.ApiKeyId --OsuExport.OsuApiKey.SecretKey --OsuExport.OsuBucket --OsuExport.OsuManifestUrl --OsuExport.OsuPrefix" -- ${cur})) +UpdateNet() { + COMPREPLY=($(compgen -W " --DhcpOptionsSetId --DryRun --NetId" -- ${cur})) } -CreateImage() { - COMPREPLY=($(compgen -W " --Architecture --BlockDeviceMappings --Description --DryRun --FileLocation --ImageName --NoReboot --ProductCodes --RootDeviceName --SourceImageId --SourceRegionName --VmId" -- ${cur})) +UpdateNic() { + COMPREPLY=($(compgen -W " --Description --DryRun --LinkNic.DeleteOnVmDeletion --LinkNic.LinkNicId --NicId --SecurityGroupIds" -- ${cur})) } -CreateFlexibleGpu() { - COMPREPLY=($(compgen -W " --DeleteOnVmDeletion --DryRun --Generation --ModelName --SubregionName" -- ${cur})) +UpdateRoutePropagation() { + COMPREPLY=($(compgen -W " --DryRun --Enable --RouteTableId --VirtualGatewayId" -- ${cur})) } -CreateDirectLinkInterface() { - COMPREPLY=($(compgen -W " --DirectLinkId --DirectLinkInterface.BgpAsn --DirectLinkInterface.BgpKey --DirectLinkInterface.ClientPrivateIp --DirectLinkInterface.DirectLinkInterfaceName --DirectLinkInterface.OutscalePrivateIp --DirectLinkInterface.VirtualGatewayId --DirectLinkInterface.Vlan --DryRun" -- ${cur})) +UpdateRoute() { + COMPREPLY=($(compgen -W " --DestinationIpRange --DryRun --GatewayId --NatServiceId --NetPeeringId --NicId --RouteTableId --VmId" -- ${cur})) } -CreateDirectLink() { - COMPREPLY=($(compgen -W " --Bandwidth --DirectLinkName --DryRun --Location" -- ${cur})) +UpdateRouteTableLink() { + COMPREPLY=($(compgen -W " --DryRun --LinkRouteTableId --RouteTableId" -- ${cur})) } -CreateDhcpOptions() { - COMPREPLY=($(compgen -W " --DomainName --DomainNameServers --DryRun --LogServers --NtpServers" -- ${cur})) +UpdateServerCertificate() { + COMPREPLY=($(compgen -W " --DryRun --Name --NewName --NewPath" -- ${cur})) } -CreateDedicatedGroup() { - COMPREPLY=($(compgen -W " --CpuGeneration --DryRun --Name --SubregionName" -- ${cur})) +UpdateSnapshot() { + COMPREPLY=($(compgen -W " --DryRun --PermissionsToCreateVolume.Additions.AccountIds --PermissionsToCreateVolume.Additions.GlobalPermission --PermissionsToCreateVolume.Removals.AccountIds --PermissionsToCreateVolume.Removals.GlobalPermission --SnapshotId" -- ${cur})) } -CreateClientGateway() { - COMPREPLY=($(compgen -W " --BgpAsn --ConnectionType --DryRun --PublicIp" -- ${cur})) +UpdateSubnet() { + COMPREPLY=($(compgen -W " --DryRun --MapPublicIpOnLaunch --SubnetId" -- ${cur})) } -CreateCa() { - COMPREPLY=($(compgen -W " --CaPem --Description --DryRun" -- ${cur})) +UpdateUserGroup() { + COMPREPLY=($(compgen -W " --DryRun --NewPath --NewUserGroupName --Path --UserGroupName" -- ${cur})) } -CreateApiAccessRule() { - COMPREPLY=($(compgen -W " --CaIds --Cns --Description --DryRun --IpRanges" -- ${cur})) +UpdateUser() { + COMPREPLY=($(compgen -W " --DryRun --NewPath --NewUserEmail --NewUserName --UserName" -- ${cur})) } -CreateAccount() { - COMPREPLY=($(compgen -W " --AdditionalEmails --City --CompanyName --Country --CustomerId --DryRun --Email --FirstName --JobTitle --LastName --MobileNumber --PhoneNumber --StateProvince --VatNumber --ZipCode" -- ${cur})) +UpdateVmGroup() { + COMPREPLY=($(compgen -W " --Description --DryRun --Tags --VmGroupId --VmGroupName --VmTemplateId" -- ${cur})) } -CreateAccessKey() { - COMPREPLY=($(compgen -W " --DryRun --ExpirationDate --UserName" -- ${cur})) +UpdateVm() { + COMPREPLY=($(compgen -W " --BlockDeviceMappings --BsuOptimized --DeletionProtection --DryRun --IsSourceDestChecked --KeypairName --NestedVirtualization --Performance --SecurityGroupIds --UserData --VmId --VmInitiatedShutdownBehavior --VmType" -- ${cur})) } -CheckAuthentication() { - COMPREPLY=($(compgen -W " --DryRun --Login --Password" -- ${cur})) +UpdateVmTemplate() { + COMPREPLY=($(compgen -W " --Description --DryRun --Tags --VmTemplateId --VmTemplateName" -- ${cur})) } -AddUserToUserGroup() { - COMPREPLY=($(compgen -W " --DryRun --UserGroupName --UserGroupPath --UserName --UserPath" -- ${cur})) +UpdateVolume() { + COMPREPLY=($(compgen -W " --DryRun --Iops --Size --VolumeId --VolumeType" -- ${cur})) } -AcceptNetPeering() { - COMPREPLY=($(compgen -W " --DryRun --NetPeeringId" -- ${cur})) +UpdateVpnConnection() { + COMPREPLY=($(compgen -W " --ClientGatewayId --DryRun --VirtualGatewayId --VpnConnectionId --VpnOptions.Phase1Options.DpdTimeoutAction --VpnOptions.Phase1Options.DpdTimeoutSeconds --VpnOptions.Phase1Options.IkeVersions --VpnOptions.Phase1Options.Phase1DhGroupNumbers --VpnOptions.Phase1Options.Phase1EncryptionAlgorithms --VpnOptions.Phase1Options.Phase1IntegrityAlgorithms --VpnOptions.Phase1Options.Phase1LifetimeSeconds --VpnOptions.Phase1Options.ReplayWindowSize --VpnOptions.Phase1Options.StartupAction --VpnOptions.Phase2Options.Phase2DhGroupNumbers --VpnOptions.Phase2Options.Phase2EncryptionAlgorithms --VpnOptions.Phase2Options.Phase2IntegrityAlgorithms --VpnOptions.Phase2Options.Phase2LifetimeSeconds --VpnOptions.Phase2Options.PreSharedKey --VpnOptions.TunnelInsideIpRange" -- ${cur})) } _mk_profiles() @@ -688,15 +688,15 @@ _cognac() case ${COMP_CWORD} in *) case ${prev} in - UpdateVpnConnection | UpdateVolume | UpdateVmTemplate | UpdateVmGroup | UpdateVm | UpdateUserGroup | UpdateUser | UpdateSubnet | UpdateSnapshot | UpdateServerCertificate | UpdateRouteTableLink | UpdateRoutePropagation | UpdateRoute | UpdateNic | UpdateNetAccessPoint | UpdateNet | UpdateLoadBalancer | UpdateListenerRule | UpdateImage | UpdateFlexibleGpu | UpdateDirectLinkInterface | UpdateDedicatedGroup | UpdateCa | UpdateApiAccessRule | UpdateApiAccessPolicy | UpdateAccount | UpdateAccessKey | UnlinkVolume | UnlinkVirtualGateway | UnlinkRouteTable | UnlinkPublicIp | UnlinkPrivateIps | UnlinkPolicy | UnlinkNic | UnlinkManagedPolicyFromUserGroup | UnlinkLoadBalancerBackendMachines | UnlinkInternetService | UnlinkFlexibleGpu | StopVms | StartVms | SetDefaultPolicyVersion | ScaleUpVmGroup | ScaleDownVmGroup | RemoveUserFromUserGroup | RejectNetPeering | RegisterVmsInLoadBalancer | RebootVms | ReadVpnConnections | ReadVolumes | ReadVmsState | ReadVmsHealth | ReadVms | ReadVmTypes | ReadVmTemplates | ReadVmGroups | ReadVirtualGateways | ReadUsers | ReadUserGroupsPerUser | ReadUserGroups | ReadUserGroupPolicy | ReadUserGroupPolicies | ReadUserGroup | ReadUnitPrice | ReadTags | ReadSubregions | ReadSubnets | ReadSnapshots | ReadSnapshotExportTasks | ReadServerCertificates | ReadSecurityGroups | ReadSecretAccessKey | ReadRouteTables | ReadRegions | ReadQuotas | ReadPublicIps | ReadPublicIpRanges | ReadPublicCatalog | ReadProductTypes | ReadPolicyVersions | ReadPolicyVersion | ReadPolicy | ReadPolicies | ReadNics | ReadNets | ReadNetPeerings | ReadNetAccessPoints | ReadNetAccessPointServices | ReadNatServices | ReadManagedPoliciesLinkedToUserGroup | ReadLocations | ReadLoadBalancers | ReadLoadBalancerTags | ReadListenerRules | ReadLinkedPolicies | ReadKeypairs | ReadInternetServices | ReadImages | ReadImageExportTasks | ReadFlexibleGpus | ReadFlexibleGpuCatalog | ReadEntitiesLinkedToPolicy | ReadDirectLinks | ReadDirectLinkInterfaces | ReadDhcpOptions | ReadDedicatedGroups | ReadConsumptionAccount | ReadConsoleOutput | ReadClientGateways | ReadCatalogs | ReadCatalog | ReadCas | ReadApiLogs | ReadApiAccessRules | ReadApiAccessPolicy | ReadAdminPassword | ReadAccounts | ReadAccessKeys | PutUserGroupPolicy | LinkVolume | LinkVirtualGateway | LinkRouteTable | LinkPublicIp | LinkPrivateIps | LinkPolicy | LinkNic | LinkManagedPolicyToUserGroup | LinkLoadBalancerBackendMachines | LinkInternetService | LinkFlexibleGpu | DeregisterVmsInLoadBalancer | DeleteVpnConnectionRoute | DeleteVpnConnection | DeleteVolume | DeleteVms | DeleteVmTemplate | DeleteVmGroup | DeleteVirtualGateway | DeleteUserGroupPolicy | DeleteUserGroup | DeleteUser | DeleteTags | DeleteSubnet | DeleteSnapshot | DeleteServerCertificate | DeleteSecurityGroupRule | DeleteSecurityGroup | DeleteRouteTable | DeleteRoute | DeletePublicIp | DeletePolicyVersion | DeletePolicy | DeleteNic | DeleteNetPeering | DeleteNetAccessPoint | DeleteNet | DeleteNatService | DeleteLoadBalancerTags | DeleteLoadBalancerPolicy | DeleteLoadBalancerListeners | DeleteLoadBalancer | DeleteListenerRule | DeleteKeypair | DeleteInternetService | DeleteImage | DeleteFlexibleGpu | DeleteExportTask | DeleteDirectLinkInterface | DeleteDirectLink | DeleteDhcpOptions | DeleteDedicatedGroup | DeleteClientGateway | DeleteCa | DeleteApiAccessRule | DeleteAccessKey | CreateVpnConnectionRoute | CreateVpnConnection | CreateVolume | CreateVms | CreateVmTemplate | CreateVmGroup | CreateVirtualGateway | CreateUserGroup | CreateUser | CreateTags | CreateSubnet | CreateSnapshotExportTask | CreateSnapshot | CreateServerCertificate | CreateSecurityGroupRule | CreateSecurityGroup | CreateRouteTable | CreateRoute | CreatePublicIp | CreateProductType | CreatePolicyVersion | CreatePolicy | CreateNic | CreateNetPeering | CreateNetAccessPoint | CreateNet | CreateNatService | CreateLoadBalancerTags | CreateLoadBalancerPolicy | CreateLoadBalancerListeners | CreateLoadBalancer | CreateListenerRule | CreateKeypair | CreateInternetService | CreateImageExportTask | CreateImage | CreateFlexibleGpu | CreateDirectLinkInterface | CreateDirectLink | CreateDhcpOptions | CreateDedicatedGroup | CreateClientGateway | CreateCa | CreateApiAccessRule | CreateAccount | CreateAccessKey | CheckAuthentication | AddUserToUserGroup | AcceptNetPeering) + AcceptNetPeering | AddUserToUserGroup | CheckAuthentication | CreateAccessKey | CreateAccount | CreateApiAccessRule | CreateCa | CreateClientGateway | CreateDedicatedGroup | CreateDhcpOptions | CreateDirectLinkInterface | CreateDirectLink | CreateFlexibleGpu | CreateImageExportTask | CreateImage | CreateInternetService | CreateKeypair | CreateListenerRule | CreateLoadBalancerListeners | CreateLoadBalancerPolicy | CreateLoadBalancer | CreateLoadBalancerTags | CreateNatService | CreateNetAccessPoint | CreateNetPeering | CreateNet | CreateNic | CreatePolicy | CreatePolicyVersion | CreateProductType | CreatePublicIp | CreateRoute | CreateRouteTable | CreateSecurityGroup | CreateSecurityGroupRule | CreateServerCertificate | CreateSnapshotExportTask | CreateSnapshot | CreateSubnet | CreateTags | CreateUserGroup | CreateUser | CreateVirtualGateway | CreateVmGroup | CreateVmTemplate | CreateVms | CreateVolume | CreateVpnConnection | CreateVpnConnectionRoute | DeleteAccessKey | DeleteApiAccessRule | DeleteCa | DeleteClientGateway | DeleteDedicatedGroup | DeleteDhcpOptions | DeleteDirectLinkInterface | DeleteDirectLink | DeleteExportTask | DeleteFlexibleGpu | DeleteImage | DeleteInternetService | DeleteKeypair | DeleteListenerRule | DeleteLoadBalancerListeners | DeleteLoadBalancerPolicy | DeleteLoadBalancer | DeleteLoadBalancerTags | DeleteNatService | DeleteNetAccessPoint | DeleteNetPeering | DeleteNet | DeleteNic | DeletePolicy | DeletePolicyVersion | DeletePublicIp | DeleteRoute | DeleteRouteTable | DeleteSecurityGroup | DeleteSecurityGroupRule | DeleteServerCertificate | DeleteSnapshot | DeleteSubnet | DeleteTags | DeleteUserGroupPolicy | DeleteUserGroup | DeleteUser | DeleteVirtualGateway | DeleteVmGroup | DeleteVmTemplate | DeleteVms | DeleteVolume | DeleteVpnConnection | DeleteVpnConnectionRoute | DeregisterVmsInLoadBalancer | LinkFlexibleGpu | LinkInternetService | LinkLoadBalancerBackendMachines | LinkManagedPolicyToUserGroup | LinkNic | LinkPolicy | LinkPrivateIps | LinkPublicIp | LinkRouteTable | LinkVirtualGateway | LinkVolume | PutUserGroupPolicy | ReadAccessKeys | ReadAccounts | ReadAdminPassword | ReadApiAccessPolicy | ReadApiAccessRules | ReadApiLogs | ReadCas | ReadCatalog | ReadCatalogs | ReadClientGateways | ReadConsoleOutput | ReadConsumptionAccount | ReadDedicatedGroups | ReadDhcpOptions | ReadDirectLinkInterfaces | ReadDirectLinks | ReadEntitiesLinkedToPolicy | ReadFlexibleGpuCatalog | ReadFlexibleGpus | ReadImageExportTasks | ReadImages | ReadInternetServices | ReadKeypairs | ReadLinkedPolicies | ReadListenerRules | ReadLoadBalancerTags | ReadLoadBalancers | ReadLocations | ReadManagedPoliciesLinkedToUserGroup | ReadNatServices | ReadNetAccessPointServices | ReadNetAccessPoints | ReadNetPeerings | ReadNets | ReadNics | ReadPolicies | ReadPolicy | ReadPolicyVersion | ReadPolicyVersions | ReadProductTypes | ReadPublicCatalog | ReadPublicIpRanges | ReadPublicIps | ReadQuotas | ReadRegions | ReadRouteTables | ReadSecretAccessKey | ReadSecurityGroups | ReadServerCertificates | ReadSnapshotExportTasks | ReadSnapshots | ReadSubnets | ReadSubregions | ReadTags | ReadUnitPrice | ReadUserGroupPolicies | ReadUserGroupPolicy | ReadUserGroup | ReadUserGroupsPerUser | ReadUserGroups | ReadUsers | ReadVirtualGateways | ReadVmGroups | ReadVmTemplates | ReadVmTypes | ReadVmsHealth | ReadVms | ReadVmsState | ReadVolumes | ReadVpnConnections | RebootVms | RegisterVmsInLoadBalancer | RejectNetPeering | RemoveUserFromUserGroup | ScaleDownVmGroup | ScaleUpVmGroup | SetDefaultPolicyVersion | StartVms | StopVms | UnlinkFlexibleGpu | UnlinkInternetService | UnlinkLoadBalancerBackendMachines | UnlinkManagedPolicyFromUserGroup | UnlinkNic | UnlinkPolicy | UnlinkPrivateIps | UnlinkPublicIp | UnlinkRouteTable | UnlinkVirtualGateway | UnlinkVolume | UpdateAccessKey | UpdateAccount | UpdateApiAccessPolicy | UpdateApiAccessRule | UpdateCa | UpdateDedicatedGroup | UpdateDirectLinkInterface | UpdateFlexibleGpu | UpdateImage | UpdateListenerRule | UpdateLoadBalancer | UpdateNetAccessPoint | UpdateNet | UpdateNic | UpdateRoutePropagation | UpdateRoute | UpdateRouteTableLink | UpdateServerCertificate | UpdateSnapshot | UpdateSubnet | UpdateUserGroup | UpdateUser | UpdateVmGroup | UpdateVm | UpdateVmTemplate | UpdateVolume | UpdateVpnConnection) eval ${prev} ;; --help) - COMPREPLY=($(compgen -W "UpdateVpnConnection UpdateVolume UpdateVmTemplate UpdateVmGroup UpdateVm UpdateUserGroup UpdateUser UpdateSubnet UpdateSnapshot UpdateServerCertificate UpdateRouteTableLink UpdateRoutePropagation UpdateRoute UpdateNic UpdateNetAccessPoint UpdateNet UpdateLoadBalancer UpdateListenerRule UpdateImage UpdateFlexibleGpu UpdateDirectLinkInterface UpdateDedicatedGroup UpdateCa UpdateApiAccessRule UpdateApiAccessPolicy UpdateAccount UpdateAccessKey UnlinkVolume UnlinkVirtualGateway UnlinkRouteTable UnlinkPublicIp UnlinkPrivateIps UnlinkPolicy UnlinkNic UnlinkManagedPolicyFromUserGroup UnlinkLoadBalancerBackendMachines UnlinkInternetService UnlinkFlexibleGpu StopVms StartVms SetDefaultPolicyVersion ScaleUpVmGroup ScaleDownVmGroup RemoveUserFromUserGroup RejectNetPeering RegisterVmsInLoadBalancer RebootVms ReadVpnConnections ReadVolumes ReadVmsState ReadVmsHealth ReadVms ReadVmTypes ReadVmTemplates ReadVmGroups ReadVirtualGateways ReadUsers ReadUserGroupsPerUser ReadUserGroups ReadUserGroupPolicy ReadUserGroupPolicies ReadUserGroup ReadUnitPrice ReadTags ReadSubregions ReadSubnets ReadSnapshots ReadSnapshotExportTasks ReadServerCertificates ReadSecurityGroups ReadSecretAccessKey ReadRouteTables ReadRegions ReadQuotas ReadPublicIps ReadPublicIpRanges ReadPublicCatalog ReadProductTypes ReadPolicyVersions ReadPolicyVersion ReadPolicy ReadPolicies ReadNics ReadNets ReadNetPeerings ReadNetAccessPoints ReadNetAccessPointServices ReadNatServices ReadManagedPoliciesLinkedToUserGroup ReadLocations ReadLoadBalancers ReadLoadBalancerTags ReadListenerRules ReadLinkedPolicies ReadKeypairs ReadInternetServices ReadImages ReadImageExportTasks ReadFlexibleGpus ReadFlexibleGpuCatalog ReadEntitiesLinkedToPolicy ReadDirectLinks ReadDirectLinkInterfaces ReadDhcpOptions ReadDedicatedGroups ReadConsumptionAccount ReadConsoleOutput ReadClientGateways ReadCatalogs ReadCatalog ReadCas ReadApiLogs ReadApiAccessRules ReadApiAccessPolicy ReadAdminPassword ReadAccounts ReadAccessKeys PutUserGroupPolicy LinkVolume LinkVirtualGateway LinkRouteTable LinkPublicIp LinkPrivateIps LinkPolicy LinkNic LinkManagedPolicyToUserGroup LinkLoadBalancerBackendMachines LinkInternetService LinkFlexibleGpu DeregisterVmsInLoadBalancer DeleteVpnConnectionRoute DeleteVpnConnection DeleteVolume DeleteVms DeleteVmTemplate DeleteVmGroup DeleteVirtualGateway DeleteUserGroupPolicy DeleteUserGroup DeleteUser DeleteTags DeleteSubnet DeleteSnapshot DeleteServerCertificate DeleteSecurityGroupRule DeleteSecurityGroup DeleteRouteTable DeleteRoute DeletePublicIp DeletePolicyVersion DeletePolicy DeleteNic DeleteNetPeering DeleteNetAccessPoint DeleteNet DeleteNatService DeleteLoadBalancerTags DeleteLoadBalancerPolicy DeleteLoadBalancerListeners DeleteLoadBalancer DeleteListenerRule DeleteKeypair DeleteInternetService DeleteImage DeleteFlexibleGpu DeleteExportTask DeleteDirectLinkInterface DeleteDirectLink DeleteDhcpOptions DeleteDedicatedGroup DeleteClientGateway DeleteCa DeleteApiAccessRule DeleteAccessKey CreateVpnConnectionRoute CreateVpnConnection CreateVolume CreateVms CreateVmTemplate CreateVmGroup CreateVirtualGateway CreateUserGroup CreateUser CreateTags CreateSubnet CreateSnapshotExportTask CreateSnapshot CreateServerCertificate CreateSecurityGroupRule CreateSecurityGroup CreateRouteTable CreateRoute CreatePublicIp CreateProductType CreatePolicyVersion CreatePolicy CreateNic CreateNetPeering CreateNetAccessPoint CreateNet CreateNatService CreateLoadBalancerTags CreateLoadBalancerPolicy CreateLoadBalancerListeners CreateLoadBalancer CreateListenerRule CreateKeypair CreateInternetService CreateImageExportTask CreateImage CreateFlexibleGpu CreateDirectLinkInterface CreateDirectLink CreateDhcpOptions CreateDedicatedGroup CreateClientGateway CreateCa CreateApiAccessRule CreateAccount CreateAccessKey CheckAuthentication AddUserToUserGroup AcceptNetPeering" -- ${cur})) + COMPREPLY=($(compgen -W "AcceptNetPeering AddUserToUserGroup CheckAuthentication CreateAccessKey CreateAccount CreateApiAccessRule CreateCa CreateClientGateway CreateDedicatedGroup CreateDhcpOptions CreateDirectLinkInterface CreateDirectLink CreateFlexibleGpu CreateImageExportTask CreateImage CreateInternetService CreateKeypair CreateListenerRule CreateLoadBalancerListeners CreateLoadBalancerPolicy CreateLoadBalancer CreateLoadBalancerTags CreateNatService CreateNetAccessPoint CreateNetPeering CreateNet CreateNic CreatePolicy CreatePolicyVersion CreateProductType CreatePublicIp CreateRoute CreateRouteTable CreateSecurityGroup CreateSecurityGroupRule CreateServerCertificate CreateSnapshotExportTask CreateSnapshot CreateSubnet CreateTags CreateUserGroup CreateUser CreateVirtualGateway CreateVmGroup CreateVmTemplate CreateVms CreateVolume CreateVpnConnection CreateVpnConnectionRoute DeleteAccessKey DeleteApiAccessRule DeleteCa DeleteClientGateway DeleteDedicatedGroup DeleteDhcpOptions DeleteDirectLinkInterface DeleteDirectLink DeleteExportTask DeleteFlexibleGpu DeleteImage DeleteInternetService DeleteKeypair DeleteListenerRule DeleteLoadBalancerListeners DeleteLoadBalancerPolicy DeleteLoadBalancer DeleteLoadBalancerTags DeleteNatService DeleteNetAccessPoint DeleteNetPeering DeleteNet DeleteNic DeletePolicy DeletePolicyVersion DeletePublicIp DeleteRoute DeleteRouteTable DeleteSecurityGroup DeleteSecurityGroupRule DeleteServerCertificate DeleteSnapshot DeleteSubnet DeleteTags DeleteUserGroupPolicy DeleteUserGroup DeleteUser DeleteVirtualGateway DeleteVmGroup DeleteVmTemplate DeleteVms DeleteVolume DeleteVpnConnection DeleteVpnConnectionRoute DeregisterVmsInLoadBalancer LinkFlexibleGpu LinkInternetService LinkLoadBalancerBackendMachines LinkManagedPolicyToUserGroup LinkNic LinkPolicy LinkPrivateIps LinkPublicIp LinkRouteTable LinkVirtualGateway LinkVolume PutUserGroupPolicy ReadAccessKeys ReadAccounts ReadAdminPassword ReadApiAccessPolicy ReadApiAccessRules ReadApiLogs ReadCas ReadCatalog ReadCatalogs ReadClientGateways ReadConsoleOutput ReadConsumptionAccount ReadDedicatedGroups ReadDhcpOptions ReadDirectLinkInterfaces ReadDirectLinks ReadEntitiesLinkedToPolicy ReadFlexibleGpuCatalog ReadFlexibleGpus ReadImageExportTasks ReadImages ReadInternetServices ReadKeypairs ReadLinkedPolicies ReadListenerRules ReadLoadBalancerTags ReadLoadBalancers ReadLocations ReadManagedPoliciesLinkedToUserGroup ReadNatServices ReadNetAccessPointServices ReadNetAccessPoints ReadNetPeerings ReadNets ReadNics ReadPolicies ReadPolicy ReadPolicyVersion ReadPolicyVersions ReadProductTypes ReadPublicCatalog ReadPublicIpRanges ReadPublicIps ReadQuotas ReadRegions ReadRouteTables ReadSecretAccessKey ReadSecurityGroups ReadServerCertificates ReadSnapshotExportTasks ReadSnapshots ReadSubnets ReadSubregions ReadTags ReadUnitPrice ReadUserGroupPolicies ReadUserGroupPolicy ReadUserGroup ReadUserGroupsPerUser ReadUserGroups ReadUsers ReadVirtualGateways ReadVmGroups ReadVmTemplates ReadVmTypes ReadVmsHealth ReadVms ReadVmsState ReadVolumes ReadVpnConnections RebootVms RegisterVmsInLoadBalancer RejectNetPeering RemoveUserFromUserGroup ScaleDownVmGroup ScaleUpVmGroup SetDefaultPolicyVersion StartVms StopVms UnlinkFlexibleGpu UnlinkInternetService UnlinkLoadBalancerBackendMachines UnlinkManagedPolicyFromUserGroup UnlinkNic UnlinkPolicy UnlinkPrivateIps UnlinkPublicIp UnlinkRouteTable UnlinkVirtualGateway UnlinkVolume UpdateAccessKey UpdateAccount UpdateApiAccessPolicy UpdateApiAccessRule UpdateCa UpdateDedicatedGroup UpdateDirectLinkInterface UpdateFlexibleGpu UpdateImage UpdateListenerRule UpdateLoadBalancer UpdateNetAccessPoint UpdateNet UpdateNic UpdateRoutePropagation UpdateRoute UpdateRouteTableLink UpdateServerCertificate UpdateSnapshot UpdateSubnet UpdateUserGroup UpdateUser UpdateVmGroup UpdateVm UpdateVmTemplate UpdateVolume UpdateVpnConnection" -- ${cur})) ;; *) PROFILES=$(_mk_profiles) - COMPREPLY=($(compgen -W "$PROFILES --config --login --password --authentication_method --color --insecure --raw-print --verbose --help -h --list-calls --version UpdateVpnConnection UpdateVolume UpdateVmTemplate UpdateVmGroup UpdateVm UpdateUserGroup UpdateUser UpdateSubnet UpdateSnapshot UpdateServerCertificate UpdateRouteTableLink UpdateRoutePropagation UpdateRoute UpdateNic UpdateNetAccessPoint UpdateNet UpdateLoadBalancer UpdateListenerRule UpdateImage UpdateFlexibleGpu UpdateDirectLinkInterface UpdateDedicatedGroup UpdateCa UpdateApiAccessRule UpdateApiAccessPolicy UpdateAccount UpdateAccessKey UnlinkVolume UnlinkVirtualGateway UnlinkRouteTable UnlinkPublicIp UnlinkPrivateIps UnlinkPolicy UnlinkNic UnlinkManagedPolicyFromUserGroup UnlinkLoadBalancerBackendMachines UnlinkInternetService UnlinkFlexibleGpu StopVms StartVms SetDefaultPolicyVersion ScaleUpVmGroup ScaleDownVmGroup RemoveUserFromUserGroup RejectNetPeering RegisterVmsInLoadBalancer RebootVms ReadVpnConnections ReadVolumes ReadVmsState ReadVmsHealth ReadVms ReadVmTypes ReadVmTemplates ReadVmGroups ReadVirtualGateways ReadUsers ReadUserGroupsPerUser ReadUserGroups ReadUserGroupPolicy ReadUserGroupPolicies ReadUserGroup ReadUnitPrice ReadTags ReadSubregions ReadSubnets ReadSnapshots ReadSnapshotExportTasks ReadServerCertificates ReadSecurityGroups ReadSecretAccessKey ReadRouteTables ReadRegions ReadQuotas ReadPublicIps ReadPublicIpRanges ReadPublicCatalog ReadProductTypes ReadPolicyVersions ReadPolicyVersion ReadPolicy ReadPolicies ReadNics ReadNets ReadNetPeerings ReadNetAccessPoints ReadNetAccessPointServices ReadNatServices ReadManagedPoliciesLinkedToUserGroup ReadLocations ReadLoadBalancers ReadLoadBalancerTags ReadListenerRules ReadLinkedPolicies ReadKeypairs ReadInternetServices ReadImages ReadImageExportTasks ReadFlexibleGpus ReadFlexibleGpuCatalog ReadEntitiesLinkedToPolicy ReadDirectLinks ReadDirectLinkInterfaces ReadDhcpOptions ReadDedicatedGroups ReadConsumptionAccount ReadConsoleOutput ReadClientGateways ReadCatalogs ReadCatalog ReadCas ReadApiLogs ReadApiAccessRules ReadApiAccessPolicy ReadAdminPassword ReadAccounts ReadAccessKeys PutUserGroupPolicy LinkVolume LinkVirtualGateway LinkRouteTable LinkPublicIp LinkPrivateIps LinkPolicy LinkNic LinkManagedPolicyToUserGroup LinkLoadBalancerBackendMachines LinkInternetService LinkFlexibleGpu DeregisterVmsInLoadBalancer DeleteVpnConnectionRoute DeleteVpnConnection DeleteVolume DeleteVms DeleteVmTemplate DeleteVmGroup DeleteVirtualGateway DeleteUserGroupPolicy DeleteUserGroup DeleteUser DeleteTags DeleteSubnet DeleteSnapshot DeleteServerCertificate DeleteSecurityGroupRule DeleteSecurityGroup DeleteRouteTable DeleteRoute DeletePublicIp DeletePolicyVersion DeletePolicy DeleteNic DeleteNetPeering DeleteNetAccessPoint DeleteNet DeleteNatService DeleteLoadBalancerTags DeleteLoadBalancerPolicy DeleteLoadBalancerListeners DeleteLoadBalancer DeleteListenerRule DeleteKeypair DeleteInternetService DeleteImage DeleteFlexibleGpu DeleteExportTask DeleteDirectLinkInterface DeleteDirectLink DeleteDhcpOptions DeleteDedicatedGroup DeleteClientGateway DeleteCa DeleteApiAccessRule DeleteAccessKey CreateVpnConnectionRoute CreateVpnConnection CreateVolume CreateVms CreateVmTemplate CreateVmGroup CreateVirtualGateway CreateUserGroup CreateUser CreateTags CreateSubnet CreateSnapshotExportTask CreateSnapshot CreateServerCertificate CreateSecurityGroupRule CreateSecurityGroup CreateRouteTable CreateRoute CreatePublicIp CreateProductType CreatePolicyVersion CreatePolicy CreateNic CreateNetPeering CreateNetAccessPoint CreateNet CreateNatService CreateLoadBalancerTags CreateLoadBalancerPolicy CreateLoadBalancerListeners CreateLoadBalancer CreateListenerRule CreateKeypair CreateInternetService CreateImageExportTask CreateImage CreateFlexibleGpu CreateDirectLinkInterface CreateDirectLink CreateDhcpOptions CreateDedicatedGroup CreateClientGateway CreateCa CreateApiAccessRule CreateAccount CreateAccessKey CheckAuthentication AddUserToUserGroup AcceptNetPeering" -- ${cur})) + COMPREPLY=($(compgen -W "$PROFILES --config --login --password --authentication_method --color --insecure --raw-print --verbose --help -h --list-calls --version AcceptNetPeering AddUserToUserGroup CheckAuthentication CreateAccessKey CreateAccount CreateApiAccessRule CreateCa CreateClientGateway CreateDedicatedGroup CreateDhcpOptions CreateDirectLinkInterface CreateDirectLink CreateFlexibleGpu CreateImageExportTask CreateImage CreateInternetService CreateKeypair CreateListenerRule CreateLoadBalancerListeners CreateLoadBalancerPolicy CreateLoadBalancer CreateLoadBalancerTags CreateNatService CreateNetAccessPoint CreateNetPeering CreateNet CreateNic CreatePolicy CreatePolicyVersion CreateProductType CreatePublicIp CreateRoute CreateRouteTable CreateSecurityGroup CreateSecurityGroupRule CreateServerCertificate CreateSnapshotExportTask CreateSnapshot CreateSubnet CreateTags CreateUserGroup CreateUser CreateVirtualGateway CreateVmGroup CreateVmTemplate CreateVms CreateVolume CreateVpnConnection CreateVpnConnectionRoute DeleteAccessKey DeleteApiAccessRule DeleteCa DeleteClientGateway DeleteDedicatedGroup DeleteDhcpOptions DeleteDirectLinkInterface DeleteDirectLink DeleteExportTask DeleteFlexibleGpu DeleteImage DeleteInternetService DeleteKeypair DeleteListenerRule DeleteLoadBalancerListeners DeleteLoadBalancerPolicy DeleteLoadBalancer DeleteLoadBalancerTags DeleteNatService DeleteNetAccessPoint DeleteNetPeering DeleteNet DeleteNic DeletePolicy DeletePolicyVersion DeletePublicIp DeleteRoute DeleteRouteTable DeleteSecurityGroup DeleteSecurityGroupRule DeleteServerCertificate DeleteSnapshot DeleteSubnet DeleteTags DeleteUserGroupPolicy DeleteUserGroup DeleteUser DeleteVirtualGateway DeleteVmGroup DeleteVmTemplate DeleteVms DeleteVolume DeleteVpnConnection DeleteVpnConnectionRoute DeregisterVmsInLoadBalancer LinkFlexibleGpu LinkInternetService LinkLoadBalancerBackendMachines LinkManagedPolicyToUserGroup LinkNic LinkPolicy LinkPrivateIps LinkPublicIp LinkRouteTable LinkVirtualGateway LinkVolume PutUserGroupPolicy ReadAccessKeys ReadAccounts ReadAdminPassword ReadApiAccessPolicy ReadApiAccessRules ReadApiLogs ReadCas ReadCatalog ReadCatalogs ReadClientGateways ReadConsoleOutput ReadConsumptionAccount ReadDedicatedGroups ReadDhcpOptions ReadDirectLinkInterfaces ReadDirectLinks ReadEntitiesLinkedToPolicy ReadFlexibleGpuCatalog ReadFlexibleGpus ReadImageExportTasks ReadImages ReadInternetServices ReadKeypairs ReadLinkedPolicies ReadListenerRules ReadLoadBalancerTags ReadLoadBalancers ReadLocations ReadManagedPoliciesLinkedToUserGroup ReadNatServices ReadNetAccessPointServices ReadNetAccessPoints ReadNetPeerings ReadNets ReadNics ReadPolicies ReadPolicy ReadPolicyVersion ReadPolicyVersions ReadProductTypes ReadPublicCatalog ReadPublicIpRanges ReadPublicIps ReadQuotas ReadRegions ReadRouteTables ReadSecretAccessKey ReadSecurityGroups ReadServerCertificates ReadSnapshotExportTasks ReadSnapshots ReadSubnets ReadSubregions ReadTags ReadUnitPrice ReadUserGroupPolicies ReadUserGroupPolicy ReadUserGroup ReadUserGroupsPerUser ReadUserGroups ReadUsers ReadVirtualGateways ReadVmGroups ReadVmTemplates ReadVmTypes ReadVmsHealth ReadVms ReadVmsState ReadVolumes ReadVpnConnections RebootVms RegisterVmsInLoadBalancer RejectNetPeering RemoveUserFromUserGroup ScaleDownVmGroup ScaleUpVmGroup SetDefaultPolicyVersion StartVms StopVms UnlinkFlexibleGpu UnlinkInternetService UnlinkLoadBalancerBackendMachines UnlinkManagedPolicyFromUserGroup UnlinkNic UnlinkPolicy UnlinkPrivateIps UnlinkPublicIp UnlinkRouteTable UnlinkVirtualGateway UnlinkVolume UpdateAccessKey UpdateAccount UpdateApiAccessPolicy UpdateApiAccessRule UpdateCa UpdateDedicatedGroup UpdateDirectLinkInterface UpdateFlexibleGpu UpdateImage UpdateListenerRule UpdateLoadBalancer UpdateNetAccessPoint UpdateNet UpdateNic UpdateRoutePropagation UpdateRoute UpdateRouteTableLink UpdateServerCertificate UpdateSnapshot UpdateSubnet UpdateUserGroup UpdateUser UpdateVmGroup UpdateVm UpdateVmTemplate UpdateVolume UpdateVpnConnection" -- ${cur})) ;; esac ;;