Skip to content

Commit 29f15b7

Browse files
Open-Source-Botjobs62
authored andcommitted
🔖 release: oapi-cli v0.13.0
Signed-off-by: Outscale Bot <opensource+bot@outscale.com>
1 parent a9bc2b1 commit 29f15b7

File tree

5 files changed

+174
-95
lines changed

5 files changed

+174
-95
lines changed

‎main.c‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
#define OAPI_RAW_OUTPUT 1
4949

50-
#define OAPI_CLI_VERSION "0.12.0"
50+
#define OAPI_CLI_VERSION "0.13.0"
5151

5252
#define OAPI_CLI_UAGENT "oapi-cli/"OAPI_CLI_VERSION"; osc-sdk-c/"
5353

@@ -1513,6 +1513,11 @@ int consumption_entry_parser(void *v_s, char *str, char *aa, struct ptr_array *p
15131513
s->is_set_price = 1;
15141514
s->price = atof(aa);
15151515
} else
1516+
if ((aret = argcmp(str, "ResourceId")) == 0 || aret == '=' || aret == '.') {
1517+
TRY(!aa, "ResourceId argument missing\n");
1518+
s->resource_id = aa; // string string
1519+
1520+
} else
15161521
if ((aret = argcmp(str, "Service")) == 0 || aret == '=' || aret == '.') {
15171522
TRY(!aa, "Service argument missing\n");
15181523
s->service = aa; // string string
@@ -16909,6 +16914,11 @@ int security_group_rule_parser(void *v_s, char *str, char *aa, struct ptr_array
1690916914
TRY(!aa, "IpRanges[] argument missing\n");
1691016915
SET_NEXT(s->ip_ranges, (aa), pa);
1691116916
} else
16917+
if ((aret = argcmp(str, "SecurityGroupRuleId")) == 0 || aret == '=' || aret == '.') {
16918+
TRY(!aa, "SecurityGroupRuleId argument missing\n");
16919+
s->security_group_rule_id = aa; // string string
16920+
16921+
} else
1691216922
if ((aret = argcmp(str, "SecurityGroupsMembers")) == 0 || aret == '=' || aret == '.') {
1691316923
char *dot_pos = strchr(str, '.');
1691416924

@@ -36889,6 +36899,22 @@ int main(int ac, char **av)
3688936899
BAD_RET("ShowPrice require true/false\n");
3689036900
}
3689136901
} else
36902+
if ((aret = argcmp(next_a, "ShowResourceDetails")) == 0 || aret == '=' || aret == '.') {
36903+
char *eq_ptr = strchr(next_a, '=');
36904+
if (eq_ptr) {
36905+
TRY((!*eq_ptr), "ShowResourceDetails argument missing\n");
36906+
aa = eq_ptr + 1;
36907+
incr = 1;
36908+
}
36909+
s->is_set_show_resource_details = 1;
36910+
if (!aa || !strcasecmp(aa, "true")) {
36911+
s->show_resource_details = 1;
36912+
} else if (!strcasecmp(aa, "false")) {
36913+
s->show_resource_details = 0;
36914+
} else {
36915+
BAD_RET("ShowResourceDetails require true/false\n");
36916+
}
36917+
} else
3689236918
if ((aret = argcmp(next_a, "ToDate")) == 0 || aret == '=' || aret == '.') {
3689336919
char *eq_ptr = strchr(next_a, '=');
3689436920
if (eq_ptr) {

‎osc_sdk.c‎

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,8 @@ static const char *calls_args_descriptions[] = {
10001000
" The prefix for the key of the OOS object.\n"
10011001
,
10021002
"--Architecture: string\n"
1003-
" **When registering from a snapshot:** The architecture of the OMI (`i386` or `x86_64`).\n"
1003+
" **When registering from a snapshot:** The architecture of the OMI (`i386` or `x86_64`). By \n"
1004+
" default, set to `x86_64`.\n"
10041005
"--BlockDeviceMappings: array ref BlockDeviceMappingImage\n"
10051006
" **(required) When registering from a snapshot:** One or more block device mappings.\n"
10061007
" One or more parameters used to automatically set up volumes when the VM \n"
@@ -1143,8 +1144,9 @@ static const char *calls_args_descriptions[] = {
11431144
" parameter is `1`, which means that the sticky session lasts for the duration of the browser \n"
11441145
" session.\n"
11451146
"--CookieName: string\n"
1146-
" The name of the application cookie used for stickiness. This parameter is required if you \n"
1147-
" create a stickiness policy based on an application-generated cookie.\n"
1147+
" The name of the application cookie used for stickiness, between 1 and 255 characters. This \n"
1148+
" parameter is required if you create a stickiness policy based on an application-generated \n"
1149+
" cookie.\n"
11481150
"--DryRun: bool\n"
11491151
" If true, checks whether you have the required permissions to perform the action.\n"
11501152
"--LoadBalancerName: string\n"
@@ -1201,7 +1203,7 @@ static const char *calls_args_descriptions[] = {
12011203
" One or more tags assigned to the load balancer.\n"
12021204
" Information about the tag.\n"
12031205
" --Tags.INDEX.Key: string\n"
1204-
" The key of the tag, with a minimum of 1 character.\n"
1206+
" The key of the tag, between 1 and 255 characters.\n"
12051207
" --Tags.INDEX.Value: string\n"
12061208
" The value of the tag, between 0 and 255 characters.\n"
12071209
,
@@ -1213,7 +1215,7 @@ static const char *calls_args_descriptions[] = {
12131215
" One or more tags to add to the specified load balancers.\n"
12141216
" Information about the tag.\n"
12151217
" --Tags.INDEX.Key: string\n"
1216-
" The key of the tag, with a minimum of 1 character.\n"
1218+
" The key of the tag, between 1 and 255 characters.\n"
12171219
" --Tags.INDEX.Value: string\n"
12181220
" The value of the tag, between 0 and 255 characters.\n"
12191221
,
@@ -1364,7 +1366,7 @@ static const char *calls_args_descriptions[] = {
13641366
" website](https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). If you \n"
13651367
" specify this parameter, you cannot specify the `Rules` parameter and its subparameters.\n"
13661368
"--IpRange: string\n"
1367-
" The IP range for the security group rule, in CIDR notation (for example, 10.0.0.0/16). If \n"
1369+
" The IP range for the security group rule, in CIDR notation (for example, `10.0.0.0/16`). If \n"
13681370
" you specify this parameter, you cannot specify the `Rules` parameter and its subparameters.\n"
13691371
"--Rules: array ref SecurityGroupRule\n"
13701372
" Information about the security group rule to create. If you specify this parent parameter \n"
@@ -1382,7 +1384,9 @@ static const char *calls_args_descriptions[] = {
13821384
" s.xhtml).\n"
13831385
" --Rules.INDEX.IpRanges: array string\n"
13841386
" One or more IP ranges for the security group rules, in CIDR notation \n"
1385-
" (for example, `10.0.0.0/16`).\n"
1387+
" (for example, `[\"10.0.0.0/24\" , \"10.0.1.0/24\"]`).\n"
1388+
" --Rules.INDEX.SecurityGroupRuleId: string\n"
1389+
" The ID of the security group rule.\n"
13861390
" --Rules.INDEX.SecurityGroupsMembers: array ref SecurityGroupsMember\n"
13871391
" Information about one or more source or destination security groups.\n"
13881392
" Information about a source or destination security group.\n"
@@ -1392,8 +1396,8 @@ static const char *calls_args_descriptions[] = {
13921396
" The ID of a source or destination security group that you want to link \n"
13931397
" to the security group of the rule.\n"
13941398
" --Rules.INDEX.SecurityGroupsMembers.INDEX.SecurityGroupName: string\n"
1395-
" (Public Cloud only) The name of a source or destination security group \n"
1396-
" that you want to link to the security group of the rule.\n"
1399+
" The name of a source or destination security group that you want to link \n"
1400+
" to the security group of the rule.\n"
13971401
" --Rules.INDEX.ServiceIds: array string\n"
13981402
" One or more service IDs to allow traffic from a Net to access the \n"
13991403
" corresponding OUTSCALE services. For more information, see \n"
@@ -1498,7 +1502,7 @@ static const char *calls_args_descriptions[] = {
14981502
" One or more tags to add to the specified resources.\n"
14991503
" Information about the tag.\n"
15001504
" --Tags.INDEX.Key: string\n"
1501-
" The key of the tag, with a minimum of 1 character.\n"
1505+
" The key of the tag, between 1 and 255 characters.\n"
15021506
" --Tags.INDEX.Value: string\n"
15031507
" The value of the tag, between 0 and 255 characters.\n"
15041508
,
@@ -1544,7 +1548,7 @@ static const char *calls_args_descriptions[] = {
15441548
" One or more tags to add to the VM group.\n"
15451549
" Information about the tag.\n"
15461550
" --Tags.INDEX.Key: string\n"
1547-
" The key of the tag, with a minimum of 1 character.\n"
1551+
" The key of the tag, between 1 and 255 characters.\n"
15481552
" --Tags.INDEX.Value: string\n"
15491553
" The value of the tag, between 0 and 255 characters.\n"
15501554
"--VmCount: long long int\n"
@@ -1575,7 +1579,7 @@ static const char *calls_args_descriptions[] = {
15751579
" One or more tags to add to the VM template.\n"
15761580
" Information about the tag.\n"
15771581
" --Tags.INDEX.Key: string\n"
1578-
" The key of the tag, with a minimum of 1 character.\n"
1582+
" The key of the tag, between 1 and 255 characters.\n"
15791583
" --Tags.INDEX.Value: string\n"
15801584
" The value of the tag, between 0 and 255 characters.\n"
15811585
"--VmTemplateName: string\n"
@@ -1985,7 +1989,9 @@ static const char *calls_args_descriptions[] = {
19851989
" s.xhtml).\n"
19861990
" --Rules.INDEX.IpRanges: array string\n"
19871991
" One or more IP ranges for the security group rules, in CIDR notation \n"
1988-
" (for example, `10.0.0.0/16`).\n"
1992+
" (for example, `[\"10.0.0.0/24\" , \"10.0.1.0/24\"]`).\n"
1993+
" --Rules.INDEX.SecurityGroupRuleId: string\n"
1994+
" The ID of the security group rule.\n"
19891995
" --Rules.INDEX.SecurityGroupsMembers: array ref SecurityGroupsMember\n"
19901996
" Information about one or more source or destination security groups.\n"
19911997
" Information about a source or destination security group.\n"
@@ -1995,8 +2001,8 @@ static const char *calls_args_descriptions[] = {
19952001
" The ID of a source or destination security group that you want to link \n"
19962002
" to the security group of the rule.\n"
19972003
" --Rules.INDEX.SecurityGroupsMembers.INDEX.SecurityGroupName: string\n"
1998-
" (Public Cloud only) The name of a source or destination security group \n"
1999-
" that you want to link to the security group of the rule.\n"
2004+
" The name of a source or destination security group that you want to link \n"
2005+
" to the security group of the rule.\n"
20002006
" --Rules.INDEX.ServiceIds: array string\n"
20012007
" One or more service IDs to allow traffic from a Net to access the \n"
20022008
" corresponding OUTSCALE services. For more information, see \n"
@@ -2038,7 +2044,7 @@ static const char *calls_args_descriptions[] = {
20382044
" value are deleted).\n"
20392045
" Information about the tag.\n"
20402046
" --Tags.INDEX.Key: string\n"
2041-
" The key of the tag, with a minimum of 1 character.\n"
2047+
" The key of the tag, between 1 and 255 characters.\n"
20422048
" --Tags.INDEX.Value: string\n"
20432049
" The value of the tag, between 0 and 255 characters.\n"
20442050
,
@@ -2483,7 +2489,10 @@ static const char *calls_args_descriptions[] = {
24832489
"--ShowPrice: bool\n"
24842490
" If true, the response also includes the unit price of the consumed resource (`UnitPrice`) \n"
24852491
" and the total price of the consumed resource during the specified time period (`Price`), in \n"
2486-
" the currency of your account.\n"
2492+
" the currency of the Region's catalog.\n"
2493+
"--ShowResourceDetails: bool\n"
2494+
" By default or if false, returns the consumption aggregated by resource type. If true, the \n"
2495+
" response returns the consumption per `ResourceId`.\n"
24872496
"--ToDate: string\n"
24882497
" The end of the time period, in ISO 8601 date format (for example, `2020-06-30`). The \n"
24892498
" date-time format is also accepted, but only with a time set to midnight (for example, \n"
@@ -2607,7 +2616,7 @@ static const char *calls_args_descriptions[] = {
26072616
" One or more tags associated with the fGPUs.\n"
26082617
" Information about the tag.\n"
26092618
" --Filters.Tags.INDEX.Key: string\n"
2610-
" The key of the tag, with a minimum of 1 character.\n"
2619+
" The key of the tag, between 1 and 255 characters.\n"
26112620
" --Filters.Tags.INDEX.ResourceId: string\n"
26122621
" The ID of the resource.\n"
26132622
" --Filters.Tags.INDEX.ResourceType: string\n"
@@ -4433,7 +4442,7 @@ static const char *calls_args_descriptions[] = {
44334442
" New tags for your VM group.\n"
44344443
" Information about the tag.\n"
44354444
" --Tags.INDEX.Key: string\n"
4436-
" The key of the tag, with a minimum of 1 character.\n"
4445+
" The key of the tag, between 1 and 255 characters.\n"
44374446
" --Tags.INDEX.Value: string\n"
44384447
" The value of the tag, between 0 and 255 characters.\n"
44394448
"--VmGroupId: string\n"
@@ -4518,7 +4527,7 @@ static const char *calls_args_descriptions[] = {
45184527
" New tags for your VM template.\n"
45194528
" Information about the tag.\n"
45204529
" --Tags.INDEX.Key: string\n"
4521-
" The key of the tag, with a minimum of 1 character.\n"
4530+
" The key of the tag, between 1 and 255 characters.\n"
45224531
" --Tags.INDEX.Value: string\n"
45234532
" The value of the tag, between 0 and 255 characters.\n"
45244533
"--VmTemplateId: string\n"
@@ -6037,6 +6046,11 @@ static int consumption_entry_setter(struct consumption_entry *args, struct osc_s
60376046
ARG_TO_JSON(Price, double, args->price);
60386047
ret += 1;
60396048
}
6049+
if (args->resource_id) {
6050+
TRY_APPEND_COL(count_args, data);
6051+
ARG_TO_JSON_STR("\"ResourceId\":", args->resource_id);
6052+
ret += 1;
6053+
}
60406054
if (args->service) {
60416055
TRY_APPEND_COL(count_args, data);
60426056
ARG_TO_JSON_STR("\"Service\":", args->service);
@@ -15585,6 +15599,11 @@ static int security_group_rule_setter(struct security_group_rule *args, struct o
1558515599
ARG_TO_JSON(IpRanges, string, args->ip_ranges_str);
1558615600
ret += 1;
1558715601
}
15602+
if (args->security_group_rule_id) {
15603+
TRY_APPEND_COL(count_args, data);
15604+
ARG_TO_JSON_STR("\"SecurityGroupRuleId\":", args->security_group_rule_id);
15605+
ret += 1;
15606+
}
1558815607
if (args->security_groups_members) {
1558915608
TRY_APPEND_COL(count_args, data);
1559015609
STRY(osc_str_append_string(data, "\"SecurityGroupsMembers\":[" ));
@@ -26685,6 +26704,10 @@ static int read_consumption_account_data(struct osc_env *e, struct osc_read_con
2668526704
ARG_TO_JSON(ShowPrice, bool, args->show_price);
2668626705
ret += 1;
2668726706
}
26707+
if (args->is_set_show_resource_details) {
26708+
ARG_TO_JSON(ShowResourceDetails, bool, args->show_resource_details);
26709+
ret += 1;
26710+
}
2668826711
if (args->to_date) {
2668926712
TRY_APPEND_COL(count_args, data);
2669026713
ARG_TO_JSON_STR("\"ToDate\":", args->to_date);

0 commit comments

Comments
 (0)