Files
sdk/api_blueprint.go

343 lines
12 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"
)
// BlueprintAPIService BlueprintAPI service
type BlueprintAPIService service
type BlueprintAPIGetBlueprintRequest struct {
ctx context.Context
ApiService *BlueprintAPIService
}
func (r BlueprintAPIGetBlueprintRequest) Execute() (*BlueprintBlueprintIndex, *http.Response, error) {
return r.ApiService.GetBlueprintExecute(r)
}
/*
GetBlueprint Returns every deployable blueprint with its service count and estimated monthly compute cost.
Returns every deployable blueprint with its service count and estimated
monthly compute cost.
It is the lightweight index the console renders as a template gallery before
drilling into one stack's bill of images — GET /v1/blueprint/sbom?template=<id>
is the detail view. The cost is the same figure the deploy path meters the
deploying org on and the 20% author royalty is taken from, priced from the
active rate card (GET /v1/blueprint/health echoes that card).
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return BlueprintAPIGetBlueprintRequest
*/
func (a *BlueprintAPIService) GetBlueprint(ctx context.Context) BlueprintAPIGetBlueprintRequest {
return BlueprintAPIGetBlueprintRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return BlueprintBlueprintIndex
func (a *BlueprintAPIService) GetBlueprintExecute(r BlueprintAPIGetBlueprintRequest) (*BlueprintBlueprintIndex, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *BlueprintBlueprintIndex
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BlueprintAPIService.GetBlueprint")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/blueprint"
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 BlueprintAPIGetBlueprintHealthRequest struct {
ctx context.Context
ApiService *BlueprintAPIService
}
func (r BlueprintAPIGetBlueprintHealthRequest) Execute() (*BlueprintBlueprintHealth, *http.Response, error) {
return r.ApiService.GetBlueprintHealthExecute(r)
}
/*
GetBlueprintHealth Reports blueprint liveness and echoes the compute rate card in force.
Reports blueprint liveness and echoes the compute rate card in force.
The rate card is the one the estimator actually applies after the operator env
overlay, so an operator can confirm a tuned knob took effect rather than
inferring it from a price. Not JWT-gated — a liveness probe must be reachable —
and it always answers 200 while the subsystem is mounted.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return BlueprintAPIGetBlueprintHealthRequest
*/
func (a *BlueprintAPIService) GetBlueprintHealth(ctx context.Context) BlueprintAPIGetBlueprintHealthRequest {
return BlueprintAPIGetBlueprintHealthRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
//
// @return BlueprintBlueprintHealth
func (a *BlueprintAPIService) GetBlueprintHealthExecute(r BlueprintAPIGetBlueprintHealthRequest) (*BlueprintBlueprintHealth, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *BlueprintBlueprintHealth
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BlueprintAPIService.GetBlueprintHealth")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/blueprint/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,
}
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 BlueprintAPIGetBlueprintSbomRequest struct {
ctx context.Context
ApiService *BlueprintAPIService
}
func (r BlueprintAPIGetBlueprintSbomRequest) Execute() (*http.Response, error) {
return r.ApiService.GetBlueprintSbomExecute(r)
}
/*
GetBlueprintSbom A blueprint's bill of images and what running it costs
Answers a blueprint's SBOM — the container images its compose stack runs, each with the CPU/memory footprint that was applied to it — together with the compute cost that footprint prices out to on the active rate card.
ONE address, TWO shapes at 200: `?template=<id>` returns that blueprint's Estimate alone (404 on an id no embedded blueprint carries), and no `template` returns `{data:[Estimate]}` for every blueprint — the batch the console's template gallery reads in one round-trip.
The blueprints are reference content embedded in the binary and validated at mount, so this read is the same for every caller and is scoped to no tenant. The per-hour figure it returns is the one the deploy path meters the deploying org on and the 20% author royalty is taken from; GET /v1/blueprint/health echoes the rate card it was priced from.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return BlueprintAPIGetBlueprintSbomRequest
*/
func (a *BlueprintAPIService) GetBlueprintSbom(ctx context.Context) BlueprintAPIGetBlueprintSbomRequest {
return BlueprintAPIGetBlueprintSbomRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
func (a *BlueprintAPIService) GetBlueprintSbomExecute(r BlueprintAPIGetBlueprintSbomRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BlueprintAPIService.GetBlueprintSbom")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/v1/blueprint/sbom"
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{}
// 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 nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}