Skip to content

Commit 45f04af

Browse files
feat: regenerate CLI from OpenAPI spec
1 parent ae73453 commit 45f04af

14 files changed

Lines changed: 1424 additions & 155 deletions

‎client/client.gen.go‎

Lines changed: 1113 additions & 155 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎cmd/agency_hosting/agency_hosting.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/hostinger/api-cli/cmd/agency_hosting/metrics"
1111
"github.com/hostinger/api-cli/cmd/agency_hosting/orders"
1212
"github.com/hostinger/api-cli/cmd/agency_hosting/php"
13+
"github.com/hostinger/api-cli/cmd/agency_hosting/ssl"
1314
"github.com/hostinger/api-cli/cmd/agency_hosting/website_setups"
1415
"github.com/hostinger/api-cli/cmd/agency_hosting/websites"
1516
"github.com/hostinger/api-cli/cmd/agency_hosting/wordpress"
@@ -32,6 +33,7 @@ func init() {
3233
GroupCmd.AddCommand(metrics.GroupCmd)
3334
GroupCmd.AddCommand(orders.GroupCmd)
3435
GroupCmd.AddCommand(php.GroupCmd)
36+
GroupCmd.AddCommand(ssl.GroupCmd)
3537
GroupCmd.AddCommand(website_setups.GroupCmd)
3638
GroupCmd.AddCommand(websites.GroupCmd)
3739
GroupCmd.AddCommand(wordpress.GroupCmd)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package ssl
2+
3+
import (
4+
"context"
5+
"log"
6+
7+
"github.com/hostinger/api-cli/api"
8+
"github.com/hostinger/api-cli/output"
9+
"github.com/spf13/cobra"
10+
)
11+
12+
var InstallWebsiteCmd = &cobra.Command{
13+
Use: "install-website <website_uid> <domain>",
14+
Short: "Install website SSL",
15+
Long: "Starts a Let's Encrypt certificate setup for the domain and returns at once; the setup runs in\nthe background. `Get website SSL status` reports `installing` while it runs, then `active` or\n`failed`; the `ssl_setup` entry of `List website processes` shows the same progress.\n\nReturns 422 when the domain already has a platform certificate that is not expired, when a\ncertificate process is recorded for the domain (a failed setup counts until it is cleaned up),\nor when the domain hit its limit of three setups per seven days. Returns 429 when the same\ndomain was requested less than a minute ago, 403 when the website is suspended or locked, and\n404 when the website or the domain does not exist.",
16+
Args: cobra.MatchAll(cobra.ExactArgs(2)),
17+
Run: func(cmd *cobra.Command, args []string) {
18+
r, err := api.Request().AgencyHostingInstallWebsiteSSLV1WithResponse(context.TODO(), args[0], args[1])
19+
if err != nil {
20+
log.Fatal(err)
21+
}
22+
23+
output.Format(cmd, r.Body, r.StatusCode())
24+
},
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package ssl
2+
3+
import (
4+
"context"
5+
"log"
6+
7+
"github.com/hostinger/api-cli/api"
8+
"github.com/hostinger/api-cli/output"
9+
"github.com/spf13/cobra"
10+
)
11+
12+
var ReinstallWebsiteCmd = &cobra.Command{
13+
Use: "reinstall-website <website_uid> <domain>",
14+
Short: "Reinstall website SSL",
15+
Long: "Replaces the Let's Encrypt certificate of the domain: the current platform certificate, when\none is recorded, is revoked and removed, then a new setup starts in the background. Returns at\nonce; `Get website SSL status` reports `installing` while it runs, then `active` or `failed`.\n\nReturns 422 for free subdomains, when a certificate process is recorded for the domain (a\nfailed setup counts until it is cleaned up), or when the domain hit its limit of three setups\nper seven days. Returns 429 when the same domain was requested less than a minute ago, and 403\nwhen the website is suspended or locked, and 404 when the website or the domain does not exist.",
16+
Args: cobra.MatchAll(cobra.ExactArgs(2)),
17+
Run: func(cmd *cobra.Command, args []string) {
18+
r, err := api.Request().AgencyHostingReinstallWebsiteSSLV1WithResponse(context.TODO(), args[0], args[1])
19+
if err != nil {
20+
log.Fatal(err)
21+
}
22+
23+
output.Format(cmd, r.Body, r.StatusCode())
24+
},
25+
}

‎cmd/agency_hosting/ssl/ssl.go‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package ssl
2+
3+
import (
4+
"github.com/spf13/cobra"
5+
)
6+
7+
var GroupCmd = &cobra.Command{
8+
Use: "ssl",
9+
Short: "SSL commands",
10+
}
11+
12+
func init() {
13+
GroupCmd.AddCommand(InstallWebsiteCmd)
14+
GroupCmd.AddCommand(ReinstallWebsiteCmd)
15+
GroupCmd.AddCommand(UninstallWebsiteCmd)
16+
GroupCmd.AddCommand(WebsiteStatusCmd)
17+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package ssl
2+
3+
import (
4+
"context"
5+
"log"
6+
7+
"github.com/hostinger/api-cli/api"
8+
"github.com/hostinger/api-cli/output"
9+
"github.com/spf13/cobra"
10+
)
11+
12+
var UninstallWebsiteCmd = &cobra.Command{
13+
Use: "uninstall-website <website_uid> <domain>",
14+
Short: "Uninstall website SSL",
15+
Long: "Removes the platform-issued Let's Encrypt certificate of the domain: the certificate is revoked\nand deleted before the response, so the domain is no longer served with a platform certificate\nuntil a new setup completes. Also succeeds when the domain has no platform certificate to\nremove. Uploaded (custom) certificates are not affected.\n\nReturns 422 when a certificate process is recorded for the domain (a failed setup counts until\nit is cleaned up), 429 when the same domain was requested less than a minute ago, and 403 when\nthe website is suspended or locked, and 404 when the website or the domain does not exist.",
16+
Args: cobra.MatchAll(cobra.ExactArgs(2)),
17+
Run: func(cmd *cobra.Command, args []string) {
18+
r, err := api.Request().AgencyHostingUninstallWebsiteSSLV1WithResponse(context.TODO(), args[0], args[1])
19+
if err != nil {
20+
log.Fatal(err)
21+
}
22+
23+
output.Format(cmd, r.Body, r.StatusCode())
24+
},
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package ssl
2+
3+
import (
4+
"context"
5+
"log"
6+
7+
"github.com/hostinger/api-cli/api"
8+
"github.com/hostinger/api-cli/output"
9+
"github.com/spf13/cobra"
10+
)
11+
12+
var WebsiteStatusCmd = &cobra.Command{
13+
Use: "website-status <website_uid> <domain>",
14+
Short: "Get website SSL status",
15+
Long: "Returns the SSL state of one domain of an Agency Plan website: the certificate `status`,\nwhether the certificate was uploaded by the customer, and when it stops being valid.\n\n`installing` means a certificate setup is running or retrying; the `ssl_setup` entry of\n`List website processes` shows the same progress. `active` means a valid certificate is in\nplace: uploaded by the customer, issued by the platform, or a lifetime certificate bought for\nthe domain. `failed` means the last setup gave up and no valid certificate is in place.\n`expired` means the certificate has run out. `not_installed` means the domain has no\ncertificate and no setup process. Returns 404 when the website or the domain does not exist.",
16+
Args: cobra.MatchAll(cobra.ExactArgs(2)),
17+
Run: func(cmd *cobra.Command, args []string) {
18+
r, err := api.Request().AgencyHostingGetWebsiteSSLStatusV1WithResponse(context.TODO(), args[0], args[1])
19+
if err != nil {
20+
log.Fatal(err)
21+
}
22+
23+
output.Format(cmd, r.Body, r.StatusCode())
24+
},
25+
}

‎docs/hostinger_agency-hosting.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Agency Hosting commands
2727
* [hostinger agency-hosting metrics](hostinger_agency-hosting_metrics.md) - Metrics commands
2828
* [hostinger agency-hosting orders](hostinger_agency-hosting_orders.md) - Orders commands
2929
* [hostinger agency-hosting php](hostinger_agency-hosting_php.md) - PHP commands
30+
* [hostinger agency-hosting ssl](hostinger_agency-hosting_ssl.md) - SSL commands
3031
* [hostinger agency-hosting website-setups](hostinger_agency-hosting_website-setups.md) - Website Setups commands
3132
* [hostinger agency-hosting websites](hostinger_agency-hosting_websites.md) - Websites commands
3233
* [hostinger agency-hosting wordpress](hostinger_agency-hosting_wordpress.md) - WordPress commands
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## hostinger agency-hosting ssl
2+
3+
SSL commands
4+
5+
### Options
6+
7+
```
8+
-h, --help help for ssl
9+
```
10+
11+
### Options inherited from parent commands
12+
13+
```
14+
--config string Config file (default is $HOME/.hostinger.yaml)
15+
--format string Output format type (json|table|tree), default: table
16+
```
17+
18+
### SEE ALSO
19+
20+
* [hostinger agency-hosting](hostinger_agency-hosting.md) - Agency Hosting commands
21+
* [hostinger agency-hosting ssl install-website](hostinger_agency-hosting_ssl_install-website.md) - Install website SSL
22+
* [hostinger agency-hosting ssl reinstall-website](hostinger_agency-hosting_ssl_reinstall-website.md) - Reinstall website SSL
23+
* [hostinger agency-hosting ssl uninstall-website](hostinger_agency-hosting_ssl_uninstall-website.md) - Uninstall website SSL
24+
* [hostinger agency-hosting ssl website-status](hostinger_agency-hosting_ssl_website-status.md) - Get website SSL status
25+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## hostinger agency-hosting ssl install-website
2+
3+
Install website SSL
4+
5+
### Synopsis
6+
7+
Starts a Let's Encrypt certificate setup for the domain and returns at once; the setup runs in
8+
the background. `Get website SSL status` reports `installing` while it runs, then `active` or
9+
`failed`; the `ssl_setup` entry of `List website processes` shows the same progress.
10+
11+
Returns 422 when the domain already has a platform certificate that is not expired, when a
12+
certificate process is recorded for the domain (a failed setup counts until it is cleaned up),
13+
or when the domain hit its limit of three setups per seven days. Returns 429 when the same
14+
domain was requested less than a minute ago, 403 when the website is suspended or locked, and
15+
404 when the website or the domain does not exist.
16+
17+
```
18+
hostinger agency-hosting ssl install-website <website_uid> <domain> [flags]
19+
```
20+
21+
### Options
22+
23+
```
24+
-h, --help help for install-website
25+
```
26+
27+
### Options inherited from parent commands
28+
29+
```
30+
--config string Config file (default is $HOME/.hostinger.yaml)
31+
--format string Output format type (json|table|tree), default: table
32+
```
33+
34+
### SEE ALSO
35+
36+
* [hostinger agency-hosting ssl](hostinger_agency-hosting_ssl.md) - SSL commands
37+

0 commit comments

Comments
 (0)