mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-11-18 19:31:25 +00:00
Merge pull request #90 from mstg/peridot-cli-improvements1
Add additional peridot cli commands
This commit is contained in:
commit
fc32d87087
@ -4,11 +4,14 @@ go_library(
|
||||
name = "peridot_lib",
|
||||
srcs = [
|
||||
"build.go",
|
||||
"build_package.go",
|
||||
"build_rpm_import.go",
|
||||
"import.go",
|
||||
"lookaside.go",
|
||||
"lookaside_upload.go",
|
||||
"main.go",
|
||||
"project.go",
|
||||
"project_catalog_sync.go",
|
||||
"project_create_hashed_repos.go",
|
||||
"utils.go",
|
||||
],
|
||||
|
@ -30,7 +30,9 @@
|
||||
|
||||
package main
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var build = &cobra.Command{
|
||||
Use: "build",
|
||||
|
105
peridot/cmd/v1/peridot/build_package.go
Normal file
105
peridot/cmd/v1/peridot/build_package.go
Normal file
@ -0,0 +1,105 @@
|
||||
// Copyright (c) All respective contributors to the Peridot Project. All rights reserved.
|
||||
// Copyright (c) 2021-2022 Rocky Enterprise Software Foundation, Inc. All rights reserved.
|
||||
// Copyright (c) 2021-2022 Ctrl IQ, Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"log"
|
||||
"openapi.peridot.resf.org/peridotopenapi"
|
||||
"time"
|
||||
)
|
||||
|
||||
var buildPackage = &cobra.Command{
|
||||
Use: "package [name]",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: buildPackageMn,
|
||||
}
|
||||
|
||||
var (
|
||||
scmHash string
|
||||
disableChecks bool
|
||||
branches []string
|
||||
moduleVariant bool
|
||||
sideNvrs []string
|
||||
setInactive bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
build.Flags().StringVar(&scmHash, "scm-hash", "", "SCM hash to build")
|
||||
build.Flags().BoolVar(&disableChecks, "disable-checks", false, "Disable checks / tests")
|
||||
build.Flags().StringSliceVar(&branches, "branches", []string{}, "Branches to build (only for module builds)")
|
||||
build.Flags().BoolVar(&moduleVariant, "module-variant", false, "Build a module variant")
|
||||
build.Flags().StringSliceVar(&sideNvrs, "side-nvrs", []string{}, "Side NVRs to include")
|
||||
build.Flags().BoolVar(&setInactive, "set-inactive", false, "Set build as inactive")
|
||||
}
|
||||
|
||||
func buildPackageMn(_ *cobra.Command, args []string) {
|
||||
// Ensure project id exists
|
||||
projectId := mustGetProjectID()
|
||||
|
||||
buildCl := getClient(serviceBuild).(peridotopenapi.BuildServiceApi)
|
||||
body := peridotopenapi.InlineObject2{
|
||||
PackageName: &args[0],
|
||||
DisableChecks: &disableChecks,
|
||||
Branches: &branches,
|
||||
ModuleVariant: &moduleVariant,
|
||||
SideNvrs: &sideNvrs,
|
||||
SetInactive: &setInactive,
|
||||
}
|
||||
if scmHash != "" {
|
||||
body.ScmHash = &scmHash
|
||||
}
|
||||
req := buildCl.SubmitBuild(getContext(), projectId).Body(body)
|
||||
buildRes, _, err := req.Execute()
|
||||
errFatal(err)
|
||||
|
||||
// Wait for build to finish
|
||||
taskCl := getClient(serviceTask).(peridotopenapi.TaskServiceApi)
|
||||
log.Printf("Waiting for build %s to finish\n", buildRes.GetTaskId())
|
||||
for {
|
||||
res, _, err := taskCl.GetTask(getContext(), projectId, buildRes.GetTaskId()).Execute()
|
||||
if err != nil {
|
||||
log.Printf("Error getting task: %s", err.Error())
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
task := res.GetTask()
|
||||
if task.GetDone() {
|
||||
if task.GetSubtasks()[0].GetStatus() == peridotopenapi.SUCCEEDED {
|
||||
log.Printf("Build %s finished successfully\n", buildRes.GetTaskId())
|
||||
break
|
||||
} else {
|
||||
log.Fatalf("Build %s failed with status %s\n", buildRes.GetTaskId(), task.GetSubtasks()[0].GetStatus())
|
||||
}
|
||||
}
|
||||
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
}
|
@ -73,7 +73,6 @@ func isFile(path string) bool {
|
||||
func buildRpmImportMn(_ *cobra.Command, args []string) {
|
||||
// Ensure project id exists
|
||||
projectId := mustGetProjectID()
|
||||
_ = projectId
|
||||
|
||||
// Ensure all args are valid files
|
||||
for _, arg := range args {
|
||||
@ -114,15 +113,17 @@ func buildRpmImportMn(_ *cobra.Command, args []string) {
|
||||
log.Printf("Waiting for import %s to finish\n", importRes.GetTaskId())
|
||||
for {
|
||||
res, _, err := taskCl.GetTask(getContext(), projectId, importRes.GetTaskId()).Execute()
|
||||
errFatal(err)
|
||||
if err != nil {
|
||||
log.Printf("Error getting task: %s", err.Error())
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
task := res.GetTask()
|
||||
if task.GetDone() {
|
||||
if task.GetSubtasks()[0].GetStatus() == peridotopenapi.SUCCEEDED {
|
||||
log.Printf("Import %s finished successfully\n", importRes.GetTaskId())
|
||||
break
|
||||
} else {
|
||||
log.Printf("Import %s failed with status %s\n", importRes.GetTaskId(), task.GetSubtasks()[0].GetStatus())
|
||||
break
|
||||
log.Fatalf("Import %s failed with status %s\n", importRes.GetTaskId(), task.GetSubtasks()[0].GetStatus())
|
||||
}
|
||||
}
|
||||
|
||||
|
101
peridot/cmd/v1/peridot/import.go
Normal file
101
peridot/cmd/v1/peridot/import.go
Normal file
@ -0,0 +1,101 @@
|
||||
// Copyright (c) All respective contributors to the Peridot Project. All rights reserved.
|
||||
// Copyright (c) 2021-2022 Rocky Enterprise Software Foundation, Inc. All rights reserved.
|
||||
// Copyright (c) 2021-2022 Ctrl IQ, Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"log"
|
||||
"openapi.peridot.resf.org/peridotopenapi"
|
||||
"time"
|
||||
)
|
||||
|
||||
var impCmd = &cobra.Command{
|
||||
Use: "import [name]",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: impCmdMn,
|
||||
}
|
||||
|
||||
var (
|
||||
version string
|
||||
release string
|
||||
)
|
||||
|
||||
func init() {
|
||||
impCmd.Flags().StringVar(&version, "version", "", "Version of the package to import (if specified, you also need to specify release)")
|
||||
impCmd.Flags().StringVar(&release, "release", "", "Release of the package to import (if specified, you also need to specify version)")
|
||||
impCmd.Flags().BoolVar(&setInactive, "set-inactive", false, "Set build as inactive")
|
||||
}
|
||||
|
||||
func impCmdMn(_ *cobra.Command, args []string) {
|
||||
if (version == "" && release != "") || (version != "" && release == "") {
|
||||
log.Fatal("You must specify both version and release")
|
||||
}
|
||||
|
||||
// Ensure project id exists
|
||||
projectId := mustGetProjectID()
|
||||
|
||||
importCl := getClient(serviceImport).(peridotopenapi.ImportServiceApi)
|
||||
body := peridotopenapi.ImportPackageRequestIsTheRequestMessageForImportServiceImportPackage{
|
||||
PackageName: &args[0],
|
||||
SetInactive: &setInactive,
|
||||
}
|
||||
if version != "" {
|
||||
body.Vre = &peridotopenapi.V1VersionRelease{
|
||||
Version: &version,
|
||||
Release: &release,
|
||||
}
|
||||
}
|
||||
req := importCl.ImportPackage(getContext(), projectId).Body(body)
|
||||
importRes, _, err := req.Execute()
|
||||
errFatal(err)
|
||||
|
||||
// Wait for import to finish
|
||||
taskCl := getClient(serviceTask).(peridotopenapi.TaskServiceApi)
|
||||
log.Printf("Waiting for import %s to finish\n", importRes.GetTaskId())
|
||||
for {
|
||||
res, _, err := taskCl.GetTask(getContext(), projectId, importRes.GetTaskId()).Execute()
|
||||
if err != nil {
|
||||
log.Printf("Error getting task: %s", err.Error())
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
task := res.GetTask()
|
||||
if task.GetDone() {
|
||||
if task.GetSubtasks()[0].GetStatus() == peridotopenapi.SUCCEEDED {
|
||||
log.Printf("Import %s finished successfully\n", importRes.GetTaskId())
|
||||
break
|
||||
} else {
|
||||
log.Fatalf("Import %s failed with status %s\n", importRes.GetTaskId(), task.GetSubtasks()[0].GetStatus())
|
||||
}
|
||||
}
|
||||
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
}
|
@ -56,9 +56,13 @@ func init() {
|
||||
|
||||
root.AddCommand(build)
|
||||
build.AddCommand(buildRpmImport)
|
||||
build.AddCommand(buildPackage)
|
||||
|
||||
root.AddCommand(project)
|
||||
project.AddCommand(projectCreateHashedRepos)
|
||||
project.AddCommand(projectCatalogSync)
|
||||
|
||||
root.AddCommand(impCmd)
|
||||
|
||||
viper.SetEnvPrefix("PERIDOT")
|
||||
viper.AutomaticEnv()
|
||||
|
103
peridot/cmd/v1/peridot/project_catalog_sync.go
Normal file
103
peridot/cmd/v1/peridot/project_catalog_sync.go
Normal file
@ -0,0 +1,103 @@
|
||||
// Copyright (c) All respective contributors to the Peridot Project. All rights reserved.
|
||||
// Copyright (c) 2021-2022 Rocky Enterprise Software Foundation, Inc. All rights reserved.
|
||||
// Copyright (c) 2021-2022 Ctrl IQ, Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the copyright holder nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
"log"
|
||||
"openapi.peridot.resf.org/peridotopenapi"
|
||||
"time"
|
||||
)
|
||||
|
||||
var projectCatalogSync = &cobra.Command{
|
||||
Use: "catalog-sync",
|
||||
Run: projectCatalogSyncMn,
|
||||
}
|
||||
|
||||
var (
|
||||
scmURL string
|
||||
scmBranch string
|
||||
)
|
||||
|
||||
func init() {
|
||||
projectCatalogSync.Flags().StringVar(&scmURL, "scm-url", "", "SCM URL (defaults to TARGET/peridot-config)")
|
||||
projectCatalogSync.Flags().StringVar(&scmBranch, "scm-branch", "", "SCM branch (defaults to {TARGET_BRANCH_PREFIX}{MAJOR_VERSION})")
|
||||
}
|
||||
|
||||
func projectCatalogSyncMn(_ *cobra.Command, _ []string) {
|
||||
// Ensure project id exists
|
||||
projectId := mustGetProjectID()
|
||||
projectCl := getClient(serviceProject).(peridotopenapi.ProjectServiceApi)
|
||||
|
||||
if scmURL == "" || scmBranch == "" {
|
||||
projectRes, _, err := projectCl.GetProject(getContext(), projectId).Execute()
|
||||
errFatal(err)
|
||||
p := projectRes.GetProject()
|
||||
|
||||
if scmURL == "" {
|
||||
scmURL = fmt.Sprintf("%s/%s/peridot-config", p.GetTargetGitlabHost(), p.GetTargetPrefix())
|
||||
}
|
||||
if scmBranch == "" {
|
||||
scmBranch = fmt.Sprintf("%s%d", p.GetTargetBranchPrefix(), p.GetMajorVersion())
|
||||
}
|
||||
}
|
||||
|
||||
body := peridotopenapi.InlineObject5{
|
||||
ScmUrl: &scmURL,
|
||||
Branch: &scmBranch,
|
||||
}
|
||||
req := projectCl.SyncCatalog(getContext(), projectId).Body(body)
|
||||
syncRes, _, err := req.Execute()
|
||||
errFatal(err)
|
||||
|
||||
// Wait for sync to finish
|
||||
taskCl := getClient(serviceTask).(peridotopenapi.TaskServiceApi)
|
||||
log.Printf("Waiting for sync %s to finish\n", syncRes.GetTaskId())
|
||||
for {
|
||||
res, _, err := taskCl.GetTask(getContext(), projectId, syncRes.GetTaskId()).Execute()
|
||||
if err != nil {
|
||||
log.Printf("Error getting task: %s", err.Error())
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
task := res.GetTask()
|
||||
if task.GetDone() {
|
||||
if task.GetSubtasks()[0].GetStatus() == peridotopenapi.SUCCEEDED {
|
||||
log.Printf("Sync %s finished successfully\n", syncRes.GetTaskId())
|
||||
break
|
||||
} else {
|
||||
log.Fatalf("Sync %s failed with status %s\n", syncRes.GetTaskId(), task.GetSubtasks()[0].GetStatus())
|
||||
}
|
||||
}
|
||||
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
}
|
1
vendor/openapi.peridot.resf.org/peridotopenapi/BUILD.bazel
generated
vendored
1
vendor/openapi.peridot.resf.org/peridotopenapi/BUILD.bazel
generated
vendored
@ -22,6 +22,7 @@ go_library(
|
||||
"model_inline_object_6.go",
|
||||
"model_inline_object_7.go",
|
||||
"model_inline_object_8.go",
|
||||
"model_inline_object_9.go",
|
||||
"model_protobuf_any.go",
|
||||
"model_rpc_status.go",
|
||||
"model_stream_result_of_api_http_body.go",
|
||||
|
8
vendor/openapi.peridot.resf.org/peridotopenapi/api_build_service.go
generated
vendored
8
vendor/openapi.peridot.resf.org/peridotopenapi/api_build_service.go
generated
vendored
@ -533,6 +533,7 @@ type ApiListBuildsRequest struct {
|
||||
ApiService BuildServiceApi
|
||||
projectId string
|
||||
filtersStatus *string
|
||||
filtersPackageName *string
|
||||
page *int32
|
||||
limit *int32
|
||||
}
|
||||
@ -541,6 +542,10 @@ func (r ApiListBuildsRequest) FiltersStatus(filtersStatus string) ApiListBuildsR
|
||||
r.filtersStatus = &filtersStatus
|
||||
return r
|
||||
}
|
||||
func (r ApiListBuildsRequest) FiltersPackageName(filtersPackageName string) ApiListBuildsRequest {
|
||||
r.filtersPackageName = &filtersPackageName
|
||||
return r
|
||||
}
|
||||
func (r ApiListBuildsRequest) Page(page int32) ApiListBuildsRequest {
|
||||
r.page = &page
|
||||
return r
|
||||
@ -597,6 +602,9 @@ func (a *BuildServiceApiService) ListBuildsExecute(r ApiListBuildsRequest) (V1Li
|
||||
if r.filtersStatus != nil {
|
||||
localVarQueryParams.Add("filters.status", parameterToString(*r.filtersStatus, ""))
|
||||
}
|
||||
if r.filtersPackageName != nil {
|
||||
localVarQueryParams.Add("filters.packageName", parameterToString(*r.filtersPackageName, ""))
|
||||
}
|
||||
if r.page != nil {
|
||||
localVarQueryParams.Add("page", parameterToString(*r.page, ""))
|
||||
}
|
||||
|
136
vendor/openapi.peridot.resf.org/peridotopenapi/api_project_service.go
generated
vendored
136
vendor/openapi.peridot.resf.org/peridotopenapi/api_project_service.go
generated
vendored
@ -26,6 +26,20 @@ var (
|
||||
|
||||
type ProjectServiceApi interface {
|
||||
|
||||
/*
|
||||
* CloneSwap Method for CloneSwap
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param targetProjectId
|
||||
* @return ApiCloneSwapRequest
|
||||
*/
|
||||
CloneSwap(ctx _context.Context, targetProjectId string) ApiCloneSwapRequest
|
||||
|
||||
/*
|
||||
* CloneSwapExecute executes the request
|
||||
* @return V1AsyncTask
|
||||
*/
|
||||
CloneSwapExecute(r ApiCloneSwapRequest) (V1AsyncTask, *_nethttp.Response, error)
|
||||
|
||||
/*
|
||||
* CreateHashedRepositories Method for CreateHashedRepositories
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
@ -211,6 +225,128 @@ type ProjectServiceApi interface {
|
||||
// ProjectServiceApiService ProjectServiceApi service
|
||||
type ProjectServiceApiService service
|
||||
|
||||
type ApiCloneSwapRequest struct {
|
||||
ctx _context.Context
|
||||
ApiService ProjectServiceApi
|
||||
targetProjectId string
|
||||
body *InlineObject9
|
||||
}
|
||||
|
||||
func (r ApiCloneSwapRequest) Body(body InlineObject9) ApiCloneSwapRequest {
|
||||
r.body = &body
|
||||
return r
|
||||
}
|
||||
|
||||
func (r ApiCloneSwapRequest) Execute() (V1AsyncTask, *_nethttp.Response, error) {
|
||||
return r.ApiService.CloneSwapExecute(r)
|
||||
}
|
||||
|
||||
/*
|
||||
* CloneSwap Method for CloneSwap
|
||||
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param targetProjectId
|
||||
* @return ApiCloneSwapRequest
|
||||
*/
|
||||
func (a *ProjectServiceApiService) CloneSwap(ctx _context.Context, targetProjectId string) ApiCloneSwapRequest {
|
||||
return ApiCloneSwapRequest{
|
||||
ApiService: a,
|
||||
ctx: ctx,
|
||||
targetProjectId: targetProjectId,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Execute executes the request
|
||||
* @return V1AsyncTask
|
||||
*/
|
||||
func (a *ProjectServiceApiService) CloneSwapExecute(r ApiCloneSwapRequest) (V1AsyncTask, *_nethttp.Response, error) {
|
||||
var (
|
||||
localVarHTTPMethod = _nethttp.MethodPost
|
||||
localVarPostBody interface{}
|
||||
localVarFormFileName string
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
localVarReturnValue V1AsyncTask
|
||||
)
|
||||
|
||||
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectServiceApiService.CloneSwap")
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
|
||||
}
|
||||
|
||||
localVarPath := localBasePath + "/v1/projects/{targetProjectId}/cloneswap"
|
||||
localVarPath = strings.Replace(localVarPath, "{"+"targetProjectId"+"}", _neturl.PathEscape(parameterToString(r.targetProjectId, "")), -1)
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := _neturl.Values{}
|
||||
localVarFormParams := _neturl.Values{}
|
||||
if r.body == nil {
|
||||
return localVarReturnValue, nil, reportError("body is required and must be specified")
|
||||
}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHTTPContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||
if localVarHTTPContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHTTPHeaderAccepts := []string{"application/json"}
|
||||
|
||||
// set Accept header
|
||||
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
||||
if localVarHTTPHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = r.body
|
||||
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return localVarReturnValue, nil, err
|
||||
}
|
||||
|
||||
localVarHTTPResponse, err := a.client.callAPI(req)
|
||||
if err != nil || localVarHTTPResponse == nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
|
||||
localVarHTTPResponse.Body.Close()
|
||||
localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))
|
||||
if err != nil {
|
||||
return localVarReturnValue, localVarHTTPResponse, err
|
||||
}
|
||||
|
||||
if localVarHTTPResponse.StatusCode >= 300 {
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
error: localVarHTTPResponse.Status,
|
||||
}
|
||||
var v RpcStatus
|
||||
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr.error = err.Error()
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
newErr.model = v
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
|
||||
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
||||
if err != nil {
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
error: err.Error(),
|
||||
}
|
||||
return localVarReturnValue, localVarHTTPResponse, newErr
|
||||
}
|
||||
|
||||
return localVarReturnValue, localVarHTTPResponse, nil
|
||||
}
|
||||
|
||||
type ApiCreateHashedRepositoriesRequest struct {
|
||||
ctx _context.Context
|
||||
ApiService ProjectServiceApi
|
||||
|
115
vendor/openapi.peridot.resf.org/peridotopenapi/model_inline_object_9.go
generated
vendored
Normal file
115
vendor/openapi.peridot.resf.org/peridotopenapi/model_inline_object_9.go
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* peridot/proto/v1/batch.proto
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* API version: version not set
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package peridotopenapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// InlineObject9 struct for InlineObject9
|
||||
type InlineObject9 struct {
|
||||
SrcProjectId *string `json:"srcProjectId,omitempty"`
|
||||
}
|
||||
|
||||
// NewInlineObject9 instantiates a new InlineObject9 object
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewInlineObject9() *InlineObject9 {
|
||||
this := InlineObject9{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewInlineObject9WithDefaults instantiates a new InlineObject9 object
|
||||
// This constructor will only assign default values to properties that have it defined,
|
||||
// but it doesn't guarantee that properties required by API are set
|
||||
func NewInlineObject9WithDefaults() *InlineObject9 {
|
||||
this := InlineObject9{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetSrcProjectId returns the SrcProjectId field value if set, zero value otherwise.
|
||||
func (o *InlineObject9) GetSrcProjectId() string {
|
||||
if o == nil || o.SrcProjectId == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
return *o.SrcProjectId
|
||||
}
|
||||
|
||||
// GetSrcProjectIdOk returns a tuple with the SrcProjectId field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *InlineObject9) GetSrcProjectIdOk() (*string, bool) {
|
||||
if o == nil || o.SrcProjectId == nil {
|
||||
return nil, false
|
||||
}
|
||||
return o.SrcProjectId, true
|
||||
}
|
||||
|
||||
// HasSrcProjectId returns a boolean if a field has been set.
|
||||
func (o *InlineObject9) HasSrcProjectId() bool {
|
||||
if o != nil && o.SrcProjectId != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetSrcProjectId gets a reference to the given string and assigns it to the SrcProjectId field.
|
||||
func (o *InlineObject9) SetSrcProjectId(v string) {
|
||||
o.SrcProjectId = &v
|
||||
}
|
||||
|
||||
func (o InlineObject9) MarshalJSON() ([]byte, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if o.SrcProjectId != nil {
|
||||
toSerialize["srcProjectId"] = o.SrcProjectId
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
type NullableInlineObject9 struct {
|
||||
value *InlineObject9
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableInlineObject9) Get() *InlineObject9 {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableInlineObject9) Set(val *InlineObject9) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableInlineObject9) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableInlineObject9) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableInlineObject9(val *InlineObject9) *NullableInlineObject9 {
|
||||
return &NullableInlineObject9{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableInlineObject9) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableInlineObject9) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
36
vendor/openapi.peridot.resf.org/peridotopenapi/model_v1_build_filters.go
generated
vendored
36
vendor/openapi.peridot.resf.org/peridotopenapi/model_v1_build_filters.go
generated
vendored
@ -17,6 +17,7 @@ import (
|
||||
// V1BuildFilters struct for V1BuildFilters
|
||||
type V1BuildFilters struct {
|
||||
Status *V1TaskStatus `json:"status,omitempty"`
|
||||
PackageName *string `json:"packageName,omitempty"`
|
||||
}
|
||||
|
||||
// NewV1BuildFilters instantiates a new V1BuildFilters object
|
||||
@ -72,11 +73,46 @@ func (o *V1BuildFilters) SetStatus(v V1TaskStatus) {
|
||||
o.Status = &v
|
||||
}
|
||||
|
||||
// GetPackageName returns the PackageName field value if set, zero value otherwise.
|
||||
func (o *V1BuildFilters) GetPackageName() string {
|
||||
if o == nil || o.PackageName == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
return *o.PackageName
|
||||
}
|
||||
|
||||
// GetPackageNameOk returns a tuple with the PackageName field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *V1BuildFilters) GetPackageNameOk() (*string, bool) {
|
||||
if o == nil || o.PackageName == nil {
|
||||
return nil, false
|
||||
}
|
||||
return o.PackageName, true
|
||||
}
|
||||
|
||||
// HasPackageName returns a boolean if a field has been set.
|
||||
func (o *V1BuildFilters) HasPackageName() bool {
|
||||
if o != nil && o.PackageName != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetPackageName gets a reference to the given string and assigns it to the PackageName field.
|
||||
func (o *V1BuildFilters) SetPackageName(v string) {
|
||||
o.PackageName = &v
|
||||
}
|
||||
|
||||
func (o V1BuildFilters) MarshalJSON() ([]byte, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if o.Status != nil {
|
||||
toSerialize["status"] = o.Status
|
||||
}
|
||||
if o.PackageName != nil {
|
||||
toSerialize["packageName"] = o.PackageName
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
|
3
vendor/openapi.peridot.resf.org/peridotopenapi/model_v1_task_type.go
generated
vendored
3
vendor/openapi.peridot.resf.org/peridotopenapi/model_v1_task_type.go
generated
vendored
@ -40,6 +40,7 @@ const (
|
||||
CREATE_HASHED_REPOSITORIES V1TaskType = "TASK_TYPE_CREATE_HASHED_REPOSITORIES"
|
||||
LOOKASIDE_FILE_UPLOAD V1TaskType = "TASK_TYPE_LOOKASIDE_FILE_UPLOAD"
|
||||
RPM_LOOKASIDE_BATCH_IMPORT V1TaskType = "TASK_TYPE_RPM_LOOKASIDE_BATCH_IMPORT"
|
||||
CLONE_SWAP V1TaskType = "TASK_TYPE_CLONE_SWAP"
|
||||
)
|
||||
|
||||
func (v *V1TaskType) UnmarshalJSON(src []byte) error {
|
||||
@ -49,7 +50,7 @@ func (v *V1TaskType) UnmarshalJSON(src []byte) error {
|
||||
return err
|
||||
}
|
||||
enumTypeValue := V1TaskType(value)
|
||||
for _, existing := range []V1TaskType{ "TASK_TYPE_UNKNOWN", "TASK_TYPE_IMPORT", "TASK_TYPE_IMPORT_SRC_GIT", "TASK_TYPE_IMPORT_SRC_GIT_TO_DIST_GIT", "TASK_TYPE_IMPORT_DOWNSTREAM", "TASK_TYPE_IMPORT_UPSTREAM", "TASK_TYPE_BUILD", "TASK_TYPE_BUILD_SRPM", "TASK_TYPE_BUILD_ARCH", "TASK_TYPE_BUILD_SRPM_UPLOAD", "TASK_TYPE_BUILD_ARCH_UPLOAD", "TASK_TYPE_WORKER_PROVISION", "TASK_TYPE_WORKER_DESTROY", "TASK_TYPE_YUMREPOFS_UPDATE", "TASK_TYPE_KEYKEEPER_SIGN_ARTIFACT", "TASK_TYPE_SYNC_CATALOG", "TASK_TYPE_RPM_IMPORT", "TASK_TYPE_CREATE_HASHED_REPOSITORIES", "TASK_TYPE_LOOKASIDE_FILE_UPLOAD", "TASK_TYPE_RPM_LOOKASIDE_BATCH_IMPORT", } {
|
||||
for _, existing := range []V1TaskType{ "TASK_TYPE_UNKNOWN", "TASK_TYPE_IMPORT", "TASK_TYPE_IMPORT_SRC_GIT", "TASK_TYPE_IMPORT_SRC_GIT_TO_DIST_GIT", "TASK_TYPE_IMPORT_DOWNSTREAM", "TASK_TYPE_IMPORT_UPSTREAM", "TASK_TYPE_BUILD", "TASK_TYPE_BUILD_SRPM", "TASK_TYPE_BUILD_ARCH", "TASK_TYPE_BUILD_SRPM_UPLOAD", "TASK_TYPE_BUILD_ARCH_UPLOAD", "TASK_TYPE_WORKER_PROVISION", "TASK_TYPE_WORKER_DESTROY", "TASK_TYPE_YUMREPOFS_UPDATE", "TASK_TYPE_KEYKEEPER_SIGN_ARTIFACT", "TASK_TYPE_SYNC_CATALOG", "TASK_TYPE_RPM_IMPORT", "TASK_TYPE_CREATE_HASHED_REPOSITORIES", "TASK_TYPE_LOOKASIDE_FILE_UPLOAD", "TASK_TYPE_RPM_LOOKASIDE_BATCH_IMPORT", "TASK_TYPE_CLONE_SWAP", } {
|
||||
if existing == enumTypeValue {
|
||||
*v = enumTypeValue
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user