@@ -982,6 +982,18 @@ type ACLMatch struct {
982982 Invert bool `json:"invert"`
983983}
984984
985+ // ACLSpec: acl spec
986+ type ACLSpec struct {
987+ // Name: name of your ACL resource
988+ Name string `json:"name"`
989+ // Action: action to undertake when an ACL filter matches
990+ Action * ACLAction `json:"action"`
991+ // Match: the ACL match rule. At least `ip_subnet` or `http_filter` and `http_filter_value` are required
992+ Match * ACLMatch `json:"match"`
993+ // Index: order between your Acls (ascending order, 0 is first acl executed)
994+ Index int32 `json:"index"`
995+ }
996+
985997// Backend: backend
986998type Backend struct {
987999 ID string `json:"id"`
@@ -1536,6 +1548,14 @@ type RouteMatch struct {
15361548 Sni * string `json:"sni"`
15371549}
15381550
1551+ // SetACLsResponse: set acls response
1552+ type SetACLsResponse struct {
1553+ // ACLs: list of ACLs object (see ACL object description)
1554+ ACLs []* ACL `json:"acls"`
1555+ // TotalCount: the total number of items
1556+ TotalCount uint32 `json:"total_count"`
1557+ }
1558+
15391559// Subscriber: subscriber
15401560type Subscriber struct {
15411561 // ID: subscriber ID
@@ -6498,6 +6518,51 @@ func (s *ZonedAPI) DeleteACL(req *ZonedAPIDeleteACLRequest, opts ...scw.RequestO
64986518 return nil
64996519}
65006520
6521+ type ZonedAPISetACLsRequest struct {
6522+ Zone scw.Zone `json:"-"`
6523+ // FrontendID: the Frontend to change ACL to
6524+ FrontendID string `json:"-"`
6525+ // ACLs: array of ACLs to erease the existing ACLs
6526+ ACLs []* ACLSpec `json:"acls"`
6527+ }
6528+
6529+ // SetACLs: set all ACLs for a given frontend
6530+ func (s * ZonedAPI ) SetACLs (req * ZonedAPISetACLsRequest , opts ... scw.RequestOption ) (* SetACLsResponse , error ) {
6531+ var err error
6532+
6533+ if req .Zone == "" {
6534+ defaultZone , _ := s .client .GetDefaultZone ()
6535+ req .Zone = defaultZone
6536+ }
6537+
6538+ if fmt .Sprint (req .Zone ) == "" {
6539+ return nil , errors .New ("field Zone cannot be empty in request" )
6540+ }
6541+
6542+ if fmt .Sprint (req .FrontendID ) == "" {
6543+ return nil , errors .New ("field FrontendID cannot be empty in request" )
6544+ }
6545+
6546+ scwReq := & scw.ScalewayRequest {
6547+ Method : "PUT" ,
6548+ Path : "/lb/v1/zones/" + fmt .Sprint (req .Zone ) + "/frontends/" + fmt .Sprint (req .FrontendID ) + "/acls" ,
6549+ Headers : http.Header {},
6550+ }
6551+
6552+ err = scwReq .SetBody (req )
6553+ if err != nil {
6554+ return nil , err
6555+ }
6556+
6557+ var resp SetACLsResponse
6558+
6559+ err = s .client .Do (scwReq , & resp , opts ... )
6560+ if err != nil {
6561+ return nil , err
6562+ }
6563+ return & resp , nil
6564+ }
6565+
65016566type ZonedAPICreateCertificateRequest struct {
65026567 Zone scw.Zone `json:"-"`
65036568 // LBID: load balancer ID
0 commit comments