subhosting

package module
v0.1.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 13 Imported by: 0

README

Subhosting Go API Library

Go Reference

The Subhosting Go library provides convenient access to the Subhosting REST API from applications written in Go. The full API of this library can be found in api.md.

Installation

import (
	"github.com/denoland/subhosting-go" // imported as subhosting
)

Or to pin the version:

go get -u 'github.com/denoland/subhosting-go@v0.1.0-alpha.1'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/denoland/subhosting-go"
	"github.com/denoland/subhosting-go/option"
)

func main() {
	client := subhosting.NewClient(
		option.WithBearerToken("My Bearer Token"), // defaults to os.LookupEnv("DEPLOY_ACCESS_TOKEN")
	)
	organization, err := client.Organizations.Get(context.TODO(), "DEPLOY_ORG_ID")
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", organization.ID)
}

Request Fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: subhosting.F("hello"),

	// Explicitly send `"description": null`
	Description: subhosting.Null[string](),

	Point: subhosting.F(subhosting.Point{
		X: subhosting.Int(0),
		Y: subhosting.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: subhosting.Raw[int64](0.01), // sends a float
	}),
}
Response Objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the repsonse JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := subhosting.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Organizations.Get(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The full list of request options is here.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

// TODO

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

// TODO
Errors

When the API returns a non-success status code, we return an error with type *subhosting.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Organizations.Get(context.TODO(), "DEPLOY_ORG_ID")
if err != nil {
	var apierr *subhosting.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/organizations/{organizationId}": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Organizations.Get(
	ctx,
	"DEPLOY_ORG_ID",
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := subhosting.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Organizations.Get(
	context.TODO(),
	"DEPLOY_ORG_ID",
	option.WithMaxRetries(5),
)
Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := subhosting.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic Versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals).
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Documentation

Index

Constants

View Source
const AnalyticsFieldsTypeBoolean = shared.AnalyticsFieldsTypeBoolean

This is an alias to an internal value.

View Source
const AnalyticsFieldsTypeNumber = shared.AnalyticsFieldsTypeNumber

This is an alias to an internal value.

View Source
const AnalyticsFieldsTypeOther = shared.AnalyticsFieldsTypeOther

This is an alias to an internal value.

View Source
const AnalyticsFieldsTypeString = shared.AnalyticsFieldsTypeString

This is an alias to an internal value.

View Source
const AnalyticsFieldsTypeTime = shared.AnalyticsFieldsTypeTime

This is an alias to an internal value.

View Source
const DeploymentStatusFailed = shared.DeploymentStatusFailed

This is an alias to an internal value.

View Source
const DeploymentStatusPending = shared.DeploymentStatusPending

This is an alias to an internal value.

View Source
const DeploymentStatusSuccess = shared.DeploymentStatusSuccess

This is an alias to an internal value.

View Source
const DomainCertificatesCipherEc = shared.DomainCertificatesCipherEc

This is an alias to an internal value.

View Source
const DomainCertificatesCipherRsa = shared.DomainCertificatesCipherRsa

This is an alias to an internal value.

View Source
const DomainProvisioningStatusFailedCodeFailed = shared.DomainProvisioningStatusFailedCodeFailed

This is an alias to an internal value.

View Source
const DomainProvisioningStatusManualCodeManual = shared.DomainProvisioningStatusManualCodeManual

This is an alias to an internal value.

View Source
const DomainProvisioningStatusPendingCodePending = shared.DomainProvisioningStatusPendingCodePending

This is an alias to an internal value.

View Source
const DomainProvisioningStatusSuccessCodeSuccess = shared.DomainProvisioningStatusSuccessCodeSuccess

This is an alias to an internal value.

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explciitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type Analytics

type Analytics = shared.Analytics

Project analytics data

This is an alias to an internal type.

type AnalyticsField

type AnalyticsField = shared.AnalyticsField

This is an alias to an internal type.

type AnalyticsFieldsType

type AnalyticsFieldsType = shared.AnalyticsFieldsType

A data type that analytic data can be represented in.

Inspired by Grafana's data types defined at: https://github.com/grafana/grafana/blob/e3288834b37b9aac10c1f43f0e621b35874c1f8a/packages/grafana-data/src/types/dataFrame.ts#L11-L23

This is an alias to an internal type.

type AnalyticsValue

type AnalyticsValue = shared.AnalyticsValue

This is an alias to an internal type.

type Client

type Client struct {
	Options       []option.RequestOption
	Organizations *OrganizationService
	Databases     *DatabaseService
	Projects      *ProjectService
	Deployments   *DeploymentService
	Domains       *DomainService
}

Client creates a struct with services and top level methods that help with interacting with the subhosting API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r *Client)

NewClient generates a new client with the default option read from the environment (DEPLOY_ACCESS_TOKEN). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

type DatabaseService

type DatabaseService struct {
	Options []option.RequestOption
}

DatabaseService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewDatabaseService method instead.

func NewDatabaseService

func NewDatabaseService(opts ...option.RequestOption) (r *DatabaseService)

NewDatabaseService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*DatabaseService) Update

func (r *DatabaseService) Update(ctx context.Context, databaseID string, body DatabaseUpdateParams, opts ...option.RequestOption) (res *shared.KvDatabase, err error)

Update KV database details

type DatabaseUpdateParams

type DatabaseUpdateParams struct {
	// The description of the KV database to be updated to. If this is `null`, no
	// update will be made to the KV database description.
	Description param.Field[string] `json:"description"`
}

func (DatabaseUpdateParams) MarshalJSON

func (r DatabaseUpdateParams) MarshalJSON() (data []byte, err error)

type Deployment

type Deployment = shared.Deployment

This is an alias to an internal type.

type DeploymentAppLogGetParams

type DeploymentAppLogGetParams struct {
	// Opaque value that represents the cursor of the last log returned in the previous
	// request.
	//
	// This is only effective for the past log mode.
	Cursor param.Field[string] `query:"cursor"`
	// Log level(s) to filter logs by.
	//
	// Defaults to all levels (i.e. no filter applied).
	//
	// Multiple levels can be specified using comma-separated format.
	Level param.Field[DeploymentAppLogGetParamsLevel] `query:"level"`
	// Maximum number of logs to return in one request.
	//
	// This is only effective for the past log mode.
	Limit param.Field[int64] `query:"limit"`
	// Sort order, either `asc` or `desc`. Defaults to `desc`.
	//
	// For backward compatibility, `timeAsc` and `timeDesc` are also supported, but
	// deprecated.
	//
	// This is only effective for the past log mode.
	Order param.Field[string] `query:"order"`
	// Text to search for in log message.
	Q param.Field[string] `query:"q"`
	// Region(s) to filter logs by.
	//
	// Defaults to all regions (i.e. no filter applied).
	//
	// Multiple regions can be specified using comma-separated format.
	Region param.Field[DeploymentAppLogGetParamsRegion] `query:"region"`
	// Start time of the time range to filter logs by.
	//
	// Defaults to the Unix Epoch (though the log retention period is 2 weeks as of
	// now).
	//
	// If neither `since` nor `until` is specified, real-time logs are returned.
	Since param.Field[time.Time] `query:"since" format:"date-time"`
	// The field to sort by. Currently only `time` is supported.
	//
	// This is only effective for the past log mode.
	Sort param.Field[string] `query:"sort"`
	// End time of the time range to filter logs by.
	//
	// Defaults to the current time.
	//
	// If neither `since` nor `until` is specified, real-time logs are returned.
	Until param.Field[time.Time] `query:"until" format:"date-time"`
}

func (DeploymentAppLogGetParams) URLQuery

func (r DeploymentAppLogGetParams) URLQuery() (v url.Values)

URLQuery serializes DeploymentAppLogGetParams's query parameters as `url.Values`.

type DeploymentAppLogGetParamsLevel

type DeploymentAppLogGetParamsLevel string

Log level(s) to filter logs by.

Defaults to all levels (i.e. no filter applied).

Multiple levels can be specified using comma-separated format.

const (
	DeploymentAppLogGetParamsLevelError   DeploymentAppLogGetParamsLevel = "error"
	DeploymentAppLogGetParamsLevelWarning DeploymentAppLogGetParamsLevel = "warning"
	DeploymentAppLogGetParamsLevelInfo    DeploymentAppLogGetParamsLevel = "info"
	DeploymentAppLogGetParamsLevelDebug   DeploymentAppLogGetParamsLevel = "debug"
)

type DeploymentAppLogGetParamsRegion

type DeploymentAppLogGetParamsRegion string

Region(s) to filter logs by.

Defaults to all regions (i.e. no filter applied).

Multiple regions can be specified using comma-separated format.

const (
	DeploymentAppLogGetParamsRegionGcpAsiaEast1              DeploymentAppLogGetParamsRegion = "gcp-asia-east1"
	DeploymentAppLogGetParamsRegionGcpAsiaEast2              DeploymentAppLogGetParamsRegion = "gcp-asia-east2"
	DeploymentAppLogGetParamsRegionGcpAsiaNortheast1         DeploymentAppLogGetParamsRegion = "gcp-asia-northeast1"
	DeploymentAppLogGetParamsRegionGcpAsiaNortheast2         DeploymentAppLogGetParamsRegion = "gcp-asia-northeast2"
	DeploymentAppLogGetParamsRegionGcpAsiaNortheast3         DeploymentAppLogGetParamsRegion = "gcp-asia-northeast3"
	DeploymentAppLogGetParamsRegionGcpAsiaSouth1             DeploymentAppLogGetParamsRegion = "gcp-asia-south1"
	DeploymentAppLogGetParamsRegionGcpAsiaSouth2             DeploymentAppLogGetParamsRegion = "gcp-asia-south2"
	DeploymentAppLogGetParamsRegionGcpAsiaSoutheast1         DeploymentAppLogGetParamsRegion = "gcp-asia-southeast1"
	DeploymentAppLogGetParamsRegionGcpAsiaSoutheast2         DeploymentAppLogGetParamsRegion = "gcp-asia-southeast2"
	DeploymentAppLogGetParamsRegionGcpAustraliaSoutheast1    DeploymentAppLogGetParamsRegion = "gcp-australia-southeast1"
	DeploymentAppLogGetParamsRegionGcpAustraliaSoutheast2    DeploymentAppLogGetParamsRegion = "gcp-australia-southeast2"
	DeploymentAppLogGetParamsRegionGcpEuropeCentral2         DeploymentAppLogGetParamsRegion = "gcp-europe-central2"
	DeploymentAppLogGetParamsRegionGcpEuropeNorth1           DeploymentAppLogGetParamsRegion = "gcp-europe-north1"
	DeploymentAppLogGetParamsRegionGcpEuropeSouthwest1       DeploymentAppLogGetParamsRegion = "gcp-europe-southwest1"
	DeploymentAppLogGetParamsRegionGcpEuropeWest1            DeploymentAppLogGetParamsRegion = "gcp-europe-west1"
	DeploymentAppLogGetParamsRegionGcpEuropeWest2            DeploymentAppLogGetParamsRegion = "gcp-europe-west2"
	DeploymentAppLogGetParamsRegionGcpEuropeWest3            DeploymentAppLogGetParamsRegion = "gcp-europe-west3"
	DeploymentAppLogGetParamsRegionGcpEuropeWest4            DeploymentAppLogGetParamsRegion = "gcp-europe-west4"
	DeploymentAppLogGetParamsRegionGcpEuropeWest6            DeploymentAppLogGetParamsRegion = "gcp-europe-west6"
	DeploymentAppLogGetParamsRegionGcpEuropeWest8            DeploymentAppLogGetParamsRegion = "gcp-europe-west8"
	DeploymentAppLogGetParamsRegionGcpMeWest1                DeploymentAppLogGetParamsRegion = "gcp-me-west1"
	DeploymentAppLogGetParamsRegionGcpNorthamericaNortheast1 DeploymentAppLogGetParamsRegion = "gcp-northamerica-northeast1"
	DeploymentAppLogGetParamsRegionGcpNorthamericaNortheast2 DeploymentAppLogGetParamsRegion = "gcp-northamerica-northeast2"
	DeploymentAppLogGetParamsRegionGcpSouthamericaEast1      DeploymentAppLogGetParamsRegion = "gcp-southamerica-east1"
	DeploymentAppLogGetParamsRegionGcpSouthamericaWest1      DeploymentAppLogGetParamsRegion = "gcp-southamerica-west1"
	DeploymentAppLogGetParamsRegionGcpUsCentral1             DeploymentAppLogGetParamsRegion = "gcp-us-central1"
	DeploymentAppLogGetParamsRegionGcpUsEast1                DeploymentAppLogGetParamsRegion = "gcp-us-east1"
	DeploymentAppLogGetParamsRegionGcpUsEast4                DeploymentAppLogGetParamsRegion = "gcp-us-east4"
	DeploymentAppLogGetParamsRegionGcpUsEast5                DeploymentAppLogGetParamsRegion = "gcp-us-east5"
	DeploymentAppLogGetParamsRegionGcpUsSouth1               DeploymentAppLogGetParamsRegion = "gcp-us-south1"
	DeploymentAppLogGetParamsRegionGcpUsWest1                DeploymentAppLogGetParamsRegion = "gcp-us-west1"
	DeploymentAppLogGetParamsRegionGcpUsWest2                DeploymentAppLogGetParamsRegion = "gcp-us-west2"
	DeploymentAppLogGetParamsRegionGcpUsWest3                DeploymentAppLogGetParamsRegion = "gcp-us-west3"
	DeploymentAppLogGetParamsRegionGcpUsWest4                DeploymentAppLogGetParamsRegion = "gcp-us-west4"
)

type DeploymentAppLogGetResponse

type DeploymentAppLogGetResponse struct {
	Level   DeploymentAppLogGetResponseLevel  `json:"level,required"`
	Message string                            `json:"message,required"`
	Region  DeploymentAppLogGetResponseRegion `json:"region,required"`
	// Log timestamp
	Time time.Time                       `json:"time,required" format:"date-time"`
	JSON deploymentAppLogGetResponseJSON `json:"-"`
}

func (*DeploymentAppLogGetResponse) UnmarshalJSON

func (r *DeploymentAppLogGetResponse) UnmarshalJSON(data []byte) (err error)

type DeploymentAppLogGetResponseLevel

type DeploymentAppLogGetResponseLevel string
const (
	DeploymentAppLogGetResponseLevelError   DeploymentAppLogGetResponseLevel = "error"
	DeploymentAppLogGetResponseLevelWarning DeploymentAppLogGetResponseLevel = "warning"
	DeploymentAppLogGetResponseLevelInfo    DeploymentAppLogGetResponseLevel = "info"
	DeploymentAppLogGetResponseLevelDebug   DeploymentAppLogGetResponseLevel = "debug"
)

type DeploymentAppLogGetResponseRegion

type DeploymentAppLogGetResponseRegion string
const (
	DeploymentAppLogGetResponseRegionGcpAsiaEast1              DeploymentAppLogGetResponseRegion = "gcp-asia-east1"
	DeploymentAppLogGetResponseRegionGcpAsiaEast2              DeploymentAppLogGetResponseRegion = "gcp-asia-east2"
	DeploymentAppLogGetResponseRegionGcpAsiaNortheast1         DeploymentAppLogGetResponseRegion = "gcp-asia-northeast1"
	DeploymentAppLogGetResponseRegionGcpAsiaNortheast2         DeploymentAppLogGetResponseRegion = "gcp-asia-northeast2"
	DeploymentAppLogGetResponseRegionGcpAsiaNortheast3         DeploymentAppLogGetResponseRegion = "gcp-asia-northeast3"
	DeploymentAppLogGetResponseRegionGcpAsiaSouth1             DeploymentAppLogGetResponseRegion = "gcp-asia-south1"
	DeploymentAppLogGetResponseRegionGcpAsiaSouth2             DeploymentAppLogGetResponseRegion = "gcp-asia-south2"
	DeploymentAppLogGetResponseRegionGcpAsiaSoutheast1         DeploymentAppLogGetResponseRegion = "gcp-asia-southeast1"
	DeploymentAppLogGetResponseRegionGcpAsiaSoutheast2         DeploymentAppLogGetResponseRegion = "gcp-asia-southeast2"
	DeploymentAppLogGetResponseRegionGcpAustraliaSoutheast1    DeploymentAppLogGetResponseRegion = "gcp-australia-southeast1"
	DeploymentAppLogGetResponseRegionGcpAustraliaSoutheast2    DeploymentAppLogGetResponseRegion = "gcp-australia-southeast2"
	DeploymentAppLogGetResponseRegionGcpEuropeCentral2         DeploymentAppLogGetResponseRegion = "gcp-europe-central2"
	DeploymentAppLogGetResponseRegionGcpEuropeNorth1           DeploymentAppLogGetResponseRegion = "gcp-europe-north1"
	DeploymentAppLogGetResponseRegionGcpEuropeSouthwest1       DeploymentAppLogGetResponseRegion = "gcp-europe-southwest1"
	DeploymentAppLogGetResponseRegionGcpEuropeWest1            DeploymentAppLogGetResponseRegion = "gcp-europe-west1"
	DeploymentAppLogGetResponseRegionGcpEuropeWest2            DeploymentAppLogGetResponseRegion = "gcp-europe-west2"
	DeploymentAppLogGetResponseRegionGcpEuropeWest3            DeploymentAppLogGetResponseRegion = "gcp-europe-west3"
	DeploymentAppLogGetResponseRegionGcpEuropeWest4            DeploymentAppLogGetResponseRegion = "gcp-europe-west4"
	DeploymentAppLogGetResponseRegionGcpEuropeWest6            DeploymentAppLogGetResponseRegion = "gcp-europe-west6"
	DeploymentAppLogGetResponseRegionGcpEuropeWest8            DeploymentAppLogGetResponseRegion = "gcp-europe-west8"
	DeploymentAppLogGetResponseRegionGcpMeWest1                DeploymentAppLogGetResponseRegion = "gcp-me-west1"
	DeploymentAppLogGetResponseRegionGcpNorthamericaNortheast1 DeploymentAppLogGetResponseRegion = "gcp-northamerica-northeast1"
	DeploymentAppLogGetResponseRegionGcpNorthamericaNortheast2 DeploymentAppLogGetResponseRegion = "gcp-northamerica-northeast2"
	DeploymentAppLogGetResponseRegionGcpSouthamericaEast1      DeploymentAppLogGetResponseRegion = "gcp-southamerica-east1"
	DeploymentAppLogGetResponseRegionGcpSouthamericaWest1      DeploymentAppLogGetResponseRegion = "gcp-southamerica-west1"
	DeploymentAppLogGetResponseRegionGcpUsCentral1             DeploymentAppLogGetResponseRegion = "gcp-us-central1"
	DeploymentAppLogGetResponseRegionGcpUsEast1                DeploymentAppLogGetResponseRegion = "gcp-us-east1"
	DeploymentAppLogGetResponseRegionGcpUsEast4                DeploymentAppLogGetResponseRegion = "gcp-us-east4"
	DeploymentAppLogGetResponseRegionGcpUsEast5                DeploymentAppLogGetResponseRegion = "gcp-us-east5"
	DeploymentAppLogGetResponseRegionGcpUsSouth1               DeploymentAppLogGetResponseRegion = "gcp-us-south1"
	DeploymentAppLogGetResponseRegionGcpUsWest1                DeploymentAppLogGetResponseRegion = "gcp-us-west1"
	DeploymentAppLogGetResponseRegionGcpUsWest2                DeploymentAppLogGetResponseRegion = "gcp-us-west2"
	DeploymentAppLogGetResponseRegionGcpUsWest3                DeploymentAppLogGetResponseRegion = "gcp-us-west3"
	DeploymentAppLogGetResponseRegionGcpUsWest4                DeploymentAppLogGetResponseRegion = "gcp-us-west4"
)

type DeploymentAppLogService

type DeploymentAppLogService struct {
	Options []option.RequestOption
}

DeploymentAppLogService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewDeploymentAppLogService method instead.

func NewDeploymentAppLogService

func NewDeploymentAppLogService(opts ...option.RequestOption) (r *DeploymentAppLogService)

NewDeploymentAppLogService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*DeploymentAppLogService) Get

Get execution logs of a deployment

This API can return either past logs or real-time logs depending on the presence of the since and until query parameters; if at least one of them is provided, past logs are returned, otherwise real-time logs are returned.

Also, the response format can be controlled by the `Accept` header; if `application/x-ndjson` is specified, the response will be a stream of newline-delimited JSON objects. Otherwise it will be a JSON array of objects.

type DeploymentBuildLogGetResponse

type DeploymentBuildLogGetResponse struct {
	Level   string                            `json:"level,required"`
	Message string                            `json:"message,required"`
	JSON    deploymentBuildLogGetResponseJSON `json:"-"`
}

func (*DeploymentBuildLogGetResponse) UnmarshalJSON

func (r *DeploymentBuildLogGetResponse) UnmarshalJSON(data []byte) (err error)

type DeploymentBuildLogService

type DeploymentBuildLogService struct {
	Options []option.RequestOption
}

DeploymentBuildLogService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewDeploymentBuildLogService method instead.

func NewDeploymentBuildLogService

func NewDeploymentBuildLogService(opts ...option.RequestOption) (r *DeploymentBuildLogService)

NewDeploymentBuildLogService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*DeploymentBuildLogService) Get

Get build logs of a deployment

This API returns build logs of the specified deployment. It's useful to watch the build progress, figure out what went wrong in case of a build failure, and so on.

The response format can be controlled by the `Accept` header; if `application/x-ndjson` is specified, the response will be a stream of newline-delimited JSON objects. Otherwise it will be a JSON array of objects.

type DeploymentRedeployParams

type DeploymentRedeployParams struct {
	// KV database ID mappings to associate with the deployment.
	//
	// A key represents a KV database name (e.g. `"default"`), and a value is a KV
	// database ID.
	//
	// Currently, only `"default"` database is supported. If any other database name is
	// specified, that will be rejected.
	//
	// The provided KV database mappings will be _merged_ with the existing one, just
	// like `env_vars`.
	//
	// If `databases` itself is not provided, no update will happen to the existing KV
	// database mappings.
	Databases param.Field[map[string]string] `json:"databases" format:"uuid"`
	// A description of the created deployment. If not provided, no update will happen
	// to the description.
	Description param.Field[string] `json:"description"`
	// A dictionary of environment variables to be set in the runtime environment of
	// the deployment.
	//
	// The provided environment variables will be _merged_ with the existing one. For
	// example, if the existing environment variables are:
	//
	// “`json
	// {
	// "a": "alice",
	// "b": "bob"
	// "c": "charlie"
	// }
	// “`
	//
	// and you pass the following environment variables in your redeploy request:
	//
	// “`json
	//
	//	{
	//	  "a": "alice2",
	//	  "b": null,
	//	  "d": "david"
	//	}
	//
	// “`
	//
	// then the result will be:
	//
	// “`json
	//
	//	{
	//	  "a": "alice2",
	//	  "c": "charlie",
	//	  "d": "david"
	//	}
	//
	// “`
	//
	// If `env_vars` itself is not provided, no update will happen to the existing
	// environment variables.
	EnvVars param.Field[map[string]string] `json:"env_vars"`
}

func (DeploymentRedeployParams) MarshalJSON

func (r DeploymentRedeployParams) MarshalJSON() (data []byte, err error)

type DeploymentService

type DeploymentService struct {
	Options   []option.RequestOption
	BuildLogs *DeploymentBuildLogService
	AppLogs   *DeploymentAppLogService
}

DeploymentService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewDeploymentService method instead.

func NewDeploymentService

func NewDeploymentService(opts ...option.RequestOption) (r *DeploymentService)

NewDeploymentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*DeploymentService) Delete

func (r *DeploymentService) Delete(ctx context.Context, deploymentID string, opts ...option.RequestOption) (err error)

Delete a deployment

func (*DeploymentService) Get

func (r *DeploymentService) Get(ctx context.Context, deploymentID string, opts ...option.RequestOption) (res *shared.Deployment, err error)

Get deployment details

func (*DeploymentService) Redeploy

func (r *DeploymentService) Redeploy(ctx context.Context, deploymentID string, body DeploymentRedeployParams, opts ...option.RequestOption) (res *shared.Deployment, err error)

Redeploy a deployment with different configuration

type DeploymentStatus

type DeploymentStatus = shared.DeploymentStatus

The status of a deployment.

This is an alias to an internal type.

type Domain

type Domain = shared.Domain

This is an alias to an internal type.

type DomainCertificate

type DomainCertificate = shared.DomainCertificate

This is an alias to an internal type.

type DomainCertificateNewParams

type DomainCertificateNewParams struct {
	// The PRM encoded certificate chain for the TLS certificate
	CertificateChain param.Field[string] `json:"certificateChain,required"`
	// The PEM encoded private key for the TLS certificate
	PrivateKey param.Field[string] `json:"privateKey,required"`
}

func (DomainCertificateNewParams) MarshalJSON

func (r DomainCertificateNewParams) MarshalJSON() (data []byte, err error)

type DomainCertificateService

type DomainCertificateService struct {
	Options []option.RequestOption
}

DomainCertificateService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewDomainCertificateService method instead.

func NewDomainCertificateService

func NewDomainCertificateService(opts ...option.RequestOption) (r *DomainCertificateService)

NewDomainCertificateService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*DomainCertificateService) New

Upload TLS certificate for a domain

This API allows you to upload a TLS certificate for a domain.

If the ownership of the domain is not verified yet, this API will trigger the verification process before storing the certificate.

func (*DomainCertificateService) Provision

func (r *DomainCertificateService) Provision(ctx context.Context, domainID string, opts ...option.RequestOption) (err error)

Provision TLS certificates for a domain

This API begins the provisioning of TLS certificates for a domain.

Note that a call to this API may take a while, up to a minute or so.

If the ownership of the domain is not verified yet, this API will trigger the verification process before provisioning the certificate.

type DomainCertificatesCipher

type DomainCertificatesCipher = shared.DomainCertificatesCipher

This is an alias to an internal type.

type DomainDNSRecord

type DomainDNSRecord = shared.DomainDNSRecord

This is an alias to an internal type.

type DomainProvisioningStatus

type DomainProvisioningStatus = shared.DomainProvisioningStatus

This is an alias to an internal type.

type DomainProvisioningStatusFailed

type DomainProvisioningStatusFailed = shared.DomainProvisioningStatusFailed

This is an alias to an internal type.

type DomainProvisioningStatusFailedCode

type DomainProvisioningStatusFailedCode = shared.DomainProvisioningStatusFailedCode

This is an alias to an internal type.

type DomainProvisioningStatusManual

type DomainProvisioningStatusManual = shared.DomainProvisioningStatusManual

This is an alias to an internal type.

type DomainProvisioningStatusManualCode

type DomainProvisioningStatusManualCode = shared.DomainProvisioningStatusManualCode

This is an alias to an internal type.

type DomainProvisioningStatusPending

type DomainProvisioningStatusPending = shared.DomainProvisioningStatusPending

This is an alias to an internal type.

type DomainProvisioningStatusPendingCode

type DomainProvisioningStatusPendingCode = shared.DomainProvisioningStatusPendingCode

This is an alias to an internal type.

type DomainProvisioningStatusSuccess

type DomainProvisioningStatusSuccess = shared.DomainProvisioningStatusSuccess

This is an alias to an internal type.

type DomainProvisioningStatusSuccessCode

type DomainProvisioningStatusSuccessCode = shared.DomainProvisioningStatusSuccessCode

This is an alias to an internal type.

type DomainService

type DomainService struct {
	Options      []option.RequestOption
	Certificates *DomainCertificateService
}

DomainService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewDomainService method instead.

func NewDomainService

func NewDomainService(opts ...option.RequestOption) (r *DomainService)

NewDomainService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*DomainService) Delete

func (r *DomainService) Delete(ctx context.Context, domainID string, opts ...option.RequestOption) (err error)

Delete a domain

func (*DomainService) Get

func (r *DomainService) Get(ctx context.Context, domainID string, opts ...option.RequestOption) (res *shared.Domain, err error)

Get domain details

func (*DomainService) Update

func (r *DomainService) Update(ctx context.Context, domainID string, body DomainUpdateParams, opts ...option.RequestOption) (err error)

Associate a domain with a deployment

This API allows you to either:

1. associate a domain with a deployment, or 2. disassociate a domain from a deployment

Domain association is required in order to serve the deployment on the domain.

If the ownership of the domain is not verified yet, this API will trigger the verification process before associating the domain with the deployment.

func (*DomainService) Verify

func (r *DomainService) Verify(ctx context.Context, domainID string, opts ...option.RequestOption) (err error)

Verify ownership of a domain

This API triggers the ownership verification of a domain. It should be called after necessary DNS records are properly set up.

type DomainUpdateParams

type DomainUpdateParams struct {
	// A deployment ID
	//
	// Note that this is not UUID v4, as opposed to organization ID and project ID.
	DeploymentID param.Field[string] `json:"deploymentId"`
}

func (DomainUpdateParams) MarshalJSON

func (r DomainUpdateParams) MarshalJSON() (data []byte, err error)

type Error

type Error = apierror.Error

type KvDatabase

type KvDatabase = shared.KvDatabase

This is an alias to an internal type.

type Organization

type Organization struct {
	ID        string           `json:"id,required" format:"uuid"`
	CreatedAt time.Time        `json:"createdAt,required" format:"date-time"`
	Name      string           `json:"name,required"`
	UpdatedAt time.Time        `json:"updatedAt,required" format:"date-time"`
	JSON      organizationJSON `json:"-"`
}

func (*Organization) UnmarshalJSON

func (r *Organization) UnmarshalJSON(data []byte) (err error)

type OrganizationAnalyticsGetParams

type OrganizationAnalyticsGetParams struct {
	// Start of the time range in RFC3339 format.
	//
	// Defaults to 24 hours ago.
	//
	// Note that the maximum allowed time range is 24 hours.
	Since param.Field[time.Time] `query:"since,required" format:"date-time"`
	// End of the time range in RFC3339 format.
	//
	// Defaults to the current time.
	//
	// Note that the maximum allowed time range is 24 hours.
	Until param.Field[time.Time] `query:"until,required" format:"date-time"`
}

func (OrganizationAnalyticsGetParams) URLQuery

func (r OrganizationAnalyticsGetParams) URLQuery() (v url.Values)

URLQuery serializes OrganizationAnalyticsGetParams's query parameters as `url.Values`.

type OrganizationAnalyticsService

type OrganizationAnalyticsService struct {
	Options []option.RequestOption
}

OrganizationAnalyticsService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewOrganizationAnalyticsService method instead.

func NewOrganizationAnalyticsService

func NewOrganizationAnalyticsService(opts ...option.RequestOption) (r *OrganizationAnalyticsService)

NewOrganizationAnalyticsService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*OrganizationAnalyticsService) Get

Retrieve organization analytics

This API returns analytics for the specified organization. The analytics are returned as time series data in 15 minute intervals, with the `time` field representing the start of the interval.

type OrganizationDatabaseListParams

type OrganizationDatabaseListParams struct {
	// The maximum number of items to return per page.
	Limit param.Field[int64] `query:"limit"`
	// Sort order, either `asc` or `desc`. Defaults to `asc`.
	Order param.Field[string] `query:"order"`
	// The page number to return.
	Page param.Field[int64] `query:"page"`
	// Query by KV database ID
	Q param.Field[string] `query:"q"`
	// The field to sort by. Currently only `created_at` is supported.
	Sort param.Field[string] `query:"sort"`
}

func (OrganizationDatabaseListParams) URLQuery

func (r OrganizationDatabaseListParams) URLQuery() (v url.Values)

URLQuery serializes OrganizationDatabaseListParams's query parameters as `url.Values`.

type OrganizationDatabaseNewParams

type OrganizationDatabaseNewParams struct {
	// The description of the KV database. If this is `null`, an empty string will be
	// set.
	Description param.Field[string] `json:"description"`
}

func (OrganizationDatabaseNewParams) MarshalJSON

func (r OrganizationDatabaseNewParams) MarshalJSON() (data []byte, err error)

type OrganizationDatabaseService

type OrganizationDatabaseService struct {
	Options []option.RequestOption
}

OrganizationDatabaseService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewOrganizationDatabaseService method instead.

func NewOrganizationDatabaseService

func NewOrganizationDatabaseService(opts ...option.RequestOption) (r *OrganizationDatabaseService)

NewOrganizationDatabaseService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*OrganizationDatabaseService) List

List KV databases of an organization

This API returns a list of KV databases belonging to the specified organization in a pagenated manner. The URLs for the next, previous, first, and last page are returned in the `Link` header of the response, if any.

func (*OrganizationDatabaseService) New

Create a KV database

This API allows you to create a new KV database under the specified organization. You will then be able to associate the created KV database with a new deployment by specifying the KV database ID in the "Create a deployment" API call.

type OrganizationDomainListParams

type OrganizationDomainListParams struct {
	// The maximum number of items to return per page.
	Limit param.Field[int64] `query:"limit"`
	// Sort order, either `asc` or `desc`. Defaults to `asc`.
	Order param.Field[string] `query:"order"`
	// The page number to return.
	Page param.Field[int64] `query:"page"`
	// Query by domain
	Q param.Field[string] `query:"q"`
	// The field to sort by, `domain`, `created_at`, or `updated_at`. Defaults to
	// `updated_at`.
	Sort param.Field[string] `query:"sort"`
}

func (OrganizationDomainListParams) URLQuery

func (r OrganizationDomainListParams) URLQuery() (v url.Values)

URLQuery serializes OrganizationDomainListParams's query parameters as `url.Values`.

type OrganizationDomainNewParams

type OrganizationDomainNewParams struct {
	Domain param.Field[string] `json:"domain,required"`
}

func (OrganizationDomainNewParams) MarshalJSON

func (r OrganizationDomainNewParams) MarshalJSON() (data []byte, err error)

type OrganizationDomainService

type OrganizationDomainService struct {
	Options []option.RequestOption
}

OrganizationDomainService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewOrganizationDomainService method instead.

func NewOrganizationDomainService

func NewOrganizationDomainService(opts ...option.RequestOption) (r *OrganizationDomainService)

NewOrganizationDomainService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*OrganizationDomainService) List

func (r *OrganizationDomainService) List(ctx context.Context, organizationID string, query OrganizationDomainListParams, opts ...option.RequestOption) (res *[]shared.Domain, err error)

List domains of an organization

This API returns a list of domains belonging to the specified organization in a pagenated manner.

The URLs for the next, previous, first, and last page are returned in the `Link` header of the response, if any.

func (*OrganizationDomainService) New

func (r *OrganizationDomainService) New(ctx context.Context, organizationID string, body OrganizationDomainNewParams, opts ...option.RequestOption) (res *shared.Domain, err error)

Add a domain to an organization

This API allows you to add a new domain to the specified organization.

Before use, added domain needs to be verified, and also TLS certificates for the domain need to be provisioned.

type OrganizationProjectListParams

type OrganizationProjectListParams struct {
	// The maximum number of items to return per page.
	Limit param.Field[int64] `query:"limit"`
	// Sort order, either `asc` or `desc`. Defaults to `asc`.
	Order param.Field[string] `query:"order"`
	// The page number to return.
	Page param.Field[int64] `query:"page"`
	// Query by project name or project ID
	Q param.Field[string] `query:"q"`
	// The field to sort by, either `name` or `updated_at`. Defaults to `updated_at`.
	Sort param.Field[string] `query:"sort"`
}

func (OrganizationProjectListParams) URLQuery

func (r OrganizationProjectListParams) URLQuery() (v url.Values)

URLQuery serializes OrganizationProjectListParams's query parameters as `url.Values`.

type OrganizationProjectNewParams

type OrganizationProjectNewParams struct {
	// The description of the project. If this is `null`, an empty string will be set.
	Description param.Field[string] `json:"description"`
	// The name of the project. This must be globally unique. If this is `null`, a
	// random unique name will be generated.
	Name param.Field[string] `json:"name"`
}

func (OrganizationProjectNewParams) MarshalJSON

func (r OrganizationProjectNewParams) MarshalJSON() (data []byte, err error)

type OrganizationProjectService

type OrganizationProjectService struct {
	Options []option.RequestOption
}

OrganizationProjectService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewOrganizationProjectService method instead.

func NewOrganizationProjectService

func NewOrganizationProjectService(opts ...option.RequestOption) (r *OrganizationProjectService)

NewOrganizationProjectService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*OrganizationProjectService) List

func (r *OrganizationProjectService) List(ctx context.Context, organizationID string, query OrganizationProjectListParams, opts ...option.RequestOption) (res *[]shared.Project, err error)

List projects of an organization

This API returns a list of projects belonging to the specified organization in a pagenated manner. The URLs for the next, previous, first, and last page are returned in the `Link` header of the response, if any.

func (*OrganizationProjectService) New

Create a project

This API allows you to create a new project under the specified organization. The project name is optional; if not provided, a random name will be generated.

type OrganizationService

type OrganizationService struct {
	Options   []option.RequestOption
	Analytics *OrganizationAnalyticsService
	Projects  *OrganizationProjectService
	Databases *OrganizationDatabaseService
	Domains   *OrganizationDomainService
}

OrganizationService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewOrganizationService method instead.

func NewOrganizationService

func NewOrganizationService(opts ...option.RequestOption) (r *OrganizationService)

NewOrganizationService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*OrganizationService) Get

func (r *OrganizationService) Get(ctx context.Context, organizationID string, opts ...option.RequestOption) (res *Organization, err error)

Get organization details

type Project

type Project = shared.Project

This is an alias to an internal type.

type ProjectAnalyticsGetParams

type ProjectAnalyticsGetParams struct {
	// Start of the time range in RFC3339 format.
	//
	// Defaults to 24 hours ago.
	Since param.Field[time.Time] `query:"since,required" format:"date-time"`
	// End of the time range in RFC3339 format.
	//
	// Defaults to the current time.
	Until param.Field[time.Time] `query:"until,required" format:"date-time"`
}

func (ProjectAnalyticsGetParams) URLQuery

func (r ProjectAnalyticsGetParams) URLQuery() (v url.Values)

URLQuery serializes ProjectAnalyticsGetParams's query parameters as `url.Values`.

type ProjectAnalyticsService

type ProjectAnalyticsService struct {
	Options []option.RequestOption
}

ProjectAnalyticsService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewProjectAnalyticsService method instead.

func NewProjectAnalyticsService

func NewProjectAnalyticsService(opts ...option.RequestOption) (r *ProjectAnalyticsService)

NewProjectAnalyticsService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ProjectAnalyticsService) Get

Retrieve project analytics

This API returns analytics for the specified project. The analytics are returned as time series data in 15 minute intervals, with the `time` field representing the start of the interval.

type ProjectDeploymentListParams

type ProjectDeploymentListParams struct {
	// The maximum number of items to return per page.
	Limit param.Field[int64] `query:"limit"`
	// Sort order, either `asc` or `desc`. Defaults to `asc`.
	Order param.Field[string] `query:"order"`
	// The page number to return.
	Page param.Field[int64] `query:"page"`
	// Query by deployment ID
	Q param.Field[string] `query:"q"`
	// The field to sort by, either `id` or `created_at`. Defaults to `created_at`.
	Sort param.Field[string] `query:"sort"`
}

func (ProjectDeploymentListParams) URLQuery

func (r ProjectDeploymentListParams) URLQuery() (v url.Values)

URLQuery serializes ProjectDeploymentListParams's query parameters as `url.Values`.

type ProjectDeploymentNewParams

type ProjectDeploymentNewParams struct {
	// A map whose key represents a file path, and the value is an asset that composes
	// the deployment.
	//
	// Each asset is one of the following three kinds:
	//
	// 1. A file with content data (which is UTF-8 for text, or base64 for binary)
	// 2. A file with a hash
	// 3. A symbolic link to another asset
	//
	// Assets that were uploaded in some of the previous deployments don't need to be
	// uploaded again. In this case, in order to identify the asset, just provide the
	// SHA-1 hash of the content.
	Assets param.Field[map[string]ProjectDeploymentNewParamsAssets] `json:"assets,required"`
	// An URL of the entry point of the application. This is the file that will be
	// executed when the deployment is invoked.
	EntryPointURL param.Field[string] `json:"entryPointUrl,required"`
	// A dictionary of environment variables to be set in the runtime environment of
	// the deployment.
	EnvVars param.Field[map[string]string] `json:"envVars,required"`
	// Compiler options to be used when building the deployment.
	//
	// If `null` is given, Deno's config file (i.e. `deno.json` or `deno.jsonc`) will
	// be auto-discovered, which may contain a `compilerOptions` field. If found, that
	// compiler options will be applied.
	//
	// If an empty object `{}` is given,
	// [the default compiler options](https://docs.deno.com/runtime/manual/advanced/typescript/configuration#how-deno-uses-a-configuration-file)
	// will be applied.
	CompilerOptions param.Field[ProjectDeploymentNewParamsCompilerOptions] `json:"compilerOptions"`
	// KV database ID mappings to associate with the deployment.
	//
	// A key represents a KV database name (e.g. `"default"`), and a value is a KV
	// database ID.
	//
	// Currently, only `"default"` database is supported. If any other database name is
	// specified, that will be rejected.
	//
	// If not provided, the deployment will be created with no KV database attached.
	Databases param.Field[map[string]string] `json:"databases" format:"uuid"`
	// A description of the created deployment. If not provided, an empty string will
	// be set.
	Description param.Field[string] `json:"description"`
	// An URL of the import map file.
	//
	// If `null` is given, import map auto-discovery logic will be performed, where it
	// looks for Deno's config file (i.e. `deno.json` or `deno.jsonc`) which may
	// contain an embedded import map or a path to an import map file. If found, that
	// import map will be used.
	//
	// If an empty string is given, no import map will be used.
	ImportMapURL param.Field[string] `json:"importMapUrl"`
	// An URL of the lock file.
	//
	// If `null` is given, lock file auto-discovery logic will be performed, where it
	// looks for Deno's config file (i.e. `deno.json` or `deno.jsonc`) which may
	// contain a path to a lock file or boolean value, such as `"lock": false` or
	// `"lock": "my-lock.lock"`. If a config file is found, the semantics of the lock
	// field is the same as the Deno CLI, so refer to
	// [the CLI doc page](https://docs.deno.com/runtime/manual/basics/modules/integrity_checking#auto-generated-lockfile).
	//
	// If an empty string is given, no lock file will be used.
	LockFileURL param.Field[string] `json:"lockFileUrl"`
}

func (ProjectDeploymentNewParams) MarshalJSON

func (r ProjectDeploymentNewParams) MarshalJSON() (data []byte, err error)

type ProjectDeploymentNewParamsAssets

type ProjectDeploymentNewParamsAssets interface {
	// contains filtered or unexported methods
}

Satisfied by ProjectDeploymentNewParamsAssetsFile, ProjectDeploymentNewParamsAssetsSymlink.

type ProjectDeploymentNewParamsAssetsFile

type ProjectDeploymentNewParamsAssetsFile struct {
	Kind     param.Field[ProjectDeploymentNewParamsAssetsFileKind]     `json:"kind,required"`
	Content  param.Field[string]                                       `json:"content"`
	Encoding param.Field[ProjectDeploymentNewParamsAssetsFileEncoding] `json:"encoding"`
	GitSha1  param.Field[string]                                       `json:"gitSha1"`
}

func (ProjectDeploymentNewParamsAssetsFile) MarshalJSON

func (r ProjectDeploymentNewParamsAssetsFile) MarshalJSON() (data []byte, err error)

type ProjectDeploymentNewParamsAssetsFileEncoding

type ProjectDeploymentNewParamsAssetsFileEncoding string
const (
	ProjectDeploymentNewParamsAssetsFileEncodingUtf8   ProjectDeploymentNewParamsAssetsFileEncoding = "utf-8"
	ProjectDeploymentNewParamsAssetsFileEncodingBase64 ProjectDeploymentNewParamsAssetsFileEncoding = "base64"
)

type ProjectDeploymentNewParamsAssetsFileKind

type ProjectDeploymentNewParamsAssetsFileKind string
const (
	ProjectDeploymentNewParamsAssetsFileKindFile ProjectDeploymentNewParamsAssetsFileKind = "file"
)
type ProjectDeploymentNewParamsAssetsSymlink struct {
	Kind   param.Field[ProjectDeploymentNewParamsAssetsSymlinkKind] `json:"kind,required"`
	Target param.Field[string]                                      `json:"target,required"`
}

func (ProjectDeploymentNewParamsAssetsSymlink) MarshalJSON

func (r ProjectDeploymentNewParamsAssetsSymlink) MarshalJSON() (data []byte, err error)

type ProjectDeploymentNewParamsAssetsSymlinkKind

type ProjectDeploymentNewParamsAssetsSymlinkKind string
const (
	ProjectDeploymentNewParamsAssetsSymlinkKindSymlink ProjectDeploymentNewParamsAssetsSymlinkKind = "symlink"
)

type ProjectDeploymentNewParamsCompilerOptions

type ProjectDeploymentNewParamsCompilerOptions struct {
	Jsx                param.Field[string] `json:"jsx"`
	JsxFactory         param.Field[string] `json:"jsxFactory"`
	JsxFragmentFactory param.Field[string] `json:"jsxFragmentFactory"`
	JsxImportSource    param.Field[string] `json:"jsxImportSource"`
}

Compiler options to be used when building the deployment.

If `null` is given, Deno's config file (i.e. `deno.json` or `deno.jsonc`) will be auto-discovered, which may contain a `compilerOptions` field. If found, that compiler options will be applied.

If an empty object `{}` is given, [the default compiler options](https://docs.deno.com/runtime/manual/advanced/typescript/configuration#how-deno-uses-a-configuration-file) will be applied.

func (ProjectDeploymentNewParamsCompilerOptions) MarshalJSON

func (r ProjectDeploymentNewParamsCompilerOptions) MarshalJSON() (data []byte, err error)

type ProjectDeploymentService

type ProjectDeploymentService struct {
	Options []option.RequestOption
}

ProjectDeploymentService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewProjectDeploymentService method instead.

func NewProjectDeploymentService

func NewProjectDeploymentService(opts ...option.RequestOption) (r *ProjectDeploymentService)

NewProjectDeploymentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ProjectDeploymentService) List

List deployments of a project

This API returns a list of deployments belonging to the specified project in a pagenated manner.

The URLs for the next, previous, first, and last page are returned in the `Link` header of the response, if any.

func (*ProjectDeploymentService) New

Create a deployment

This API initiates a build process for a new deployment.

Note that this process is asynchronous; the completion of this API doesn't mean the deployment is ready. In order to keep track of the progress of the build, call the "Get build logs of a deployment" API or the "Get deployment details" API.

type ProjectService

type ProjectService struct {
	Options     []option.RequestOption
	Analytics   *ProjectAnalyticsService
	Deployments *ProjectDeploymentService
}

ProjectService contains methods and other services that help with interacting with the subhosting API. Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewProjectService method instead.

func NewProjectService

func NewProjectService(opts ...option.RequestOption) (r *ProjectService)

NewProjectService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ProjectService) Delete

func (r *ProjectService) Delete(ctx context.Context, projectID string, opts ...option.RequestOption) (err error)

Delete a project

func (*ProjectService) Get

func (r *ProjectService) Get(ctx context.Context, projectID string, opts ...option.RequestOption) (res *shared.Project, err error)

Get project details

func (*ProjectService) Update

func (r *ProjectService) Update(ctx context.Context, projectID string, body ProjectUpdateParams, opts ...option.RequestOption) (res *shared.Project, err error)

Update project details

type ProjectUpdateParams

type ProjectUpdateParams struct {
	// The description of the project to be updated to. If this is `null`, no update
	// will be made to the project description.
	Description param.Field[string] `json:"description"`
	// The name of the project to be updated to. This must be globally unique. If this
	// is `null`, no update will be made to the project name.
	Name param.Field[string] `json:"name"`
}

func (ProjectUpdateParams) MarshalJSON

func (r ProjectUpdateParams) MarshalJSON() (data []byte, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL