{"modulePath":"github.com/hostinger/api-cli","version":"v1.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package post_install_scripts\n\n## Variables\n\n```go\nvar CreateCmd = \u0026cobra.Command{\n\tUse:   \"create\",\n\tShort: \"Create post-install script\",\n\tLong:  \"Add a new post-install script to your account, which can then be used after virtual machine installation.\\n\\nThe script contents will be saved to the file `/post_install` with executable attribute set\\nand will be executed once virtual machine is installed.\\nThe output of the script will be redirected to `/post_install.log`. Maximum script size is 48KB.\\n\\nUse this endpoint to create automation scripts for VPS setup tasks.\",\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tpayload, err := json.Marshal(createBody(cmd))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tr, err := api.Request().VPSCreatePostInstallScriptV1WithBodyWithResponse(context.TODO(), \"application/json\", bytes.NewReader(payload))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar DeleteCmd = \u0026cobra.Command{\n\tUse:   \"delete \u003cpost-install-script-id\u003e\",\n\tShort: \"Delete post-install script\",\n\tLong:  \"Delete a post-install script from your account.\\n       \\nUse this endpoint to remove unused automation scripts.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(1)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().VPSDeletePostInstallScriptV1WithResponse(context.TODO(), utils.StringToInt(args[0]))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar GetCmd = \u0026cobra.Command{\n\tUse:   \"get \u003cpost-install-script-id\u003e\",\n\tShort: \"Get post-install script\",\n\tLong:  \"Retrieve post-install script by its ID.\\n\\nUse this endpoint to view specific automation script details.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(1)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().VPSGetPostInstallScriptV1WithResponse(context.TODO(), utils.StringToInt(args[0]))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar GroupCmd = \u0026cobra.Command{\n\tUse:   \"post-install-scripts\",\n\tShort: \"Post-install scripts commands\",\n}\n```\n\n```go\nvar ListCmd = \u0026cobra.Command{\n\tUse:   \"list\",\n\tShort: \"Get post-install scripts\",\n\tLong:  \"Retrieve post-install scripts associated with your account.\\n\\nUse this endpoint to view available automation scripts for VPS deployment.\",\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tr, err := api.Request().VPSGetPostInstallScriptsV1WithResponse(context.TODO(), listParams(cmd))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n```go\nvar UpdateCmd = \u0026cobra.Command{\n\tUse:   \"update \u003cpost-install-script-id\u003e\",\n\tShort: \"Update post-install script\",\n\tLong:  \"Update a specific post-install script.\\n\\nUse this endpoint to modify existing automation scripts.\",\n\tArgs:  cobra.MatchAll(cobra.ExactArgs(1)),\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tpayload, err := json.Marshal(updateBody(cmd))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tr, err := api.Request().VPSUpdatePostInstallScriptV1WithBodyWithResponse(context.TODO(), utils.StringToInt(args[0]), \"application/json\", bytes.NewReader(payload))\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\toutput.Format(cmd, r.Body, r.StatusCode())\n\t},\n}\n```\n\n","path":"github.com/hostinger/api-cli/cmd/vps/post_install_scripts","name":"post_install_scripts","synopsis":"","isRedistributable":true}
