Skip to content

Schemas

Ark SDK is entirely based on schemas constructed from Pydantic. Pydantic is a schema and data validation library that also provides settings management and uses Python type annotations.

All exec actions in the Ark SDK receive a model parsed from the CLI or from the SDK in code and, some of them, return a model or set of models. All of these models inherit from ArkModel:

1
2
3
class ArkModel(BaseModel):
    class Config:
        allow_population_by_field_name = True

Derived from the model above, there are different model types that serve different purposes, such as aliasing attributes with camelCase and adding polling parameters.

Example

Any request can be called with a defined model, for example:

1
2
identity_api = ArkIdentityAPI(isp_auth)
role: ArkIdentityRole = identity_api.identity_roles.create_role(ArkIdentityCreateRole(role_name='IT'))

In the above example, we create the identity service, and call create_role, passing the ArkIdentityCreateRole model, which is based on the model, and returns an ArkIdentityRole model

Where the models are specified as follows:

1
2
3
4
5
6
7
8
class ArkIdentityCreateRole(ArkModel):
    role_name: str = Field(description='Role name to create')
    admin_rights: List[ArkIdentityAdminRights] = Field(description='Admin rights to add to the role', default_factory=list)


class ArkIdentityRole(ArkModel):
    role_id: str = Field(description='Identifier of the role')
    role_name: str = Field(description='Name of the role')

All models can be found here and are separated to folders based on topic, from auth to services