github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/mrs/v1/job/Get.go (about)

     1  package job
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/opentelekomcloud/gophertelekomcloud"
     7  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     8  	"github.com/opentelekomcloud/gophertelekomcloud/openstack"
     9  )
    10  
    11  func Get(c *golangsdk.ServiceClient, id string) (*JobExecution, error) {
    12  	// GET /v1.1/{project_id}/job-exes/{job_exe_id}
    13  	raw, err := c.Get(c.ServiceURL("job-exes", id), nil, openstack.StdRequestOpts())
    14  	return extra(err, raw)
    15  }
    16  
    17  func extra(err error, raw *http.Response) (*JobExecution, error) {
    18  	if err != nil {
    19  		return nil, err
    20  	}
    21  
    22  	var res JobExecution
    23  	err = extract.IntoStructPtr(raw.Body, &res, "job_execution")
    24  	return &res, err
    25  }
    26  
    27  type JobExecution struct {
    28  	// Whether job execution objects are generated by job templates.
    29  	Templated bool `json:"templated,omitempty"`
    30  	// Creation time, which is a 10-bit timestamp.
    31  	CreatedAt string `json:"created_at,omitempty"`
    32  	// Update time, which is a 10-bit timestamp.
    33  	UpdatedAt string `json:"updated_at,omitempty"`
    34  	// Job ID
    35  	Id string `json:"id,omitempty"`
    36  	// Project ID. For details on how to obtain the project ID
    37  	TenantId string `json:"tenant_id,omitempty"`
    38  	// Job application ID
    39  	JobId string `json:"job_id,omitempty"`
    40  	// Job name
    41  	JobName string `json:"job_name,omitempty"`
    42  	// Data input ID
    43  	InputId string `json:"input_id,omitempty"`
    44  	// Data output ID
    45  	OutputId string `json:"output_id,omitempty"`
    46  	// Start time of job execution, which is a 10-bit timestamp.
    47  	StartTime int64 `json:"start_time,omitempty"`
    48  	// End time of job execution, which is a 10-bit timestamp.
    49  	EndTime int64 `json:"end_time,omitempty"`
    50  	// Cluster ID
    51  	ClusterId string `json:"cluster_id,omitempty"`
    52  	// Workflow ID of Oozie
    53  	EngineJobId string `json:"engine_job_id,omitempty"`
    54  	// Returned code for an execution result
    55  	ReturnCode string `json:"return_code,omitempty"`
    56  	// Whether a job is public
    57  	// The current version does not support this function.
    58  	IsPublic bool `json:"is_public,omitempty"`
    59  	// Whether a job is protected
    60  	// The current version does not support this function.
    61  	IsProtected bool `json:"is_protected,omitempty"`
    62  	// Group ID of a job
    63  	GroupId string `json:"group_id,omitempty"`
    64  	// Path of the .jar file for program execution
    65  	JarPath string `json:"jar_path,omitempty"`
    66  	// Address for inputting data
    67  	Input string `json:"input,omitempty"`
    68  	// Address for outputting data
    69  	Output string `json:"output,omitempty"`
    70  	// Address for storing job logs
    71  	JobLog string `json:"job_log,omitempty"`
    72  	// Job type code
    73  	// 1: MapReduce
    74  	// 2: Spark
    75  	// 3: Hive Script
    76  	// 4: HiveQL (not supported currently)
    77  	// 5: DistCp
    78  	// 6: Spark Script
    79  	// 7: Spark SQL (not supported in this API currently)
    80  	JobType int `json:"job_type,omitempty"`
    81  	// Data import and export
    82  	FileAction string `json:"file_action,omitempty"`
    83  	// Key parameter for program execution. The parameter is specified by the function of the user's internal program.
    84  	// MRS is only responsible for loading the parameter. This parameter can be empty.
    85  	Arguments string `json:"arguments,omitempty"`
    86  	// Job status code
    87  	// -1: Terminated
    88  	// 1: Starting
    89  	// 2: Running
    90  	// 3: Completed
    91  	// 4: Abnormal
    92  	// 5: Error
    93  	JobState int `json:"job_state,omitempty"`
    94  	// Final job status
    95  	// 0: unfinished
    96  	// 1: terminated due to an execution error
    97  	// 2: executed successfully
    98  	// 3: canceled
    99  	JobFinalStatus int `json:"job_final_status,omitempty"`
   100  	// Address of the Hive script
   101  	HiveScriptPath string `json:"hive_script_path,omitempty"`
   102  	// User ID for creating jobs
   103  	// This parameter is not used in the current version, but is retained for compatibility with earlier versions.
   104  	CreateBy string `json:"create_by,omitempty"`
   105  	// Number of completed steps
   106  	// This parameter is not used in the current version, but is retained for compatibility with earlier versions.
   107  	FinishedStep int `json:"finished_step,omitempty"`
   108  	// Main ID of a job
   109  	// This parameter is not used in the current version, but is retained for compatibility with earlier versions.
   110  	JobMainId string `json:"job_main_id,omitempty"`
   111  	// Step ID of a job
   112  	// This parameter is not used in the current version, but is retained for compatibility with earlier versions.
   113  	JobStepId string `json:"job_step_id,omitempty"`
   114  	// Delay time, which is a 10-bit timestamp.
   115  	// This parameter is not used in the current version, but is retained for compatibility with earlier versions.
   116  	PostponeAt int64 `json:"postpone_at,omitempty"`
   117  	// Step name of a job
   118  	// This parameter is not used in the current version, but is retained for compatibility with earlier versions.
   119  	StepName string `json:"step_name,omitempty"`
   120  	// Number of steps
   121  	// This parameter is not used in the current version, but is retained for compatibility with earlier versions.
   122  	StepNum int `json:"step_num,omitempty"`
   123  	// Number of tasks
   124  	// This parameter is not used in the current version, but is retained for compatibility with earlier versions.
   125  	TaskNum int `json:"task_num,omitempty"`
   126  	// User ID for updating jobs
   127  	UpdateBy string `json:"update_by,omitempty"`
   128  	// Token
   129  	// The current version does not support this function.
   130  	Credentials string `json:"credentials,omitempty"`
   131  	// User ID for creating jobs
   132  	// This parameter is not used in the current version, but is retained for compatibility with earlier versions.
   133  	UserId string `json:"user_id,omitempty"`
   134  	// Key-value pair set for saving job running configurations
   135  	JobConfigs map[string]interface{} `json:"job_configs,omitempty"`
   136  	// Authentication information
   137  	// The current version does not support this function.
   138  	Extra map[string]interface{} `json:"extra,omitempty"`
   139  	// Data source URL
   140  	DataSourceUrls map[string]interface{} `json:"data_source_urls,omitempty"`
   141  	// Key-value pair set, containing job running information returned by Oozie
   142  	Info map[string]interface{} `json:"info,omitempty"`
   143  	// Encrypt Type
   144  	EncryptType int `json:"encrypt_type,omitempty"`
   145  }