-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
314 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package ospatch | ||
|
||
import "github.com/centurylinkcloud/clc-go-cli/base" | ||
|
||
type PatchInfo struct { | ||
Execution_id string | ||
Status string | ||
Start_time base.Time | ||
End_time base.Time | ||
Init_messages []struct { | ||
Start_time base.Time | ||
End_time base.Time | ||
Init_begin_message string | ||
Init_end_message string | ||
} | ||
} | ||
|
||
type PatchDetails struct { | ||
Execution_id string | ||
Status string | ||
Start_time base.Time | ||
End_time base.Time | ||
Duration string | ||
Begin_message string | ||
End_message string | ||
Patches []struct { | ||
Start_time base.Time | ||
End_time base.Time | ||
Patch_begin_message string | ||
Patch_end_message string | ||
Status string | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package ospatch | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
"github.com/centurylinkcloud/clc-go-cli/errors" | ||
"github.com/centurylinkcloud/clc-go-cli/models/server" | ||
) | ||
|
||
var ( | ||
packages = map[string]server.PackageDef{ | ||
"Windows2012": server.PackageDef{ | ||
PackageId: "b229535c-a313-4a31-baf8-6aa71ff4b9ed", | ||
}, | ||
"RedHat": server.PackageDef{ | ||
PackageId: "c3c6642e-24e1-4c37-b56a-1cf1476ee360", | ||
Parameters: map[string]string{ | ||
"patch.debug.mode": "false", | ||
}, | ||
}, | ||
} | ||
) | ||
|
||
type Patch struct { | ||
ServerIds []string `json:"servers"` | ||
OsType string `valid:"required" oneOf:"Windows2012,RedHat"` | ||
} | ||
|
||
func (p *Patch) Validate() error { | ||
if len(p.ServerIds) == 0 { | ||
return errors.EmptyField("server-ids") | ||
} | ||
return nil | ||
} | ||
|
||
func (p *Patch) MarshalJSON() ([]byte, error) { | ||
return json.Marshal(server.ExecutePackage{ | ||
ServerIds: p.ServerIds, | ||
Package: packages[p.OsType], | ||
}) | ||
} | ||
|
||
type List struct { | ||
server.Server `argument:"composed" URIParam:"ServerId"` | ||
} | ||
|
||
type ListDetails struct { | ||
server.Server `argument:"composed" URIParam:"ServerId"` | ||
ExecutionId string `URIParam:"yes" valid:"required"` | ||
} |
Oops, something went wrong.