diff --git a/main.c b/main.c index 5b62c0e..d5f4c9d 100644 --- a/main.c +++ b/main.c @@ -47,7 +47,7 @@ #define OAPI_RAW_OUTPUT 1 -#define OAPI_CLI_VERSION "0.14.0" +#define OAPI_CLI_VERSION "0.15.0" #define OAPI_CLI_UAGENT "oapi-cli/"OAPI_CLI_VERSION"; osc-sdk-c/" @@ -14391,6 +14391,11 @@ int load_balancer_parser(void *v_s, char *str, char *aa, struct ptr_array *pa) { TRY(!aa, "NetId argument missing\n"); s->net_id = aa; // string string + } else + if ((aret = argcmp(str, "PrivateIp")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "PrivateIp argument missing\n"); + s->private_ip = aa; // string string + } else if ((aret = argcmp(str, "PublicIp")) == 0 || aret == '=' || aret == '.') { TRY(!aa, "PublicIp argument missing\n"); @@ -16407,6 +16412,39 @@ int public_ip_parser(void *v_s, char *str, char *aa, struct ptr_array *pa) { s->link_public_ip_id = aa; // string string } else + if ((aret = argcmp(str, "NatServiceId")) == 0 || aret == '=' || aret == '.') { + TRY(!aa, "NatServiceId argument missing\n"); + s->nat_service_id = aa; // string string + + } else + if ((aret = argcmp(str, "NetAccessPointIds")) == 0 || aret == '=' || aret == '.') { + if (aret == '.') { + int pos; + char *endptr; + int last = 0; + char *dot_pos = strchr(str, '.'); + + TRY(!(dot_pos++), "NetAccessPointIds argument missing\n"); + pos = strtoul(dot_pos, &endptr, 0); + TRY(endptr == dot_pos, "NetAccessPointIds require an index\n"); + if (s->net_access_point_ids) { + for (; s->net_access_point_ids[last]; ++last); + } + if (pos < last) { + s->net_access_point_ids[pos] = (aa); + } else { + for (int i = last; i < pos; ++i) + SET_NEXT(s->net_access_point_ids, "", pa); + SET_NEXT(s->net_access_point_ids, (aa), pa); + } + } else { + TRY(!aa, "NetAccessPointIds argument missing\n"); + s->net_access_point_ids_str = aa; + } + } else if (!(aret = argcmp(str, "NetAccessPointIds[]")) || aret == '=') { + TRY(!aa, "NetAccessPointIds[] argument missing\n"); + SET_NEXT(s->net_access_point_ids, (aa), pa); + } else if ((aret = argcmp(str, "NicAccountId")) == 0 || aret == '=' || aret == '.') { TRY(!aa, "NicAccountId argument missing\n"); s->nic_account_id = aa; // string string diff --git a/osc-sdk-C b/osc-sdk-C index 6f9715f..d2a5d49 160000 --- a/osc-sdk-C +++ b/osc-sdk-C @@ -1 +1 @@ -Subproject commit 6f9715fd730a9f4e641ec4f75d00bd9d00e01728 +Subproject commit d2a5d49e3f8c1321aa8277022c1c884266cad921 diff --git a/osc_sdk.c b/osc_sdk.c index 616c8cb..16889e5 100644 --- a/osc_sdk.c +++ b/osc_sdk.c @@ -13767,6 +13767,11 @@ static int load_balancer_setter(struct load_balancer *args, struct osc_str *data ARG_TO_JSON_STR("\"NetId\":", args->net_id); ret += 1; } + if (args->private_ip) { + TRY_APPEND_COL(count_args, data); + ARG_TO_JSON_STR("\"PrivateIp\":", args->private_ip); + ret += 1; + } if (args->public_ip) { TRY_APPEND_COL(count_args, data); ARG_TO_JSON_STR("\"PublicIp\":", args->public_ip); @@ -15210,6 +15215,27 @@ static int public_ip_setter(struct public_ip *args, struct osc_str *data) { ARG_TO_JSON_STR("\"LinkPublicIpId\":", args->link_public_ip_id); ret += 1; } + if (args->nat_service_id) { + TRY_APPEND_COL(count_args, data); + ARG_TO_JSON_STR("\"NatServiceId\":", args->nat_service_id); + ret += 1; + } + if (args->net_access_point_ids) { + char **as; + + TRY_APPEND_COL(count_args, data); + STRY(osc_str_append_string(data, "\"NetAccessPointIds\":[" )); + for (as = args->net_access_point_ids; *as; ++as) { + if (as != args->net_access_point_ids) + STRY(osc_str_append_string(data, "," )); + ARG_TO_JSON_STR("", *as); + } + STRY(osc_str_append_string(data, "]" )); + ret += 1; + } else if (args->net_access_point_ids_str) { + ARG_TO_JSON(NetAccessPointIds, string, args->net_access_point_ids_str); + ret += 1; + } if (args->nic_account_id) { TRY_APPEND_COL(count_args, data); ARG_TO_JSON_STR("\"NicAccountId\":", args->nic_account_id); diff --git a/osc_sdk.h b/osc_sdk.h index e436f92..37fbe96 100644 --- a/osc_sdk.h +++ b/osc_sdk.h @@ -77,8 +77,8 @@ struct osc_str { #define OSC_ENV_FREE_AK_SK (OSC_ENV_FREE_AK | OSC_ENV_FREE_SK) -#define OSC_API_VERSION "1.40.1" -#define OSC_SDK_VERSION 0X002000 +#define OSC_API_VERSION "1.41.0" +#define OSC_SDK_VERSION 0X002100 enum osc_auth_method { OSC_AKSK_METHOD, @@ -4472,6 +4472,10 @@ struct load_balancer { * The ID of the Net for the load balancer. */ char *net_id; + /* + * The primary private IP of the load balancer. + */ + char *private_ip; /* * (internet-facing only) The public IP associated with the load * balancer. @@ -5697,6 +5701,16 @@ struct public_ip { * IP with the VM or the NIC. */ char *link_public_ip_id; + /* + * The ID of the NAT service associated with the public IP (if any). + */ + char *nat_service_id; + /* + * The IDs of the Net access points associated with the public IP (if + * any). + */ + char *net_access_point_ids_str; + char **net_access_point_ids; /* * The OUTSCALE account ID of the owner of the NIC. */ @@ -5706,7 +5720,7 @@ struct public_ip { */ char *nic_id; /* - * The private IP associated with the public IP. + * The private IP associated with the NIC or load balancer. */ char *private_ip; /* diff --git a/version b/version index a803cc2..a551051 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.14.0 +0.15.0