@@ -14,12 +14,12 @@ import (
14
14
"strings"
15
15
"time"
16
16
17
+ std "github.com/scaleway/scaleway-sdk-go/api/std"
17
18
"github.com/scaleway/scaleway-sdk-go/errors"
18
19
"github.com/scaleway/scaleway-sdk-go/marshaler"
19
20
"github.com/scaleway/scaleway-sdk-go/namegenerator"
20
21
"github.com/scaleway/scaleway-sdk-go/parameter"
21
22
"github.com/scaleway/scaleway-sdk-go/scw"
22
- std "github.com/scaleway/scaleway-sdk-go/api/std"
23
23
)
24
24
25
25
// always import dependencies
@@ -1073,6 +1073,15 @@ type HostingAPIGetHostingRequest struct {
1073
1073
HostingID string `json:"-"`
1074
1074
}
1075
1075
1076
+ // HostingAPIGetResourceSummaryRequest: hosting api get resource summary request.
1077
+ type HostingAPIGetResourceSummaryRequest struct {
1078
+ // Region: region to target. If none is passed will use default region from the config.
1079
+ Region scw.Region `json:"-"`
1080
+
1081
+ // HostingID: hosting ID.
1082
+ HostingID string `json:"-"`
1083
+ }
1084
+
1076
1085
// HostingAPIListHostingsRequest: hosting api list hostings request.
1077
1086
type HostingAPIListHostingsRequest struct {
1078
1087
// Region: region to target. If none is passed will use default region from the config.
@@ -1465,6 +1474,21 @@ type ResetHostingPasswordResponse struct {
1465
1474
OneTimePassword string `json:"one_time_password"`
1466
1475
}
1467
1476
1477
+ // ResourceSummary: resource summary.
1478
+ type ResourceSummary struct {
1479
+ // DatabasesCount: total number of active databases in the Web Hosting plan.
1480
+ DatabasesCount uint32 `json:"databases_count"`
1481
+
1482
+ // MailAccountsCount: total number of active email accounts in the Web Hosting plan.
1483
+ MailAccountsCount uint32 `json:"mail_accounts_count"`
1484
+
1485
+ // FtpAccountsCount: total number of active FTP accounts in the Web Hosting plan.
1486
+ FtpAccountsCount uint32 `json:"ftp_accounts_count"`
1487
+
1488
+ // WebsitesCount: total number of active domains in the the Web Hosting plan.
1489
+ WebsitesCount uint32 `json:"websites_count"`
1490
+ }
1491
+
1468
1492
// Session: session.
1469
1493
type Session struct {
1470
1494
// URL: logged user's session URL.
@@ -2294,6 +2318,37 @@ func (s *HostingAPI) ResetHostingPassword(req *HostingAPIResetHostingPasswordReq
2294
2318
return & resp , nil
2295
2319
}
2296
2320
2321
+ // GetResourceSummary: Get the total counts of websites, databases, email accounts, and FTP accounts of a Web Hosting plan.
2322
+ func (s * HostingAPI ) GetResourceSummary (req * HostingAPIGetResourceSummaryRequest , opts ... scw.RequestOption ) (* ResourceSummary , error ) {
2323
+ var err error
2324
+
2325
+ if req .Region == "" {
2326
+ defaultRegion , _ := s .client .GetDefaultRegion ()
2327
+ req .Region = defaultRegion
2328
+ }
2329
+
2330
+ if fmt .Sprint (req .Region ) == "" {
2331
+ return nil , errors .New ("field Region cannot be empty in request" )
2332
+ }
2333
+
2334
+ if fmt .Sprint (req .HostingID ) == "" {
2335
+ return nil , errors .New ("field HostingID cannot be empty in request" )
2336
+ }
2337
+
2338
+ scwReq := & scw.ScalewayRequest {
2339
+ Method : "GET" ,
2340
+ Path : "/webhosting/v1/regions/" + fmt .Sprint (req .Region ) + "/hostings/" + fmt .Sprint (req .HostingID ) + "/resource-summary" ,
2341
+ }
2342
+
2343
+ var resp ResourceSummary
2344
+
2345
+ err = s .client .Do (scwReq , & resp , opts ... )
2346
+ if err != nil {
2347
+ return nil , err
2348
+ }
2349
+ return & resp , nil
2350
+ }
2351
+
2297
2352
// This API allows you to manage your FTP accounts for your Web Hosting services.
2298
2353
type FtpAccountAPI struct {
2299
2354
client * scw.Client
0 commit comments