Fixes for dynamic secret
This commit is contained in:
@@ -8,6 +8,12 @@ import type {
|
|||||||
DefaultApiApiV1DynamicSecretsPostRequest
|
DefaultApiApiV1DynamicSecretsPostRequest
|
||||||
} from "../infisicalapi_client";
|
} from "../infisicalapi_client";
|
||||||
|
|
||||||
|
import type { TDynamicSecretProvider } from "./schemas/dynamic-secrets";
|
||||||
|
|
||||||
|
type CreateDynamicSecretOptions = Omit<DefaultApiApiV1DynamicSecretsPostRequest["apiV1DynamicSecretsPostRequest"], "provider"> & {
|
||||||
|
provider: TDynamicSecretProvider;
|
||||||
|
};
|
||||||
|
|
||||||
export default class DynamicSecretsClient {
|
export default class DynamicSecretsClient {
|
||||||
#apiInstance: InfisicalApi;
|
#apiInstance: InfisicalApi;
|
||||||
#requestOptions: RawAxiosRequestConfig | undefined;
|
#requestOptions: RawAxiosRequestConfig | undefined;
|
||||||
@@ -16,15 +22,15 @@ export default class DynamicSecretsClient {
|
|||||||
this.#requestOptions = requestOptions;
|
this.#requestOptions = requestOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(options: DefaultApiApiV1DynamicSecretsPostRequest["apiV1DynamicSecretsPostRequest"]) {
|
async create(options: CreateDynamicSecretOptions) {
|
||||||
const res = await this.#apiInstance.apiV1DynamicSecretsPost(
|
const res = await this.#apiInstance.apiV1DynamicSecretsPost(
|
||||||
{
|
{
|
||||||
apiV1DynamicSecretsPostRequest: options
|
apiV1DynamicSecretsPostRequest: options as DefaultApiApiV1DynamicSecretsPostRequest["apiV1DynamicSecretsPostRequest"]
|
||||||
},
|
},
|
||||||
this.#requestOptions
|
this.#requestOptions
|
||||||
);
|
);
|
||||||
|
|
||||||
return res.data;
|
return res.data.dynamicSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
async delete(dynamicSecretName: string, options: DefaultApiApiV1DynamicSecretsNameDeleteRequest["apiV1DynamicSecretsNameDeleteRequest"]) {
|
async delete(dynamicSecretName: string, options: DefaultApiApiV1DynamicSecretsNameDeleteRequest["apiV1DynamicSecretsNameDeleteRequest"]) {
|
||||||
@@ -36,7 +42,7 @@ export default class DynamicSecretsClient {
|
|||||||
this.#requestOptions
|
this.#requestOptions
|
||||||
);
|
);
|
||||||
|
|
||||||
return res.data;
|
return res.data.dynamicSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
leases = {
|
leases = {
|
||||||
|
|||||||
Reference in New Issue
Block a user