@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Service Accounts API
@version 1.0.0
@endpoints 7
@toc organizations(6), projects(1)

@group organizations
@endpoint GET /organizations/{organizationId}/service-accounts
@desc List Service Accounts
@returns(200) {results: [map], status: any} # Success
@errors {401, 403, 404}

@endpoint POST /organizations/{organizationId}/service-accounts
@desc Create Service Account
@required {username: str # A descriptive name for the service account}
@optional {role: str(owner/admin/analyst/consumer) # The service account's role, expires: str(date-time) # The datetime that the service account should expire, projects: [map{id: int, role: str}] # A list of projects to make this serivce account a member of}
@returns(201) {results: any, status: any} # Service account successfully created
@errors {400, 401, 403, 404}

@endpoint GET /organizations/{organizationId}/service-accounts/{serviceAccountId}
@desc Get Service Account
@returns(200) {id: int, username: str, last_used: str(date-time), expires: str(date-time), creator: int, created: str(date-time), user: int} # successful operation
@errors {401, 403, 404}

@endpoint DELETE /organizations/{organizationId}/service-accounts/{serviceAccountId}
@desc Delete Service Account
@returns(200) Successfully deleted service account
@errors {401, 403, 404}

@endgroup

@group projects
@endpoint GET /projects/{projectId}/service-accounts
@desc List Service Accounts For Project
@returns(200) {results: [any], status: any} # Success
@errors {401, 403, 404}

@endgroup

@group organizations
@endpoint POST /organizations/{organizationId}/service-accounts/add-to-project
@desc Add Service Accounts To Projects
@required {projects: [map{id!: int, role!: str}] # List of project/roles, service_account_ids: [int] # List of service account ids}
@returns(200) {status: any} # Service accounts added to projects
@errors {400, 401, 403, 404}

@endpoint POST /organizations/{organizationId}/service-accounts/remove-from-project
@desc Remove Service Accounts From Projects
@required {projects: [map{id!: int, service_account_ids!: [int]}] # A list of projects and service accounts to remove}
@returns(200) {status: any} # Service accounts removed from projects
@errors {400, 401, 403, 404}

@endgroup

@end
