diff --git a/origingroups/origingroups.go b/origingroups/origingroups.go index 6e8ea60..72c803d 100644 --- a/origingroups/origingroups.go +++ b/origingroups/origingroups.go @@ -14,10 +14,10 @@ type OriginGroupService interface { type GroupRequest struct { Name string `json:"name"` UseNext bool `json:"useNext"` - Origins []OriginRequest `json:"origins"` + Sources []SourceRequest `json:"sources"` } -type OriginRequest struct { +type SourceRequest struct { Source string `json:"source"` Backup bool `json:"backup"` Enabled bool `json:"enabled"` @@ -27,11 +27,10 @@ type OriginGroup struct { ID int64 `json:"id"` Name string `json:"name"` UseNext bool `json:"useNext"` - Origins []Origin `json:"origin_ids"` + Sources []Source `json:"sources"` } -type Origin struct { - ID int64 `json:"id"` +type Source struct { Source string `json:"source"` Backup bool `json:"backup"` Enabled bool `json:"enabled"` diff --git a/origingroups/service.go b/origingroups/service.go index 4f14108..8a63991 100644 --- a/origingroups/service.go +++ b/origingroups/service.go @@ -20,7 +20,7 @@ func NewService(r gcore.Requester) *Service { func (s *Service) Create(ctx context.Context, req *GroupRequest) (*OriginGroup, error) { var group OriginGroup - if err := s.r.Request(ctx, http.MethodPost, "/cdn/originGroups", req, &group); err != nil { + if err := s.r.Request(ctx, http.MethodPost, "/cdn/origin_groups", req, &group); err != nil { return nil, fmt.Errorf("request: %w", err) } @@ -29,7 +29,7 @@ func (s *Service) Create(ctx context.Context, req *GroupRequest) (*OriginGroup, func (s *Service) Get(ctx context.Context, id int64) (*OriginGroup, error) { var group OriginGroup - if err := s.r.Request(ctx, http.MethodGet, fmt.Sprintf("/cdn/originGroups/%d", id), nil, &group); err != nil { + if err := s.r.Request(ctx, http.MethodGet, fmt.Sprintf("/cdn/origin_groups/%d", id), nil, &group); err != nil { return nil, fmt.Errorf("request: %w", err) } @@ -38,7 +38,7 @@ func (s *Service) Get(ctx context.Context, id int64) (*OriginGroup, error) { func (s *Service) Update(ctx context.Context, id int64, req *GroupRequest) (*OriginGroup, error) { var group OriginGroup - if err := s.r.Request(ctx, http.MethodPut, fmt.Sprintf("/cdn/originGroups/%d", id), req, &group); err != nil { + if err := s.r.Request(ctx, http.MethodPut, fmt.Sprintf("/cdn/origin_groups/%d", id), req, &group); err != nil { return nil, fmt.Errorf("request: %w", err) } @@ -46,8 +46,7 @@ func (s *Service) Update(ctx context.Context, id int64, req *GroupRequest) (*Ori } func (s *Service) Delete(ctx context.Context, id int64) error { - if err := s.r.Request(ctx, http.MethodDelete, fmt.Sprintf("/cdn/originGroups/%d", id), nil, nil); err != nil { - + if err := s.r.Request(ctx, http.MethodDelete, fmt.Sprintf("/cdn/origin_groups/%d", id), nil, nil); err != nil { return fmt.Errorf("request: %w", err) }