gitlab.com/jfprevost/gitlab-runner-notlscheck@v11.11.4+incompatible/network/remote_job_state_response.go (about) 1 package network 2 3 import ( 4 "net/http" 5 ) 6 7 type RemoteJobStateResponse struct { 8 StatusCode int 9 RemoteState string 10 } 11 12 func (r *RemoteJobStateResponse) IsAborted() bool { 13 if r.RemoteState == "canceled" || r.RemoteState == "failed" { 14 return true 15 } 16 17 if r.StatusCode == http.StatusForbidden { 18 return true 19 } 20 21 return false 22 } 23 24 func NewRemoteJobStateResponse(response *http.Response) *RemoteJobStateResponse { 25 if response == nil { 26 return &RemoteJobStateResponse{} 27 } 28 29 return &RemoteJobStateResponse{ 30 StatusCode: response.StatusCode, 31 RemoteState: response.Header.Get("Job-Status"), 32 } 33 }