Files
sdk/api_kms.go

1021 lines
38 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"bytes"
"context"
"io"
"net/http"
"net/url"
"strings"
)
// KmsAPIService KmsAPI service
type KmsAPIService service
type KmsAPIDeleteKmsSecretsByWildcard1Request struct {
ctx context.Context
ApiService *KmsAPIService
wildcard1 string
env *string
}
// Env selects the environment to resolve the secret in. It is part of the storage key, so one name in two environments is two secrets. OMITTED means the `default` environment — where a WRITE refuses to default, because a misplaced write strands a value no reader looks for, a read or a delete aimed at the wrong environment simply answers 404 and the caller learns.
func (r KmsAPIDeleteKmsSecretsByWildcard1Request) Env(env string) KmsAPIDeleteKmsSecretsByWildcard1Request {
r.env = &env
return r
}
func (r KmsAPIDeleteKmsSecretsByWildcard1Request) Execute() (*KmsKmsRemoved, *http.Response, error) {
return r.ApiService.DeleteKmsSecretsByWildcard1Execute(r)
}
/*
DeleteKmsSecretsByWildcard1 Removes one secret from your org.
Removes one secret from your org.
Forgets one secret belonging to the caller's own org and confirms the name and
environment that were removed. Deleting a secret that is not there is a 404,
not a silent success, so a caller can tell a real deletion from a typo.
`secret` is the coordinate beneath the caller's org root, subpath and name
together, and over HTTP it is the trailing path itself. `env` selects the
environment and falls back to the default when omitted. The org comes from the
validated claim, never from the request.
A delete is a WRITE to the grant rule, like the put: destroying a secret is as
consequential as replacing it, and a credential distributed to READ one must
not be able to remove it. It opens only for SuperAdmin holding an access
token, audited, or for a holder a declared WRITE grant covers. Fail-closed
admission, in order: a validated member, well-formed org, master key present,
well-formed address, then the grant — 401/403, 400, 503, 400 and 403, all
decided before any record is touched.
A value this deployment seals on the org's behalf is removed by the app that
holds it, and never here for membership or org admin, whatever the grant
declaration says about enforcement: deleting a wallet's signing key or an MCP
server's credential destroys what the app acts with.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param wildcard1 Secret is the coordinate beneath the caller's own org root: an optional `/`-separated subpath and then the name, such as `ci/deploy/token`. Over HTTP it is the trailing path itself, and the trailing path WINS over any other spelling sent with it. There is no org in it — the tenant comes from the validated claim — so another tenant's secret is not merely refused, it is unnameable. OMITTED is refused with a 400: there is no secret named \"everything\", and a blank address must not read as one.
@return KmsAPIDeleteKmsSecretsByWildcard1Request
*/
func (a *KmsAPIService) DeleteKmsSecretsByWildcard1(ctx context.Context, wildcard1 string) KmsAPIDeleteKmsSecretsByWildcard1Request {
return KmsAPIDeleteKmsSecretsByWildcard1Request{
ApiService: a,
ctx: ctx,
wildcard1: wildcard1,
}
}
// Execute executes the request
//
// @return KmsKmsRemoved
func (a *KmsAPIService) DeleteKmsSecretsByWildcard1Execute(r KmsAPIDeleteKmsSecretsByWildcard1Request) (*KmsKmsRemoved, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodDelete
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *KmsKmsRemoved
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KmsAPIService.DeleteKmsSecretsByWildcard1")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/kms/secrets/{wildcard1}"
localVarPath = strings.Replace(localVarPath, "{"+"wildcard1"+"}", url.PathEscape(parameterValueToString(r.wildcard1, "wildcard1")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.env != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "env", r.env, "form", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v ProblemDetails
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type KmsAPIGetKmsConfigRequest struct {
ctx context.Context
ApiService *KmsAPIService
}
func (r KmsAPIGetKmsConfigRequest) Execute() (*KmsKmsConfig, *http.Response, error) {
return r.ApiService.GetKmsConfigExecute(r)
}
/*
GetKmsConfig Returns the runtime configuration for the KMS console.
Returns the runtime configuration for the KMS console.
What the console needs before anyone has signed in: the brand, the OIDC issuer
it authenticates against, the API base for this subsystem and the path of the
login exchange.
Public on purpose, and it holds nothing sensitive — it is deliberately kept
under this subsystem's own namespace rather than under an admin prefix, so a
gateway that admin-gates the admin routes cannot break the console's
legitimate pre-login fetch.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return KmsAPIGetKmsConfigRequest
*/
func (a *KmsAPIService) GetKmsConfig(ctx context.Context) KmsAPIGetKmsConfigRequest {
return KmsAPIGetKmsConfigRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return KmsKmsConfig
func (a *KmsAPIService) GetKmsConfigExecute(r KmsAPIGetKmsConfigRequest) (*KmsKmsConfig, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *KmsKmsConfig
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KmsAPIService.GetKmsConfig")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/kms/config"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v ProblemDetails
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type KmsAPIGetKmsHealthRequest struct {
ctx context.Context
ApiService *KmsAPIService
}
func (r KmsAPIGetKmsHealthRequest) Execute() (*KmsKmsHealth, *http.Response, error) {
return r.ApiService.GetKmsHealthExecute(r)
}
/*
GetKmsHealth Reports whether this broker can actually serve secrets.
Reports whether this broker can actually serve secrets.
A real readiness probe, not a liveness stub: 200 only when the store is open
AND a master key is configured, with `signing` reporting whether signing keys
are set up too. Anything less answers 503 with `ready:false` and the reason —
no in-process store, or no master key — which are exactly the two states in
which the secret operations refuse.
Not token-gated, because the platform must be able to probe it without a
credential. It reports the broker's configuration state only; no secret, no
key material and no tenant name appears in it.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return KmsAPIGetKmsHealthRequest
*/
func (a *KmsAPIService) GetKmsHealth(ctx context.Context) KmsAPIGetKmsHealthRequest {
return KmsAPIGetKmsHealthRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return KmsKmsHealth
func (a *KmsAPIService) GetKmsHealthExecute(r KmsAPIGetKmsHealthRequest) (*KmsKmsHealth, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *KmsKmsHealth
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KmsAPIService.GetKmsHealth")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/kms/health"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 503 {
var v KmsKmsHealth
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
var v ProblemDetails
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type KmsAPIGetKmsSecretsRequest struct {
ctx context.Context
ApiService *KmsAPIService
env *string
environment *string
path *string
secretPath *string
}
// Env selects the environment, which is part of a secret's storage key. OMITTED means EVERY environment — this is the enumeration surface, so it must be able to answer \"what is in here\" without being told where to look.
func (r KmsAPIGetKmsSecretsRequest) Env(env string) KmsAPIGetKmsSecretsRequest {
r.env = &env
return r
}
// Environment is the KMS operator's spelling of Env, accepted so one caller need not learn the other's vocabulary. Env wins when both are sent.
func (r KmsAPIGetKmsSecretsRequest) Environment(environment string) KmsAPIGetKmsSecretsRequest {
r.environment = &environment
return r
}
// Path narrows the listing to one subtree beneath the caller's org root, as a `/`-separated path such as `/ci`. OMITTED means the whole org.
func (r KmsAPIGetKmsSecretsRequest) Path(path string) KmsAPIGetKmsSecretsRequest {
r.path = &path
return r
}
// SecretPath is the KMS operator's spelling of Path. Path wins when both are sent.
func (r KmsAPIGetKmsSecretsRequest) SecretPath(secretPath string) KmsAPIGetKmsSecretsRequest {
r.secretPath = &secretPath
return r
}
func (r KmsAPIGetKmsSecretsRequest) Execute() (*KmsKmsSecrets, *http.Response, error) {
return r.ApiService.GetKmsSecretsExecute(r)
}
/*
GetKmsSecrets Lists the secrets your org holds, without their values.
Lists the secrets your org holds, without their values.
Returns the METADATA of the caller's own secrets: each one's name, path,
environment and sealing scheme. No value and no ciphertext is included — this
operation exists to enumerate what is held, and reading a value is a separate,
per-secret call.
Scoped to the caller's own org and nothing else, structurally: there is no org
in the path, the store root is derived from the validated org claim, and a
caller therefore has no way to name another tenant's namespace. `path` narrows
to a subpath and `env` selects the environment; both are also accepted under
the operator's spellings, `secretPath` and `environment`. An omitted `env`
means every environment and an omitted `path` means the whole org, because a
default here reported a populated store as empty.
Who sees what: a SuperAdmin holding an access token (audited) sees every name,
and so does an admin of the org holding their own access token, outside the
brand and platform orgs, whose stores are the platform's. Any other caller sees
only the names a declared grant lets it read or write, and is refused with a 403
when none of its grants lies inside the subtree asked about. Membership alone
shows nothing.
Admission is fail-closed and in order: a validated member, an org that is a
DNS-1123 label, a store holding a master key, well-formed input, then who may
list — 403, 400, 503, 400 and 403 respectively, all decided before any record
is touched.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return KmsAPIGetKmsSecretsRequest
*/
func (a *KmsAPIService) GetKmsSecrets(ctx context.Context) KmsAPIGetKmsSecretsRequest {
return KmsAPIGetKmsSecretsRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return KmsKmsSecrets
func (a *KmsAPIService) GetKmsSecretsExecute(r KmsAPIGetKmsSecretsRequest) (*KmsKmsSecrets, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *KmsKmsSecrets
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KmsAPIService.GetKmsSecrets")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/kms/secrets"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.env != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "env", r.env, "form", "")
}
if r.environment != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "environment", r.environment, "form", "")
}
if r.path != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "path", r.path, "form", "")
}
if r.secretPath != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "secretPath", r.secretPath, "form", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v ProblemDetails
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type KmsAPIGetKmsSecretsByWildcard1Request struct {
ctx context.Context
ApiService *KmsAPIService
wildcard1 string
env *string
}
// Env selects the environment to resolve the secret in. It is part of the storage key, so one name in two environments is two secrets. OMITTED means the `default` environment — where a WRITE refuses to default, because a misplaced write strands a value no reader looks for, a read or a delete aimed at the wrong environment simply answers 404 and the caller learns.
func (r KmsAPIGetKmsSecretsByWildcard1Request) Env(env string) KmsAPIGetKmsSecretsByWildcard1Request {
r.env = &env
return r
}
func (r KmsAPIGetKmsSecretsByWildcard1Request) Execute() (*KmsKmsSecret, *http.Response, error) {
return r.ApiService.GetKmsSecretsByWildcard1Execute(r)
}
/*
GetKmsSecretsByWildcard1 Reads one secret's value from your org.
Reads one secret's value from your org.
Opens one sealed secret belonging to the caller's own org and returns its
value, with the name and environment it was resolved under. This is the
broker's purpose, and the response body is the ONLY place the value appears —
it is not logged, and it is never carried in an error.
`secret` is the coordinate beneath the caller's org root, subpath and name
together, and over HTTP it is the trailing path itself. `env` selects the
environment and falls back to the default when omitted. A secret that is not
there is a plain 404 that names nothing about the store.
Scoped to the caller's own org and nothing else: there is no org in the
address, so another tenant's secret is not merely refused, it is unnameable.
Within that org the value opens only for SuperAdmin holding an access token,
audited, or for a holder a declared READ grant covers at this exact path, key
and environment; membership and org admin alone open nothing. Admission is
fail-closed and in order — a validated member, an org that is a DNS-1123
label, a store holding a master key, a well-formed address, then the grant —
401/403, 400, 503, 400 and 403, all decided before any record is touched, so
a refused caller learns nothing about whether the secret exists.
A value this deployment seals on the org's behalf — an MCP server's
credential, a repository's environment secret, a connected account's token —
is read by the app that sealed it, and never opens here for membership or org
admin, whatever the grant declaration says about enforcement. A deployed
app's or a validator's own folder also opens for the org's KMS-sync identity,
which projects it into the org's namespace.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param wildcard1 Secret is the coordinate beneath the caller's own org root: an optional `/`-separated subpath and then the name, such as `ci/deploy/token`. Over HTTP it is the trailing path itself, and the trailing path WINS over any other spelling sent with it. There is no org in it — the tenant comes from the validated claim — so another tenant's secret is not merely refused, it is unnameable. OMITTED is refused with a 400: there is no secret named \"everything\", and a blank address must not read as one.
@return KmsAPIGetKmsSecretsByWildcard1Request
*/
func (a *KmsAPIService) GetKmsSecretsByWildcard1(ctx context.Context, wildcard1 string) KmsAPIGetKmsSecretsByWildcard1Request {
return KmsAPIGetKmsSecretsByWildcard1Request{
ApiService: a,
ctx: ctx,
wildcard1: wildcard1,
}
}
// Execute executes the request
//
// @return KmsKmsSecret
func (a *KmsAPIService) GetKmsSecretsByWildcard1Execute(r KmsAPIGetKmsSecretsByWildcard1Request) (*KmsKmsSecret, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *KmsKmsSecret
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KmsAPIService.GetKmsSecretsByWildcard1")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/kms/secrets/{wildcard1}"
localVarPath = strings.Replace(localVarPath, "{"+"wildcard1"+"}", url.PathEscape(parameterValueToString(r.wildcard1, "wildcard1")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.env != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "env", r.env, "form", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v ProblemDetails
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type KmsAPIPostKmsAuthLoginRequest struct {
ctx context.Context
ApiService *KmsAPIService
kmsKmsLogin *KmsKmsLogin
}
func (r KmsAPIPostKmsAuthLoginRequest) KmsKmsLogin(kmsKmsLogin KmsKmsLogin) KmsAPIPostKmsAuthLoginRequest {
r.kmsKmsLogin = &kmsKmsLogin
return r
}
func (r KmsAPIPostKmsAuthLoginRequest) Execute() (*KmsKmsToken, *http.Response, error) {
return r.ApiService.PostKmsAuthLoginExecute(r)
}
/*
PostKmsAuthLogin Exchanges a machine credential for an IAM bearer token.
Exchanges a machine credential for an IAM bearer token.
Takes a tenant's machine credential — a client id and client secret — and
returns an owner-scoped IAM access token with its lifetime, which is the
bearer the caller then carries on the org-scoped secret operations.
It is deliberately public and unauthenticated, because it IS the credential
exchange and runs before any principal exists. That makes it the one route in
this subsystem rate-limited PER SOURCE IP, keyed on the real TCP peer rather
than on any caller-supplied header, and body-capped in the same place.
The submitted secret is never logged and never echoed, and failures collapse
to one clean status with no upstream detail: 401 when the credential does not
authenticate, 502 when the identity provider is unreachable, 503 when no
issuer is configured. That is on purpose — a richer error would be a validity
oracle for guessed credentials.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return KmsAPIPostKmsAuthLoginRequest
*/
func (a *KmsAPIService) PostKmsAuthLogin(ctx context.Context) KmsAPIPostKmsAuthLoginRequest {
return KmsAPIPostKmsAuthLoginRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return KmsKmsToken
func (a *KmsAPIService) PostKmsAuthLoginExecute(r KmsAPIPostKmsAuthLoginRequest) (*KmsKmsToken, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *KmsKmsToken
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KmsAPIService.PostKmsAuthLogin")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/kms/auth/login"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.kmsKmsLogin == nil {
return localVarReturnValue, nil, reportError("kmsKmsLogin is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.kmsKmsLogin
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v ProblemDetails
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type KmsAPIPostKmsSecretsRequest struct {
ctx context.Context
ApiService *KmsAPIService
kmsKmsPut *KmsKmsPut
}
func (r KmsAPIPostKmsSecretsRequest) KmsKmsPut(kmsKmsPut KmsKmsPut) KmsAPIPostKmsSecretsRequest {
r.kmsKmsPut = &kmsKmsPut
return r
}
func (r KmsAPIPostKmsSecretsRequest) Execute() (*KmsKmsStored, *http.Response, error) {
return r.ApiService.PostKmsSecretsExecute(r)
}
/*
PostKmsSecrets Stores or replaces one secret in your org.
Stores or replaces one secret in your org.
Upserts one secret under the caller's own org. The value is sealed before it
is written — a fresh per-secret data key, itself wrapped by the master key —
so plaintext never reaches disk. The receipt confirms the name and environment
that were written and does not echo the value.
`env` is REQUIRED on a write and has no default, which is the rule most easily
got wrong here: reads and deletes still fall back to the default environment
for older callers, but a write must not, because the environment is part of
the storage key. A silently defaulted write lands in a bucket the readers that
resolve project, environment and path never look in, and the stale value keeps
being served — so the write fails loudly instead.
`name` is required, `path` is an optional subpath beneath the org root, and
the org is taken from the validated claim rather than the body. A `path` that
starts with `/orgs/` is refused with a 400 that names where it would have
landed: the root is already `/orgs/<org>`, so `/orgs/hanzo` written in org
admin is stored at `/orgs/admin/orgs/hanzo`, which no reader of org hanzo
looks in. The org is chosen with the credential (the CLI's `--as`).
Opens only for SuperAdmin holding an access token, audited, or for a holder
a declared WRITE grant covers at this exact path, key and environment. Org
admin confers nothing here. Fail-closed admission, in order: a validated
member, well-formed org, master key present, well-formed input, then the
grant — 401/403, 400, 503, 400 and 403, all decided before any record is
touched.
A value this deployment seals on the org's behalf — an MCP server's
credential, a wallet's signing key, a delivery provider's token — is written
by the app that holds it, through that app's own operation, and is never
replaced here for membership or org admin, whatever the grant declaration
says about enforcement.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return KmsAPIPostKmsSecretsRequest
*/
func (a *KmsAPIService) PostKmsSecrets(ctx context.Context) KmsAPIPostKmsSecretsRequest {
return KmsAPIPostKmsSecretsRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return KmsKmsStored
func (a *KmsAPIService) PostKmsSecretsExecute(r KmsAPIPostKmsSecretsRequest) (*KmsKmsStored, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *KmsKmsStored
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KmsAPIService.PostKmsSecrets")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/kms/secrets"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.kmsKmsPut == nil {
return localVarReturnValue, nil, reportError("kmsKmsPut is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.kmsKmsPut
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
var v ProblemDetails
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}