diff --git a/.gitignore b/.gitignore index dee441537f..0f71fa0160 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ out .vscode/ +.idea diff --git a/base/client.go b/base/client.go index 761174eda3..32dce646ee 100644 --- a/base/client.go +++ b/base/client.go @@ -1,6 +1,8 @@ package base import ( + "github.com/ucloud/ucloud-sdk-go/services/ufile" + "github.com/jellybean4/ucloud-sdk-go/services/uflink" ppathx "github.com/ucloud/ucloud-sdk-go/private/services/pathx" pudb "github.com/ucloud/ucloud-sdk-go/private/services/udb" puhost "github.com/ucloud/ucloud-sdk-go/private/services/uhost" @@ -46,6 +48,8 @@ type Client struct { udb.UDBClient umem.UMemClient uphost.UPHostClient + uflink.UFlinkClient + ufile.UFileClient PrivateUHostClient PrivateUDBClient PrivateUMemClient @@ -74,6 +78,8 @@ func NewClient(config *sdk.Config, credential *auth.Credential) *Client { pudbClient = *pudb.NewClient(config, credential) pumemClient = *pumem.NewClient(config, credential) ppathxClient = *ppathx.NewClient(config, credential) + uflinkClient = *uflink.NewClient(config, credential) + ufileClient = *ufile.NewClient(config, credential) ) uaccountClient.Client.AddRequestHandler(handler) @@ -91,6 +97,8 @@ func NewClient(config *sdk.Config, credential *auth.Credential) *Client { pudbClient.Client.AddRequestHandler(handler) pumemClient.Client.AddRequestHandler(handler) ppathxClient.Client.AddRequestHandler(handler) + ufileClient.Client.AddRequestHandler(handler) + uflinkClient.Client.AddRequestHandler(handler) return &Client{ uaccountClient, @@ -104,6 +112,8 @@ func NewClient(config *sdk.Config, credential *auth.Credential) *Client { udbClient, umemClient, uphostClient, + uflinkClient, + ufileClient, puhostClient, pudbClient, pumemClient, diff --git a/cmd/root.go b/cmd/root.go index c96ce1f2ef..58810bcdd0 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -183,6 +183,7 @@ func Execute() { cmd.AddCommand(NewCmdRedis()) cmd.AddCommand(NewCmdMemcache()) cmd.AddCommand(NewCmdExt()) + cmd.AddCommand(NewCmdUFlink()) for _, c := range cmd.Commands() { if c.Name() != "init" && c.Name() != "gendoc" && c.Name() != "config" { c.PersistentFlags().StringVar(&global.PublicKey, "public-key", global.PublicKey, "Set public key to override the public key in local config file") diff --git a/cmd/uflink.go b/cmd/uflink.go new file mode 100644 index 0000000000..3c478eac9b --- /dev/null +++ b/cmd/uflink.go @@ -0,0 +1,535 @@ +package cmd + +import ( + "encoding/json" + "fmt" + "github.com/jellybean4/ucloud-sdk-go/services/uflink" + "github.com/spf13/cobra" + "github.com/ucloud/ucloud-cli/base" + "github.com/ucloud/ucloud-cli/ux" + "io" + "io/ioutil" + "net/url" + "strings" +) + +type UFlinkApplicationRow struct { + ApplicationName string + OriginalName string + Id string + State string + ElapsedTime int + StartedTime int + FinishedTime int + AllocatedMB float32 + AllocatedVCores int + FlinkVersion string + Request string +} + +type UFlinkPointFileRow struct { + Path string + ModificationTime int + Length int + BlockSize int +} + +type FlinkRunParams struct { + Class string `json:"--class,omitempty"` + Parallelism string `json:"--parallelism,omitempty"` + FromSavepoint string `json:"--fromSavepoint,omitempty"` + YarnJobManagerMemory string `json:"--yarnjobManagerMemory,omitempty"` + YarnContainer string `json:"--yarncontainer,omitempty"` + YarnSlots string `json:"--yarnslots,omitempty"` + YarnTaskManagerMemory string `json:"--yarntaskManagerMemory,omitempty"` +} + +func NewCmdUFlink() *cobra.Command { + cmd := &cobra.Command{ + Use: "uflink", + Short: "list,create,kill,describe,resubmit uflink application", + Long: `list,create,kill,describe,resubmit uflink application`, + Args: cobra.NoArgs, + } + out := base.Cxt.GetWriter() + cmd.AddCommand(NewCmdUFlinkApplicationList(out)) + cmd.AddCommand(NewCmdUFlinkApplicationCreate(out)) + cmd.AddCommand(NewCmdUFlinkSubmittedJobList(out)) + cmd.AddCommand(NewCmdUFlinkSubmittedJobLogGet(out)) + + cmd.AddCommand(NewCmdUFlinkApplication(out, killUFlinkApplicationCmdBuilder)) + cmd.AddCommand(NewCmdUFlinkApplication(out, describeUFlinkApplicationCmdBuilder)) + cmd.AddCommand(NewCmdUFlinkApplication(out, resubmitUFlinkApplicationCmdBuilder)) + cmd.AddCommand(NewCmdUFlinkApplication(out, listUFlinkApplicationPointsCmdBuilder)) + cmd.AddCommand(NewCmdUFlinkApplication(out, runUFlinkApplicationSavepointCmdBuilder)) + return cmd +} + +func parseSubmitParams(params FlinkRunParams) (string, error) { + paramsMap := make(map[string]string) + if temp, err := json.Marshal(params); err != nil { + return "", err + } else if err := json.Unmarshal(temp, ¶msMap); err != nil { + return "", err + } else { + result := "" + for k, v := range paramsMap { + result += fmt.Sprintf(" %s %s ", k, v) + } + return result, nil + } +} + +func NewCmdUFlinkApplicationCreate(out io.Writer) *cobra.Command { + var submitParams FlinkRunParams + var flinkConf string + + req := base.BizClient.NewCreateUFlinkApplicationRequest() + cmd := &cobra.Command{ + Use: "create", + Short: `Create uflink application: [OPTIONS] `, + Long: `Create uflink application: [OPTIONS] `, + Example: `[OPTIONS] `, + Run: func(cmd *cobra.Command, args []string) { + if len(cmd.Flags().Args()) < 1 { + fmt.Fprint(out, "UFlink application ufile path not specified\n") + return + } + req.AppFile = &(cmd.Flags().Args()[0]) + + if submitParamsContent, err := parseSubmitParams(submitParams); err != nil { + fmt.Fprintf(out, "Failed to read encode submit params for %s\n", base.ParseError(err)) + return + } else { + req.SubmitParams = &submitParamsContent + } + + appParams := cmd.Flags().Args()[1:] + if len(appParams) > 0 { + appParamsContent := strings.Join(appParams, " ") + req.AppParams = &appParamsContent + } + + if flinkConf != "" { + content, err := ioutil.ReadFile(flinkConf) + if err != nil { + base.LogError(fmt.Sprintf("Failed to read runtime configs from file[%s] for %s", flinkConf, base.ParseError(err))) + return + } + configs := string(content[:]) + req.RuntimeParams = &configs + } else { + configs := "" + req.RuntimeParams = &configs + } + base.LogInfo(fmt.Sprintf("Prepare to create uflink application: %v", base.ToQueryMap(req))) + _, err := base.BizClient.CreateUFlinkApplication(req) + if err != nil { + base.LogError(fmt.Sprintf("Failed to create new uflink application: %s", base.ParseError(err))) + return + } + fmt.Fprintf(out, "Create application[%s] success\n", *req.Name) + }, + } + cmd.Flags().SortFlags = false + req.ProjectId = cmd.Flags().String("project-id", base.ConfigIns.ProjectID, "Optional. Assign project-id") + req.Region = cmd.Flags().String("region", base.ConfigIns.Region, "Optional. Assign region.") + req.Zone = cmd.Flags().String("zone", base.ConfigIns.Zone, "Optional. Assign availability zone") + req.InstanceId = cmd.Flags().String("instance-id", "", "Required. Resource ID of uflink instance") + cmd.Flags().SetFlagValuesFunc("project-id", getProjectList) + cmd.Flags().SetFlagValuesFunc("region", getRegionList) + cmd.Flags().SetFlagValuesFunc("zone", func() []string { + return getZoneList(req.GetRegion()) + }) + + req.Name = cmd.Flags().String("name", "", "Required. Name of the new uflink application") + req.FlinkVersion = cmd.Flags().String("flink-version", "1.6.4", "Required. Version of the new uflink application") + //req.AppFile = cmd.Flags().String("app-file", "", "Optional. UFile path of the uflink application jar file") + req.SQL = cmd.Flags().String("sql", "", "Optional. Flink sql used to create uflink application") + req.Resources = cmd.Flags().String("resources", "", "Optional. Comma separated list of ufile resource files") + req.JobType = cmd.Flags().String("job-type", "JAR_JOB", "Required. Job Type") + + // flink run params + cmd.Flags().StringVar(&submitParams.Class, "classname", "", `Optional. Class with the program entry point ("main" method or "getPlan()" method. Only needed if the JAR file does not specify the class in its manifest.`) + cmd.Flags().StringVar(&submitParams.Parallelism, "parallelism", "1", `Optional. The parallelism with which to run the program. Optional flag to override the default value specified in the configuration.`) + cmd.Flags().StringVar(&submitParams.FromSavepoint, "fromSavepoint", "", `Optional. Path to a savepoint to restore the job from (for example hdfs:///flink/savepoint-1537)`) + cmd.Flags().StringVar(&submitParams.YarnJobManagerMemory, "yarnjobManagerMemory", "", `Optional. Memory for JobManager Container with optional unit(default: MB)`) + cmd.Flags().StringVar(&submitParams.YarnTaskManagerMemory, "yarntaskManagerMemory", "", `Optional. Memory per TaskManager Container with optional unit (default: MB)`) + cmd.Flags().StringVar(&submitParams.YarnContainer, "yarncontainer", "1", `Optional. Number of YARN container to allocate (=Number of Task Managers)`) + cmd.Flags().StringVar(&submitParams.YarnSlots, "yarnslots", "1", `Optional. Number of slots per TaskManager`) + + //cmd.Flags().StringVar(&appParams, "app-params", "", "Optional. Main method args of the new uflink application") + cmd.Flags().StringVar(&flinkConf, "flink-conf", "", "Optional. File path of flink-conf.yaml override default flink conf") + + cmd.Flags().SetFlagValues("flink-version", "1.6.4_2.11", "1.7.2_2.11", "1.7.2_2.12", "1.8.0_2.11", "1.8.0_2.12") + cmd.Flags().SetFlagValues("job-type", "JAR_JOB", "SQL_JOB") + cmd.Flags().SetInterspersed(false) + + cmd.MarkFlagRequired("instance-id") + cmd.MarkFlagRequired("name") + cmd.MarkFlagRequired("flink-version") + cmd.MarkFlagRequired("job-type") + return cmd +} + +func NewCmdUFlinkApplicationList(out io.Writer) *cobra.Command { + var output string + offset := 0 + limit := 100 + + req := base.BizClient.NewListUFlinkApplicationsRequest() + cmd := &cobra.Command{ + Use: "list", + Short: "List all reserved uflink applications", + Long: `List all reserved uflink applications`, + Run: func(cmd *cobra.Command, args []string) { + applications, err := listAllApplications(req) + if err != nil { + base.HandleError(err) + return + } + showApplications(applications, out, output) + }, + } + cmd.Flags().SortFlags = false + req.ProjectId = cmd.Flags().String("project-id", base.ConfigIns.ProjectID, "Optional. Assign project-id") + req.Region = cmd.Flags().String("region", base.ConfigIns.Region, "Optional. Assign region.") + req.Zone = cmd.Flags().String("zone", base.ConfigIns.Zone, "Optional. Assign availability zone") + req.InstanceId = cmd.Flags().String("instance-id", "", "Required. Resource ID of uflink instance") + + cmd.Flags().StringVarP(&output, "output", "o", "", "Optional. Accept values: wide. Display more information about uflink applications") + + req.Offset = &offset + req.Limit = &limit + + cmd.Flags().SetFlagValues("output", "wide") + cmd.Flags().SetFlagValuesFunc("project-id", getProjectList) + cmd.Flags().SetFlagValuesFunc("region", getRegionList) + cmd.Flags().SetFlagValuesFunc("zone", func() []string { + return getZoneList(req.GetRegion()) + }) + + cmd.MarkFlagRequired("instance-id") + return cmd +} + +func NewCmdUFlinkApplication(out io.Writer, builder func(req *uflink.ApplicationRequest, out io.Writer) *cobra.Command) *cobra.Command { + req := base.BizClient.NewApplicationRequest() + req.SetRetryable(true) + cmd := builder(req, out) + cmd.Flags().SortFlags = false + req.ProjectId = cmd.Flags().String("project-id", base.ConfigIns.ProjectID, "Optional. Assign project-id") + req.Region = cmd.Flags().String("region", base.ConfigIns.Region, "Optional. Assign region.") + req.Zone = cmd.Flags().String("zone", base.ConfigIns.Zone, "Optional. Assign availability zone") + req.InstanceId = cmd.Flags().String("instance-id", "", "Required. Resource ID of uflink instance") + req.ApplicationId = cmd.Flags().String("application-id", "", "Required. Application Id of the specific job") + + cmd.Flags().SetFlagValuesFunc("project-id", getProjectList) + cmd.Flags().SetFlagValuesFunc("region", getRegionList) + cmd.Flags().SetFlagValuesFunc("zone", func() []string { + return getZoneList(req.GetRegion()) + }) + cmd.MarkFlagRequired("instance-id") + cmd.MarkFlagRequired("application-id") + return cmd +} + +func NewCmdUFlinkSubmittedJobList(out io.Writer) *cobra.Command { + req := base.BizClient.NewListUFlinkSubmittedJobsRequest() + cmd := &cobra.Command{ + Use: "submitted", + Short: "list all submitted history", + Long: `list all submitted history`, + Run: func(cmd *cobra.Command, args []string) { + info, err := base.BizClient.ListUFlinkSubmittedJobs(req) + if err != nil { + base.HandleError(err) + return + } + showSubmittedJobs(info.Data, out) + }, + } + cmd.Flags().SortFlags = false + req.ProjectId = cmd.Flags().String("project-id", base.ConfigIns.ProjectID, "Optional. Assign project-id") + req.Region = cmd.Flags().String("region", base.ConfigIns.Region, "Optional. Assign region.") + req.Zone = cmd.Flags().String("zone", base.ConfigIns.Zone, "Optional. Assign availability zone") + req.InstanceId = cmd.Flags().String("instance-id", "", "Required. Resource ID of uflink instance") + + cmd.Flags().SetFlagValuesFunc("project-id", getProjectList) + cmd.Flags().SetFlagValuesFunc("region", getRegionList) + cmd.Flags().SetFlagValuesFunc("zone", func() []string { + return getZoneList(req.GetRegion()) + }) + + cmd.MarkFlagRequired("instance-id") + return cmd +} + +func NewCmdUFlinkSubmittedJobLogGet(out io.Writer) *cobra.Command { + req := base.BizClient.NewGetUFlinkSubmittedJobLogRequest() + cmd := &cobra.Command{ + Use: "submitted-log", + Short: "show the specific submitted job log", + Long: `show the specific submitted job log`, + Run: func(cmd *cobra.Command, args []string) { + info, err := base.BizClient.GetUFlinkSubmittedJobLog(req) + if err != nil { + base.HandleError(err) + return + } + fmt.Fprint(out, info.Data, "\n") + }, + } + cmd.Flags().SortFlags = false + req.ProjectId = cmd.Flags().String("project-id", base.ConfigIns.ProjectID, "Optional. Assign project-id") + req.Region = cmd.Flags().String("region", base.ConfigIns.Region, "Optional. Assign region.") + req.Zone = cmd.Flags().String("zone", base.ConfigIns.Zone, "Optional. Assign availability zone") + req.InstanceId = cmd.Flags().String("instance-id", "", "Required. Resource ID of uflink instance") + req.Id = cmd.Flags().Int("job-id", 0, "Required. Submitted Id of the job") + + cmd.Flags().SetFlagValuesFunc("project-id", getProjectList) + cmd.Flags().SetFlagValuesFunc("region", getRegionList) + cmd.Flags().SetFlagValuesFunc("zone", func() []string { + return getZoneList(req.GetRegion()) + }) + + cmd.MarkFlagRequired("instance-id") + cmd.MarkFlagRequired("job-id") + return cmd +} + +func resubmitUFlinkApplicationCmdBuilder(req *uflink.ApplicationRequest, out io.Writer) *cobra.Command { + return &cobra.Command{ + Use: "resubmit", + Short: "Resubmit uflink application", + Long: "Resubmit uflink application", + Run: func(cmd *cobra.Command, args []string) { + var logs []string + req.SetRetryable(false) + res, logs := resubmitUFlinkApplication(req) + logs = append(logs, fmt.Sprintf("Resubmit application[%s] %t", *req.ApplicationId, res)) + base.LogInfo(logs...) + fmt.Fprintf(out, "Resubmit application[%s] %t\n", *req.ApplicationId, res) + }, + } +} + +func killUFlinkApplicationCmdBuilder(req *uflink.ApplicationRequest, out io.Writer) *cobra.Command { + var yes *bool + cmd := &cobra.Command{ + Use: "kill", + Short: "Kill uflink application", + Long: "Kill uflink application", + Run: func(cmd *cobra.Command, args []string) { + if !*yes { + sure, err := ux.Prompt("Are you sure you want to kill the application?") + if err != nil { + base.Cxt.Println(err) + return + } + if !sure { + return + } + } + res, logs := killApplication(req) + logs = append(logs, fmt.Sprintf("kill application %t", res)) + base.LogInfo(logs...) + fmt.Fprintf(out, "kill application %t\n", res) + }, + } + yes = cmd.Flags().BoolP("yes", "y", false, "Optional. Do not prompt for confirmation.") + return cmd +} + +func describeUFlinkApplicationCmdBuilder(req *uflink.ApplicationRequest, out io.Writer) *cobra.Command { + return &cobra.Command{ + Use: "describe", + Short: "Describe uflink application", + Long: "Describe uflink application", + Run: func(cmd *cobra.Command, args []string) { + application, err := describeUFlinkApplication(req) + if err != nil { + logs := fmt.Sprintf("Failed to describe application[%s] for %s", *req.ApplicationId, base.ParseError(err)) + base.LogError(logs) + return + } + showDetailApplication(*application) + }, + } +} + +func listUFlinkApplicationPointsCmdBuilder(req *uflink.ApplicationRequest, out io.Writer) *cobra.Command { + return &cobra.Command{ + Use: "list-points", + Short: "list-points of uflink application", + Long: "list-points of uflink application", + Run: func(cmd *cobra.Command, args []string) { + points, err := base.BizClient.ListUFlinkApplicationPoints(req) + if err != nil { + logs := fmt.Sprintf("Failed to list application[%s] points for %s", *req.ApplicationId, base.ParseError(err)) + base.LogError(logs) + return + } + showUFlinkApplicationPoints(points.Data, out) + }, + } +} + +func runUFlinkApplicationSavepointCmdBuilder(req *uflink.ApplicationRequest, out io.Writer) *cobra.Command { + return &cobra.Command{ + Use: "savepoint", + Short: "trigger savepoint of the uflink application", + Long: "trigger savepoint of the uflink application", + Run: func(cmd *cobra.Command, args [] string) { + req.SetRetryable(false) + resp, err := base.BizClient.RunUFlinkApplicationSavepoint(req) + if err != nil { + logs := fmt.Sprintf("Failed to trigger application[%s] savepoint for %s", *req.ApplicationId, base.ParseError(err)) + base.LogError(logs) + return + } + fmt.Fprintf(out, "Trigger application[%s] savepoint: %t\n", *req.ApplicationId, resp.Data) + }, + } +} + +func showUFlinkApplicationPoints(points []uflink.HDFSFileStatus, out io.Writer) { + if global.JSON { + base.PrintJSON(points, out) + } else { + cols := []string{"Path", "ModificationTime", "Length", "BlockSize"} + base.PrintTable(points, cols) + } +} + +func resubmitUFlinkApplication(req *uflink.ApplicationRequest) (bool, []string) { + var logs []string + logs = append(logs, fmt.Sprintf("api:SendUFlinkResubmitJob, request: %v", base.ToQueryMap(req))) + _, err := base.BizClient.SendUFlinkResubmitJob(req) + if err != nil { + logs = append(logs, fmt.Sprintf("Resubmit uflink application[%s] failed: %s", *req.ApplicationId, base.ParseError(err))) + return false, logs + } + logs = append(logs, fmt.Sprintf("application[%s] resubmitted", *req.ApplicationId)) + return true, logs +} + +func killApplication(req *uflink.ApplicationRequest) (bool, []string) { + var logs []string + + application, err := describeUFlinkApplication(req) + if err != nil { + logs = append(logs, fmt.Sprintf("describe application[%s] failed: %s", *req.ApplicationId, base.ParseError(err))) + return false, logs + } + + if application == nil { + logs = append(logs, fmt.Sprintf("application[%s] does not exist", *req.ApplicationId)) + return false, logs + } + + if application.State == "Running" { + _req := base.BizClient.NewApplicationRequest() + _req.ProjectId = req.ProjectId + _req.Region = req.Region + _req.Zone = req.Zone + _req.InstanceId = req.InstanceId + _req.ApplicationId = req.ApplicationId + } + logs = append(logs, fmt.Sprintf("api:KillUFlinkApplication, request:%v", base.ToQueryMap(req))) + _, err = base.BizClient.KillUFlinkApplication(req) + if err != nil { + logs = append(logs, fmt.Sprintf("kill uflink application[%s] failed: %s", *req.ApplicationId, base.ParseError(err))) + return false, logs + } + logs = append(logs, fmt.Sprintf("application[%s] killed", *req.ApplicationId)) + return true, logs +} + +func describeUFlinkApplication(req *uflink.ApplicationRequest) (*uflink.ApplicationDetailData, error) { + resp, err := base.BizClient.DescribeUFlinkApplication(req) + if err != nil { + return nil, err + } + return &resp.Data, nil +} + +func showDetailApplication(application uflink.ApplicationDetailData) { + var info []base.DescribeTableRow + info = append(info, base.DescribeTableRow{"ApplicationId", application.Id}) + info = append(info, base.DescribeTableRow{"State", application.State}) + info = append(info, base.DescribeTableRow{"Name", application.Name}) + info = append(info, base.DescribeTableRow{"AllocatedMB", fmt.Sprintf("%f", application.AllocatedMB)}) + info = append(info, base.DescribeTableRow{"AllocatedVCores", fmt.Sprintf("%d", application.AllocatedVCores)}) + info = append(info, base.DescribeTableRow{"StartedTime", fmt.Sprintf("%d", application.StartedTime)}) + info = append(info, base.DescribeTableRow{"FinishedTime", fmt.Sprintf("%d", application.FinishedTime)}) + info = append(info, base.DescribeTableRow{"ElapsedTime", fmt.Sprintf("%d", application.ElapsedTime)}) + info = append(info, base.DescribeTableRow{"TrackingUrl", application.OriginalTrackingUrl}) + if global.JSON { + base.PrintDescribe(info, true) + } else { + base.PrintDescribe(info, false) + } +} + +func showApplications(applications []uflink.ApplicationData, out io.Writer, output string) { + list := make([]UFlinkApplicationRow, 0) + for _, app := range applications { + row := UFlinkApplicationRow{} + row.ApplicationName = app.Name + row.OriginalName = app.OriginalName + row.Id = app.Id + row.State = app.State + row.StartedTime = app.StartedTime + row.FinishedTime = app.FinishedTime + row.AllocatedMB = app.AllocatedMB + row.FlinkVersion = app.FlinkVersion + row.Request = app.Request + + list = append(list, row) + } + + if global.JSON { + base.PrintJSON(list, out) + } else { + var cols []string + if output != "wide" { + cols = []string{"OriginalName", "ApplicationName", "Id", "FlinkVersion", "State"} + } else { + cols = []string{"OriginalName", "ApplicationName", "Id", "FlinkVersion", "State", "StartedTime", "FinishedTime", "AllocatedMB", "Request"} + } + base.PrintTable(list, cols) + } +} + +func showSubmittedJobs(jobs []uflink.SubmittedJob, out io.Writer) { + if global.JSON { + base.PrintJSON(jobs, out) + } else { + cols := []string{"Id", "Name", "SubmitStatus", "CreateTime", "JobType", "ApplicationId"} + base.PrintTable(jobs, cols) + } +} + +func listAllApplications(req *uflink.ListUFlinkApplicationsRequest) ([]uflink.ApplicationData, error) { + applications, _, err := listApplications(req) + if err != nil { + return nil, err + } + return applications, nil +} + +func listApplications(req *uflink.ListUFlinkApplicationsRequest) ([]uflink.ApplicationData, int, error) { + resp, err := base.BizClient.ListUFlinkApplications(req) + if err != nil { + return nil, 0, err + } + return resp.Data, resp.TotalCount, nil +} + +func Encode(v string) string { + if v == "" { + return "" + } + return url.QueryEscape(v) +} diff --git a/go.mod b/go.mod index 0167b79a43..3bc36dca83 100644 --- a/go.mod +++ b/go.mod @@ -3,11 +3,12 @@ module github.com/ucloud/ucloud-cli go 1.12 require ( + github.com/jellybean4/ucloud-sdk-go v0.12.7 github.com/kr/pretty v0.1.0 // indirect github.com/sirupsen/logrus v1.3.0 github.com/spf13/cobra v0.0.3 github.com/spf13/pflag v1.0.3 - github.com/ucloud/ucloud-sdk-go v0.8.10 + github.com/ucloud/ucloud-sdk-go v0.11.1 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect ) diff --git a/go.sum b/go.sum index ab171e03b2..8edccda890 100644 --- a/go.sum +++ b/go.sum @@ -14,6 +14,20 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jellybean4/ucloud-sdk-go v0.12.1 h1:krRGQJw01rgbo9174jBINzdVuV+JP4X3yEEdRCJIN4s= +github.com/jellybean4/ucloud-sdk-go v0.12.1/go.mod h1:nIWNgDI0RjG742B2Y2PqaqPkbsOETjke/G/R6GRjYQA= +github.com/jellybean4/ucloud-sdk-go v0.12.2 h1:zNd8B+MEHzZSei9CiyLCCgpBqfcsatP1UQZPbyoA+X0= +github.com/jellybean4/ucloud-sdk-go v0.12.2/go.mod h1:jo40UfBMSd6Pe6pdY/V1aWvLwdObcXCWhBcD2zwXOE0= +github.com/jellybean4/ucloud-sdk-go v0.12.3 h1:BjMGNp94A6/mBerbgV6W3qb48UTFXq/yqmtFCKCKAas= +github.com/jellybean4/ucloud-sdk-go v0.12.3/go.mod h1:p2j/0nODcTg0Oi1OCdYrH9NYqHLsR1lqn0xpxnG6Wi0= +github.com/jellybean4/ucloud-sdk-go v0.12.4 h1:nKtAeXk23Sa/RDeSF4LwXpetkL0KQE83mzNZG8K/LK4= +github.com/jellybean4/ucloud-sdk-go v0.12.4/go.mod h1:p2j/0nODcTg0Oi1OCdYrH9NYqHLsR1lqn0xpxnG6Wi0= +github.com/jellybean4/ucloud-sdk-go v0.12.5 h1:sgWawIQtoSc/hSjVh/npM0KAxCGhJ3isvocfpexOKE0= +github.com/jellybean4/ucloud-sdk-go v0.12.5/go.mod h1:p2j/0nODcTg0Oi1OCdYrH9NYqHLsR1lqn0xpxnG6Wi0= +github.com/jellybean4/ucloud-sdk-go v0.12.6 h1:nXEDtr8Ye+DlAQpv+HXN2Dvqpv9UnzsYiH156lqz+MI= +github.com/jellybean4/ucloud-sdk-go v0.12.6/go.mod h1:p2j/0nODcTg0Oi1OCdYrH9NYqHLsR1lqn0xpxnG6Wi0= +github.com/jellybean4/ucloud-sdk-go v0.12.7 h1:vlAbnY4KD0J3Se0xIbfikkDn7EE0sukV3xI85xnwCGM= +github.com/jellybean4/ucloud-sdk-go v0.12.7/go.mod h1:p2j/0nODcTg0Oi1OCdYrH9NYqHLsR1lqn0xpxnG6Wi0= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -53,6 +67,8 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1 github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/ucloud/ucloud-sdk-go v0.8.10 h1:CNpVvsGRV2CDeme6pmAg8AcMxxBERYndcOzyu0dRgCg= github.com/ucloud/ucloud-sdk-go v0.8.10/go.mod h1:lM6fpI8y6iwACtlbHUav823/uKPdXsNBlnBpRF2fj3c= +github.com/ucloud/ucloud-sdk-go v0.11.1 h1:rnyoqM3oJ1c3vX0IqDF4JPgVBYgPGiAxrQ6mv2woNDg= +github.com/ucloud/ucloud-sdk-go v0.11.1/go.mod h1:lM6fpI8y6iwACtlbHUav823/uKPdXsNBlnBpRF2fj3c= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 h1:3SVOIvH7Ae1KRYyQWRjXWJEA9sS/c/pjvH++55Gr648= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/LICENSE b/vendor/github.com/jellybean4/ucloud-sdk-go/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/client.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/client.go new file mode 100644 index 0000000000..a265a67272 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/client.go @@ -0,0 +1,20 @@ +package uflink + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/auth" +) + +// UDPNClient is the client of UDPN +type UFlinkClient struct { + *ucloud.Client +} + +// NewClient will return a instance of UDPNClient +func NewClient(config *ucloud.Config, credential *auth.Credential) *UFlinkClient { + meta := ucloud.ClientMeta{Product: "UFlink"} + client := ucloud.NewClientWithMeta(config, credential, meta) + return &UFlinkClient{ + client, + } +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/create_uflink_application.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/create_uflink_application.go new file mode 100644 index 0000000000..327240109e --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/create_uflink_application.go @@ -0,0 +1,49 @@ +package uflink + +import "github.com/ucloud/ucloud-sdk-go/ucloud/request" + +type CreateUFlinkApplicationRequest struct { + request.CommonBase + + InstanceId *string `required:"true"` + + Name *string `required:"true"` + + FlinkVersion *string `required:"true"` + + JobType *string `required:"true"` + + AppFile *string `required:"false"` + + AppParams *string `required:"false"` + + SubmitParams *string `required:"false"` + + RuntimeParams *string `required:"false"` + + ApplicationId *string `required:"false"` + + SQL *string `required:"false"` + + UDXFJars *string `required:"false"` + + Resources *string `required:"false"` +} + +func (c *UFlinkClient) NewCreateUFlinkApplicationRequest() *CreateUFlinkApplicationRequest { + req := &CreateUFlinkApplicationRequest{} + c.Client.SetupRequest(req) + req.SetRetryable(false) + return req +} + +func (c *UFlinkClient) CreateUFlinkApplication(req *CreateUFlinkApplicationRequest) (*ApplicationResponse3, error) { + var err error + var res ApplicationResponse3 + + err = c.Client.InvokeAction("CreateUFlinkApplication", req, &res) + if err != nil { + return &res, err + } + return &res, nil +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/describe_uflink_application.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/describe_uflink_application.go new file mode 100644 index 0000000000..97ac16c701 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/describe_uflink_application.go @@ -0,0 +1,22 @@ +package uflink + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +type DescribeUFlinkApplicationResponse struct { + response.CommonBase + + Data ApplicationDetailData +} + +func (c *UFlinkClient) DescribeUFlinkApplication(req *ApplicationRequest) (*DescribeUFlinkApplicationResponse, error) { + var err error + var res DescribeUFlinkApplicationResponse + + err = c.Client.InvokeAction("DescribeUFlinkApplication", req, &res) + if err != nil { + return &res, err + } + return &res, nil +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/doc.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/doc.go new file mode 100644 index 0000000000..d79425a36b --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/doc.go @@ -0,0 +1,9 @@ +/* +Package uflink include resources of ucloud uflink product + +See also + - Product: https://www.ucloud.cn/site/product/uflink.html + +for detail. +*/ +package uflink diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/get_uflink_network_connection.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/get_uflink_network_connection.go new file mode 100644 index 0000000000..c2dd871e13 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/get_uflink_network_connection.go @@ -0,0 +1,42 @@ +package uflink + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +type GetUFlinkNetworkConnectionRequest struct { + request.CommonBase + + InstanceId *string `required:"true"` + + Ip *string `required:"true"` + + Port *int `required:"true"` +} + +type GetUFlinkNetworkConnectionResponse struct { + response.CommonBase + + Data NetworkConnectionResult +} + +func (c *UFlinkClient) NewGetUFlinkNetworkConnectionRequest() *GetUFlinkNetworkConnectionRequest { + req := &GetUFlinkNetworkConnectionRequest{} + + c.Client.SetupRequest(req) + + req.SetRetryable(true) + return req +} + +func (c *UFlinkClient) GetUFlinkNetworkConnection(req* GetUFlinkNetworkConnectionRequest) (*GetUFlinkNetworkConnectionResponse, error) { + var err error + var res GetUFlinkNetworkConnectionResponse + + err = c.Client.InvokeAction("GetUFlinkNetworkConnection", req, &res) + if err != nil { + return &res, err + } + return &res, nil +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/get_uflink_submitted_job_log.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/get_uflink_submitted_job_log.go new file mode 100644 index 0000000000..c94844d231 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/get_uflink_submitted_job_log.go @@ -0,0 +1,38 @@ +package uflink + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +type GetUFlinkSubmittedJobLogRequest struct { + request.CommonBase + + InstanceId *string `required:"true"` + + Id *int `required:"true"` +} + +type GetUFlinkSubmittedJobLogResponse struct { + response.CommonBase + + Data string +} + +func (c *UFlinkClient) NewGetUFlinkSubmittedJobLogRequest() *GetUFlinkSubmittedJobLogRequest { + req := &GetUFlinkSubmittedJobLogRequest{} + c.Client.SetupRequest(req) + req.SetRetryable(true) + return req +} + +func (c *UFlinkClient) GetUFlinkSubmittedJobLog(req *GetUFlinkSubmittedJobLogRequest) (*GetUFlinkSubmittedJobLogResponse, error) { + var err error + var res GetUFlinkSubmittedJobLogResponse + + err = c.Client.InvokeAction("GetUFlinkSubmittedJobLog", req, &res) + if err != nil { + return &res, err + } + return &res, nil +} \ No newline at end of file diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/kill_uflink_application.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/kill_uflink_application.go new file mode 100644 index 0000000000..e6d5d6fa08 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/kill_uflink_application.go @@ -0,0 +1,22 @@ +package uflink + + +func (c *UFlinkClient) NewApplicationRequest() *ApplicationRequest { + req := &ApplicationRequest{} + + c.Client.SetupRequest(req) + + req.SetRetryable(true) + return req +} + +func (c *UFlinkClient) KillUFlinkApplication(req *ApplicationRequest) (*ApplicationResponse, error) { + var err error + var res ApplicationResponse + + err = c.Client.InvokeAction("KillUFlinkApplication", req, &res) + if err != nil { + return &res, err + } + return &res, nil +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/list_uflink_application_points.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/list_uflink_application_points.go new file mode 100644 index 0000000000..eb4e3b26ad --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/list_uflink_application_points.go @@ -0,0 +1,20 @@ +package uflink + +import "github.com/ucloud/ucloud-sdk-go/ucloud/response" + +type ListUFlinkApplicationPointsResponse struct { + response.CommonBase + + Data []HDFSFileStatus +} + +func (c *UFlinkClient) ListUFlinkApplicationPoints(req *ApplicationRequest) (*ListUFlinkApplicationPointsResponse, error) { + var err error + var res ListUFlinkApplicationPointsResponse + + err = c.Client.InvokeAction("ListUFlinkApplicationPoints", req, &res) + if err != nil { + return &res, err + } + return &res, nil +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/list_uflink_applications.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/list_uflink_applications.go new file mode 100644 index 0000000000..0a42f68b4e --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/list_uflink_applications.go @@ -0,0 +1,59 @@ +package uflink + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// List all uflink applications reserved +type ListUFlinkApplicationsRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 集群资源ID + InstanceId *string `required:"true"` + + // 分页起始条目数,默认为0 + Offset *int `required:"false"` + + // 每页显示数据条目上限,默认为0 + Limit *int `required:"false"` +} + +type ListUFlinkApplicationsResponse struct { + response.CommonBase + + // 应用总数 + TotalCount int + + // 应用详细数据 + Data []ApplicationData +} + +func (c *UFlinkClient) NewListUFlinkApplicationsRequest() *ListUFlinkApplicationsRequest { + req := &ListUFlinkApplicationsRequest{} + + c.Client.SetupRequest(req) + + req.SetRetryable(true) + return req +} + +func (c *UFlinkClient) ListUFlinkApplications(req *ListUFlinkApplicationsRequest) (*ListUFlinkApplicationsResponse, error) { + var err error + var res ListUFlinkApplicationsResponse + + err = c.Client.InvokeAction("ListUFlinkApplications", req, &res) + if err != nil { + return &res, err + } + return &res, nil +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/list_uflink_submitted_job.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/list_uflink_submitted_job.go new file mode 100644 index 0000000000..d83b2c1788 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/list_uflink_submitted_job.go @@ -0,0 +1,39 @@ +package uflink + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +type ListUFlinkSubmittedJobsRequest struct { + request.CommonBase + + // 集群资源ID + InstanceId *string `required:"true"` +} + +type ListUFlinkSubmittedJobsResponse struct { + response.CommonBase + + TotalCount int + + Data []SubmittedJob +} + +func (c *UFlinkClient) NewListUFlinkSubmittedJobsRequest() *ListUFlinkSubmittedJobsRequest { + req := &ListUFlinkSubmittedJobsRequest{} + c.Client.SetupRequest(req) + req.SetRetryable(true) + return req +} + +func (c *UFlinkClient) ListUFlinkSubmittedJobs(req *ListUFlinkSubmittedJobsRequest) (*ListUFlinkSubmittedJobsResponse, error) { + var err error + var res ListUFlinkSubmittedJobsResponse + + err = c.Client.InvokeAction("ListUFlinkSubmittedJob", req, &res) + if err != nil { + return &res, err + } + return &res, nil +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/run_uflink_application_savepoint.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/run_uflink_application_savepoint.go new file mode 100644 index 0000000000..92f072aa76 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/run_uflink_application_savepoint.go @@ -0,0 +1,12 @@ +package uflink + +func (c *UFlinkClient) RunUFlinkApplicationSavepoint(req *ApplicationRequest) (*ApplicationResponse, error) { + var err error + var res ApplicationResponse + + err = c.Client.InvokeAction("RunUFlinkApplicationSavepoint", req, &res) + if err != nil { + return &res, err + } + return &res, nil +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/send_uflink_resubmit_job.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/send_uflink_resubmit_job.go new file mode 100644 index 0000000000..44caa8ae4b --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/send_uflink_resubmit_job.go @@ -0,0 +1,12 @@ +package uflink + +func (c *UFlinkClient) SendUFlinkResubmitJob(req *ApplicationRequest) (*ApplicationResponse3, error) { + var err error + var res ApplicationResponse3 + + err = c.Client.InvokeAction("SendUFlinkResubmitJob", req, &res) + if err != nil { + return &res, err + } + return &res, nil +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_hdfs_file_status.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_hdfs_file_status.go new file mode 100644 index 0000000000..ee9d09a0d8 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_hdfs_file_status.go @@ -0,0 +1,11 @@ +package uflink + +type HDFSFileStatus struct { + Path string + + ModificationTime int + + Length int + + BlockSize int +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_network_connection_result.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_network_connection_result.go new file mode 100644 index 0000000000..b27ed1288a --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_network_connection_result.go @@ -0,0 +1,7 @@ +package uflink + +type NetworkConnectionResult struct { + Reachable bool + + Message string +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_application_data.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_application_data.go new file mode 100644 index 0000000000..cb15a64a15 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_application_data.go @@ -0,0 +1,40 @@ +package uflink + +/* +UFlinkApplicationData - ListUFlinkApplications +*/ + +type ApplicationData struct { + // 应用已经运行的时长 + ElapsedTime int + + // 应用的Yarn ApplicationId + Id string + + // 应用的名称,全局唯一 + Name string + + // 应用的当前状态 + State string + + // 应用的启动时间 + StartedTime int + + // 应用的结束时间 + FinishedTime int + + // 应用分配的内存大小 + AllocatedMB float32 + + // 应用分配的CPU数量 + AllocatedVCores int + + // Flink版本信息 + FlinkVersion string + + // 应用的原始名称 + OriginalName string + + // 应用提交的各种参数 + Request string +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_application_detail_data.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_application_detail_data.go new file mode 100644 index 0000000000..060ea29679 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_application_detail_data.go @@ -0,0 +1,29 @@ +package uflink + +type ApplicationDetailData struct { + // 应用已经运行的时长 + ElapsedTime int + + OriginalTrackingUrl string + + // 应用的Yarn ApplicationId + Id string + + // 应用的名称,全局唯一 + Name string + + // 应用的当前状态 + State string + + // 应用的启动时间 + StartedTime int + + // 应用的结束时间 + FinishedTime int + + // 应用分配的内存大小 + AllocatedMB float32 + + // 应用分配的CPU数量 + AllocatedVCores int +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_application_request.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_application_request.go new file mode 100644 index 0000000000..ece093f634 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_application_request.go @@ -0,0 +1,20 @@ +package uflink + +import "github.com/ucloud/ucloud-sdk-go/ucloud/request" + +type ApplicationRequest struct { + request.CommonBase + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) + // Zone *string `required:"false"` + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + InstanceId *string `required:"true"` + + ApplicationId *string `required:"true"` +} diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_application_response.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_application_response.go new file mode 100644 index 0000000000..8ee464a103 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_application_response.go @@ -0,0 +1,21 @@ +package uflink + +import "github.com/ucloud/ucloud-sdk-go/ucloud/response" + +type ApplicationResponse struct { + response.CommonBase + + Data bool +} + +type ApplicationResponse2 struct { + response.CommonBase + + Data string +} + +type ApplicationResponse3 struct { + response.CommonBase + + Data int64 +} \ No newline at end of file diff --git a/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_submitted_job_data.go b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_submitted_job_data.go new file mode 100644 index 0000000000..ea6e8977f9 --- /dev/null +++ b/vendor/github.com/jellybean4/ucloud-sdk-go/services/uflink/type_uflink_submitted_job_data.go @@ -0,0 +1,11 @@ +package uflink + +type SubmittedJob struct { + SubmitStatus string + CreateTime int + Name string + Id int + JobType string + Request string + ApplicationId string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/accessor.go b/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/accessor.go index efe834c6b8..5dc2ac8e26 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/accessor.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/private/utils/accessor.go @@ -57,7 +57,10 @@ func ValueAtPath(v interface{}, path string) (interface{}, error) { } if rv.Kind() == reflect.Struct { - itemV := rv.FieldByName(components[0]) + itemV := rv.FieldByNameFunc(func(s string) bool { + return strings.ToLower(s) == strings.ToLower(components[0]) + }) + if !itemV.IsValid() { return nil, errors.Errorf("path %s is invalid for struct", path) } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/pathx/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/pathx/client.go index 0f18ce6c9a..0f97293b04 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/pathx/client.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/pathx/client.go @@ -1,3 +1,5 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + package pathx import ( @@ -12,7 +14,8 @@ type PathXClient struct { // NewClient will return a instance of PathXClient func NewClient(config *ucloud.Config, credential *auth.Credential) *PathXClient { - client := ucloud.NewClient(config, credential) + meta := ucloud.ClientMeta{Product: "PathX"} + client := ucloud.NewClientWithMeta(config, credential, meta) return &PathXClient{ client, } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/client.go index 26c8f390c8..2dd7e401bb 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/client.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uaccount/client.go @@ -1,3 +1,5 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + package uaccount import ( @@ -12,7 +14,8 @@ type UAccountClient struct { // NewClient will return a instance of UAccountClient func NewClient(config *ucloud.Config, credential *auth.Credential) *UAccountClient { - client := ucloud.NewClient(config, credential) + meta := ucloud.ClientMeta{Product: "UAccount"} + client := ucloud.NewClientWithMeta(config, credential, meta) return &UAccountClient{ client, } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/client.go index 613bc6abbd..ae2c40649b 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/client.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/udb/client.go @@ -1,3 +1,5 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + package udb import ( @@ -12,7 +14,8 @@ type UDBClient struct { // NewClient will return a instance of UDBClient func NewClient(config *ucloud.Config, credential *auth.Credential) *UDBClient { - client := ucloud.NewClient(config, credential) + meta := ucloud.ClientMeta{Product: "UDB"} + client := ucloud.NewClientWithMeta(config, credential, meta) return &UDBClient{ client, } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/udisk/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/udisk/client.go index 865a2db25e..a56a6cc9b6 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/udisk/client.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/udisk/client.go @@ -1,3 +1,5 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + package udisk import ( @@ -12,7 +14,8 @@ type UDiskClient struct { // NewClient will return a instance of UDiskClient func NewClient(config *ucloud.Config, credential *auth.Credential) *UDiskClient { - client := ucloud.NewClient(config, credential) + meta := ucloud.ClientMeta{Product: "UDisk"} + client := ucloud.NewClientWithMeta(config, credential, meta) return &UDiskClient{ client, } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/udpn/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/udpn/client.go index 29bed9a63d..8ed0938373 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/udpn/client.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/udpn/client.go @@ -1,3 +1,5 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + package udpn import ( @@ -12,7 +14,8 @@ type UDPNClient struct { // NewClient will return a instance of UDPNClient func NewClient(config *ucloud.Config, credential *auth.Credential) *UDPNClient { - client := ucloud.NewClient(config, credential) + meta := ucloud.ClientMeta{Product: "UDPN"} + client := ucloud.NewClientWithMeta(config, credential, meta) return &UDPNClient{ client, } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/client.go new file mode 100644 index 0000000000..479a8df2f5 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/client.go @@ -0,0 +1,21 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ufile + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/auth" +) + +// UFileClient is the client of UFile +type UFileClient struct { + *ucloud.Client +} + +// NewClient will return a instance of UFileClient +func NewClient(config *ucloud.Config, credential *auth.Credential) *UFileClient { + client := ucloud.NewClient(config, credential) + return &UFileClient{ + client, + } +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/create_bucket.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/create_bucket.go new file mode 100644 index 0000000000..081ac606d3 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/create_bucket.go @@ -0,0 +1,63 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ufile + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// CreateBucketRequest is request schema for CreateBucket action +type CreateBucketRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // 待创建Bucket的名称,具有全局唯一性 + BucketName *string `required:"true"` + + // Bucket访问类型,public或private; 默认为private + Type *string `required:"false"` +} + +// CreateBucketResponse is response schema for CreateBucket action +type CreateBucketResponse struct { + response.CommonBase + + // 已创建Bucket的ID + BucketId string + + // 已创建Bucket的名称 + BucketName string +} + +// NewCreateBucketRequest will create request of CreateBucket action. +func (c *UFileClient) NewCreateBucketRequest() *CreateBucketRequest { + req := &CreateBucketRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// CreateBucket - 创建Bucket +func (c *UFileClient) CreateBucket(req *CreateBucketRequest) (*CreateBucketResponse, error) { + var err error + var res CreateBucketResponse + + reqCopier := *req + + err = c.Client.InvokeAction("CreateBucket", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/create_ufile_token.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/create_ufile_token.go new file mode 100644 index 0000000000..47887bf794 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/create_ufile_token.go @@ -0,0 +1,69 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ufile + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// CreateUFileTokenRequest is request schema for CreateUFileToken action +type CreateUFileTokenRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"false"` + + // 令牌允许操作的bucket,默认*表示全部 + AllowedBuckets []string `required:"false"` + + // 令牌允许执行的操作,[ TOKEN_ALLOW_NONE , TOKEN_ALLOW_READ , TOKEN_ALLOW_WRITE , TOKEN_ALLOW_DELETE , TOKEN_ALLOW_LIST, TOKEN_ALLOW_IOP , TOKEN_ALLOW_DP ]。默认TOKEN_ALLOW_NONE + AllowedOps []string `required:"false"` + + // 令牌允许操作的key前缀,默认*表示全部 + AllowedPrefixes []string `required:"false"` + + // 令牌的超时时间点(时间戳),默认一天;注意:过期时间不能超过 4102416000 + ExpireTime *int `required:"false"` + + // 令牌名称 + TokenName *string `required:"true"` +} + +// CreateUFileTokenResponse is response schema for CreateUFileToken action +type CreateUFileTokenResponse struct { + response.CommonBase + + // 创建令牌的token_id + TokenId string +} + +// NewCreateUFileTokenRequest will create request of CreateUFileToken action. +func (c *UFileClient) NewCreateUFileTokenRequest() *CreateUFileTokenRequest { + req := &CreateUFileTokenRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// CreateUFileToken - 创建ufile令牌 +func (c *UFileClient) CreateUFileToken(req *CreateUFileTokenRequest) (*CreateUFileTokenResponse, error) { + var err error + var res CreateUFileTokenResponse + + reqCopier := *req + + err = c.Client.InvokeAction("CreateUFileToken", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/delete_bucket.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/delete_bucket.go new file mode 100644 index 0000000000..8d62e1fd30 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/delete_bucket.go @@ -0,0 +1,60 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ufile + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DeleteBucketRequest is request schema for DeleteBucket action +type DeleteBucketRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 待删除Bucket的名称 + BucketName *string `required:"true"` +} + +// DeleteBucketResponse is response schema for DeleteBucket action +type DeleteBucketResponse struct { + response.CommonBase + + // Bucket的ID + BucketId string + + // Bucket的名称 + BucketName string +} + +// NewDeleteBucketRequest will create request of DeleteBucket action. +func (c *UFileClient) NewDeleteBucketRequest() *DeleteBucketRequest { + req := &DeleteBucketRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DeleteBucket - 删除Bucket +func (c *UFileClient) DeleteBucket(req *DeleteBucketRequest) (*DeleteBucketResponse, error) { + var err error + var res DeleteBucketResponse + + reqCopier := *req + // In order to ignore the parameters about Region + reqCopier.Region = ucloud.String("") + + err = c.Client.InvokeAction("DeleteBucket", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/delete_ufile_token.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/delete_ufile_token.go new file mode 100644 index 0000000000..c8a4600899 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/delete_ufile_token.go @@ -0,0 +1,54 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ufile + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DeleteUFileTokenRequest is request schema for DeleteUFileToken action +type DeleteUFileTokenRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // 令牌ID + TokenId *string `required:"true"` +} + +// DeleteUFileTokenResponse is response schema for DeleteUFileToken action +type DeleteUFileTokenResponse struct { + response.CommonBase +} + +// NewDeleteUFileTokenRequest will create request of DeleteUFileToken action. +func (c *UFileClient) NewDeleteUFileTokenRequest() *DeleteUFileTokenRequest { + req := &DeleteUFileTokenRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DeleteUFileToken - 删除令牌 +func (c *UFileClient) DeleteUFileToken(req *DeleteUFileTokenRequest) (*DeleteUFileTokenResponse, error) { + var err error + var res DeleteUFileTokenResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DeleteUFileToken", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/describe_bucket.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/describe_bucket.go new file mode 100644 index 0000000000..6cc873192e --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/describe_bucket.go @@ -0,0 +1,64 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ufile + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeBucketRequest is request schema for DescribeBucket action +type DescribeBucketRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // 待获取Bucket的名称,若不提供,则获取所有Bucket + BucketName *string `required:"false"` + + // 获取所有Bucket列表的限制数目,默认为20 + Limit *int `required:"false"` + + // 获取所有Bucket列表的偏移数目,默认为0 + Offset *int `required:"false"` +} + +// DescribeBucketResponse is response schema for DescribeBucket action +type DescribeBucketResponse struct { + response.CommonBase + + // Bucket的描述信息 参数见 UFileBucketSet + DataSet []UFileBucketSet +} + +// NewDescribeBucketRequest will create request of DescribeBucket action. +func (c *UFileClient) NewDescribeBucketRequest() *DescribeBucketRequest { + req := &DescribeBucketRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeBucket - 获取Bucket的描述信息 +func (c *UFileClient) DescribeBucket(req *DescribeBucketRequest) (*DescribeBucketResponse, error) { + var err error + var res DescribeBucketResponse + + reqCopier := *req + + // In order to ignore the parameters about Region + reqCopier.Region = ucloud.String("") + + err = c.Client.InvokeAction("DescribeBucket", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/describe_ufile_token.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/describe_ufile_token.go new file mode 100644 index 0000000000..c935f43092 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/describe_ufile_token.go @@ -0,0 +1,66 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ufile + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeUFileTokenRequest is request schema for DescribeUFileToken action +type DescribeUFileTokenRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"false"` + + // 0表示显示部分token信息;不传递和其他情况表示显示全部token信息 + Display *int `required:"false"` + + // 令牌ID,只返回指定ID信息,否则拉取所有令牌 + TokenId *string `required:"false"` +} + +// DescribeUFileTokenResponse is response schema for DescribeUFileToken action +type DescribeUFileTokenResponse struct { + response.CommonBase + + // 操作名称 + Action string + + // 令牌描述信息 + DataSet []UFileTokenSet + + // 返回码 + RetCode int +} + +// NewDescribeUFileTokenRequest will create request of DescribeUFileToken action. +func (c *UFileClient) NewDescribeUFileTokenRequest() *DescribeUFileTokenRequest { + req := &DescribeUFileTokenRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeUFileToken - 获取令牌信息 +func (c *UFileClient) DescribeUFileToken(req *DescribeUFileTokenRequest) (*DescribeUFileTokenResponse, error) { + var err error + var res DescribeUFileTokenResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeUFileToken", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/doc.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/doc.go new file mode 100644 index 0000000000..1be7726ee2 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/doc.go @@ -0,0 +1,13 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +/* +Package ufile include resources of ucloud ufile product + +See also + + - API: https://docs.ucloud.cn/api/ufile-api/index + - Product: https://www.ucloud.cn/site/product/ufile.html + +for detail. +*/ +package ufile diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/types_ufile_bucket_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/types_ufile_bucket_set.go new file mode 100644 index 0000000000..5747ae0025 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/types_ufile_bucket_set.go @@ -0,0 +1,45 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ufile + +/* +UFileBucketSet - DescribeBucket + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn/api for detail. +*/ +type UFileBucketSet struct { + + // Bucket所属业务, general或vod或udb general: 普通业务; vod: 视频云业务; udb: 云数据库业务 + Biz string + + // Bucket的ID + BucketId string + + // Bucket名称 + BucketName string + + // 与Bucket关联的CND加速域名的ID列表 + CdnDomainId []string + + // Bucket的创建时间 + CreateTime int + + // Bucket的域名集合 参数见 UFileDomainSet + Domain UFileDomainSet + + // 是否存在自定义域名。0不存在,1存在,2错误 + HasUserDomain int + + // Bucket的修改时间 + ModifyTime int + + // Bucket所属地域 + Region string + + // 所属业务组 + Tag string + + // Bucket访问类型 + Type string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/types_ufile_domain_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/types_ufile_domain_set.go new file mode 100644 index 0000000000..6960186d08 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/types_ufile_domain_set.go @@ -0,0 +1,24 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ufile + +/* +UFileDomainSet - DescribeBucket + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn/api for detail. +*/ +type UFileDomainSet struct { + + // UCDN加速域名 + Cdn []string + + // 用户自定义CDN加速域名 + CustomCdn []string + + // 用户自定义源站域名 + CustomSrc []string + + // 源站域名 + Src []string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/types_ufile_token_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/types_ufile_token_set.go new file mode 100644 index 0000000000..596773ffe5 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/types_ufile_token_set.go @@ -0,0 +1,45 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ufile + +/* +UFileTokenSet - ufile令牌集合 + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn/api for detail. +*/ +type UFileTokenSet struct { + + // 令牌允许操作的bucket + AllowedBuckets []string + + // 令牌允许执行的操作,[ TOKEN_ALLOW_NONE , TOKEN_ALLOW_READ , TOKEN_ALLOW_WRITE , TOKEN_ALLOW_DELETE , TOKEN_ALLOW_LIST, TOKEN_ALLOW_IOP , TOKEN_ALLOW_DP ] + AllowedOps []string + + // 令牌允许操作的key前缀 + AllowedPrefixes []string + + // 创建时间 + CreateTime int + + // 令牌的超时时间点 + ExpireTime int + + // 修改时间 + ModifyTime int + + // 令牌私钥 + PrivateKey string + + // 令牌公钥 + PublicKey string + + // 所属地区 + Region string + + // 令牌ID + TokenId string + + // 令牌名称 + TokenName string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/update_bucket.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/update_bucket.go new file mode 100644 index 0000000000..ff5c79885a --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/update_bucket.go @@ -0,0 +1,62 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ufile + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// UpdateBucketRequest is request schema for UpdateBucket action +type UpdateBucketRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"true"` + + // 待修改Bucket的名称 + BucketName *string `required:"true"` + + // Bucket访问类型;public或private + Type *string `required:"true"` +} + +// UpdateBucketResponse is response schema for UpdateBucket action +type UpdateBucketResponse struct { + response.CommonBase + + // Bucket的ID + BucketId string + + // Bucket的名称 + BucketName string +} + +// NewUpdateBucketRequest will create request of UpdateBucket action. +func (c *UFileClient) NewUpdateBucketRequest() *UpdateBucketRequest { + req := &UpdateBucketRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// UpdateBucket - 更改Bucket的属性 +func (c *UFileClient) UpdateBucket(req *UpdateBucketRequest) (*UpdateBucketResponse, error) { + var err error + var res UpdateBucketResponse + + reqCopier := *req + reqCopier.Region = ucloud.String("") + + err = c.Client.InvokeAction("UpdateBucket", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/update_ufile_token.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/update_ufile_token.go new file mode 100644 index 0000000000..e801cb873b --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ufile/update_ufile_token.go @@ -0,0 +1,69 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package ufile + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// UpdateUFileTokenRequest is request schema for UpdateUFileToken action +type UpdateUFileTokenRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"false"` + + // 令牌允许操作的bucket + AllowedBuckets []string `required:"false"` + + // 令牌允许执行的操作,[ TOKEN_ALLOW_NONE , TOKEN_ALLOW_READ , TOKEN_ALLOW_WRITE , TOKEN_ALLOW_DELETE , TOKEN_ALLOW_LIST, TOKEN_ALLOW_IOP , TOKEN_ALLOW_DP ] + AllowedOps []string `required:"false"` + + // 令牌允许操作的key前缀 + AllowedPrefixes []string `required:"false"` + + // 令牌的超时时间点(时间戳);注意:过期时间不能超过 4102416000 + ExpireTime *int `required:"false"` + + // 令牌ID + TokenId *string `required:"true"` + + // 令牌名称 + TokenName *string `required:"false"` +} + +// UpdateUFileTokenResponse is response schema for UpdateUFileToken action +type UpdateUFileTokenResponse struct { + response.CommonBase +} + +// NewUpdateUFileTokenRequest will create request of UpdateUFileToken action. +func (c *UFileClient) NewUpdateUFileTokenRequest() *UpdateUFileTokenRequest { + req := &UpdateUFileTokenRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// UpdateUFileToken - 更新令牌的操作权限,可操作key的前缀,可操作bucket和令牌超时时间点 +func (c *UFileClient) UpdateUFileToken(req *UpdateUFileTokenRequest) (*UpdateUFileTokenResponse, error) { + var err error + var res UpdateUFileTokenResponse + + reqCopier := *req + + err = c.Client.InvokeAction("UpdateUFileToken", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/client.go index 85b57089aa..bf38bf07b2 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/client.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/client.go @@ -1,3 +1,5 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + package uhost import ( @@ -12,7 +14,8 @@ type UHostClient struct { // NewClient will return a instance of UHostClient func NewClient(config *ucloud.Config, credential *auth.Credential) *UHostClient { - client := ucloud.NewClient(config, credential) + meta := ucloud.ClientMeta{Product: "UHost"} + client := ucloud.NewClientWithMeta(config, credential, meta) return &UHostClient{ client, } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/create_uhost_instance.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/create_uhost_instance.go index 690eb985b6..0a87ab99e8 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/create_uhost_instance.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uhost/create_uhost_instance.go @@ -114,6 +114,12 @@ type CreateUHostInstanceRequest struct { // 最低cpu平台,枚举值["Intel/Auto", "Intel/LvyBridge", "Intel/Haswell", "Intel/Broadwell", "Intel/Skylake", "Intel/Cascadelake"(只有O型云主机可选)] MinimalCpuPlatform *string `required:"false"` + // 【批量创建主机时必填】最大创建主机数量,取值范围是[1,100]; + MaxCount *int `required:"false"` + + // GPU类型,枚举值["K80", "P40", "V100"],MachineType为G时必填 + GpuType *string `required:"false"` + // NetworkInterface NetworkInterface []CreateUHostInstanceParamNetworkInterface } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/client.go index c6ccac8f58..f5da5ed7ff 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/client.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/ulb/client.go @@ -1,3 +1,5 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + package ulb import ( @@ -12,7 +14,8 @@ type ULBClient struct { // NewClient will return a instance of ULBClient func NewClient(config *ucloud.Config, credential *auth.Credential) *ULBClient { - client := ucloud.NewClient(config, credential) + meta := ucloud.ClientMeta{Product: "ULB"} + client := ucloud.NewClientWithMeta(config, credential, meta) return &ULBClient{ client, } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/umem/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/umem/client.go index 577525aca8..7c08c1758d 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/umem/client.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/umem/client.go @@ -1,3 +1,5 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + package umem import ( @@ -12,7 +14,8 @@ type UMemClient struct { // NewClient will return a instance of UMemClient func NewClient(config *ucloud.Config, credential *auth.Credential) *UMemClient { - client := ucloud.NewClient(config, credential) + meta := ucloud.ClientMeta{Product: "UMem"} + client := ucloud.NewClientWithMeta(config, credential, meta) return &UMemClient{ client, } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/client.go index 745ad23ee9..e714444f20 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/client.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/client.go @@ -1,3 +1,5 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + package unet import ( @@ -12,7 +14,8 @@ type UNetClient struct { // NewClient will return a instance of UNetClient func NewClient(config *ucloud.Config, credential *auth.Credential) *UNetClient { - client := ucloud.NewClient(config, credential) + meta := ucloud.ClientMeta{Product: "UNet"} + client := ucloud.NewClientWithMeta(config, credential, meta) return &UNetClient{ client, } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_vip.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_vip.go index fd8c972f08..df70ab839f 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_vip.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/describe_vip.go @@ -1,5 +1,4 @@ -//Code is generated by ucloud code generator, don't modify it by hand, it will cause undefined behaviors. -//go:generate ucloud-gen-go-api UNet DescribeVIP +// Code is generated by ucloud-model, DO NOT EDIT IT. package unet @@ -12,17 +11,17 @@ import ( type DescribeVIPRequest struct { request.CommonBase + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"true"` + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) // Region *string `required:"true"` // [公共参数] 可用区。参见 [可用区列表](../summary/regionlist.html) // Zone *string `required:"false"` - // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) - // ProjectId *string `required:"false"` - - // vpc的id,指定SubnetId时必填 - VPCId *string `required:"false"` + // 业务组 + BusinessId *string `required:"false"` // 子网id,不指定则获取VPCId下的所有vip SubnetId *string `required:"false"` @@ -30,22 +29,25 @@ type DescribeVIPRequest struct { // 业务组名称, 默认为 Default Tag *string `required:"false"` - // 业务组 - BusinessId *string `required:"false"` + // VIP ID + VIPId *string `required:"false"` + + // vpc的id,指定SubnetId时必填 + VPCId *string `required:"false"` } // DescribeVIPResponse is response schema for DescribeVIP action type DescribeVIPResponse struct { response.CommonBase - // 内网VIP详情,请见VIPDetailSet - VIPSet []VIPDetailSet - // 内网VIP地址列表 DataSet []string // vip数量 TotalCount int + + // 内网VIP详情,请见VIPDetailSet + VIPSet []VIPDetailSet } // NewDescribeVIPRequest will create request of DescribeVIP action. @@ -65,7 +67,9 @@ func (c *UNetClient) DescribeVIP(req *DescribeVIPRequest) (*DescribeVIPResponse, var err error var res DescribeVIPResponse - err = c.Client.InvokeAction("DescribeVIP", req, &res) + reqCopier := *req + + err = c.Client.InvokeAction("DescribeVIP", &reqCopier, &res) if err != nil { return &res, err } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_vipdetail_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_vip_detail_set.go similarity index 65% rename from vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_vipdetail_set.go rename to vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_vip_detail_set.go index 44bcbf41a4..918daa3ebb 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_vipdetail_set.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/types_vip_detail_set.go @@ -1,34 +1,42 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + package unet /* VIPDetailSet - VIPDetailSet this model is auto created by ucloud code generater for open api, -you can also see https://docs.ucloud.cn for detail. +you can also see https://docs.ucloud.cn/api for detail. */ type VIPDetailSet struct { - // 地域 - Zone string - - // 虚拟ip id - VIPId string - // 创建时间 CreateTime int + // VIP名称 + Name string + // 真实主机ip RealIp string - // 虚拟ip - VIP string + // VIP备注 + Remark string // 子网id SubnetId string + // VIP所属业务组 + Tag string + + // 虚拟ip + VIP string + + // 虚拟ip id + VIPId string + // VPC id VPCId string - // Virtual IP 名称 - Name string + // 地域 + Zone string } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/update_vip_attribute.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/update_vip_attribute.go new file mode 100644 index 0000000000..cc36dee25a --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/unet/update_vip_attribute.go @@ -0,0 +1,63 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package unet + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// UpdateVIPAttributeRequest is request schema for UpdateVIPAttribute action +type UpdateVIPAttributeRequest struct { + request.CommonBase + + // [公共参数] 项目ID。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // 内网VIP的名称 + Name *string `required:"false"` + + // 内网VIP的备注 + Remark *string `required:"false"` + + // 内网VIP所属的业务组 + Tag *string `required:"false"` + + // 内网VIP的资源Id + VIPId *string `required:"true"` +} + +// UpdateVIPAttributeResponse is response schema for UpdateVIPAttribute action +type UpdateVIPAttributeResponse struct { + response.CommonBase +} + +// NewUpdateVIPAttributeRequest will create request of UpdateVIPAttribute action. +func (c *UNetClient) NewUpdateVIPAttributeRequest() *UpdateVIPAttributeRequest { + req := &UpdateVIPAttributeRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// UpdateVIPAttribute - 更新VIP信息 +func (c *UNetClient) UpdateVIPAttribute(req *UpdateVIPAttributeRequest) (*UpdateVIPAttributeResponse, error) { + var err error + var res UpdateVIPAttributeResponse + + reqCopier := *req + + err = c.Client.InvokeAction("UpdateVIPAttribute", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/uphost/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/uphost/client.go index 564d2a6f53..2ebf7ba979 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/uphost/client.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/uphost/client.go @@ -1,3 +1,5 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + package uphost import ( @@ -12,7 +14,8 @@ type UPHostClient struct { // NewClient will return a instance of UPHostClient func NewClient(config *ucloud.Config, credential *auth.Credential) *UPHostClient { - client := ucloud.NewClient(config, credential) + meta := ucloud.ClientMeta{Product: "UPHost"} + client := ucloud.NewClientWithMeta(config, credential, meta) return &UPHostClient{ client, } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/add_white_list_resource.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/add_white_list_resource.go new file mode 100644 index 0000000000..32d54ae04d --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/add_white_list_resource.go @@ -0,0 +1,57 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// AddWhiteListResourceRequest is request schema for AddWhiteListResource action +type AddWhiteListResourceRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // NAT网关Id + NATGWId *string `required:"true"` + + // 可添加白名单的资源Id + ResourceIds []string `required:"true"` +} + +// AddWhiteListResourceResponse is response schema for AddWhiteListResource action +type AddWhiteListResourceResponse struct { + response.CommonBase +} + +// NewAddWhiteListResourceRequest will create request of AddWhiteListResource action. +func (c *VPCClient) NewAddWhiteListResourceRequest() *AddWhiteListResourceRequest { + req := &AddWhiteListResourceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// AddWhiteListResource - 添加NAT网关白名单 +func (c *VPCClient) AddWhiteListResource(req *AddWhiteListResourceRequest) (*AddWhiteListResourceResponse, error) { + var err error + var res AddWhiteListResourceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("AddWhiteListResource", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/client.go index fe52e6c3da..1298deba46 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/client.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/client.go @@ -1,3 +1,5 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + package vpc import ( @@ -5,14 +7,15 @@ import ( "github.com/ucloud/ucloud-sdk-go/ucloud/auth" ) -// VPCClient is the client of VPC2.0 +// VPCClient is the client of VPC type VPCClient struct { *ucloud.Client } // NewClient will return a instance of VPCClient func NewClient(config *ucloud.Config, credential *auth.Credential) *VPCClient { - client := ucloud.NewClient(config, credential) + meta := ucloud.ClientMeta{Product: "VPC2.0"} + client := ucloud.NewClientWithMeta(config, credential, meta) return &VPCClient{ client, } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_natgw.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_natgw.go new file mode 100644 index 0000000000..f62f28b9f5 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_natgw.go @@ -0,0 +1,78 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// CreateNATGWRequest is request schema for CreateNATGW action +type CreateNATGWRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // NAT网关绑定的EIPId + EIPIds []string `required:"true"` + + // NAT网关绑定的防火墙Id + FirewallId *string `required:"true"` + + // 白名单开关标记。0表示关闭,1表示开启。默认为0 + IfOpen *int `required:"false"` + + // NAT网关名称 + NATGWName *string `required:"true"` + + // 备注。默认为空 + Remark *string `required:"false"` + + // NAT网关绑定的子网Id + SubnetworkIds []string `required:"true"` + + // 业务组。默认为空 + Tag *string `required:"false"` + + // NAT网关所属的VPC Id。默认为Default VPC Id + VPCId *string `required:"false"` +} + +// CreateNATGWResponse is response schema for CreateNATGW action +type CreateNATGWResponse struct { + response.CommonBase + + // 申请到的NATGateWay Id + NATGWId string +} + +// NewCreateNATGWRequest will create request of CreateNATGW action. +func (c *VPCClient) NewCreateNATGWRequest() *CreateNATGWRequest { + req := &CreateNATGWRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// CreateNATGW - 创建NAT网关 +func (c *VPCClient) CreateNATGW(req *CreateNATGWRequest) (*CreateNATGWResponse, error) { + var err error + var res CreateNATGWResponse + + reqCopier := *req + + err = c.Client.InvokeAction("CreateNATGW", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_natgw_policy.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_natgw_policy.go new file mode 100644 index 0000000000..008e01b50a --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/create_natgw_policy.go @@ -0,0 +1,75 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// CreateNATGWPolicyRequest is request schema for CreateNATGWPolicy action +type CreateNATGWPolicyRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // 目标IP。填写对应的目标IP地址 + DstIP *string `required:"true"` + + // 目标端口。可填写固定端口,也可填写端口范围。支持的端口范围为1-65535 + DstPort *string `required:"true"` + + // NAT网关Id + NATGWId *string `required:"true"` + + // 转发策略名称。默认为空 + PolicyName *string `required:"false"` + + // 协议类型。枚举值为:TCP、UDP + Protocol *string `required:"true"` + + // 源IP。填写对应的EIP Id + SrcEIPId *string `required:"true"` + + // 源端口。可填写固定端口,也可填写端口范围。支持的端口范围为1-65535 + SrcPort *string `required:"true"` +} + +// CreateNATGWPolicyResponse is response schema for CreateNATGWPolicy action +type CreateNATGWPolicyResponse struct { + response.CommonBase + + // 创建时分配的策略Id + PolicyId string +} + +// NewCreateNATGWPolicyRequest will create request of CreateNATGWPolicy action. +func (c *VPCClient) NewCreateNATGWPolicyRequest() *CreateNATGWPolicyRequest { + req := &CreateNATGWPolicyRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(false) + return req +} + +// CreateNATGWPolicy - 添加NAT网关端口转发规则 +func (c *VPCClient) CreateNATGWPolicy(req *CreateNATGWPolicyRequest) (*CreateNATGWPolicyResponse, error) { + var err error + var res CreateNATGWPolicyResponse + + reqCopier := *req + + err = c.Client.InvokeAction("CreateNATGWPolicy", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_natgw.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_natgw.go new file mode 100644 index 0000000000..258ad84b6c --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_natgw.go @@ -0,0 +1,57 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DeleteNATGWRequest is request schema for DeleteNATGW action +type DeleteNATGWRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // NAT网关Id + NATGWId *string `required:"true"` + + // 是否释放绑定的EIP。true:解绑并释放;false:只解绑不释放。默认为false + ReleaseEip *bool `required:"false"` +} + +// DeleteNATGWResponse is response schema for DeleteNATGW action +type DeleteNATGWResponse struct { + response.CommonBase +} + +// NewDeleteNATGWRequest will create request of DeleteNATGW action. +func (c *VPCClient) NewDeleteNATGWRequest() *DeleteNATGWRequest { + req := &DeleteNATGWRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DeleteNATGW - 删除NAT网关 +func (c *VPCClient) DeleteNATGW(req *DeleteNATGWRequest) (*DeleteNATGWResponse, error) { + var err error + var res DeleteNATGWResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DeleteNATGW", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_natgw_policy.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_natgw_policy.go new file mode 100644 index 0000000000..3779d9d093 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_natgw_policy.go @@ -0,0 +1,57 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DeleteNATGWPolicyRequest is request schema for DeleteNATGWPolicy action +type DeleteNATGWPolicyRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // NAT网关Id + NATGWId *string `required:"true"` + + // 端口转发规则Id + PolicyId *string `required:"true"` +} + +// DeleteNATGWPolicyResponse is response schema for DeleteNATGWPolicy action +type DeleteNATGWPolicyResponse struct { + response.CommonBase +} + +// NewDeleteNATGWPolicyRequest will create request of DeleteNATGWPolicy action. +func (c *VPCClient) NewDeleteNATGWPolicyRequest() *DeleteNATGWPolicyRequest { + req := &DeleteNATGWPolicyRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DeleteNATGWPolicy - 删除NAT网关端口转发规则 +func (c *VPCClient) DeleteNATGWPolicy(req *DeleteNATGWPolicyRequest) (*DeleteNATGWPolicyResponse, error) { + var err error + var res DeleteNATGWPolicyResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DeleteNATGWPolicy", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_white_list_resource.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_white_list_resource.go new file mode 100644 index 0000000000..dd7f08d22e --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/delete_white_list_resource.go @@ -0,0 +1,57 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DeleteWhiteListResourceRequest is request schema for DeleteWhiteListResource action +type DeleteWhiteListResourceRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // NAT网关Id + NATGWId *string `required:"true"` + + // 删除白名单的资源Id + ResourceIds []string `required:"true"` +} + +// DeleteWhiteListResourceResponse is response schema for DeleteWhiteListResource action +type DeleteWhiteListResourceResponse struct { + response.CommonBase +} + +// NewDeleteWhiteListResourceRequest will create request of DeleteWhiteListResource action. +func (c *VPCClient) NewDeleteWhiteListResourceRequest() *DeleteWhiteListResourceRequest { + req := &DeleteWhiteListResourceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DeleteWhiteListResource - 删除NAT网关白名单列表 +func (c *VPCClient) DeleteWhiteListResource(req *DeleteWhiteListResourceRequest) (*DeleteWhiteListResourceResponse, error) { + var err error + var res DeleteWhiteListResourceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DeleteWhiteListResource", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_natgw.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_natgw.go new file mode 100644 index 0000000000..40d3031746 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_natgw.go @@ -0,0 +1,66 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeNATGWRequest is request schema for DescribeNATGW action +type DescribeNATGWRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // 数据分页值。默认为20 + Limit *int `required:"false"` + + // NAT网关Id。默认为该项目下所有NAT网关 + NATGWIds []string `required:"false"` + + // 数据偏移量。默认为0 + Offset *int `required:"false"` +} + +// DescribeNATGWResponse is response schema for DescribeNATGW action +type DescribeNATGWResponse struct { + response.CommonBase + + // 查到的NATGW信息列表 + DataSet []NatGatewayDataSet + + // 满足条件的实例的总数 + TotalCount int +} + +// NewDescribeNATGWRequest will create request of DescribeNATGW action. +func (c *VPCClient) NewDescribeNATGWRequest() *DescribeNATGWRequest { + req := &DescribeNATGWRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeNATGW - 获取NAT网关信息 +func (c *VPCClient) DescribeNATGW(req *DescribeNATGWRequest) (*DescribeNATGWResponse, error) { + var err error + var res DescribeNATGWResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeNATGW", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_natgw_policy.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_natgw_policy.go new file mode 100644 index 0000000000..cd0b2b4217 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_natgw_policy.go @@ -0,0 +1,66 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeNATGWPolicyRequest is request schema for DescribeNATGWPolicy action +type DescribeNATGWPolicyRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // 返回数据长度,默认为10000 + Limit *int `required:"false"` + + // NAT网关Id + NATGWId *string `required:"true"` + + // 列表起始位置偏移量,默认为0 + Offset *int `required:"false"` +} + +// DescribeNATGWPolicyResponse is response schema for DescribeNATGWPolicy action +type DescribeNATGWPolicyResponse struct { + response.CommonBase + + // 查到的NATGW 转发策略的详细信息 + DataSet []NATGWPolicyDataSet + + // 满足条件的转发策略总数 + TotalCount int +} + +// NewDescribeNATGWPolicyRequest will create request of DescribeNATGWPolicy action. +func (c *VPCClient) NewDescribeNATGWPolicyRequest() *DescribeNATGWPolicyRequest { + req := &DescribeNATGWPolicyRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeNATGWPolicy - 展示NAT网关端口转发规则 +func (c *VPCClient) DescribeNATGWPolicy(req *DescribeNATGWPolicyRequest) (*DescribeNATGWPolicyResponse, error) { + var err error + var res DescribeNATGWPolicyResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeNATGWPolicy", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_white_list_resource.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_white_list_resource.go new file mode 100644 index 0000000000..8d64a3eba4 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/describe_white_list_resource.go @@ -0,0 +1,60 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// DescribeWhiteListResourceRequest is request schema for DescribeWhiteListResource action +type DescribeWhiteListResourceRequest struct { + request.CommonBase + + // [公共参数] 项目id + // ProjectId *string `required:"true"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // NAT网关的Id + NATGWIds []string `required:"true"` +} + +// DescribeWhiteListResourceResponse is response schema for DescribeWhiteListResource action +type DescribeWhiteListResourceResponse struct { + response.CommonBase + + // 白名单资源的详细信息,详见DescribeResourceWhiteListDataSet + DataSet []NatGWWhitelistDataSet + + // 上述DataSet总数量 + TotalCount int +} + +// NewDescribeWhiteListResourceRequest will create request of DescribeWhiteListResource action. +func (c *VPCClient) NewDescribeWhiteListResourceRequest() *DescribeWhiteListResourceRequest { + req := &DescribeWhiteListResourceRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// DescribeWhiteListResource - 展示NAT网关白名单资源列表 +func (c *VPCClient) DescribeWhiteListResource(req *DescribeWhiteListResourceRequest) (*DescribeWhiteListResourceResponse, error) { + var err error + var res DescribeWhiteListResourceResponse + + reqCopier := *req + + err = c.Client.InvokeAction("DescribeWhiteListResource", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/enable_white_list.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/enable_white_list.go new file mode 100644 index 0000000000..90f1fd4991 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/enable_white_list.go @@ -0,0 +1,57 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// EnableWhiteListRequest is request schema for EnableWhiteList action +type EnableWhiteListRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // 白名单开关标记。0:关闭;1:开启。默认为0 + IfOpen *int `required:"true"` + + // NAT网关Id + NATGWId *string `required:"true"` +} + +// EnableWhiteListResponse is response schema for EnableWhiteList action +type EnableWhiteListResponse struct { + response.CommonBase +} + +// NewEnableWhiteListRequest will create request of EnableWhiteList action. +func (c *VPCClient) NewEnableWhiteListRequest() *EnableWhiteListRequest { + req := &EnableWhiteListRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// EnableWhiteList - 修改NAT网关白名单开关 +func (c *VPCClient) EnableWhiteList(req *EnableWhiteListRequest) (*EnableWhiteListResponse, error) { + var err error + var res EnableWhiteListResponse + + reqCopier := *req + + err = c.Client.InvokeAction("EnableWhiteList", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/get_available_resource_for_policy.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/get_available_resource_for_policy.go new file mode 100644 index 0000000000..c3a8dd2353 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/get_available_resource_for_policy.go @@ -0,0 +1,63 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// GetAvailableResourceForPolicyRequest is request schema for GetAvailableResourceForPolicy action +type GetAvailableResourceForPolicyRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // 返回数据长度,默认为10000 + Limit *int `required:"false"` + + // NAT网关Id + NATGWId *string `required:"true"` + + // 列表起始位置偏移量,默认为0 + Offset *int `required:"false"` +} + +// GetAvailableResourceForPolicyResponse is response schema for GetAvailableResourceForPolicy action +type GetAvailableResourceForPolicyResponse struct { + response.CommonBase + + // 支持资源类型的信息 + DataSet []GetAvailableResourceForPolicyDataSet +} + +// NewGetAvailableResourceForPolicyRequest will create request of GetAvailableResourceForPolicy action. +func (c *VPCClient) NewGetAvailableResourceForPolicyRequest() *GetAvailableResourceForPolicyRequest { + req := &GetAvailableResourceForPolicyRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// GetAvailableResourceForPolicy - 获取NAT网关可配置端口转发规则的资源信息 +func (c *VPCClient) GetAvailableResourceForPolicy(req *GetAvailableResourceForPolicyRequest) (*GetAvailableResourceForPolicyResponse, error) { + var err error + var res GetAvailableResourceForPolicyResponse + + reqCopier := *req + + err = c.Client.InvokeAction("GetAvailableResourceForPolicy", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/get_available_resource_for_white_list.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/get_available_resource_for_white_list.go new file mode 100644 index 0000000000..ea29920cb7 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/get_available_resource_for_white_list.go @@ -0,0 +1,60 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// GetAvailableResourceForWhiteListRequest is request schema for GetAvailableResourceForWhiteList action +type GetAvailableResourceForWhiteListRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // NAT网关Id + NATGWId *string `required:"true"` +} + +// GetAvailableResourceForWhiteListResponse is response schema for GetAvailableResourceForWhiteList action +type GetAvailableResourceForWhiteListResponse struct { + response.CommonBase + + // 返回白名单列表的详细信息 + DataSet []GetAvailableResourceForWhiteListDataSet + + // 白名单资源列表的总的个数 + TotalCount int +} + +// NewGetAvailableResourceForWhiteListRequest will create request of GetAvailableResourceForWhiteList action. +func (c *VPCClient) NewGetAvailableResourceForWhiteListRequest() *GetAvailableResourceForWhiteListRequest { + req := &GetAvailableResourceForWhiteListRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// GetAvailableResourceForWhiteList - 获取NAT网关可添加白名单的资源 +func (c *VPCClient) GetAvailableResourceForWhiteList(req *GetAvailableResourceForWhiteListRequest) (*GetAvailableResourceForWhiteListResponse, error) { + var err error + var res GetAvailableResourceForWhiteListResponse + + reqCopier := *req + + err = c.Client.InvokeAction("GetAvailableResourceForWhiteList", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/list_subnet_for_natgw.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/list_subnet_for_natgw.go new file mode 100644 index 0000000000..f38c6ac754 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/list_subnet_for_natgw.go @@ -0,0 +1,57 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// ListSubnetForNATGWRequest is request schema for ListSubnetForNATGW action +type ListSubnetForNATGWRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // NAT网关所属VPC Id。默认值为Default VPC Id + VPCId *string `required:"false"` +} + +// ListSubnetForNATGWResponse is response schema for ListSubnetForNATGW action +type ListSubnetForNATGWResponse struct { + response.CommonBase + + // 具体参数请见NatgwSubnetDataSet + DataSet []NatgwSubnetDataSet +} + +// NewListSubnetForNATGWRequest will create request of ListSubnetForNATGW action. +func (c *VPCClient) NewListSubnetForNATGWRequest() *ListSubnetForNATGWRequest { + req := &ListSubnetForNATGWRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// ListSubnetForNATGW - 展示NAT网关可绑定的子网列表 +func (c *VPCClient) ListSubnetForNATGW(req *ListSubnetForNATGWRequest) (*ListSubnetForNATGWResponse, error) { + var err error + var res ListSubnetForNATGWResponse + + reqCopier := *req + + err = c.Client.InvokeAction("ListSubnetForNATGW", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/set_gw_default_export.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/set_gw_default_export.go new file mode 100644 index 0000000000..e0713d4d3d --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/set_gw_default_export.go @@ -0,0 +1,60 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// SetGwDefaultExportRequest is request schema for SetGwDefaultExport action +type SetGwDefaultExportRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // NAT网关绑定的EIP Id。ExportIp和ExportEipId必填一个 + ExportEipId *string `required:"false"` + + // NAT网关绑定的EIP。ExportIp和ExportEipId必填一个 + ExportIp *string `required:"false"` + + // NAT网关Id + NATGWId *string `required:"true"` +} + +// SetGwDefaultExportResponse is response schema for SetGwDefaultExport action +type SetGwDefaultExportResponse struct { + response.CommonBase +} + +// NewSetGwDefaultExportRequest will create request of SetGwDefaultExport action. +func (c *VPCClient) NewSetGwDefaultExportRequest() *SetGwDefaultExportRequest { + req := &SetGwDefaultExportRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// SetGwDefaultExport - 设置NAT网关的默认出口 +func (c *VPCClient) SetGwDefaultExport(req *SetGwDefaultExportRequest) (*SetGwDefaultExportResponse, error) { + var err error + var res SetGwDefaultExportResponse + + reqCopier := *req + + err = c.Client.InvokeAction("SetGwDefaultExport", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_describe_white_list_resource_object_ip_info.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_describe_white_list_resource_object_ip_info.go new file mode 100644 index 0000000000..2798b852d4 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_describe_white_list_resource_object_ip_info.go @@ -0,0 +1,39 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +/* +DescribeWhiteListResourceObjectIPInfo - DescribeWhiteListResource + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn/api for detail. +*/ +type DescribeWhiteListResourceObjectIPInfo struct { + + // natgw字符串 + GwType string + + // 白名单资源的内网IP + PrivateIP string + + // 白名单资源Id信息 + ResourceId string + + // 白名单资源名称 + ResourceName string + + // 白名单资源类型 + ResourceType string + + // 资源绑定的虚拟网卡的实例ID + SubResourceId string + + // 资源绑定的虚拟网卡的实例名称 + SubResourceName string + + // 资源绑定的虚拟网卡的类型 + SubResourceType string + + // 白名单资源所属VPCId + VPCId string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_get_available_resource_for_policy_data_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_get_available_resource_for_policy_data_set.go new file mode 100644 index 0000000000..295e4ab4f7 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_get_available_resource_for_policy_data_set.go @@ -0,0 +1,21 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +/* +GetAvailableResourceForPolicyDataSet - GetAvailableResourceForPolicy + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn/api for detail. +*/ +type GetAvailableResourceForPolicyDataSet struct { + + // 资源对应的内网Ip + PrivateIP string + + // 资源的Id + ResourceId string + + // 资源类型。"uhost":云主机; "upm",物理云主机; "hadoophost":hadoop节点; "fortresshost":堡垒机: "udockhost",容器 + ResourceType string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_get_available_resource_for_white_list_data_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_get_available_resource_for_white_list_data_set.go new file mode 100644 index 0000000000..7b1af27bc1 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_get_available_resource_for_white_list_data_set.go @@ -0,0 +1,39 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +/* +GetAvailableResourceForWhiteListDataSet - GetAvailableResourceForWhiteList + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn/api for detail. +*/ +type GetAvailableResourceForWhiteListDataSet struct { + + // 资源的内网Ip + PrivateIP string + + // 资源类型Id + ResourceId string + + // 资源名称 + ResourceName string + + // 资源类型。"uhost":云主机; "upm",物理云主机; "hadoophost":hadoop节点; "fortresshost":堡垒机: "udockhost",容器 + ResourceType string + + // 资源绑定的虚拟网卡的实例ID + SubResouceId string + + // 资源绑定的虚拟网卡的实例类型 + SubResouceType string + + // 资源绑定的虚拟网卡的实例名称 + SubResourceName string + + // 资源所属子网Id + SubnetworkId string + + // 资源所属VPCId + VPCId string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gateway_data_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gateway_data_set.go new file mode 100644 index 0000000000..0227927275 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gateway_data_set.go @@ -0,0 +1,45 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +/* +NatGatewayDataSet - natgw的信息 + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn/api for detail. +*/ +type NatGatewayDataSet struct { + + // natgw创建时间 + CreateTime int + + // 绑定的防火墙Id + FirewallId string + + // 绑定的EIP 信息 + IPSet []NatGatewayIPSet + + // natgw id + NATGWId string + + // natgw名称 + NATGWName string + + // 转发策略Id + PolicyId []string + + // 备注 + Remark string + + // 子网 Id + SubnetSet []NatGatewaySubnetSet + + // 业务组 + Tag string + + // 所属VPC Id + VPCId string + + // 所属VPC 信息 + VPCInfo string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gateway_ip_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gateway_ip_set.go new file mode 100644 index 0000000000..85cfac2f57 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gateway_ip_set.go @@ -0,0 +1,27 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +/* +NatGatewayIPSet - IPSet信息 + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn/api for detail. +*/ +type NatGatewayIPSet struct { + + // 带宽 + Bandwidth int + + // EIP带宽类型 + BandwidthType string + + // 外网IP的 EIPId + EIPId string + + // 外网IP信息 + IPResInfo []NatGWIPResInfo + + // 权重为100的为出口 + Weight int +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gateway_subnet_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gateway_subnet_set.go new file mode 100644 index 0000000000..d8b919543c --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gateway_subnet_set.go @@ -0,0 +1,21 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +/* +NatGatewaySubnetSet - natgw里面的子网信息 + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn/api for detail. +*/ +type NatGatewaySubnetSet struct { + + // 子网网段 + Subnet string + + // 子网名字 + SubnetName string + + // 子网id + SubnetworkId string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gw_ip_res_info.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gw_ip_res_info.go new file mode 100644 index 0000000000..dd2694fe6b --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gw_ip_res_info.go @@ -0,0 +1,18 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +/* +NatGWIPResInfo - IP信息 + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn/api for detail. +*/ +type NatGWIPResInfo struct { + + // 外网IP + EIP string + + // IP的运营商信息 + OperatorName string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gw_whitelist_data_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gw_whitelist_data_set.go new file mode 100644 index 0000000000..b4ec7a39a3 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_nat_gw_whitelist_data_set.go @@ -0,0 +1,21 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +/* +NatGWWhitelistDataSet - nat网关白名单数据 + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn/api for detail. +*/ +type NatGWWhitelistDataSet struct { + + // 白名单开关标记 + IfOpen int + + // NATGateWay Id + NATGWId string + + // 白名单详情 + ObjectIPInfo []DescribeWhiteListResourceObjectIPInfo +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_natgw_policy_data_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_natgw_policy_data_set.go new file mode 100644 index 0000000000..4b476cb2b5 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_natgw_policy_data_set.go @@ -0,0 +1,39 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +/* +NATGWPolicyDataSet - DescribeNATGWPolicy + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn/api for detail. +*/ +type NATGWPolicyDataSet struct { + + // 目的地址 + DstIP string + + // 目的端口 + DstPort string + + // NAT网关Id + NATGWId string + + // 转发策略Id + PolicyId string + + // 转发策略名称 + PolicyName string + + // 协议类型 + Protocol string + + // 端口转发前端EIP + SrcEIP string + + // 端口转发前端EIP Id + SrcEIPId string + + // 源端口 + SrcPort string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_natgw_subnet_data_set.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_natgw_subnet_data_set.go new file mode 100644 index 0000000000..5700c1f4f9 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/types_natgw_subnet_data_set.go @@ -0,0 +1,27 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +/* +NatgwSubnetDataSet - natgw可以绑定的子网 + +this model is auto created by ucloud code generater for open api, +you can also see https://docs.ucloud.cn/api for detail. +*/ +type NatgwSubnetDataSet struct { + + // 是否绑定NATGW + HasNATGW bool + + // 掩码 + Netmask string + + // 子网网段 + Subnet string + + // 子网id + SubnetId string + + // 子网名字 + SubnetName string +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/update_natgw_policy.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/update_natgw_policy.go new file mode 100644 index 0000000000..8dee917c04 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/update_natgw_policy.go @@ -0,0 +1,75 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// UpdateNATGWPolicyRequest is request schema for UpdateNATGWPolicy action +type UpdateNATGWPolicyRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // 目标IP。填写对饮的目标IP地址 + DstIP *string `required:"true"` + + // 目标端口。可填写固定端口,也可填写端口范围。支持的端口范围为1-65535 + DstPort *string `required:"true"` + + // NAT网关Id + NATGWId *string `required:"true"` + + // 转发策略Id + PolicyId *string `required:"true"` + + // 转发策略名称。默认为空 + PolicyName *string `required:"false"` + + // 协议类型。枚举值为:TCP 、 UDP + Protocol *string `required:"true"` + + // 源IP。填写对应的EIP Id + SrcEIPId *string `required:"true"` + + // 源端口。可填写固定端口,也可填写端口范围。支持的端口范围为1-6553 + SrcPort *string `required:"true"` +} + +// UpdateNATGWPolicyResponse is response schema for UpdateNATGWPolicy action +type UpdateNATGWPolicyResponse struct { + response.CommonBase +} + +// NewUpdateNATGWPolicyRequest will create request of UpdateNATGWPolicy action. +func (c *VPCClient) NewUpdateNATGWPolicyRequest() *UpdateNATGWPolicyRequest { + req := &UpdateNATGWPolicyRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// UpdateNATGWPolicy - 更新NAT网关端口转发规则 +func (c *VPCClient) UpdateNATGWPolicy(req *UpdateNATGWPolicyRequest) (*UpdateNATGWPolicyResponse, error) { + var err error + var res UpdateNATGWPolicyResponse + + reqCopier := *req + + err = c.Client.InvokeAction("UpdateNATGWPolicy", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/update_natgw_subnet.go b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/update_natgw_subnet.go new file mode 100644 index 0000000000..31178e5a27 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/services/vpc/update_natgw_subnet.go @@ -0,0 +1,57 @@ +// Code is generated by ucloud-model, DO NOT EDIT IT. + +package vpc + +import ( + "github.com/ucloud/ucloud-sdk-go/ucloud/request" + "github.com/ucloud/ucloud-sdk-go/ucloud/response" +) + +// UpdateNATGWSubnetRequest is request schema for UpdateNATGWSubnet action +type UpdateNATGWSubnetRequest struct { + request.CommonBase + + // [公共参数] 项目Id。不填写为默认项目,子帐号必须填写。 请参考[GetProjectList接口](../summary/get_project_list.html) + // ProjectId *string `required:"false"` + + // [公共参数] 地域。 参见 [地域和可用区列表](../summary/regionlist.html) + // Region *string `required:"true"` + + // NAT网关Id + NATGWId *string `required:"true"` + + // NAT网关绑定的子网Id + SubnetworkIds []string `required:"true"` +} + +// UpdateNATGWSubnetResponse is response schema for UpdateNATGWSubnet action +type UpdateNATGWSubnetResponse struct { + response.CommonBase +} + +// NewUpdateNATGWSubnetRequest will create request of UpdateNATGWSubnet action. +func (c *VPCClient) NewUpdateNATGWSubnetRequest() *UpdateNATGWSubnetRequest { + req := &UpdateNATGWSubnetRequest{} + + // setup request with client config + c.Client.SetupRequest(req) + + // setup retryable with default retry policy (retry for non-create action and common error) + req.SetRetryable(true) + return req +} + +// UpdateNATGWSubnet - 更新NAT网关绑定的子网 +func (c *VPCClient) UpdateNATGWSubnet(req *UpdateNATGWSubnetRequest) (*UpdateNATGWSubnetResponse, error) { + var err error + var res UpdateNATGWSubnetResponse + + reqCopier := *req + + err = c.Client.InvokeAction("UpdateNATGWSubnet", &reqCopier, &res) + if err != nil { + return &res, err + } + + return &res, nil +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/client.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/client.go index a2e2cc989a..eedb56d056 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/client.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/client.go @@ -16,6 +16,10 @@ import ( "github.com/ucloud/ucloud-sdk-go/ucloud/response" ) +type ClientMeta struct { + Product string +} + // Client 客户端 type Client struct { // configurations @@ -31,6 +35,9 @@ type Client struct { httpRequestHandlers []HttpRequestHandler responseHandlers []ResponseHandler httpResponseHandlers []HttpResponseHandler + + // client information injection + meta ClientMeta } // NewClient will create an client of ucloud sdk @@ -38,6 +45,7 @@ func NewClient(config *Config, credential *auth.Credential) *Client { client := Client{ credential: credential, config: config, + meta: ClientMeta{}, } client.requestHandlers = append(client.requestHandlers, defaultRequestHandlers...) @@ -51,6 +59,12 @@ func NewClient(config *Config, credential *auth.Credential) *Client { return &client } +func NewClientWithMeta(config *Config, credential *auth.Credential, meta ClientMeta) *Client { + client := NewClient(config, credential) + client.meta = meta + return client +} + // SetHttpClient will setup a http client func (c *Client) SetHttpClient(httpClient http.Client) error { c.httpClient = httpClient @@ -67,6 +81,11 @@ func (c *Client) GetConfig() *Config { return c.config } +// GetMeta will return the meta data of client. +func (c *Client) GetMeta() ClientMeta { + return c.meta +} + // SetLogger will set the logger of client func (c *Client) SetLogger(logger log.Logger) { c.logger = logger @@ -131,6 +150,9 @@ func (c *Client) InvokeActionWithPatcher(action string, req request.Common, resp } err = c.unmarshalHTTPResponse(body, resp) + + uuid := httpResp.GetHeaders().Get(headerKeyRequestUUID) + resp.SetRequestUUID(uuid) } // use response middle to build and convert response when response has been created. diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/config.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/config.go index 2b79bc119e..a8f3fc507f 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/config.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/config.go @@ -4,8 +4,14 @@ import ( "time" "github.com/ucloud/ucloud-sdk-go/ucloud/log" + "github.com/ucloud/ucloud-sdk-go/ucloud/version" ) +// Version is the version of sdk +const Version = version.Version + +const headerKeyRequestUUID = "X-UCLOUD-REQUEST-UUID" + // Config is the config of ucloud sdk, use for setting up client type Config struct { // Region is the region of backend service diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/helpers/waiter/error.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/helpers/waiter/error.go index de57966ab1..5bf25586a9 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/helpers/waiter/error.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/helpers/waiter/error.go @@ -21,23 +21,23 @@ type TimeoutError struct { } func (e *TimeoutError) Error() string { - errors := []string{"cannot waiting for resource is completed"} + errs := []string{"cannot waiting for resource is completed"} if e.Timeout > 0 { - errors = append(errors, fmt.Sprintf("timeout: %s", e.Timeout)) + errs = append(errs, fmt.Sprintf("timeout: %s", e.Timeout)) } if e.LastState != "" { - errors = append(errors, fmt.Sprintf("last state: %q", e.LastState)) + errs = append(errs, fmt.Sprintf("last state: %q", e.LastState)) } if len(e.ExpectedStates) > 0 { - errors = append(errors, fmt.Sprintf("want: %q", strings.Join(e.ExpectedStates, ","))) + errs = append(errs, fmt.Sprintf("want: %q", strings.Join(e.ExpectedStates, ","))) } if e.LastError != nil { - errors = append(errors, fmt.Sprintf("err: %s", e.LastError)) + errs = append(errs, fmt.Sprintf("err: %s", e.LastError)) } - return strings.Join(errors, ", ") + return strings.Join(errs, ", ") } diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/common.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/common.go index 62bddd8590..eb17917f28 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/common.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/common.go @@ -59,7 +59,6 @@ type CommonBase struct { retryCount int timeout time.Duration requestTime time.Time - requestUUID string } // SetRetryCount will set retry count of request diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/encoder.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/encoder.go index f6c78f39d0..c068167076 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/encoder.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/encoder.go @@ -1,12 +1,18 @@ package request import ( + "encoding/base64" "errors" "fmt" "reflect" "strconv" ) +// ToBase64Query will encode a wrapped string as base64 wrapped string +func ToBase64Query(s *string) *string { + return String(base64.StdEncoding.EncodeToString([]byte(StringValue(s)))) +} + // ToQueryMap will convert a request to string map func ToQueryMap(req Common) (map[string]string, error) { v := reflect.ValueOf(req) diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/schema.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/schema.go new file mode 100644 index 0000000000..dfd09163f3 --- /dev/null +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/request/schema.go @@ -0,0 +1,70 @@ +package request + +import ( + "time" +) + +// String will return a pointer to string +func String(val string) *string { + return &val +} + +// StringValue will return a string from string pointer +func StringValue(ptr *string) string { + if ptr != nil { + return *ptr + } + return "" +} + +// Int will return a pointer to int +func Int(val int) *int { + return &val +} + +// IntValue will return a int from int pointer +func IntValue(ptr *int) int { + if ptr != nil { + return *ptr + } + return 0 +} + +// Bool will return a pointer to bool +func Bool(val bool) *bool { + return &val +} + +// BoolValue will return a bool from bool pointer +func BoolValue(ptr *bool) bool { + if ptr != nil { + return *ptr + } + return false +} + +// Float64 will return a pointer to float64 +func Float64(val float64) *float64 { + return &val +} + +// Float64Value will return a float64 from float64 pointer +func Float64Value(ptr *float64) float64 { + if ptr != nil { + return *ptr + } + return 0.0 +} + +// TimeDuration will return a pointer to time.Duration +func TimeDuration(val time.Duration) *time.Duration { + return &val +} + +// TimeDurationValue will return a time.Duration from a time.Duration pointer +func TimeDurationValue(ptr *time.Duration) time.Duration { + if ptr != nil { + return *ptr + } + return 0 +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/response/common.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/response/common.go index 1677a785ce..6b175df8c0 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/response/common.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/response/common.go @@ -16,6 +16,9 @@ type Common interface { GetRequest() request.Common SetRequest(request.Common) + + SetRequestUUID(string) + GetRequestUUID() string } // CommonBase has common attribute and method, @@ -25,6 +28,8 @@ type CommonBase struct { RetCode int Message string + requestUUID string + request request.Common } @@ -53,3 +58,13 @@ func (c *CommonBase) GetRequest() request.Common { func (c *CommonBase) SetRequest(req request.Common) { c.request = req } + +// SetRequestUUID will set uuid of request +func (c *CommonBase) SetRequestUUID(uuid string) { + c.requestUUID = uuid +} + +// GetRequestUUID will get uuid of request +func (c *CommonBase) GetRequestUUID() string { + return c.requestUUID +} diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/schema.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/schema.go index 26ffec2dea..cca0cceed4 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/schema.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/schema.go @@ -1,75 +1,18 @@ package ucloud import ( - "time" - - "github.com/ucloud/ucloud-sdk-go/ucloud/version" + "github.com/ucloud/ucloud-sdk-go/ucloud/request" ) -// Version is the version of sdk -const Version = version.Version - -// String will return a pointer to string -func String(val string) *string { - return &val -} - -// StringValue will return a string from string pointer -func StringValue(ptr *string) string { - if ptr != nil { - return *ptr - } - return "" -} - -// Int will return a pointer to int -func Int(val int) *int { - return &val -} - -// IntValue will return a int from int pointer -func IntValue(ptr *int) int { - if ptr != nil { - return *ptr - } - return 0 -} - -// Bool will return a pointer to bool -func Bool(val bool) *bool { - return &val -} - -// BoolValue will return a bool from bool pointer -func BoolValue(ptr *bool) bool { - if ptr != nil { - return *ptr - } - return false -} - -// Float64 will return a pointer to float64 -func Float64(val float64) *float64 { - return &val -} - -// Float64Value will return a float64 from float64 pointer -func Float64Value(ptr *float64) float64 { - if ptr != nil { - return *ptr - } - return 0.0 -} - -// TimeDuration will return a pointer to time.Duration -func TimeDuration(val time.Duration) *time.Duration { - return &val -} - -// TimeDurationValue will return a time.Duration from a time.Duration pointer -func TimeDurationValue(ptr *time.Duration) time.Duration { - if ptr != nil { - return *ptr - } - return 0 -} +var ( + String = request.String + StringValue = request.StringValue + Int = request.Int + IntValue = request.IntValue + Bool = request.Bool + BoolValue = request.BoolValue + Float64 = request.Float64 + Float64Value = request.Float64Value + TimeDuration = request.TimeDuration + TimeDurationValue = request.TimeDurationValue +) diff --git a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go index 0e9e4972df..b81e4b8d1d 100644 --- a/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go +++ b/vendor/github.com/ucloud/ucloud-sdk-go/ucloud/version/version.go @@ -4,4 +4,4 @@ Package version is the version of sdk package version // Version see also semantic version: https://semver.org/ -const Version = "0.8.10" +const Version = "0.11.1" diff --git a/vendor/modules.txt b/vendor/modules.txt index a475d02c78..afe3346fdf 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -2,6 +2,8 @@ github.com/cpuguy83/go-md2man/md2man # github.com/inconshreveable/mousetrap v1.0.0 github.com/inconshreveable/mousetrap +# github.com/jellybean4/ucloud-sdk-go v0.12.7 +github.com/jellybean4/ucloud-sdk-go/services/uflink # github.com/konsorten/go-windows-terminal-sequences v1.0.1 github.com/konsorten/go-windows-terminal-sequences # github.com/pkg/errors v0.8.0 @@ -15,7 +17,7 @@ github.com/spf13/cobra github.com/spf13/cobra/doc # github.com/spf13/pflag v1.0.3 => github.com/lixiaojun629/pflag v1.0.5 github.com/spf13/pflag -# github.com/ucloud/ucloud-sdk-go v0.8.10 +# github.com/ucloud/ucloud-sdk-go v0.11.1 github.com/ucloud/ucloud-sdk-go/private/services/pathx github.com/ucloud/ucloud-sdk-go/private/services/udb github.com/ucloud/ucloud-sdk-go/private/services/uhost @@ -25,6 +27,7 @@ github.com/ucloud/ucloud-sdk-go/services/uaccount github.com/ucloud/ucloud-sdk-go/services/udb github.com/ucloud/ucloud-sdk-go/services/udisk github.com/ucloud/ucloud-sdk-go/services/udpn +github.com/ucloud/ucloud-sdk-go/services/ufile github.com/ucloud/ucloud-sdk-go/services/uhost github.com/ucloud/ucloud-sdk-go/services/ulb github.com/ucloud/ucloud-sdk-go/services/umem