2018-05-22 21:43:36 +02:00
|
|
|
// Copyright 2016-2018, Pulumi Corporation.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2018-02-28 19:02:02 +01:00
|
|
|
|
2018-02-28 22:12:19 +01:00
|
|
|
// Package apitype contains the full set of "exchange types" that are serialized and sent across separately versionable
|
|
|
|
// boundaries, including service APIs, plugins, and file formats. As a result, we must consider the versioning impacts
|
|
|
|
// for each change we make to types within this package. In general, this means the following:
|
|
|
|
//
|
|
|
|
// 1) DO NOT take anything away
|
|
|
|
// 2) DO NOT change processing rules
|
|
|
|
// 3) DO NOT make optional things required
|
|
|
|
// 4) DO make anything new be optional
|
|
|
|
//
|
|
|
|
// In the event that this is not possible, a breaking change is implied. The preferred approach is to never make
|
|
|
|
// breaking changes. If that isn't possible, the next best approach is to support both the old and new formats
|
|
|
|
// side-by-side (for instance, by using a union type for the property in question).
|
2019-01-23 22:33:25 +01:00
|
|
|
//
|
|
|
|
// nolint: lll
|
2018-02-28 19:02:02 +01:00
|
|
|
package apitype
|
|
|
|
|
|
|
|
import (
|
2021-09-22 06:37:06 +02:00
|
|
|
_ "embed" // for embedded schemas
|
2018-03-03 21:12:54 +01:00
|
|
|
"encoding/json"
|
2018-02-28 19:02:02 +01:00
|
|
|
"time"
|
|
|
|
|
2021-03-17 14:20:05 +01:00
|
|
|
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
|
|
|
|
"github.com/pulumi/pulumi/sdk/v3/go/common/resource/config"
|
|
|
|
"github.com/pulumi/pulumi/sdk/v3/go/common/tokens"
|
|
|
|
"github.com/pulumi/pulumi/sdk/v3/go/common/workspace"
|
2018-02-28 19:02:02 +01:00
|
|
|
)
|
|
|
|
|
2021-09-22 06:37:06 +02:00
|
|
|
//go:embed deployments.json
|
|
|
|
var deploymentSchema string
|
|
|
|
|
|
|
|
// DeploymentSchemaID is the $id for the deployment schema.
|
|
|
|
const DeploymentSchemaID = "https://github.com/pulumi/pulumi/blob/master/sdk/go/common/apitype/deployments.json"
|
|
|
|
|
|
|
|
// DeploymentSchema returns a JSON schema that can be used to validate serialized deployments (i.e. `UntypedDeployment`
|
|
|
|
// objects).
|
|
|
|
func DeploymentSchema() string {
|
|
|
|
return deploymentSchema
|
|
|
|
}
|
|
|
|
|
|
|
|
//go:embed resources.json
|
|
|
|
var resourceSchema string
|
|
|
|
|
|
|
|
// ResourceSchemaID is the $id for the deployment schema.
|
|
|
|
const ResourceSchemaID = "https://github.com/pulumi/pulumi/blob/master/sdk/go/common/apitype/resources.json"
|
|
|
|
|
|
|
|
// ResourceSchema returns a JSON schema that can be used to validate serialized resource values (e.g. `ResourceV3`).
|
|
|
|
func ResourceSchema() string {
|
|
|
|
return resourceSchema
|
|
|
|
}
|
|
|
|
|
|
|
|
//go:embed property-values.json
|
|
|
|
var propertyValueSchema string
|
|
|
|
|
|
|
|
// PropertyValueSchemaID is the $id for the property value schema.
|
|
|
|
const PropertyValueSchemaID = "https://github.com/pulumi/pulumi/blob/master/sdk/go/common/apitype/property-values.json"
|
|
|
|
|
|
|
|
// PropertyValueSchema returns a JSON schema that can be used to validate serialized property values.
|
|
|
|
func PropertyValueSchema() string {
|
|
|
|
return propertyValueSchema
|
|
|
|
}
|
|
|
|
|
2018-05-25 22:29:59 +02:00
|
|
|
const (
|
|
|
|
// DeploymentSchemaVersionCurrent is the current version of the `Deployment` schema.
|
|
|
|
// Any deployments newer than this version will be rejected.
|
Implement more precise delete-before-replace semantics. (#2369)
This implements the new algorithm for deciding which resources must be
deleted due to a delete-before-replace operation.
We need to compute the set of resources that may be replaced by a
change to the resource under consideration. We do this by taking the
complete set of transitive dependents on the resource under
consideration and removing any resources that would not be replaced by
changes to their dependencies. We determine whether or not a resource
may be replaced by substituting unknowns for input properties that may
change due to deletion of the resources their value depends on and
calling the resource provider's Diff method.
This is perhaps clearer when described by example. Consider the
following dependency graph:
A
__|__
B C
| _|_
D E F
In this graph, all of B, C, D, E, and F transitively depend on A. It may
be the case, however, that changes to the specific properties of any of
those resources R that would occur if a resource on the path to A were
deleted and recreated may not cause R to be replaced. For example, the
edge from B to A may be a simple dependsOn edge such that a change to
B does not actually influence any of B's input properties. In that case,
neither B nor D would need to be deleted before A could be deleted.
In order to make the above algorithm a reality, the resource monitor
interface has been updated to include a map that associates an input
property key with the list of resources that input property depends on.
Older clients of the resource monitor will leave this map empty, in
which case all input properties will be treated as depending on all
dependencies of the resource. This is probably overly conservative, but
it is less conservative than what we currently implement, and is
certainly correct.
2019-01-28 18:46:30 +01:00
|
|
|
DeploymentSchemaVersionCurrent = 3
|
2018-05-25 22:29:59 +02:00
|
|
|
)
|
|
|
|
|
2018-03-08 19:52:05 +01:00
|
|
|
// VersionedCheckpoint is a version number plus a json document. The version number describes what
|
|
|
|
// version of the Checkpoint structure the Checkpoint member's json document can decode into.
|
|
|
|
type VersionedCheckpoint struct {
|
|
|
|
Version int `json:"version"`
|
|
|
|
Checkpoint json.RawMessage `json:"checkpoint"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// CheckpointV1 is a serialized deployment target plus a record of the latest deployment.
|
|
|
|
type CheckpointV1 struct {
|
2018-02-28 19:02:02 +01:00
|
|
|
// Stack is the stack to update.
|
|
|
|
Stack tokens.QName `json:"stack" yaml:"stack"`
|
|
|
|
// Config contains a bag of optional configuration keys/values.
|
|
|
|
Config config.Map `json:"config,omitempty" yaml:"config,omitempty"`
|
|
|
|
// Latest is the latest/current deployment (if an update has occurred).
|
2018-04-17 19:38:47 +02:00
|
|
|
Latest *DeploymentV1 `json:"latest,omitempty" yaml:"latest,omitempty"`
|
2018-02-28 19:02:02 +01:00
|
|
|
}
|
|
|
|
|
2018-07-11 18:16:53 +02:00
|
|
|
// CheckpointV2 is the second version of the Checkpoint. It contains a newer version of
|
|
|
|
// the latest deployment.
|
|
|
|
type CheckpointV2 struct {
|
|
|
|
// Stack is the stack to update.
|
|
|
|
Stack tokens.QName `json:"stack" yaml:"stack"`
|
|
|
|
// Config contains a bag of optional configuration keys/values.
|
|
|
|
Config config.Map `json:"config,omitempty" yaml:"config,omitempty"`
|
|
|
|
// Latest is the latest/current deployment (if an update has occurred).
|
|
|
|
Latest *DeploymentV2 `json:"latest,omitempty" yaml:"latest,omitempty"`
|
|
|
|
}
|
|
|
|
|
2019-01-23 22:33:25 +01:00
|
|
|
// CheckpointV3 is the third version of the Checkpoint. It contains a newer version of
|
|
|
|
// the latest deployment.
|
|
|
|
type CheckpointV3 struct {
|
|
|
|
// Stack is the stack to update.
|
|
|
|
Stack tokens.QName `json:"stack" yaml:"stack"`
|
|
|
|
// Config contains a bag of optional configuration keys/values.
|
|
|
|
Config config.Map `json:"config,omitempty" yaml:"config,omitempty"`
|
|
|
|
// Latest is the latest/current deployment (if an update has occurred).
|
|
|
|
Latest *DeploymentV3 `json:"latest,omitempty" yaml:"latest,omitempty"`
|
|
|
|
}
|
|
|
|
|
2018-04-17 19:38:47 +02:00
|
|
|
// DeploymentV1 represents a deployment that has actually occurred. It is similar to the engine's snapshot structure,
|
2018-02-28 19:02:02 +01:00
|
|
|
// except that it flattens and rearranges a few data structures for serializability.
|
2018-04-17 19:38:47 +02:00
|
|
|
type DeploymentV1 struct {
|
2018-02-28 19:02:02 +01:00
|
|
|
// Manifest contains metadata about this deployment.
|
2018-04-17 19:38:47 +02:00
|
|
|
Manifest ManifestV1 `json:"manifest" yaml:"manifest"`
|
2018-02-28 19:02:02 +01:00
|
|
|
// Resources contains all resources that are currently part of this stack after this deployment has finished.
|
2018-04-17 19:38:47 +02:00
|
|
|
Resources []ResourceV1 `json:"resources,omitempty" yaml:"resources,omitempty"`
|
2018-02-28 19:02:02 +01:00
|
|
|
}
|
|
|
|
|
2019-01-23 22:33:25 +01:00
|
|
|
// DeploymentV2 is the second version of the Deployment. It contains newer versions of the
|
2018-07-11 18:16:53 +02:00
|
|
|
// Resource API type.
|
|
|
|
type DeploymentV2 struct {
|
|
|
|
// Manifest contains metadata about this deployment.
|
|
|
|
Manifest ManifestV1 `json:"manifest" yaml:"manifest"`
|
|
|
|
// Resources contains all resources that are currently part of this stack after this deployment has finished.
|
|
|
|
Resources []ResourceV2 `json:"resources,omitempty" yaml:"resources,omitempty"`
|
Add a list of in-flight operations to the deployment (#1759)
* Add a list of in-flight operations to the deployment
This commit augments 'DeploymentV2' with a list of operations that are
currently in flight. This information is used by the engine to keep
track of whether or not a particular deployment is in a valid state.
The SnapshotManager is responsible for inserting and removing operations
from the in-flight operation list. When the engine registers an intent
to perform an operation, SnapshotManager inserts an Operation into this
list and saves it to the snapshot. When an operation completes, the
SnapshotManager removes it from the snapshot. From this, the engine can
infer that if it ever sees a deployment with pending operations, the
Pulumi CLI must have crashed or otherwise abnormally terminated before
seeing whether or not an operation completed successfully.
To remedy this state, this commit also adds code to 'pulumi stack
import' that clears all pending operations from a deployment, as well as
code to plan generation that will reject any deployments that have
pending operations present.
At the CLI level, if we see that we are in a state where pending
operations were in-flight when the engine died, we'll issue a
human-friendly error message that indicates which resources are in a bad
state and how to recover their stack.
* CR: Multi-line string literals, renaming in-flight -> pending
* CR: Add enum to apitype for operation type, also name status -> type for clarity
* Fix the yaml type
* Fix missed renames
* Add implementation for lifecycle_test.go
* Rebase against master
2018-08-11 06:39:59 +02:00
|
|
|
// PendingOperations are all operations that were known by the engine to be currently executing.
|
|
|
|
PendingOperations []OperationV1 `json:"pending_operations,omitempty" yaml:"pending_operations,omitempty"`
|
|
|
|
}
|
|
|
|
|
2019-01-23 22:33:25 +01:00
|
|
|
// DeploymentV3 is the third version of the Deployment. It contains newer versions of the
|
|
|
|
// Resource and Operation API types and a placeholder for a stack's secrets configuration.
|
|
|
|
type DeploymentV3 struct {
|
|
|
|
// Manifest contains metadata about this deployment.
|
|
|
|
Manifest ManifestV1 `json:"manifest" yaml:"manifest"`
|
|
|
|
// SecretsProviders is a placeholder for secret provider configuration.
|
2019-04-17 22:48:38 +02:00
|
|
|
SecretsProviders *SecretsProvidersV1 `json:"secrets_providers,omitempty" yaml:"secrets_providers,omitempty"`
|
2019-01-23 22:33:25 +01:00
|
|
|
// Resources contains all resources that are currently part of this stack after this deployment has finished.
|
|
|
|
Resources []ResourceV3 `json:"resources,omitempty" yaml:"resources,omitempty"`
|
|
|
|
// PendingOperations are all operations that were known by the engine to be currently executing.
|
|
|
|
PendingOperations []OperationV2 `json:"pending_operations,omitempty" yaml:"pending_operations,omitempty"`
|
|
|
|
}
|
|
|
|
|
2019-04-17 22:48:38 +02:00
|
|
|
type SecretsProvidersV1 struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
State json.RawMessage `json:"state,omitempty"`
|
|
|
|
}
|
|
|
|
|
Add a list of in-flight operations to the deployment (#1759)
* Add a list of in-flight operations to the deployment
This commit augments 'DeploymentV2' with a list of operations that are
currently in flight. This information is used by the engine to keep
track of whether or not a particular deployment is in a valid state.
The SnapshotManager is responsible for inserting and removing operations
from the in-flight operation list. When the engine registers an intent
to perform an operation, SnapshotManager inserts an Operation into this
list and saves it to the snapshot. When an operation completes, the
SnapshotManager removes it from the snapshot. From this, the engine can
infer that if it ever sees a deployment with pending operations, the
Pulumi CLI must have crashed or otherwise abnormally terminated before
seeing whether or not an operation completed successfully.
To remedy this state, this commit also adds code to 'pulumi stack
import' that clears all pending operations from a deployment, as well as
code to plan generation that will reject any deployments that have
pending operations present.
At the CLI level, if we see that we are in a state where pending
operations were in-flight when the engine died, we'll issue a
human-friendly error message that indicates which resources are in a bad
state and how to recover their stack.
* CR: Multi-line string literals, renaming in-flight -> pending
* CR: Add enum to apitype for operation type, also name status -> type for clarity
* Fix the yaml type
* Fix missed renames
* Add implementation for lifecycle_test.go
* Rebase against master
2018-08-11 06:39:59 +02:00
|
|
|
// OperationType is the type of an operation initiated by the engine. Its value indicates the type of operation
|
|
|
|
// that the engine initiated.
|
|
|
|
type OperationType string
|
|
|
|
|
|
|
|
const (
|
|
|
|
// OperationTypeCreating is the state of resources that are being created.
|
|
|
|
OperationTypeCreating OperationType = "creating"
|
|
|
|
// OperationTypeUpdating is the state of resources that are being updated.
|
|
|
|
OperationTypeUpdating OperationType = "updating"
|
|
|
|
// OperationTypeDeleting is the state of resources that are being deleted.
|
|
|
|
OperationTypeDeleting OperationType = "deleting"
|
|
|
|
// OperationTypeReading is the state of resources that are being read.
|
|
|
|
OperationTypeReading OperationType = "reading"
|
|
|
|
)
|
|
|
|
|
|
|
|
// OperationV1 represents an operation that the engine is performing. It consists of a Resource, which is the state
|
|
|
|
// that the engine used to initiate the operation, and a Status, which is a string representation of the operation
|
|
|
|
// that the engine initiated.
|
|
|
|
type OperationV1 struct {
|
|
|
|
// Resource is the state that the engine used to initiate this operation.
|
|
|
|
Resource ResourceV2 `json:"resource" yaml:"resource"`
|
|
|
|
// Status is a string representation of the operation that the engine is performing.
|
|
|
|
Type OperationType `json:"type" yaml:"type"`
|
2018-07-11 18:16:53 +02:00
|
|
|
}
|
|
|
|
|
2019-01-23 22:33:25 +01:00
|
|
|
// OperationV2 represents an operation that the engine is performing. It consists of a Resource, which is the state
|
|
|
|
// that the engine used to initiate the operation, and a Status, which is a string representation of the operation
|
|
|
|
// that the engine initiated.
|
|
|
|
type OperationV2 struct {
|
|
|
|
// Resource is the state that the engine used to initiate this operation.
|
|
|
|
Resource ResourceV3 `json:"resource" yaml:"resource"`
|
|
|
|
// Status is a string representation of the operation that the engine is performing.
|
|
|
|
Type OperationType `json:"type" yaml:"type"`
|
|
|
|
}
|
|
|
|
|
2018-03-03 21:12:54 +01:00
|
|
|
// UntypedDeployment contains an inner, untyped deployment structure.
|
|
|
|
type UntypedDeployment struct {
|
2018-04-18 01:01:52 +02:00
|
|
|
// Version indicates the schema of the encoded deployment.
|
|
|
|
Version int `json:"version,omitempty"`
|
2018-04-17 19:38:47 +02:00
|
|
|
// The opaque Pulumi deployment. This is conceptually of type `Deployment`, but we use `json.Message` to
|
2018-03-03 21:12:54 +01:00
|
|
|
// permit round-tripping of stack contents when an older client is talking to a newer server. If we unmarshaled
|
|
|
|
// the contents, and then remarshaled them, we could end up losing important information.
|
|
|
|
Deployment json.RawMessage `json:"deployment,omitempty"`
|
|
|
|
}
|
|
|
|
|
2018-04-17 19:38:47 +02:00
|
|
|
// ResourceV1 describes a Cloud resource constructed by Pulumi.
|
|
|
|
type ResourceV1 struct {
|
2018-02-28 19:02:02 +01:00
|
|
|
// URN uniquely identifying this resource.
|
|
|
|
URN resource.URN `json:"urn" yaml:"urn"`
|
|
|
|
// Custom is true when it is managed by a plugin.
|
|
|
|
Custom bool `json:"custom" yaml:"custom"`
|
|
|
|
// Delete is true when the resource should be deleted during the next update.
|
|
|
|
Delete bool `json:"delete,omitempty" yaml:"delete,omitempty"`
|
|
|
|
// ID is the provider-assigned resource, if any, for custom resources.
|
|
|
|
ID resource.ID `json:"id,omitempty" yaml:"id,omitempty"`
|
|
|
|
// Type is the resource's full type token.
|
|
|
|
Type tokens.Type `json:"type" yaml:"type"`
|
|
|
|
// Inputs are the input properties supplied to the provider.
|
|
|
|
Inputs map[string]interface{} `json:"inputs,omitempty" yaml:"inputs,omitempty"`
|
|
|
|
// Defaults contains the default values supplied by the provider (DEPRECATED, see #637).
|
|
|
|
Defaults map[string]interface{} `json:"defaults,omitempty" yaml:"defaults,omitempty"`
|
|
|
|
// Outputs are the output properties returned by the provider after provisioning.
|
|
|
|
Outputs map[string]interface{} `json:"outputs,omitempty" yaml:"outputs,omitempty"`
|
|
|
|
// Parent is an optional parent URN if this resource is a child of it.
|
|
|
|
Parent resource.URN `json:"parent,omitempty" yaml:"parent,omitempty"`
|
|
|
|
// Protect is set to true when this resource is "protected" and may not be deleted.
|
|
|
|
Protect bool `json:"protect,omitempty" yaml:"protect,omitempty"`
|
|
|
|
// Dependencies contains the dependency edges to other resources that this depends on.
|
2018-07-11 18:16:53 +02:00
|
|
|
Dependencies []resource.URN `json:"dependencies" yaml:"dependencies,omitempty"`
|
2018-07-19 07:52:01 +02:00
|
|
|
// InitErrors is the set of errors encountered in the process of initializing resource (i.e.,
|
|
|
|
// during create or update).
|
|
|
|
InitErrors []string `json:"initErrors" yaml:"initErrors,omitempty"`
|
2018-07-11 18:16:53 +02:00
|
|
|
}
|
|
|
|
|
2018-07-27 22:53:14 +02:00
|
|
|
// ResourceV2 is the second version of the Resource API type. It absorbs a few breaking changes:
|
2018-07-11 18:16:53 +02:00
|
|
|
// 1. The deprecated `Defaults` field is removed because it is not used anywhere,
|
|
|
|
// 2. It adds an additional bool field, "External", which reflects whether or not this resource
|
|
|
|
// exists because of a call to `ReadResource`. This is motivated by a need to store
|
|
|
|
// resources that Pulumi does not own in the deployment.
|
Add a list of in-flight operations to the deployment (#1759)
* Add a list of in-flight operations to the deployment
This commit augments 'DeploymentV2' with a list of operations that are
currently in flight. This information is used by the engine to keep
track of whether or not a particular deployment is in a valid state.
The SnapshotManager is responsible for inserting and removing operations
from the in-flight operation list. When the engine registers an intent
to perform an operation, SnapshotManager inserts an Operation into this
list and saves it to the snapshot. When an operation completes, the
SnapshotManager removes it from the snapshot. From this, the engine can
infer that if it ever sees a deployment with pending operations, the
Pulumi CLI must have crashed or otherwise abnormally terminated before
seeing whether or not an operation completed successfully.
To remedy this state, this commit also adds code to 'pulumi stack
import' that clears all pending operations from a deployment, as well as
code to plan generation that will reject any deployments that have
pending operations present.
At the CLI level, if we see that we are in a state where pending
operations were in-flight when the engine died, we'll issue a
human-friendly error message that indicates which resources are in a bad
state and how to recover their stack.
* CR: Multi-line string literals, renaming in-flight -> pending
* CR: Add enum to apitype for operation type, also name status -> type for clarity
* Fix the yaml type
* Fix missed renames
* Add implementation for lifecycle_test.go
* Rebase against master
2018-08-11 06:39:59 +02:00
|
|
|
// 3. It adds an additional string field, "Provider", that is a reference to a first-class provider
|
2018-07-27 22:53:14 +02:00
|
|
|
// associated with this resource.
|
2018-07-11 18:16:53 +02:00
|
|
|
//
|
|
|
|
// Migrating from ResourceV1 to ResourceV2 involves:
|
|
|
|
// 1. Dropping the `Defaults` field (it should be empty anyway)
|
|
|
|
// 2. Setting the `External` field to "false", since a ResourceV1 existing for a resource
|
|
|
|
// implies that it is owned by Pulumi. Note that since this is the default value for
|
|
|
|
// booleans in Go, no explicit assignment needs to be made.
|
Add a list of in-flight operations to the deployment (#1759)
* Add a list of in-flight operations to the deployment
This commit augments 'DeploymentV2' with a list of operations that are
currently in flight. This information is used by the engine to keep
track of whether or not a particular deployment is in a valid state.
The SnapshotManager is responsible for inserting and removing operations
from the in-flight operation list. When the engine registers an intent
to perform an operation, SnapshotManager inserts an Operation into this
list and saves it to the snapshot. When an operation completes, the
SnapshotManager removes it from the snapshot. From this, the engine can
infer that if it ever sees a deployment with pending operations, the
Pulumi CLI must have crashed or otherwise abnormally terminated before
seeing whether or not an operation completed successfully.
To remedy this state, this commit also adds code to 'pulumi stack
import' that clears all pending operations from a deployment, as well as
code to plan generation that will reject any deployments that have
pending operations present.
At the CLI level, if we see that we are in a state where pending
operations were in-flight when the engine died, we'll issue a
human-friendly error message that indicates which resources are in a bad
state and how to recover their stack.
* CR: Multi-line string literals, renaming in-flight -> pending
* CR: Add enum to apitype for operation type, also name status -> type for clarity
* Fix the yaml type
* Fix missed renames
* Add implementation for lifecycle_test.go
* Rebase against master
2018-08-11 06:39:59 +02:00
|
|
|
// 3. Setting the "Provider" field to the empty string, because V1 deployments don't have first-class providers.
|
2018-07-11 18:16:53 +02:00
|
|
|
type ResourceV2 struct {
|
|
|
|
// URN uniquely identifying this resource.
|
|
|
|
URN resource.URN `json:"urn" yaml:"urn"`
|
|
|
|
// Custom is true when it is managed by a plugin.
|
|
|
|
Custom bool `json:"custom" yaml:"custom"`
|
|
|
|
// Delete is true when the resource should be deleted during the next update.
|
|
|
|
Delete bool `json:"delete,omitempty" yaml:"delete,omitempty"`
|
|
|
|
// ID is the provider-assigned resource, if any, for custom resources.
|
|
|
|
ID resource.ID `json:"id,omitempty" yaml:"id,omitempty"`
|
|
|
|
// Type is the resource's full type token.
|
|
|
|
Type tokens.Type `json:"type" yaml:"type"`
|
|
|
|
// Inputs are the input properties supplied to the provider.
|
|
|
|
Inputs map[string]interface{} `json:"inputs,omitempty" yaml:"inputs,omitempty"`
|
|
|
|
// Outputs are the output properties returned by the provider after provisioning.
|
|
|
|
Outputs map[string]interface{} `json:"outputs,omitempty" yaml:"outputs,omitempty"`
|
|
|
|
// Parent is an optional parent URN if this resource is a child of it.
|
|
|
|
Parent resource.URN `json:"parent,omitempty" yaml:"parent,omitempty"`
|
|
|
|
// Protect is set to true when this resource is "protected" and may not be deleted.
|
|
|
|
Protect bool `json:"protect,omitempty" yaml:"protect,omitempty"`
|
|
|
|
// External is set to true when the lifecycle of this resource is not managed by Pulumi.
|
|
|
|
External bool `json:"external,omitempty" yaml:"external,omitempty"`
|
|
|
|
// Dependencies contains the dependency edges to other resources that this depends on.
|
2018-11-01 16:28:11 +01:00
|
|
|
Dependencies []resource.URN `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
|
2018-07-19 07:52:01 +02:00
|
|
|
// InitErrors is the set of errors encountered in the process of initializing resource (i.e.,
|
|
|
|
// during create or update).
|
2018-11-01 16:28:11 +01:00
|
|
|
InitErrors []string `json:"initErrors,omitempty" yaml:"initErrors,omitempty"`
|
2018-07-27 22:53:14 +02:00
|
|
|
// Provider is a reference to the provider that is associated with this resource.
|
|
|
|
Provider string `json:"provider,omitempty" yaml:"provider,omitempty"`
|
2018-02-28 19:02:02 +01:00
|
|
|
}
|
|
|
|
|
2019-01-23 22:33:25 +01:00
|
|
|
// ResourceV3 is the third version of the Resource API type. It absorbs a few breaking changes:
|
|
|
|
// 1. It adds a map from input property names to the dependencies that affect that input property. This is used to
|
|
|
|
// improve the precision of delete-before-create operations.
|
|
|
|
// 2. It adds a new boolean field, `PendingReplacement`, that marks resources that have been deleted as part of a
|
|
|
|
// delete-before-create operation but have not yet been recreated.
|
|
|
|
//
|
|
|
|
// Migrating from ResourceV2 to ResourceV3 involves:
|
|
|
|
// 1. Populating the map from input property names to dependencies by assuming that every dependency listed in
|
|
|
|
// `Dependencies` affects every input property.
|
|
|
|
type ResourceV3 struct {
|
|
|
|
// URN uniquely identifying this resource.
|
|
|
|
URN resource.URN `json:"urn" yaml:"urn"`
|
|
|
|
// Custom is true when it is managed by a plugin.
|
|
|
|
Custom bool `json:"custom" yaml:"custom"`
|
|
|
|
// Delete is true when the resource should be deleted during the next update.
|
|
|
|
Delete bool `json:"delete,omitempty" yaml:"delete,omitempty"`
|
|
|
|
// ID is the provider-assigned resource, if any, for custom resources.
|
|
|
|
ID resource.ID `json:"id,omitempty" yaml:"id,omitempty"`
|
|
|
|
// Type is the resource's full type token.
|
|
|
|
Type tokens.Type `json:"type" yaml:"type"`
|
|
|
|
// Inputs are the input properties supplied to the provider.
|
|
|
|
Inputs map[string]interface{} `json:"inputs,omitempty" yaml:"inputs,omitempty"`
|
|
|
|
// Outputs are the output properties returned by the provider after provisioning.
|
|
|
|
Outputs map[string]interface{} `json:"outputs,omitempty" yaml:"outputs,omitempty"`
|
|
|
|
// Parent is an optional parent URN if this resource is a child of it.
|
|
|
|
Parent resource.URN `json:"parent,omitempty" yaml:"parent,omitempty"`
|
|
|
|
// Protect is set to true when this resource is "protected" and may not be deleted.
|
|
|
|
Protect bool `json:"protect,omitempty" yaml:"protect,omitempty"`
|
|
|
|
// External is set to true when the lifecycle of this resource is not managed by Pulumi.
|
|
|
|
External bool `json:"external,omitempty" yaml:"external,omitempty"`
|
|
|
|
// Dependencies contains the dependency edges to other resources that this depends on.
|
|
|
|
Dependencies []resource.URN `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
|
|
|
|
// InitErrors is the set of errors encountered in the process of initializing resource (i.e.,
|
|
|
|
// during create or update).
|
|
|
|
InitErrors []string `json:"initErrors,omitempty" yaml:"initErrors,omitempty"`
|
|
|
|
// Provider is a reference to the provider that is associated with this resource.
|
|
|
|
Provider string `json:"provider,omitempty" yaml:"provider,omitempty"`
|
|
|
|
// PropertyDependencies maps from an input property name to the set of resources that property depends on.
|
|
|
|
PropertyDependencies map[resource.PropertyKey][]resource.URN `json:"propertyDependencies,omitempty" yaml:"property_dependencies,omitempty"`
|
|
|
|
// PendingReplacement is used to track delete-before-replace resources that have been deleted but not yet
|
|
|
|
// recreated.
|
|
|
|
PendingReplacement bool `json:"pendingReplacement,omitempty" yaml:"pendingReplacement,omitempty"`
|
2019-05-09 23:27:34 +02:00
|
|
|
// AdditionalSecretOutputs is a list of outputs that were explicitly marked as secret when the resource was created.
|
|
|
|
AdditionalSecretOutputs []resource.PropertyKey `json:"additionalSecretOutputs,omitempty" yaml:"additionalSecretOutputs,omitempty"`
|
2019-06-01 08:01:01 +02:00
|
|
|
// Aliases is a list of previous URNs that this resource may have had in previous deployments
|
|
|
|
Aliases []resource.URN `json:"aliases,omitempty" yaml:"aliases,omitempty"`
|
Addition of Custom Timeouts (#2885)
* Plumbing the custom timeouts from the engine to the providers
* Plumbing the CustomTimeouts through to the engine and adding test to show this
* Change the provider proto to include individual timeouts
* Plumbing the CustomTimeouts from the engine through to the Provider RPC interface
* Change how the CustomTimeouts are sent across RPC
These errors were spotted in testing. We can now see that the timeout
information is arriving in the RegisterResourceRequest
```
req=&pulumirpc.RegisterResourceRequest{
Type: "aws:s3/bucket:Bucket",
Name: "my-bucket",
Parent: "urn:pulumi:dev::aws-vpc::pulumi:pulumi:Stack::aws-vpc-dev",
Custom: true,
Object: &structpb.Struct{},
Protect: false,
Dependencies: nil,
Provider: "",
PropertyDependencies: {},
DeleteBeforeReplace: false,
Version: "",
IgnoreChanges: nil,
AcceptSecrets: true,
AdditionalSecretOutputs: nil,
Aliases: nil,
CustomTimeouts: &pulumirpc.RegisterResourceRequest_CustomTimeouts{
Create: 300,
Update: 400,
Delete: 500,
XXX_NoUnkeyedLiteral: struct {}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
},
XXX_NoUnkeyedLiteral: struct {}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
}
```
* Changing the design to use strings
* CHANGELOG entry to include the CustomTimeouts work
* Changing custom timeouts to be passed around the engine as converted value
We don't want to pass around strings - the user can provide it but we want
to make the engine aware of the timeout in seconds as a float64
2019-07-15 23:26:28 +02:00
|
|
|
// CustomTimeouts is a configuration block that can be used to control timeouts of CRUD operations
|
|
|
|
CustomTimeouts *resource.CustomTimeouts `json:"customTimeouts,omitempty" yaml:"customTimeouts,omitempty"`
|
2020-04-16 03:52:40 +02:00
|
|
|
// ImportID is the import input used for imported resources.
|
|
|
|
ImportID resource.ID `json:"importID,omitempty" yaml:"importID,omitempty"`
|
2019-01-23 22:33:25 +01:00
|
|
|
}
|
|
|
|
|
2018-04-17 19:38:47 +02:00
|
|
|
// ManifestV1 captures meta-information about this checkpoint file, such as versions of binaries, etc.
|
|
|
|
type ManifestV1 struct {
|
2018-02-28 19:02:02 +01:00
|
|
|
// Time of the update.
|
|
|
|
Time time.Time `json:"time" yaml:"time"`
|
|
|
|
// Magic number, used to identify integrity of the checkpoint.
|
|
|
|
Magic string `json:"magic" yaml:"magic"`
|
|
|
|
// Version of the Pulumi engine used to render the checkpoint.
|
|
|
|
Version string `json:"version" yaml:"version"`
|
|
|
|
// Plugins contains the binary version info of plug-ins used.
|
2018-04-17 19:38:47 +02:00
|
|
|
Plugins []PluginInfoV1 `json:"plugins,omitempty" yaml:"plugins,omitempty"`
|
2018-02-28 19:02:02 +01:00
|
|
|
}
|
|
|
|
|
2018-04-17 19:38:47 +02:00
|
|
|
// PluginInfoV1 captures the version and information about a plugin.
|
|
|
|
type PluginInfoV1 struct {
|
2018-02-28 19:02:02 +01:00
|
|
|
Name string `json:"name" yaml:"name"`
|
|
|
|
Path string `json:"path" yaml:"path"`
|
|
|
|
Type workspace.PluginKind `json:"type" yaml:"type"`
|
|
|
|
Version string `json:"version" yaml:"version"`
|
|
|
|
}
|
|
|
|
|
2019-01-23 22:33:25 +01:00
|
|
|
// SecretV1 captures the information that a particular value is secret and must be decrypted before use.
|
|
|
|
//
|
|
|
|
// NOTE: nothing produces these values yet. This type is merely a placeholder for future use.
|
|
|
|
type SecretV1 struct {
|
|
|
|
Sig string `json:"4dabf18193072939515e22adb298388d" yaml:"4dabf18193072939515e22adb298388d"`
|
2020-05-11 20:16:30 +02:00
|
|
|
Ciphertext string `json:"ciphertext,omitempty" yaml:"ciphertext,omitempty"`
|
|
|
|
Plaintext string `json:"plaintext,omitempty" yaml:"plaintext,omitempty"`
|
2019-01-23 22:33:25 +01:00
|
|
|
}
|
|
|
|
|
2018-02-28 19:02:02 +01:00
|
|
|
// ConfigValue describes a single (possibly secret) configuration value.
|
|
|
|
type ConfigValue struct {
|
2019-10-30 16:25:05 +01:00
|
|
|
// When Object is false: String is either the plaintext value (for non-secrets) or the base64-encoded ciphertext
|
|
|
|
// (for secrets). When Object is true: String is a JSON encoded object. If both Object and Secret are true, then the
|
|
|
|
// object contains at least one secure value. Secure values in an object are encoded as `{"secure":"ciphertext"}`
|
|
|
|
// where ciphertext is the base64-encoded ciphertext.
|
2018-02-28 19:02:02 +01:00
|
|
|
String string `json:"string"`
|
|
|
|
// Secret is true if this value is a secret and false otherwise.
|
|
|
|
Secret bool `json:"secret"`
|
2019-10-30 16:25:05 +01:00
|
|
|
// Object is true if this value is a JSON encoded object.
|
|
|
|
Object bool `json:"object"`
|
2018-02-28 19:02:02 +01:00
|
|
|
}
|
|
|
|
|
2018-03-28 19:47:02 +02:00
|
|
|
// StackTagName is the key for the tags bag in stack. This is just a string, but we use a type alias to provide a richer
|
|
|
|
// description of how the string is used in our apitype definitions.
|
|
|
|
type StackTagName = string
|
|
|
|
|
|
|
|
const (
|
|
|
|
// ProjectNameTag is a tag that represents the name of a project (coresponds to the `name` property of Pulumi.yaml).
|
|
|
|
ProjectNameTag StackTagName = "pulumi:project"
|
2018-04-09 18:31:46 +02:00
|
|
|
// ProjectRuntimeTag is a tag that represents the runtime of a project (the `runtime` property of Pulumi.yaml).
|
|
|
|
ProjectRuntimeTag StackTagName = "pulumi:runtime"
|
|
|
|
// ProjectDescriptionTag is a tag that represents the description of a project (Pulumi.yaml's `description`).
|
|
|
|
ProjectDescriptionTag StackTagName = "pulumi:description"
|
2018-03-28 19:47:02 +02:00
|
|
|
// GitHubOwnerNameTag is a tag that represents the name of the owner on GitHub that this stack
|
|
|
|
// may be associated with (inferred by the CLI based on git remote info).
|
2018-10-23 23:53:52 +02:00
|
|
|
// TODO [pulumi/pulumi-service#2306] Once the UI is updated, we would no longer need the GitHub specific keys.
|
2018-03-28 19:47:02 +02:00
|
|
|
GitHubOwnerNameTag StackTagName = "gitHub:owner"
|
|
|
|
// GitHubRepositoryNameTag is a tag that represents the name of a repository on GitHub that this stack
|
|
|
|
// may be associated with (inferred by the CLI based on git remote info).
|
|
|
|
GitHubRepositoryNameTag StackTagName = "gitHub:repo"
|
2018-10-23 23:53:52 +02:00
|
|
|
// VCSOwnerNameTag is a tag that represents the name of the owner on the cloud VCS that this stack
|
|
|
|
// may be associated with (inferred by the CLI based on git remote info).
|
|
|
|
VCSOwnerNameTag StackTagName = "vcs:owner"
|
|
|
|
// VCSRepositoryNameTag is a tag that represents the name of a repository on the cloud VCS that this stack
|
|
|
|
// may be associated with (inferred by the CLI based on git remote info).
|
|
|
|
VCSRepositoryNameTag StackTagName = "vcs:repo"
|
|
|
|
// VCSRepositoryKindTag is a tag that represents the kind of the cloud VCS that this stack
|
|
|
|
// may be associated with (inferred by the CLI based on the git remote info).
|
|
|
|
VCSRepositoryKindTag StackTagName = "vcs:kind"
|
2018-03-28 19:47:02 +02:00
|
|
|
)
|
|
|
|
|
2018-02-28 19:02:02 +01:00
|
|
|
// Stack describes a Stack running on a Pulumi Cloud.
|
|
|
|
type Stack struct {
|
2019-08-15 00:26:58 +02:00
|
|
|
OrgName string `json:"orgName"`
|
2019-01-14 23:40:00 +01:00
|
|
|
ProjectName string `json:"projectName"`
|
2018-02-28 19:02:02 +01:00
|
|
|
StackName tokens.QName `json:"stackName"`
|
2020-01-17 16:44:23 +01:00
|
|
|
// CurrentOperation provides information about a stack operation in-progress, as applicable.
|
|
|
|
CurrentOperation *OperationStatus `json:"currentOperation,omitempty"`
|
|
|
|
ActiveUpdate string `json:"activeUpdate"`
|
|
|
|
Tags map[StackTagName]string `json:"tags,omitempty"`
|
2018-02-28 19:02:02 +01:00
|
|
|
|
|
|
|
Version int `json:"version"`
|
|
|
|
}
|
2020-01-17 16:44:23 +01:00
|
|
|
|
|
|
|
// OperationStatus describes the state of an operation being performed on a Pulumi stack.
|
|
|
|
type OperationStatus struct {
|
|
|
|
Kind UpdateKind `json:"kind"`
|
|
|
|
Author string `json:"author"`
|
|
|
|
Started int64 `json:"started"`
|
|
|
|
}
|