244 Commits

Author SHA1 Message Date
Artem Goncharov
d3f1f124e5 Fix role_assignments command
In the cli generation it was assumed that the first element in the
response schema is the object itself. That is used to check whether the
response is list or not. Now the role_assignment schema return `links`
object first breaking that assumption. Extend the check to first look at
the `response_key` that we identified previously.

Change-Id: Ib2cf6e394486ebd0a475ed3d9bba97feefcd5205
2025-05-17 13:40:28 +02:00
Artem Goncharov
d201f9a6d9 Hopefully address nested structures renaming race
Sometimes (and now very often) there is some race in the deep nested
structures rename handling. Apparently during renaming the wrong object
was modified causing it not to find referred entity later causing some
confusions depending on the order in which entities are processed.
Additionally when enum with the same name occur we should also look
whether the schema hash equals, in which case it is safe to simply skip
the schema completely).

Change-Id: I1bbb5f1e4f702ab54f72cdb70418b04567047187
2025-05-17 12:29:58 +02:00
Artem Goncharov
85c09cd60e Add support setting Null for nullable optional args
For primitive types (not arrays and not dicts or similar) when resource
attribute can be explicitly nullable (while also being optional) it is
necessary to allow CLI user to set it to null. The only practical way
found till now is to add additional argument: `device_id / no_device_id`
which can be used to set explicit null. Neither relying on specific
value ("", "null") nor using default value when no value is sustainable
looking at the variations of APIs.

Change-Id: I6d549ffcc5c51a9c3ed849c590777b5ba4f6d721
2025-05-13 16:16:55 +02:00
Zuul
7811367bea Merge "Address explicit nullable types in network" 2025-05-13 08:22:55 +00:00
Artem Goncharov
8a10a63394 Address explicit nullable types in network
Some conversion schemes missed explicit null support.

Change-Id: I01ed16f2690c78492a0d8673ad86f67de92c80ae
2025-05-13 08:11:52 +02:00
Artem Goncharov
d6cbd6dc26 Fix server schema
image in the server response may be an empty string if the server was
provisioned from a volume.

Change-Id: I4ec1d5391d373ec1aaba40b0547b06ebc9629ec2
2025-05-08 15:40:18 +02:00
Artem Goncharov
f193d31dfc Adjust fip.port_details schema
On the response admin_state_up can be only boolean

Change-Id: I2d991491dbc5a97e36446a6d29c52b653b5a1657
2025-05-08 11:00:35 +02:00
Artem Goncharov
52d3f05969 Fix fip.port_details schema
port_details is an object and not array of objects.

Change-Id: I4095e664d714222d1d1ef8fdac0422393e7c451b
2025-05-07 17:08:42 +02:00
Artem Goncharov
0120737d06 Add cascade QP for delete octavia loadbalancer
Change-Id: I8f394639f3272d4385618dda6731880e02e85a4e
2025-05-06 17:18:50 +02:00
Artem Goncharov
752bc74a11 Fix typos in parameter names
Change-Id: I652e8b85632789d5172593154ddd9fef7508f359
2025-05-06 10:01:16 +02:00
Artem Goncharov
1e293968c7 Copy openapi spec into rust project
In order to do more tests of the sdk/cli/types it is necessary to have a
convenient access to the source openapi spec. Copy this into the
`openstack_types/data`.

Change-Id: Ica1849dc81e77d05f277a14bb00030485c704ba2
2025-05-05 13:44:44 +02:00
Artem Goncharov
63632a0ced Start populating resource_key in the CLI
Next step of enabling CLI output configuration. This time we add
resource_key into the generated CLI code so that we can map config
entries.

Change-Id: I43460adb71c18516c65ae20cf29a0a42a201a01f
2025-04-25 16:02:38 +02:00
Artem Goncharov
a0e5529b8a Fix few nova response schemas
- keypair create response does not contain ID
- server create response has a response_key (server). This is not really
  true, since creation may return reservation_id, but this is not
  typical and we can try to find a solution for that later. For now make
  sure cli server creation works.

Change-Id: I3f52f0e6686767dcc8862543c4c3a155f42ead0e
2025-04-24 13:28:19 +02:00
Artem Goncharov
f4a1f265a3 Fix security-group.rule.port_range_xx type
`port_range_min` and `port_range_max` of the security-groups[].rule
response has integer/null type

Change-Id: I10cfa565bede4c5f77069b6ac47a3b7ca0bc0e25
2025-04-22 12:54:52 +02:00
Artem Goncharov
cc9c23449b Add instance_uuid to the instance action schema
Change-Id: I5912a18f1a7f60b6eff96aeb9580eb2d05c3ebb6
2025-04-18 16:39:15 +02:00
Zuul
eceadd597c Merge "Fix nova instance_action schema" 2025-04-18 14:04:57 +00:00
Zuul
fe673c0171 Merge "Extend tools for new services" 2025-04-18 10:46:11 +00:00
Zuul
1bada0488b Merge "Fix BS response schemas" 2025-04-18 10:40:54 +00:00
Artem Goncharov
2c638bbf44 Fix nova instance_action schema
There is case (at least on one cloud) where user_id attribute of the
instance_action is null (explicit null and not unset).

Change-Id: Ic8ac6416a4d48d13a62b37b4b08c25b425ecc2b7
2025-04-18 07:46:43 +00:00
Artem Goncharov
b92f142710 Extend tools for new services
Change-Id: I664672f9aca455991f737047d8ca53c844d4058f
2025-04-18 07:46:27 +00:00
Artem Goncharov
5e697cf6eb Fix BS response schemas
Not all of the fields declared as mandatory are being returned by real
clouds.

Change-Id: I59ed1b1014a6eb91f067b61e3b57a3bb8f4e2b8e
2025-04-18 07:46:17 +00:00
Artem Goncharov
52eee9df4d Repair image container_format and disk_format schema
container_format and disk_format in reality need to be `anyOf[String,
Enum]` since it is possible to modify this list on the deployment level.
Unfortunately this also means that the CLI (create case) is becoming
very tricky. For now prepare, but not enable corresponding changes in
the create schema until a good way of handling this in cli has been
found.

Change-Id: I9162e238d98fd494131c01ff02990e2ddeda4887
2025-04-18 07:46:05 +00:00
Artem Goncharov
1ae47e0b0e Switch cli to openstack_types
There are lot of changes related to the deduplication caused mostly be
lot of data simplifactions done on the cli side for the responses which
are not done on openstack_types. This changes were applied manually to
the target repository since the changes require also bumping structable
version.

Some other minor enum sorting and docstring formatting fixes has been
applied.

Change-Id: Ifc508c54c01bd39af12e3023668e698085829a05
2025-04-17 14:41:11 +02:00
Zuul
f3093fb583 Merge "Adapt openstack_types to structable_derive 0.2" 2025-04-14 11:34:50 +00:00
Artem Goncharov
abda7a8b6a Adapt openstack_types to structable_derive 0.2
Rework StructTable imports to point directly to structable (with
additional Options import). On the way drop unnecessary
`#[serde(untagged)]` for StringEnum and `serialize` for `Option<String>`

Change-Id: Ic9b7b5b319e5a7ea881f7b5e3e9da986276d079b
2025-04-14 11:00:26 +02:00
Zuul
f1bbf1cfa4 Merge "Update project readme" 2025-04-11 17:01:44 +00:00
Zuul
9a00c332b5 Merge "Use dedicated deser helpers in response types" 2025-04-11 15:59:53 +00:00
Artem Goncharov
2cebebd4d6 Update project readme
- add services added recently
- add info about sdk/cli/tui that are generated using codegenerator.

Change-Id: Id41a3262be58deefd1f127a4c1a0df0b3b2e0aec
2025-04-11 15:49:47 +02:00
Artem Goncharov
95c77151bc Use dedicated deser helpers in response types
Change-Id: Ibd1272ff55ea36624de2947945376291c460dce3
2025-04-11 14:28:34 +02:00
Artem Goncharov
952612a5c9 Sort types enum kinds alphabetically
Change-Id: I5e390dbb7ecb79eef0dacca90a6897433ab1851e
2025-04-11 08:48:03 +02:00
Artem Goncharov
4e919bf8c0 Fix api-ref parsing
openstackdocstheme changes got merged and we need to adopt to it.

Change-Id: I4781e311e332d0837036eb4225a3fcca2116572c
2025-04-10 20:29:15 +02:00
Artem Goncharov
2c5a228684 Make openstack_types props also public
struct properties should be also public

Change-Id: Id1f706003694e2e8c071a3ea76a24d85010fcec6
2025-04-08 19:09:22 +02:00
Artem Goncharov
8f2a2d6150 Fix wrong enum serde macros
In the previous change new serde macros were added to the reused class
what resulted in sdk structs being partly corrupted.

Make response structs public

Change-Id: Ia53f7b21d58b23cc4647f891b5b9744c7fc5556d
2025-04-08 15:27:13 +02:00
Zuul
6f9d426ba4 Merge "Start building response types in the SDK" 2025-04-08 11:42:32 +00:00
Artem Goncharov
b19ca1d4d5 Start building response types in the SDK
Introduce openstack_types crate with certain types that might be
helpful.

In the current form those cannot be reused from cli or tui since it is
necessary to tweak StructableTable to be able to treat different
rendering of cli and tui versus the raw structs.

Change-Id: I23674e0e9119f75739139e015f44d1100d6d84e2
2025-04-08 10:27:25 +02:00
Zuul
83f01f9ff7 Merge "Adopt uv instead of pip" 2025-04-04 18:19:16 +00:00
Artem Goncharov
91ffe23c7e Convert to FakeOpenStackClient in tests
Switch from MockServerClient to FakeOpenStackClient

Change-Id: I46c092d3b50158c9e65c865051c50cff8b5d37d4
2025-04-04 15:46:00 +02:00
Artem Goncharov
04ae7d1c4e Adapt tui generator to the 2024 edition
Code has been adapted on the destination side and now the new generated code
cannot be compiled. Apply the same changes to the generator templates.

Change-Id: I9fe5e18ba3db240a0adf59c878f8742fb6dfa13a
2025-04-04 11:03:21 +02:00
Artem Goncharov
e3dda1cbc3 Adopt uv instead of pip
- fix pyproject.toml file name (causing few reformats missed previously)
- extend pyproject.toml with the info from setup.cfg to make uv work
- introduce uv and start using it inside tox
- fix unittest that started failing due to that change

Change-Id: I461ffc9fee39085f795ced07b7d00ebde28a6034
2025-04-03 17:03:47 +02:00
Artem Goncharov
0f870d5a5f Import IntString from openstack_sdk
We are moving IntString, NumString, BoolString from cli to sdk so that we can
also use them in tui.

Change-Id: Ib2dcdd2f54481feacb7848037fb26fae4ef5d738
2025-04-03 14:59:11 +02:00
Artem Goncharov
e0f1e9c0b2 Format generated Rust code
Change-Id: I75d43d3280d2353d5038b6bce714a186bd9cf956
2025-03-25 15:40:36 +00:00
Artem Goncharov
a6002e661b Make sensitive fields be SecretString
Enable sensitive handling of certain fields known to contain sensitive data
(password, passcode, secret, token.id)

Change-Id: Iae8cf9a084b981600fc0b1b94176c0ef4109c5df
2025-03-25 12:48:52 +01:00
Zuul
51403407d7 Merge "Replace wrong simplification of vec of vec of strings" 2025-03-20 16:54:40 +00:00
Artem Goncharov
5d8e2552b1 Replace wrong simplification of vec of vec of strings
In Keystone.user MFA rules are vec of vec of strings. Current simplification
renders it as vec of strings loosing one level. Also indicate to the user array
parameters are actually arrays.

Change-Id: I382aa157b4b4286daf91f08af001a5db0247a88f
2025-03-20 12:16:03 +01:00
Artem Goncharov
7e5438973e Replace imported protocol schema
Temporary hardcode protocol schema which is about to be replaced with a proper
schema.

Change-Id: Iba6eff82645b18c788d6664e2fbc7f0e3d4244f7
2025-03-19 16:26:32 +01:00
Zuul
c3b231fb89 Merge "Actually start building magnum code" 2025-03-07 16:36:58 +00:00
Zuul
d683219d38 Merge "Fix network external_gateway_info schema" 2025-03-07 09:50:01 +00:00
Artem Goncharov
8be0291327 Actually start building magnum code
previous change container a typo in the service name and it was silently
ignored.

Change-Id: I5a037745274e728346140c23b7d17c4e3b151032
2025-03-07 09:11:22 +01:00
gtema
ea8f60e66c Fix network external_gateway_info schema
Recently validation of the external_gateway_info has been modified in
the Neutron so that we are not able to detect the schema anymore. Adapt
it to how it "look like it is intended".

Change-Id: I8976a019cd11b4cb3d8780553bb72b7ce6627519
2025-03-06 18:44:59 +01:00
Artem Goncharov
f1d3a0aa1b Add magnum metadata
and start generating code.

Change-Id: I80dcdf5952d709819138404ccaddb3a37bd63ff3
2025-03-05 19:02:52 +01:00