File tree Expand file tree Collapse file tree 2 files changed +45
-2
lines changed
Expand file tree Collapse file tree 2 files changed +45
-2
lines changed Original file line number Diff line number Diff line change 1414
1515package config
1616
17- import "github.com/pipe-cd/piped-plugin-sdk-go/unit"
17+ import (
18+ "encoding/json"
19+
20+ "github.com/creasty/defaults"
21+ "github.com/pipe-cd/piped-plugin-sdk-go/unit"
22+ )
1823
1924type CloudRunApplicationSpec struct {
2025 // Input for CloudRun deployment such as docker image...
@@ -23,10 +28,26 @@ type CloudRunApplicationSpec struct {
2328 QuickSync CloudRunSyncStageOptions `json:"quickSync"`
2429}
2530
31+ func (s * CloudRunApplicationSpec ) UnmarshalJSON (data []byte ) error {
32+ type alias CloudRunApplicationSpec
33+
34+ var a alias
35+ if err := json .Unmarshal (data , & a ); err != nil {
36+ return err
37+ }
38+
39+ * s = CloudRunApplicationSpec (a )
40+ if err := defaults .Set (s ); err != nil {
41+ return err
42+ }
43+
44+ return nil
45+ }
46+
2647type CloudRunDeploymentInput struct {
2748 // The name of service manifest file placing in application directory.
2849 // Default is service.yaml
29- ServiceManifestFile string `json:"serviceManifestFile"`
50+ ServiceManifestFile string `json:"serviceManifestFile" default:"service.yaml" `
3051}
3152
3253// CloudRunSyncStageOptions contains all configurable values for a CLOUDRUN_SYNC stage.
Original file line number Diff line number Diff line change 1414
1515package config
1616
17+ import (
18+ "encoding/json"
19+
20+ "github.com/creasty/defaults"
21+ )
22+
1723// Config represents the plugin-scoped configuration.
1824type Config struct {}
1925
@@ -30,6 +36,22 @@ type DeployTargetConfig struct {
3036 DriftDetectionEnabled * bool `json:"driftDetectionEnabled" default:"true"`
3137}
3238
39+ func (c * DeployTargetConfig ) UnmarshalJSON (data []byte ) error {
40+ type alias DeployTargetConfig
41+
42+ var a alias
43+ if err := json .Unmarshal (data , & a ); err != nil {
44+ return err
45+ }
46+
47+ * c = DeployTargetConfig (a )
48+ if err := defaults .Set (c ); err != nil {
49+ return err
50+ }
51+
52+ return nil
53+ }
54+
3355// ApplicationConfigSpec represents the application-scoped plugin config.
3456type ApplicationConfigSpec struct {
3557 // The terraform workspace name.
You can’t perform that action at this time.
0 commit comments