Skip to content

Commit

Permalink
chore(serverless): rename job_run_id to id and job_definition_id to id (
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot committed Nov 8, 2023
1 parent ded9c4b commit 78e9e1d
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions api/jobs/v1alpha1/jobs_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (enum *ListJobRunsRequestOrderBy) UnmarshalJSON(data []byte) error {

// JobDefinition: job definition.
type JobDefinition struct {
JobDefinitionID string `json:"job_definition_id"`
ID string `json:"id"`

Name string `json:"name"`

Expand Down Expand Up @@ -166,7 +166,7 @@ type JobDefinition struct {

// JobRun: job run.
type JobRun struct {
JobRunID string `json:"job_run_id"`
ID string `json:"id"`

JobDefinitionID string `json:"job_definition_id"`

Expand Down Expand Up @@ -218,23 +218,23 @@ type DeleteJobDefinitionRequest struct {
// Region: region to target. If none is passed will use default region from the config.
Region scw.Region `json:"-"`

JobDefinitionID string `json:"-"`
ID string `json:"-"`
}

// GetJobDefinitionRequest: get job definition request.
type GetJobDefinitionRequest struct {
// Region: region to target. If none is passed will use default region from the config.
Region scw.Region `json:"-"`

JobDefinitionID string `json:"-"`
ID string `json:"-"`
}

// GetJobRunRequest: get job run request.
type GetJobRunRequest struct {
// Region: region to target. If none is passed will use default region from the config.
Region scw.Region `json:"-"`

JobRunID string `json:"-"`
ID string `json:"-"`
}

// GetServiceInfoRequest: get service info request.
Expand Down Expand Up @@ -296,7 +296,7 @@ type ListJobRunsRequest struct {
// OrderBy: default value: created_at_asc
OrderBy ListJobRunsRequestOrderBy `json:"-"`

JobDefinitionID *string `json:"-"`
ID *string `json:"-"`

ProjectID *string `json:"-"`
}
Expand Down Expand Up @@ -332,23 +332,23 @@ type StartJobDefinitionRequest struct {
// Region: region to target. If none is passed will use default region from the config.
Region scw.Region `json:"-"`

JobDefinitionID string `json:"-"`
ID string `json:"-"`
}

// StopJobRunRequest: stop job run request.
type StopJobRunRequest struct {
// Region: region to target. If none is passed will use default region from the config.
Region scw.Region `json:"-"`

JobRunID string `json:"-"`
ID string `json:"-"`
}

// UpdateJobDefinitionRequest: update job definition request.
type UpdateJobDefinitionRequest struct {
// Region: region to target. If none is passed will use default region from the config.
Region scw.Region `json:"-"`

JobDefinitionID string `json:"-"`
ID string `json:"-"`

Name *string `json:"name,omitempty"`

Expand Down Expand Up @@ -463,13 +463,13 @@ func (s *API) GetJobDefinition(req *GetJobDefinitionRequest, opts ...scw.Request
return nil, errors.New("field Region cannot be empty in request")
}

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

scwReq := &scw.ScalewayRequest{
Method: "GET",
Path: "/serverless-jobs/v1alpha1/regions/" + fmt.Sprint(req.Region) + "/job-definitions/" + fmt.Sprint(req.JobDefinitionID) + "",
Path: "/serverless-jobs/v1alpha1/regions/" + fmt.Sprint(req.Region) + "/job-definitions/" + fmt.Sprint(req.ID) + "",
}

var resp JobDefinition
Expand Down Expand Up @@ -533,13 +533,13 @@ func (s *API) UpdateJobDefinition(req *UpdateJobDefinitionRequest, opts ...scw.R
return nil, errors.New("field Region cannot be empty in request")
}

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

scwReq := &scw.ScalewayRequest{
Method: "PATCH",
Path: "/serverless-jobs/v1alpha1/regions/" + fmt.Sprint(req.Region) + "/job-definitions/" + fmt.Sprint(req.JobDefinitionID) + "",
Path: "/serverless-jobs/v1alpha1/regions/" + fmt.Sprint(req.Region) + "/job-definitions/" + fmt.Sprint(req.ID) + "",
}

err = scwReq.SetBody(req)
Expand Down Expand Up @@ -569,13 +569,13 @@ func (s *API) DeleteJobDefinition(req *DeleteJobDefinitionRequest, opts ...scw.R
return errors.New("field Region cannot be empty in request")
}

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

scwReq := &scw.ScalewayRequest{
Method: "DELETE",
Path: "/serverless-jobs/v1alpha1/regions/" + fmt.Sprint(req.Region) + "/job-definitions/" + fmt.Sprint(req.JobDefinitionID) + "",
Path: "/serverless-jobs/v1alpha1/regions/" + fmt.Sprint(req.Region) + "/job-definitions/" + fmt.Sprint(req.ID) + "",
}

err = s.client.Do(scwReq, nil, opts...)
Expand All @@ -598,13 +598,13 @@ func (s *API) StartJobDefinition(req *StartJobDefinitionRequest, opts ...scw.Req
return nil, errors.New("field Region cannot be empty in request")
}

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

scwReq := &scw.ScalewayRequest{
Method: "POST",
Path: "/serverless-jobs/v1alpha1/regions/" + fmt.Sprint(req.Region) + "/job-definitions/" + fmt.Sprint(req.JobDefinitionID) + "/start",
Path: "/serverless-jobs/v1alpha1/regions/" + fmt.Sprint(req.Region) + "/job-definitions/" + fmt.Sprint(req.ID) + "/start",
}

err = scwReq.SetBody(req)
Expand Down Expand Up @@ -634,13 +634,13 @@ func (s *API) GetJobRun(req *GetJobRunRequest, opts ...scw.RequestOption) (*JobR
return nil, errors.New("field Region cannot be empty in request")
}

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

scwReq := &scw.ScalewayRequest{
Method: "GET",
Path: "/serverless-jobs/v1alpha1/regions/" + fmt.Sprint(req.Region) + "/job-runs/" + fmt.Sprint(req.JobRunID) + "",
Path: "/serverless-jobs/v1alpha1/regions/" + fmt.Sprint(req.Region) + "/job-runs/" + fmt.Sprint(req.ID) + "",
}

var resp JobRun
Expand All @@ -665,13 +665,13 @@ func (s *API) StopJobRun(req *StopJobRunRequest, opts ...scw.RequestOption) (*Jo
return nil, errors.New("field Region cannot be empty in request")
}

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

scwReq := &scw.ScalewayRequest{
Method: "POST",
Path: "/serverless-jobs/v1alpha1/regions/" + fmt.Sprint(req.Region) + "/job-runs/" + fmt.Sprint(req.JobRunID) + "/stop",
Path: "/serverless-jobs/v1alpha1/regions/" + fmt.Sprint(req.Region) + "/job-runs/" + fmt.Sprint(req.ID) + "/stop",
}

err = scwReq.SetBody(req)
Expand Down Expand Up @@ -706,7 +706,7 @@ func (s *API) ListJobRuns(req *ListJobRunsRequest, opts ...scw.RequestOption) (*
parameter.AddToQuery(query, "page", req.Page)
parameter.AddToQuery(query, "page_size", req.PageSize)
parameter.AddToQuery(query, "order_by", req.OrderBy)
parameter.AddToQuery(query, "job_definition_id", req.JobDefinitionID)
parameter.AddToQuery(query, "id", req.ID)
parameter.AddToQuery(query, "project_id", req.ProjectID)

if fmt.Sprint(req.Region) == "" {
Expand Down

0 comments on commit 78e9e1d

Please sign in to comment.