@@ -19,6 +19,9 @@ type StackDeploymentGroups interface {
19
19
// Read retrieves a stack deployment group by its ID.
20
20
Read (ctx context.Context , stackDeploymentGroupID string ) (* StackDeploymentGroup , error )
21
21
22
+ // ReadByName retrieves a stack deployment group by its Name.
23
+ ReadByName (ctx context.Context , stackConfigurationID string , stackDeploymentName string ) (* StackDeploymentGroup , error )
24
+
22
25
// ApproveAllPlans approves all pending plans in a stack deployment group.
23
26
ApproveAllPlans (ctx context.Context , stackDeploymentGroupID string ) error
24
27
@@ -65,8 +68,6 @@ type StackDeploymentGroupList struct {
65
68
// StackDeploymentGroupListOptions represents additional options when listing stack deployment groups.
66
69
type StackDeploymentGroupListOptions struct {
67
70
ListOptions
68
- // A query string used to filter by deployment group name.
69
- GroupName string `url:"group_name,omitempty"`
70
71
}
71
72
72
73
// StackDeploymentGroupRerunOptions represents options for rerunning deployments in a stack deployment group.
@@ -81,12 +82,11 @@ func (s stackDeploymentGroups) List(ctx context.Context, stackConfigID string, o
81
82
return nil , fmt .Errorf ("invalid stack configuration ID: %s" , stackConfigID )
82
83
}
83
84
84
- u := fmt .Sprintf ("stack-configurations/%s/stack-deployment-groups/" , url .PathEscape (stackConfigID ))
85
- qp , err := decodeQueryParams (options )
86
- if err != nil {
87
- return nil , err
85
+ if options == nil {
86
+ options = & StackDeploymentGroupListOptions {}
88
87
}
89
- req , err := s .client .NewRequestWithAdditionalQueryParams ("GET" , u , nil , qp )
88
+
89
+ req , err := s .client .NewRequest ("GET" , fmt .Sprintf ("stack-configurations/%s/stack-deployment-groups" , url .PathEscape (stackConfigID )), options )
90
90
if err != nil {
91
91
return nil , err
92
92
}
@@ -100,6 +100,29 @@ func (s stackDeploymentGroups) List(ctx context.Context, stackConfigID string, o
100
100
return sdgl , nil
101
101
}
102
102
103
+ // ReadByName retrieves a stack deployment group by its Name.
104
+ func (s stackDeploymentGroups ) ReadByName (ctx context.Context , stackConfigurationID string , stackDeploymentName string ) (* StackDeploymentGroup , error ) {
105
+ if ! validStringID (& stackConfigurationID ) {
106
+ return nil , fmt .Errorf ("invalid stack configuration id: %s" , stackConfigurationID )
107
+ }
108
+ if ! validStringID (& stackDeploymentName ) {
109
+ return nil , fmt .Errorf ("invalid stack deployment group name: %s" , stackDeploymentName )
110
+ }
111
+
112
+ req , err := s .client .NewRequest ("GET" , fmt .Sprintf ("stack-configurations/%s/stack-deployment-groups/%s" , url .PathEscape (stackConfigurationID ), url .PathEscape (stackDeploymentName )), nil )
113
+ if err != nil {
114
+ return nil , err
115
+ }
116
+
117
+ sdg := & StackDeploymentGroup {}
118
+ err = req .Do (ctx , sdg )
119
+ if err != nil {
120
+ return nil , err
121
+ }
122
+
123
+ return sdg , nil
124
+ }
125
+
103
126
// Read retrieves a stack deployment group by its ID.
104
127
func (s stackDeploymentGroups ) Read (ctx context.Context , stackDeploymentGroupID string ) (* StackDeploymentGroup , error ) {
105
128
if ! validStringID (& stackDeploymentGroupID ) {
0 commit comments