Documentation
¶
Index ¶
- Constants
- func UnzipFile(src, dest string) error
- type Client
- func (c *Client) GetConfigurationUpdateData(data ConfigurationUpdateData) (*ConfigurationUpdateFile, error)
- func (c *Client) GetPatchDistributionData(data PatchDistributionData) (*PatchDistributionFile, error)
- func (c *Client) GetPatchesFilesInfo(patchUinList ...string) (PatchesGetFilesResponse, error)
- func (c *Client) GetPatchesInfo(programName, programVersion string, InstalledPatchesList ...string) (PatchesInfoResponse, error)
- func (c *Client) GetPatchesInfoRequest(programVersionList []ProgramVersion, installedPatchesList []string) (PatchesInfoResponse, error)
- func (c *Client) GetUpdate(programVersionUin string, UpgradeSequence []string) (UpdateResponse, error)
- func (c *Client) GetUpdateInfo(programName, version string, updateTypeAndPlatformVersion ...string) (UpdateInfoResponse, error)
- type ConfigurationUpdateData
- type ConfigurationUpdateFile
- type ConfigurationUpdateInfo
- type ErrorResponse
- type PatchDistributionData
- type PatchDistributionFile
- type PatchUpdate
- type PatchesGetFilesRequest
- type PatchesGetFilesResponse
- type PatchesInfoRequest
- type PatchesInfoResponse
- type PlatformUpdateInfo
- type ProgramVersion
- type RequestError
- type UpdateInfoRequest
- type UpdateInfoResponse
- type UpdateRequest
- type UpdateResponse
Examples ¶
Constants ¶
View Source
const ( Accounting = "Accounting" ZUP = "HRM" )
View Source
const ( NewConfigurationAndOrPlatformUpdateType = "NewConfigurationAndOrPlatform" // - РабочееОбновление NewProgramOrRedactionUpdateType = "NewProgramOrRedaction" // - ПереходНаДругуюПрограммуИлиРедакцию NewPlatformUpdateType = "NewPlatform" // Новая платформа )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
func NewClient ¶
Example ¶
package main
import (
apiClient "github.com/v8platform/updateApiClient"
"log"
)
func main() {
client := apiClient.NewClient("ITS_USER", "ITS_PASSWORD")
updateInfo, err := client.GetUpdateInfo("Accounting",
"3.0.88.22",
apiClient.NewProgramOrRedactionUpdateType, "8.3.15.2107")
if err != nil {
log.Fatal(err)
}
log.Println(updateInfo)
}
func (*Client) GetConfigurationUpdateData ¶
func (c *Client) GetConfigurationUpdateData(data ConfigurationUpdateData) (*ConfigurationUpdateFile, error)
Example ¶
package main
import (
apiClient "github.com/v8platform/updateApiClient"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
)
func main() {
client := apiClient.NewClient("ITS_USER", "ITS_PASSWORD")
updateInfo, err := client.GetUpdateInfo("Accounting",
"3.0.88.22",
apiClient.NewProgramOrRedactionUpdateType, "8.3.15.2107")
if err != nil {
log.Fatal(err)
}
updateData, err := client.GetUpdate(updateInfo.ConfigurationUpdate.ProgramVersionUin, updateInfo.ConfigurationUpdate.UpgradeSequence)
if err != nil {
log.Fatal(err)
}
for _, data := range updateData.ConfigurationUpdateDataList {
updateDataFile, err := client.GetConfigurationUpdateData(data)
if err != nil {
log.Fatal(err)
}
log.Println("Download:", updateDataFile.UpdateFileUrl)
distPath := strings.ReplaceAll(updateDataFile.TemplatePath, "\\", string(os.PathSeparator))
distPath = filepath.Join(".", distPath)
log.Println("Path:", distPath)
err = os.MkdirAll(distPath, os.ModeDir)
if err != nil {
log.Fatal(err)
}
f, err := ioutil.TempFile("", "."+updateDataFile.UpdateFileFormat)
if err != nil {
log.Fatal(err)
}
_, err = io.Copy(f, updateDataFile)
f.Close()
updateDataFile.Close()
err = apiClient.UnzipFile(f.Name(), distPath)
if err != nil {
log.Fatal(err)
}
}
}
func (*Client) GetPatchDistributionData ¶
func (c *Client) GetPatchDistributionData(data PatchDistributionData) (*PatchDistributionFile, error)
Example ¶
package main
import (
apiClient "github.com/v8platform/updateApiClient"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
)
func main() {
client := apiClient.NewClient("ITS_USER", "ITS_PASSWORD")
patchesInfo, err := client.GetPatchesInfo("Accounting",
"3.0.88.22")
if err != nil {
log.Fatal(err)
}
log.Printf("Get paches info for %d", len(patchesInfo.PatchUpdateList))
var patchesList []string
patchesNames := make(map[string]string)
for _, update := range patchesInfo.PatchUpdateList {
patchesList = append(patchesList, update.Ueid)
patchesNames[update.Ueid] = update.Name
}
patchesFilesInfo, err := client.GetPatchesFilesInfo(patchesList...)
if err != nil {
log.Fatal(err)
}
log.Printf("Get paches files info for %d", len(patchesFilesInfo.PatchDistributionDataList))
for _, data := range patchesFilesInfo.PatchDistributionDataList {
fileInfo, err := client.GetPatchDistributionData(data)
if err != nil {
log.Fatal(err)
}
log.Println("Download:", fileInfo.PatchFileUrl)
distPath := strings.ReplaceAll(fileInfo.PatchFileName, "\\", string(os.PathSeparator))
distPath = filepath.Join(".", "patches", patchesNames[fileInfo.PatchUeid])
log.Println("Path:", distPath)
err = os.MkdirAll(distPath, os.ModeDir)
if err != nil {
log.Fatal(err)
}
f, err := ioutil.TempFile("", ".pzip")
if err != nil {
log.Fatal(err)
}
_, err = io.Copy(f, fileInfo)
f.Close()
err = apiClient.UnzipFile(f.Name(), distPath)
if err != nil {
log.Fatal(err)
}
}
}
func (*Client) GetPatchesFilesInfo ¶
func (c *Client) GetPatchesFilesInfo(patchUinList ...string) (PatchesGetFilesResponse, error)
Example ¶
package main
import (
apiClient "github.com/v8platform/updateApiClient"
"log"
)
func main() {
client := apiClient.NewClient("ITS_USER", "ITS_PASSWORD")
patchesInfo, err := client.GetPatchesInfo("Accounting",
"3.0.88.22")
if err != nil {
log.Fatal(err)
}
log.Printf("Get paches info for %d", len(patchesInfo.PatchUpdateList))
var patchesList []string
for _, update := range patchesInfo.PatchUpdateList {
patchesList = append(patchesList, update.Ueid)
}
patchesFilesInfo, err := client.GetPatchesFilesInfo(patchesList...)
if err != nil {
log.Fatal(err)
}
log.Printf("Get paches files info for %d", len(patchesFilesInfo.PatchDistributionDataList))
}
func (*Client) GetPatchesInfo ¶
func (c *Client) GetPatchesInfo(programName, programVersion string, InstalledPatchesList ...string) (PatchesInfoResponse, error)
Example ¶
package main
import (
apiClient "github.com/v8platform/updateApiClient"
"log"
)
func main() {
client := apiClient.NewClient("ITS_USER", "ITS_PASSWORD")
patchesInfo, err := client.GetPatchesInfo("Accounting",
"3.0.88.22")
if err != nil {
log.Fatal(err)
}
log.Printf("Get paches info for %d", len(patchesInfo.PatchUpdateList))
}
func (*Client) GetPatchesInfoRequest ¶
func (c *Client) GetPatchesInfoRequest(programVersionList []ProgramVersion, installedPatchesList []string) (PatchesInfoResponse, error)
func (*Client) GetUpdate ¶
func (c *Client) GetUpdate(programVersionUin string, UpgradeSequence []string) (UpdateResponse, error)
Example ¶
package main
import (
apiClient "github.com/v8platform/updateApiClient"
"log"
)
func main() {
client := apiClient.NewClient("ITS_USER", "ITS_PASSWORD")
updateInfo, err := client.GetUpdateInfo("Accounting",
"3.0.88.22",
apiClient.NewProgramOrRedactionUpdateType, "8.3.15.2107")
if err != nil {
log.Fatal(err)
}
log.Println(updateInfo)
updateData, err := client.GetUpdate(updateInfo.ConfigurationUpdate.ProgramVersionUin, updateInfo.ConfigurationUpdate.UpgradeSequence)
if err != nil {
log.Fatal(err)
}
log.Println(updateData)
}
func (*Client) GetUpdateInfo ¶
func (c *Client) GetUpdateInfo(programName, version string, updateTypeAndPlatformVersion ...string) (UpdateInfoResponse, error)
Example ¶
package main
import (
apiClient "github.com/v8platform/updateApiClient"
"log"
)
func main() {
client := apiClient.NewClient("", "")
updateInfo, err := client.GetUpdateInfo("Accounting",
"3.0.88.22",
apiClient.NewProgramOrRedactionUpdateType, "8.3.15.2107")
if err != nil {
log.Fatal(err)
}
log.Println(updateInfo)
}
type ConfigurationUpdateData ¶
type ConfigurationUpdateData struct {
TemplatePath string `json:"templatePath"`
ExecuteUpdateProcess bool `json:"executeUpdateProcess"`
UpdateFileUrl string `json:"updateFileUrl"`
UpdateFileName string `json:"updateFileName"`
UpdateFileFormat string `json:"updateFileFormat"`
Size int `json:"size"`
HashSum string `json:"hashSum"`
}
type ConfigurationUpdateFile ¶
type ConfigurationUpdateFile struct {
io.ReadCloser
ConfigurationUpdateData
}
type ConfigurationUpdateInfo ¶
type ConfigurationUpdateInfo struct {
ConfigurationVersion string `json:"configurationVersion"`
Size int `json:"size"`
PlatformVersion string `json:"platformVersion"`
UpdateInfoUrl string `json:"updateInfoUrl"`
HowToUpdateInfoUrl string `json:"howToUpdateInfoUrl"`
UpgradeSequence []string `json:"upgradeSequence"`
ProgramVersionUin string `json:"programVersionUin"`
}
type ErrorResponse ¶
type ErrorResponse struct {
ErrorName string `json:"errorName"`
ErrorMessage string `json:"errorMessage"`
}
func (ErrorResponse) Error ¶
func (c ErrorResponse) Error() string
type PatchDistributionData ¶
type PatchDistributionFile ¶
type PatchDistributionFile struct {
io.Reader
PatchDistributionData
}
type PatchUpdate ¶
type PatchUpdate struct {
Ueid string `json:"ueid"`
Name string `json:"name"`
Description string `json:"description"`
BuildDate int64 `json:"buildDate"`
ModificatedMetadata string `json:"modificatedMetadata"`
Status string `json:"status"`
Size int `json:"size"`
ApplyToVersion []ProgramVersion `json:"applyToVersion"`
}
type PatchesGetFilesRequest ¶
type PatchesGetFilesResponse ¶
type PatchesGetFilesResponse struct {
ErrorResponse
PatchDistributionDataList []PatchDistributionData `json:"patchDistributionDataList"`
}
func (PatchesGetFilesResponse) Error ¶
func (c PatchesGetFilesResponse) Error() error
type PatchesInfoRequest ¶
type PatchesInfoRequest struct {
ProgramVersionList []ProgramVersion `json:"programVersionList"`
InstalledPatchesList []string `json:"installedPatchesList"`
}
type PatchesInfoResponse ¶
type PatchesInfoResponse struct {
ErrorResponse
PatchUpdateList []PatchUpdate `json:"patchUpdateList"`
}
func (PatchesInfoResponse) Error ¶
func (c PatchesInfoResponse) Error() error
type PlatformUpdateInfo ¶
type ProgramVersion ¶
type RequestError ¶
type RequestError struct {
Timestamp int64 `json:"timestamp"`
Status int `json:"status"`
Err string `json:"error"`
Exception string `json:"exception"`
Errors []struct {
Codes []string `json:"codes"`
Arguments []struct {
Codes []string `json:"codes"`
Arguments interface{} `json:"arguments"`
DefaultMessage string `json:"defaultMessage"`
Code string `json:"code"`
} `json:"arguments"`
DefaultMessage string `json:"defaultMessage"`
ObjectName string `json:"objectName"`
Field string `json:"field"`
RejectedValue string `json:"rejectedValue"`
BindingFailure bool `json:"bindingFailure"`
Code string `json:"code"`
} `json:"errors"`
Message string `json:"message"`
Path string `json:"path"`
}
func (RequestError) Error ¶
func (e RequestError) Error() string
type UpdateInfoRequest ¶
type UpdateInfoRequest struct {
ProgramVersion
UpdateType string `json:"updateType"`
PlatformVersion string `json:"platformVersion"`
}
type UpdateInfoResponse ¶
type UpdateInfoResponse struct {
ErrorResponse
ConfigurationUpdate ConfigurationUpdateInfo `json:"configurationUpdateResponse"`
PlatformUpdate PlatformUpdateInfo `json:"platformUpdateResponse"`
AdditionalParameters map[string]string `json:"additionalParameters"`
}
func (UpdateInfoResponse) Error ¶
func (c UpdateInfoResponse) Error() error
type UpdateRequest ¶
type UpdateResponse ¶
type UpdateResponse struct {
ErrorResponse
ConfigurationUpdateDataList []ConfigurationUpdateData `json:"configurationUpdateDataList"`
PlatformDistributionUrl string `json:"platformDistributionUrl"`
AdditionalParameters map[string]string `json:"additionalParameters"`
}
func (UpdateResponse) Error ¶
func (c UpdateResponse) Error() error
Click to show internal directories.
Click to hide internal directories.