Skip to content

Commit b6170c7

Browse files
authored
feat(lb): generate ip_type for ListIpsRequest (#1967)
1 parent fd0f14f commit b6170c7

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

api/lb/v1/lb_sdk.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,37 @@ func (enum *ListFrontendsRequestOrderBy) UnmarshalJSON(data []byte) error {
524524
return nil
525525
}
526526

527+
type ListIPsRequestIPType string
528+
529+
const (
530+
ListIPsRequestIPTypeAll = ListIPsRequestIPType("all")
531+
ListIPsRequestIPTypeIPv4 = ListIPsRequestIPType("ipv4")
532+
ListIPsRequestIPTypeIPv6 = ListIPsRequestIPType("ipv6")
533+
)
534+
535+
func (enum ListIPsRequestIPType) String() string {
536+
if enum == "" {
537+
// return default value if empty
538+
return "all"
539+
}
540+
return string(enum)
541+
}
542+
543+
func (enum ListIPsRequestIPType) MarshalJSON() ([]byte, error) {
544+
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
545+
}
546+
547+
func (enum *ListIPsRequestIPType) UnmarshalJSON(data []byte) error {
548+
tmp := ""
549+
550+
if err := json.Unmarshal(data, &tmp); err != nil {
551+
return err
552+
}
553+
554+
*enum = ListIPsRequestIPType(ListIPsRequestIPType(tmp).String())
555+
return nil
556+
}
557+
527558
type ListLBsRequestOrderBy string
528559

529560
const (
@@ -2363,6 +2394,10 @@ type ListIPsRequest struct {
23632394

23642395
// ProjectID: project ID to filter for, only Load Balancer IP addresses from this Project will be returned.
23652396
ProjectID *string `json:"-"`
2397+
2398+
// IPType: IP type to filter for.
2399+
// Default value: all
2400+
IPType ListIPsRequestIPType `json:"-"`
23662401
}
23672402

23682403
// ListIPsResponse: list i ps response.
@@ -3727,6 +3762,10 @@ type ZonedAPIListIPsRequest struct {
37273762

37283763
// ProjectID: project ID to filter for, only Load Balancer IP addresses from this Project will be returned.
37293764
ProjectID *string `json:"-"`
3765+
3766+
// IPType: IP type to filter for.
3767+
// Default value: all
3768+
IPType ListIPsRequestIPType `json:"-"`
37303769
}
37313770

37323771
// ZonedAPIListLBPrivateNetworksRequest: zoned api list lb private networks request.
@@ -4525,6 +4564,7 @@ func (s *ZonedAPI) ListIPs(req *ZonedAPIListIPsRequest, opts ...scw.RequestOptio
45254564
parameter.AddToQuery(query, "ip_address", req.IPAddress)
45264565
parameter.AddToQuery(query, "organization_id", req.OrganizationID)
45274566
parameter.AddToQuery(query, "project_id", req.ProjectID)
4567+
parameter.AddToQuery(query, "ip_type", req.IPType)
45284568

45294569
if fmt.Sprint(req.Zone) == "" {
45304570
return nil, errors.New("field Zone cannot be empty in request")
@@ -6484,6 +6524,7 @@ func (s *API) ListIPs(req *ListIPsRequest, opts ...scw.RequestOption) (*ListIPsR
64846524
parameter.AddToQuery(query, "ip_address", req.IPAddress)
64856525
parameter.AddToQuery(query, "organization_id", req.OrganizationID)
64866526
parameter.AddToQuery(query, "project_id", req.ProjectID)
6527+
parameter.AddToQuery(query, "ip_type", req.IPType)
64876528

64886529
if fmt.Sprint(req.Region) == "" {
64896530
return nil, errors.New("field Region cannot be empty in request")

0 commit comments

Comments
 (0)