types

« Previous section Next section »

UCloud Developer Guide / Core / Core Types

Core Types

Table of Contents

1. Data Models

Data Models

CommonErrorMessage

A generic error message

data class CommonErrorMessage(
    val why: String,
    val errorCode: String?,
)

UCloud uses HTTP status code for all error messages. In addition and if possible, UCloud will include a message using a common format. Note that this is not guaranteed to be included in case of a failure somewhere else in the network stack. For example, UCloud's load balancer might not be able to contact the backend at all. In such a case UCloud will not include a more detailed error message.

Properties


FindByIntId

A request message to find a resource by a numeric unique identifier.

data class FindByIntId(
    val id: Int,
)
Properties


FindByLongId

A request message to find a resource by a numeric unique identifier.

data class FindByLongId(
    val id: Long,
)
Properties


FindByStringId

A request message to find a resource by a unique identifier.

data class FindByStringId(
    val id: String,
)
Properties


Page

A page of items. Superseded by PageV2.

data class Page<T>(
    val itemsInTotal: Int,
    val itemsPerPage: Int,
    val pageNumber: Int,
    val items: List<T>,
)
Properties


PageV2

Represents a single 'page' of results

data class PageV2<T>(
    val itemsPerPage: Int,
    val items: List<T>,
    val next: String?,
)

Every page contains the items from the current result set, along with information which allows the client to fetch additional information.

Properties


Role

Represents a SecurityPrincipal's system-wide role.

enum class Role {
    GUEST,
    USER,
    ADMIN,
    SERVICE,
    THIRD_PARTY_APP,
    PROVIDER,
    UNKNOWN,
}

This is usually not used for application-specific authorization.

Services are encouraged to implement their own authorization control, potentially from a common library.

Properties


SecurityPrincipal

A minimal representation of a security principal.

data class SecurityPrincipal(
    val username: String,
    val role: Role,
    val firstName: String,
    val lastName: String,
    val email: String?,
    val twoFactorAuthentication: Boolean?,
    val principalType: String?,
    val serviceAgreementAccepted: Boolean?,
    val organization: String?,
)

More information can be gathered from an auth service, using the username as a key.

Properties


PaginationRequest

data class PaginationRequest(
    val itemsPerPage: Int?,
    val page: Int?,
)
Properties


PaginationRequestV2Consistency

enum class PaginationRequestV2Consistency {
    PREFER,
    REQUIRE,
}
Properties


BulkRequest

A base type for requesting a bulk operation.

data class BulkRequest<T>(
    val items: List<T>,
)

⚠ WARNING: All request items listed in the bulk request must be treated as a single transaction. This means that either the entire request succeeds, or the entire request fails.

There are two exceptions to this rule:

  1. Certain calls may choose to only guarantee this at the provider level. That is if a single call contain request for multiple providers, then in rare occasions (i.e. crash) changes might not be rolled back immediately on all providers. A service MUST attempt to rollback already committed changes at other providers.

  2. The underlying system does not provide such guarantees. In this case the service/provider MUST support the verification API to cleanup these resources later.


Properties


BulkResponse

data class BulkResponse<T>(
    val responses: List<T>,
)
Properties


Last updated