Skip to content

Commit

Permalink
chore: update docs and remove GetServiceInfo (#1186)
Browse files Browse the repository at this point in the history
Co-authored-by: Rémy Léone <rleone@scaleway.com>
  • Loading branch information
scaleway-bot and remyleone authored Apr 12, 2022
1 parent ba30fab commit aa796b0
Show file tree
Hide file tree
Showing 15 changed files with 1,531 additions and 346 deletions.
64 changes: 33 additions & 31 deletions api/applesilicon/v1alpha1/applesilicon_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,38 +286,10 @@ type ServerTypeMemory struct {

// Service API

type GetServiceInfoRequest struct {
Zone scw.Zone `json:"-"`
}

func (s *API) GetServiceInfo(req *GetServiceInfoRequest, opts ...scw.RequestOption) (*scw.ServiceInfo, error) {
var err error

if req.Zone == "" {
defaultZone, _ := s.client.GetDefaultZone()
req.Zone = defaultZone
}

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

scwReq := &scw.ScalewayRequest{
Method: "GET",
Path: "/apple-silicon/v1alpha1/zones/" + fmt.Sprint(req.Zone) + "",
Headers: http.Header{},
}

var resp scw.ServiceInfo

err = s.client.Do(scwReq, &resp, opts...)
if err != nil {
return nil, err
}
return &resp, nil
}

type ListServerTypesRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
}

Expand Down Expand Up @@ -352,6 +324,9 @@ func (s *API) ListServerTypes(req *ListServerTypesRequest, opts ...scw.RequestOp
}

type GetServerTypeRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerType: server type identifier
ServerType string `json:"-"`
Expand Down Expand Up @@ -392,6 +367,9 @@ func (s *API) GetServerType(req *GetServerTypeRequest, opts ...scw.RequestOption
}

type CreateServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// Name: create a server with this given name
Name string `json:"name"`
Expand Down Expand Up @@ -446,6 +424,9 @@ func (s *API) CreateServer(req *CreateServerRequest, opts ...scw.RequestOption)
}

type ListServersRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// OrderBy: the sort order of the returned servers
//
Expand Down Expand Up @@ -507,6 +488,9 @@ func (s *API) ListServers(req *ListServersRequest, opts ...scw.RequestOption) (*
}

type ListOSRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// Page: a positive integer to choose the page to return
Page *int32 `json:"-"`
Expand Down Expand Up @@ -563,6 +547,9 @@ func (s *API) ListOS(req *ListOSRequest, opts ...scw.RequestOption) (*ListOSResp
}

type GetOSRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// OsID: UUID of the OS you want to get
OsID string `json:"-"`
Expand Down Expand Up @@ -603,6 +590,9 @@ func (s *API) GetOS(req *GetOSRequest, opts ...scw.RequestOption) (*OS, error) {
}

type GetServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: UUID of the server you want to get
ServerID string `json:"-"`
Expand Down Expand Up @@ -643,6 +633,9 @@ func (s *API) GetServer(req *GetServerRequest, opts ...scw.RequestOption) (*Serv
}

type UpdateServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: UUID of the server you want to update
ServerID string `json:"-"`
Expand Down Expand Up @@ -690,6 +683,9 @@ func (s *API) UpdateServer(req *UpdateServerRequest, opts ...scw.RequestOption)
}

type DeleteServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: UUID of the server you want to delete
ServerID string `json:"-"`
Expand Down Expand Up @@ -728,6 +724,9 @@ func (s *API) DeleteServer(req *DeleteServerRequest, opts ...scw.RequestOption)
}

type RebootServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: UUID of the server you want to reboot
ServerID string `json:"-"`
Expand Down Expand Up @@ -773,6 +772,9 @@ func (s *API) RebootServer(req *RebootServerRequest, opts ...scw.RequestOption)
}

type ReinstallServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: UUID of the server you want to reinstall
ServerID string `json:"-"`
Expand Down
75 changes: 75 additions & 0 deletions api/baremetal/v1/baremetal_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,9 @@ type Setting struct {
// Service API

type ListServersRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// Page: page number
Page *int32 `json:"-"`
Expand Down Expand Up @@ -946,6 +949,9 @@ func (s *API) ListServers(req *ListServersRequest, opts ...scw.RequestOption) (*
}

type GetServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: ID of the server
ServerID string `json:"-"`
Expand Down Expand Up @@ -986,6 +992,9 @@ func (s *API) GetServer(req *GetServerRequest, opts ...scw.RequestOption) (*Serv
}

type CreateServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// OfferID: offer ID of the new server
OfferID string `json:"offer_id"`
Expand Down Expand Up @@ -1053,6 +1062,9 @@ func (s *API) CreateServer(req *CreateServerRequest, opts ...scw.RequestOption)
}

type UpdateServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: ID of the server to update
ServerID string `json:"-"`
Expand Down Expand Up @@ -1104,6 +1116,9 @@ func (s *API) UpdateServer(req *UpdateServerRequest, opts ...scw.RequestOption)
}

type InstallServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: server ID to install
ServerID string `json:"-"`
Expand Down Expand Up @@ -1163,6 +1178,9 @@ func (s *API) InstallServer(req *InstallServerRequest, opts ...scw.RequestOption
}

type GetServerMetricsRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: server ID to get the metrics
ServerID string `json:"-"`
Expand Down Expand Up @@ -1203,6 +1221,9 @@ func (s *API) GetServerMetrics(req *GetServerMetricsRequest, opts ...scw.Request
}

type DeleteServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: ID of the server to delete
ServerID string `json:"-"`
Expand Down Expand Up @@ -1243,6 +1264,9 @@ func (s *API) DeleteServer(req *DeleteServerRequest, opts ...scw.RequestOption)
}

type RebootServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: ID of the server to reboot
ServerID string `json:"-"`
Expand Down Expand Up @@ -1292,6 +1316,9 @@ func (s *API) RebootServer(req *RebootServerRequest, opts ...scw.RequestOption)
}

type StartServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: ID of the server to start
ServerID string `json:"-"`
Expand Down Expand Up @@ -1341,6 +1368,9 @@ func (s *API) StartServer(req *StartServerRequest, opts ...scw.RequestOption) (*
}

type StopServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: ID of the server to stop
ServerID string `json:"-"`
Expand Down Expand Up @@ -1386,6 +1416,9 @@ func (s *API) StopServer(req *StopServerRequest, opts ...scw.RequestOption) (*Se
}

type ListServerEventsRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: ID of the server events searched
ServerID string `json:"-"`
Expand Down Expand Up @@ -1445,6 +1478,9 @@ func (s *API) ListServerEvents(req *ListServerEventsRequest, opts ...scw.Request
}

type StartBMCAccessRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: ID of the server
ServerID string `json:"-"`
Expand Down Expand Up @@ -1496,6 +1532,9 @@ func (s *API) StartBMCAccess(req *StartBMCAccessRequest, opts ...scw.RequestOpti
}

type GetBMCAccessRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: ID of the server
ServerID string `json:"-"`
Expand Down Expand Up @@ -1536,6 +1575,9 @@ func (s *API) GetBMCAccess(req *GetBMCAccessRequest, opts ...scw.RequestOption)
}

type StopBMCAccessRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: ID of the server
ServerID string `json:"-"`
Expand Down Expand Up @@ -1574,6 +1616,9 @@ func (s *API) StopBMCAccess(req *StopBMCAccessRequest, opts ...scw.RequestOption
}

type UpdateIPRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: ID of the server
ServerID string `json:"-"`
Expand Down Expand Up @@ -1627,6 +1672,9 @@ func (s *API) UpdateIP(req *UpdateIPRequest, opts ...scw.RequestOption) (*IP, er
}

type AddOptionServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: ID of the server
ServerID string `json:"-"`
Expand Down Expand Up @@ -1678,6 +1726,9 @@ func (s *API) AddOptionServer(req *AddOptionServerRequest, opts ...scw.RequestOp
}

type DeleteOptionServerRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// ServerID: ID of the server
ServerID string `json:"-"`
Expand Down Expand Up @@ -1724,6 +1775,9 @@ func (s *API) DeleteOptionServer(req *DeleteOptionServerRequest, opts ...scw.Req
}

type ListOffersRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// Page: page number
Page *int32 `json:"-"`
Expand Down Expand Up @@ -1777,6 +1831,9 @@ func (s *API) ListOffers(req *ListOffersRequest, opts ...scw.RequestOption) (*Li
}

type GetOfferRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// OfferID: ID of the researched Offer
OfferID string `json:"-"`
Expand Down Expand Up @@ -1817,6 +1874,9 @@ func (s *API) GetOffer(req *GetOfferRequest, opts ...scw.RequestOption) (*Offer,
}

type GetOptionRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// OptionID: ID of the option
OptionID string `json:"-"`
Expand Down Expand Up @@ -1857,6 +1917,9 @@ func (s *API) GetOption(req *GetOptionRequest, opts ...scw.RequestOption) (*Opti
}

type ListOptionsRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// Page: page number
Page *int32 `json:"-"`
Expand Down Expand Up @@ -1911,6 +1974,9 @@ func (s *API) ListOptions(req *ListOptionsRequest, opts ...scw.RequestOption) (*
}

type ListSettingsRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// Page: page number
Page *int32 `json:"-"`
Expand Down Expand Up @@ -1967,6 +2033,9 @@ func (s *API) ListSettings(req *ListSettingsRequest, opts ...scw.RequestOption)
}

type UpdateSettingRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// SettingID: ID of the setting
SettingID string `json:"-"`
Expand Down Expand Up @@ -2014,6 +2083,9 @@ func (s *API) UpdateSetting(req *UpdateSettingRequest, opts ...scw.RequestOption
}

type ListOSRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// Page: page number
Page *int32 `json:"-"`
Expand Down Expand Up @@ -2065,6 +2137,9 @@ func (s *API) ListOS(req *ListOSRequest, opts ...scw.RequestOption) (*ListOSResp
}

type GetOSRequest struct {
// Zone:
//
// Zone to target. If none is passed will use default zone from the config
Zone scw.Zone `json:"-"`
// OsID: ID of the OS
OsID string `json:"-"`
Expand Down
Loading

0 comments on commit aa796b0

Please sign in to comment.