Documentation
¶
Overview ¶
Package httpstate implements the logic for interacting with a web backend.
Index ¶
- Constants
- Variables
- func DefaultURL(ws pkgWorkspace.Context) string
- func IsValidAccessToken(ctx context.Context, cloudURL string, insecure bool, accessToken string) (bool, string, []string, *workspace.TokenInformation, error)
- func RenewLeaseFunc(client *client.Client, update client.UpdateIdentifier, ...) ...
- func ValueOrDefaultURL(ws pkgWorkspace.Context, cloudURL string) string
- func WelcomeUser(opts display.Options)
- type AIPromptRequestBody
- type Backend
- type DisplayEventType
- type LoginManager
- type MockHTTPBackend
- func (b *MockHTTPBackend) Capabilities(context.Context) apitype.Capabilities
- func (b *MockHTTPBackend) Client() *client.Client
- func (b *MockHTTPBackend) CloudURL() string
- func (b *MockHTTPBackend) GetPackageRegistry() (backend.PackageRegistry, error)
- func (b *MockHTTPBackend) NaturalLanguageSearch(ctx context.Context, orgName string, query string) (*apitype.ResourceSearchResponse, error)
- func (b *MockHTTPBackend) PromptAI(ctx context.Context, requestBody AIPromptRequestBody) (*http.Response, error)
- func (b *MockHTTPBackend) RunDeployment(ctx context.Context, stackRef backend.StackReference, ...) error
- func (b *MockHTTPBackend) Search(ctx context.Context, orgName string, queryParams *apitype.PulumiQueryRequest) (*apitype.ResourceSearchResponse, error)
- func (b *MockHTTPBackend) StackConsoleURL(stackRef backend.StackReference) (string, error)
- type PulumiAILanguage
- type Stack
Constants ¶
const ( // ConsoleDomainEnvVar overrides the way we infer the domain we assume the Pulumi Console will // be served from, and instead just use this value. e.g. so links to the stack update go to // https://pulumi.example.com/org/project/stack/updates/2 instead. ConsoleDomainEnvVar = "PULUMI_CONSOLE_DOMAIN" // PulumiCloudURL is the Cloud URL used if no environment or explicit cloud is chosen. PulumiCloudURL = "https://" + defaultAPIDomainPrefix + "pulumi.com" )
const PulumiAILanguagesClause = "TypeScript, JavaScript, Python, Go, C#, Java, or YAML"
A natural language list of languages supported by Pulumi AI.
Variables ¶
var PulumiAILanguageOptions = []PulumiAILanguage{ PulumiAILanguageTypeScript, PulumiAILanguageJavaScript, PulumiAILanguagePython, PulumiAILanguageGo, PulumiAILanguageCSharp, PulumiAILanguageJava, PulumiAILanguageYAML, }
All of the languages supported by Pulumi AI.
Functions ¶
func DefaultURL ¶
func DefaultURL(ws pkgWorkspace.Context) string
DefaultURL returns the default cloud URL. This may be overridden using the PULUMI_API environment variable. If no override is found, and we are authenticated with a cloud, choose that. Otherwise, we will default to the https://api.pulumi.com/ endpoint.
func IsValidAccessToken ¶
func IsValidAccessToken(ctx context.Context, cloudURL string, insecure bool, accessToken string, ) (bool, string, []string, *workspace.TokenInformation, error)
IsValidAccessToken tries to use the provided Pulumi access token and returns if it is accepted or not. Returns error on any unexpected error.
func RenewLeaseFunc ¶ added in v3.139.0
func ValueOrDefaultURL ¶
func ValueOrDefaultURL(ws pkgWorkspace.Context, cloudURL string) string
ValueOrDefaultURL returns the value if specified, or the default cloud URL otherwise.
func WelcomeUser ¶
WelcomeUser prints a Welcome to Pulumi message.
Types ¶
type AIPromptRequestBody ¶ added in v3.99.0
type AIPromptRequestBody struct { Language PulumiAILanguage `json:"language"` Instructions string `json:"instructions"` ResponseMode string `json:"responseMode"` ConversationID string `json:"conversationId"` ConnectionID string `json:"connectionId"` }
type Backend ¶
type Backend interface { backend.Backend CloudURL() string StackConsoleURL(stackRef backend.StackReference) (string, error) Client() *client.Client RunDeployment(ctx context.Context, stackRef backend.StackReference, req apitype.CreateDeploymentRequest, opts display.Options, deploymentInitiator string, streamDeploymentLogs bool) error // Queries the backend for resources based on the given query parameters. Search( ctx context.Context, orgName string, queryParams *apitype.PulumiQueryRequest, ) (*apitype.ResourceSearchResponse, error) NaturalLanguageSearch( ctx context.Context, orgName string, query string, ) (*apitype.ResourceSearchResponse, error) PromptAI(ctx context.Context, requestBody AIPromptRequestBody) (*http.Response, error) // Capabilities returns the capabilities of the backend indicating what features are available. Capabilities(ctx context.Context) apitype.Capabilities }
Backend extends the base backend interface with specific information about cloud backends.
type DisplayEventType ¶
type DisplayEventType string
const ( UpdateEvent DisplayEventType = "UpdateEvent" ShutdownEvent DisplayEventType = "Shutdown" )
type LoginManager ¶ added in v3.43.0
type LoginManager interface { // Current returns the current cloud backend if one is already logged in. Current(ctx context.Context, cloudURL string, insecure, setCurrent bool) (*workspace.Account, error) // Login logs into the target cloud URL and returns the cloud backend for it. Login( ctx context.Context, cloudURL string, insecure bool, command string, message string, welcome func(display.Options), current bool, opts display.Options, ) (*workspace.Account, error) }
LoginManager provides a slim wrapper around functions related to backend logins.
func NewLoginManager ¶ added in v3.43.0
func NewLoginManager() LoginManager
NewLoginManager returns a LoginManager for handling backend logins.
type MockHTTPBackend ¶ added in v3.99.0
type MockHTTPBackend struct { backend.MockBackend FClient func() *client.Client FCloudURL func() string FSearch func(ctx context.Context, orgName string, queryParams *apitype.PulumiQueryRequest, ) (*apitype.ResourceSearchResponse, error) FNaturalLanguageSearch func(ctx context.Context, orgName string, query string) (*apitype.ResourceSearchResponse, error) FPromptAI func(ctx context.Context, requestBody AIPromptRequestBody) (*http.Response, error) FStackConsoleURL func(stackRef backend.StackReference) (string, error) FRunDeployment func( ctx context.Context, stackRef backend.StackReference, req apitype.CreateDeploymentRequest, opts display.Options, deploymentInitiator string, suppressStreamLogs bool, ) error FGetPackageRegistry func() (backend.PackageRegistry, error) }
func (*MockHTTPBackend) Capabilities ¶ added in v3.151.0
func (b *MockHTTPBackend) Capabilities(context.Context) apitype.Capabilities
func (*MockHTTPBackend) Client ¶ added in v3.99.0
func (b *MockHTTPBackend) Client() *client.Client
func (*MockHTTPBackend) CloudURL ¶ added in v3.99.0
func (b *MockHTTPBackend) CloudURL() string
func (*MockHTTPBackend) GetPackageRegistry ¶ added in v3.158.0
func (b *MockHTTPBackend) GetPackageRegistry() (backend.PackageRegistry, error)
func (*MockHTTPBackend) NaturalLanguageSearch ¶ added in v3.99.0
func (b *MockHTTPBackend) NaturalLanguageSearch( ctx context.Context, orgName string, query string, ) (*apitype.ResourceSearchResponse, error)
func (*MockHTTPBackend) PromptAI ¶ added in v3.99.0
func (b *MockHTTPBackend) PromptAI( ctx context.Context, requestBody AIPromptRequestBody, ) (*http.Response, error)
func (*MockHTTPBackend) RunDeployment ¶ added in v3.99.0
func (b *MockHTTPBackend) RunDeployment( ctx context.Context, stackRef backend.StackReference, req apitype.CreateDeploymentRequest, opts display.Options, deploymentInitiator string, suppressStreamLogs bool, ) error
func (*MockHTTPBackend) Search ¶ added in v3.99.0
func (b *MockHTTPBackend) Search( ctx context.Context, orgName string, queryParams *apitype.PulumiQueryRequest, ) (*apitype.ResourceSearchResponse, error)
func (*MockHTTPBackend) StackConsoleURL ¶ added in v3.99.0
func (b *MockHTTPBackend) StackConsoleURL(stackRef backend.StackReference) (string, error)
type PulumiAILanguage ¶ added in v3.99.0
type PulumiAILanguage string
const ( PulumiAILanguageTypeScript PulumiAILanguage = "TypeScript" PulumiAILanguageJavaScript PulumiAILanguage = "JavaScript" PulumiAILanguagePython PulumiAILanguage = "Python" PulumiAILanguageGo PulumiAILanguage = "Go" PulumiAILanguageCSharp PulumiAILanguage = "C#" PulumiAILanguageJava PulumiAILanguage = "Java" PulumiAILanguageYAML PulumiAILanguage = "YAML" )
func (*PulumiAILanguage) Set ¶ added in v3.99.0
func (e *PulumiAILanguage) Set(v string) error
func (*PulumiAILanguage) String ¶ added in v3.99.0
func (e *PulumiAILanguage) String() string
func (*PulumiAILanguage) Type ¶ added in v3.99.0
func (e *PulumiAILanguage) Type() string
type Stack ¶
type Stack interface { backend.Stack OrgName() string // the organization that owns this stack. CurrentOperation() *apitype.OperationStatus // in progress operation, if applicable. StackIdentifier() client.StackIdentifier }
Stack is a cloud stack. This simply adds some cloud-specific properties atop the standard backend stack interface.