All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.main.kotlin.com.gabrielfeo.develocity.api.AuthApi.kt Maven / Gradle / Ivy

The newest version!
package com.gabrielfeo.develocity.api

import com.gabrielfeo.develocity.api.internal.infrastructure.CollectionFormats.*
import retrofit2.http.*
import retrofit2.Response
import okhttp3.RequestBody
import com.squareup.moshi.Json

import com.gabrielfeo.develocity.api.model.ApiProblem

@JvmSuppressWildcards
interface AuthApi {
    /**
     * Create a new access token
     * Create a new short-lived access token, optionally limited to the provided permissions and projects. Users do not need any specific Develocity permission to do this. If an access key is used to authenticate this request, the created token will be limited to the user's permissions and projects. If an access token is used to authenticate this request, the created token will be limited to the authenticating token's permissions and projects and not live longer than the authenticating token's remaining lifetime. Query parameters can be used to further restrict the permissions of the access token. A 403 response will be sent if one of the projects or permissions present in the query parameters is not assigned to this user. A 403 will also be sent if an access token is used to authenticate the request and the requested expiration date is after the authenticating access token's expiration.
     * Responses:
     *  - 200: An access token
     *  - 400: The request cannot be fulfilled due to a problem.
     *  - 403: The current user or authenticating access token does not have sufficient access or lifetime to create the requested access token.
     *  - 404: The referenced resource either does not exist or the permissions to know about it are missing.
     *  - 500: The server encountered an unexpected error.
     *
     * @param projectIds Limit the created token to one or more projects. Values should be project ids. Comma seperated values and repeated parameters are supported. (optional)
     * @param permissions Limit the created token to one or more permissions. Values should be permission [config values](https://gradle.com/help/helm-admin-permissions). Comma seperated values and repeated parameters are supported. (optional)
     * @param expiresInHours The lifetime of the created token, in hours. (optional, default to 2f)
     * @return [kotlin.String]
     */
    @POST("api/auth/token")
    suspend fun createAccessToken(@Query("projectIds") projectIds: @JvmSuppressWildcards kotlin.collections.Set? = null, @Query("permissions") permissions: @JvmSuppressWildcards kotlin.collections.Set? = null, @Query("expiresInHours") expiresInHours: kotlin.Float? = 2f): kotlin.String

    /**
     * Revoke auth token signing keys
     * Revokes the existing auth token signing keys, and creates a new one. Requires the `Administer Develocity` permission. All existing access tokens will become invalid. Develocity may take a few minutes to revoke all existing access tokens.
     * Responses:
     *  - 200: The existing signing keys have been revoked, all access tokens will become invalid shortly
     *  - 400: The request cannot be fulfilled due to a problem.
     *  - 403: The authenticated user has insufficient permissions.
     *  - 404: The referenced resource either does not exist or the permissions to know about it are missing.
     *  - 500: The server encountered an unexpected error.
     *
     * @return [Unit]
     */
    @POST("api/auth/revoke-signing-keys")
    suspend fun revokeSigningKeys(): Unit

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy