Example: Retrieving a list of products supported by accessible providers¶
Frequency of use | Common |
---|---|
Trigger | Typically triggered by a client to determine which operations are supported |
Pre-conditions |
|
Actors |
|
Communication Flow: Kotlin
Files.retrieveProducts.call(
Unit,
user
).orThrow()
/*
SupportByProvider(
productsByProvider = mapOf("ucloud" to listOf(ResolvedSupport(
product = Product.Storage(
allowAllocationRequestsFrom = AllocationRequestsGroup.ALL,
category = ProductCategoryId(
id = "u1-cephfs",
name = "u1-cephfs",
provider = "ucloud",
),
chargeType = ChargeType.DIFFERENTIAL_QUOTA,
description = "Storage provided by UCloud",
freeToUse = false,
hiddenInGrantApplications = false,
name = "u1-cephfs",
pricePerUnit = 1,
priority = 0,
productType = ProductType.STORAGE,
unitOfPrice = ProductPriceUnit.PER_UNIT,
version = 1,
balance = null,
id = "u1-cephfs",
maxUsableBalance = null,
),
support = FSSupport(
collection = FSCollectionSupport(
aclModifiable = false,
usersCanCreate = true,
usersCanDelete = true,
usersCanRename = true,
),
files = FSFileSupport(
aclModifiable = false,
isReadOnly = false,
searchSupported = true,
sharesSupported = true,
streamingSearchSupported = false,
trashSupported = true,
),
maintenance = null,
product = ProductReference(
category = "u1-cephfs",
id = "u1-cephfs",
provider = "ucloud",
),
stats = FSProductStatsSupport(
accessedAt = false,
createdAt = true,
modifiedAt = true,
sizeInBytes = true,
sizeIncludingChildrenInBytes = true,
unixGroup = true,
unixOwner = true,
unixPermissions = true,
),
),
))),
)
*/
Communication Flow: Curl
# ------------------------------------------------------------------------------------------------------
# $host is the UCloud instance to contact. Example: 'http://localhost:8080' or 'https://cloud.sdu.dk'
# $accessToken is a valid access-token issued by UCloud
# ------------------------------------------------------------------------------------------------------
# Authenticated as user
curl -XGET -H "Authorization: Bearer $accessToken" "$host/api/files/retrieveProducts"
# {
# "productsByProvider": {
# "ucloud": [
# {
# "product": {
# "balance": null,
# "maxUsableBalance": null,
# "name": "u1-cephfs",
# "pricePerUnit": 1,
# "category": {
# "name": "u1-cephfs",
# "provider": "ucloud"
# },
# "description": "Storage provided by UCloud",
# "priority": 0,
# "version": 1,
# "freeToUse": false,
# "allowAllocationRequestsFrom": "ALL",
# "unitOfPrice": "PER_UNIT",
# "chargeType": "DIFFERENTIAL_QUOTA",
# "hiddenInGrantApplications": false,
# "productType": "STORAGE"
# },
# "support": {
# "product": {
# "id": "u1-cephfs",
# "category": "u1-cephfs",
# "provider": "ucloud"
# },
# "stats": {
# "sizeInBytes": true,
# "sizeIncludingChildrenInBytes": true,
# "modifiedAt": true,
# "createdAt": true,
# "accessedAt": false,
# "unixPermissions": true,
# "unixOwner": true,
# "unixGroup": true
# },
# "collection": {
# "aclModifiable": false,
# "usersCanCreate": true,
# "usersCanDelete": true,
# "usersCanRename": true
# },
# "files": {
# "aclModifiable": false,
# "trashSupported": true,
# "isReadOnly": false,
# "searchSupported": true,
# "streamingSearchSupported": false,
# "sharesSupported": true
# },
# "maintenance": null
# }
# }
# ]
# }
# }