Merge pull request #1250 from pulumi/MoreDeploymentVersions
Add deployment version fields to more types.
This commit is contained in:
commit
fa97af772a
|
@ -2,6 +2,8 @@
|
|||
|
||||
package apitype
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// UpdateKind is an enum for the type of update performed.
|
||||
//
|
||||
// Should generally mirror backend.UpdateKind, but we clone it in this package to add
|
||||
|
@ -70,10 +72,11 @@ type UpdateInfo struct {
|
|||
Config map[string]ConfigValue `json:"config"`
|
||||
|
||||
// Information obtained from an update completing.
|
||||
Result UpdateResult `json:"result"`
|
||||
EndTime int64 `json:"endTime"`
|
||||
Deployment *DeploymentV1 `json:"deployment,omitempty"`
|
||||
ResourceChanges map[OpType]int `json:"resourceChanges,omitempty"`
|
||||
Result UpdateResult `json:"result"`
|
||||
EndTime int64 `json:"endTime"`
|
||||
Version int `json:"version"`
|
||||
Deployment json.RawMessage `json:"deployment,omitempty"`
|
||||
ResourceChanges map[OpType]int `json:"resourceChanges,omitempty"`
|
||||
}
|
||||
|
||||
// GetHistoryResponse is the response from the Pulumi Service when requesting
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
package apitype
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// StackSummary presents an overview of a particular stack without enumerating its current resource set.
|
||||
type StackSummary struct {
|
||||
// ID is the unique identifier for a stack in the context of its PPC.
|
||||
|
@ -59,6 +61,9 @@ type GetStackResponse struct {
|
|||
// TODO: [pulumi/pulumi-ppc#29]: make this state recoverable. This could be as simple as import/export.
|
||||
UnknownState bool `json:"unknownState"`
|
||||
|
||||
// Version indicates the schema of the Resources, Manifest, and Deployment fields below.
|
||||
Version int `json:"version"`
|
||||
|
||||
// Resources provides the list of cloud resources managed by this stack.
|
||||
Resources []ResourceV1 `json:"resources"`
|
||||
|
||||
|
@ -66,7 +71,7 @@ type GetStackResponse struct {
|
|||
Manifest ManifestV1 `json:"manifest"`
|
||||
|
||||
// Deployment provides a view of the stack as an opaque Pulumi deployment.
|
||||
Deployment *DeploymentV1 `json:"deployment,omitempty"`
|
||||
Deployment json.RawMessage `json:"deployment,omitempty"`
|
||||
}
|
||||
|
||||
// EncryptValueRequest defines the request body for encrypting a value.
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
@ -871,6 +872,15 @@ func (b *cloudBackend) GetHistory(stackRef backend.StackReference) ([]backend.Up
|
|||
// Convert apitype.UpdateInfo objects to the backend type.
|
||||
var beUpdates []backend.UpdateInfo
|
||||
for _, update := range updates {
|
||||
// Decode the deployment.
|
||||
if update.Version > 1 {
|
||||
return nil, errors.Errorf("unsupported checkpoint version %v", update.Version)
|
||||
}
|
||||
var deployment apitype.DeploymentV1
|
||||
if err := json.Unmarshal([]byte(update.Deployment), &deployment); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Convert types from the apitype package into their internal counterparts.
|
||||
cfg, err := convertConfig(update.Config)
|
||||
if err != nil {
|
||||
|
@ -885,7 +895,7 @@ func (b *cloudBackend) GetHistory(stackRef backend.StackReference) ([]backend.Up
|
|||
Result: backend.UpdateResult(update.Result),
|
||||
StartTime: update.StartTime,
|
||||
EndTime: update.EndTime,
|
||||
Deployment: update.Deployment,
|
||||
Deployment: &deployment,
|
||||
ResourceChanges: convertResourceChanges(update.ResourceChanges),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -75,6 +75,6 @@ type UpdateInfo struct {
|
|||
// Information obtained from an update completing.
|
||||
Result UpdateResult `json:"result"`
|
||||
EndTime int64 `json:"endTime"`
|
||||
Deployment *apitype.Deployment `json:"deployment,omitempty"`
|
||||
Deployment *apitype.DeploymentV1 `json:"deployment,omitempty"`
|
||||
ResourceChanges engine.ResourceChanges `json:"resourceChanges,omitempty"`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue