|
| 1 | +import { SpaceConnector } from '@cloudforet/core-lib/space-connector'; |
| 2 | + |
| 3 | +import { useAPIQueryKey } from '@/api-clients/_common/composables/use-api-query-key'; |
| 4 | +import type { ListResponse } from '@/api-clients/_common/schema/api-verbs/list'; |
| 5 | +import type { ServiceAccountCreateParameters } from '@/api-clients/identity/service-account/schema/api-verbs/create'; |
| 6 | +import type { ServiceAccountDeleteParameters } from '@/api-clients/identity/service-account/schema/api-verbs/detele'; |
| 7 | +import type { ServiceAccountDeleteSecretDataParameters } from '@/api-clients/identity/service-account/schema/api-verbs/detele-secret-data'; |
| 8 | +import type { ServiceAccountGetParameters } from '@/api-clients/identity/service-account/schema/api-verbs/get'; |
| 9 | +import type { ServiceAccountListParameters } from '@/api-clients/identity/service-account/schema/api-verbs/list'; |
| 10 | +import type { ServiceAccountStatParameters } from '@/api-clients/identity/service-account/schema/api-verbs/stat'; |
| 11 | +import type { ServiceAccountUpdateParameters } from '@/api-clients/identity/service-account/schema/api-verbs/update'; |
| 12 | +import type { ServiceAccountUpdateSecretDataParameters } from '@/api-clients/identity/service-account/schema/api-verbs/update-secret-data'; |
| 13 | +import type { ServiceAccountModel } from '@/api-clients/identity/service-account/schema/model'; |
| 14 | + |
| 15 | + |
| 16 | +export const useServiceAccountApi = () => { |
| 17 | + const serviceAccountQueryKey = useAPIQueryKey('identity', 'service-account', 'get'); |
| 18 | + const serviceAccountListQueryKey = useAPIQueryKey('identity', 'service-account', 'list'); |
| 19 | + |
| 20 | + const actions = { |
| 21 | + create: SpaceConnector.clientV2.identity.serviceAccount.create<ServiceAccountCreateParameters, ServiceAccountModel>, |
| 22 | + update: SpaceConnector.clientV2.identity.serviceAccount.update<ServiceAccountUpdateParameters, ServiceAccountModel>, |
| 23 | + delete: SpaceConnector.clientV2.identity.serviceAccount.delete<ServiceAccountDeleteParameters>, |
| 24 | + get: SpaceConnector.clientV2.identity.serviceAccount.get<ServiceAccountGetParameters, ServiceAccountModel>, |
| 25 | + list: SpaceConnector.clientV2.identity.serviceAccount.list<ServiceAccountListParameters, ListResponse<ServiceAccountModel>>, |
| 26 | + stat: SpaceConnector.clientV2.identity.serviceAccount.stat<ServiceAccountStatParameters, any>, |
| 27 | + updateSecretData: SpaceConnector.clientV2.identity.serviceAccount.updateSecretData<ServiceAccountUpdateSecretDataParameters, ServiceAccountModel>, |
| 28 | + deleteSecretData: SpaceConnector.clientV2.identity.serviceAccount.deleteSecretData<ServiceAccountDeleteSecretDataParameters>, |
| 29 | + }; |
| 30 | + |
| 31 | + return { |
| 32 | + serviceAccountQueryKey, |
| 33 | + serviceAccountListQueryKey, |
| 34 | + serviceAccountAPI: actions, |
| 35 | + }; |
| 36 | +}; |
0 commit comments